@Test
  public void testCreateView() throws IllegalPathException {
    // 1. create with select
    CreateLogicalViewStatement stmt =
        createViewStmt("create view root.sg.view_dd as select s1 from root.sg.d1;");
    List<PartialPath> path = new ArrayList<>();
    path.add(new PartialPath("root.sg.d1"));
    assertEquals(null, stmt.getSourcePaths().fullPathList);
    assertEquals(path, stmt.getQueryStatement().getFromComponent().getPrefixPaths());

    // 2. create with path
    stmt = createViewStmt("create view root.sg as root.sg.d2;");
    List<PartialPath> path2 = new ArrayList<>();
    path2.add(new PartialPath("root.sg.d2"));
    assertEquals(path2, stmt.getSourcePaths().fullPathList);
    assertEquals(null, stmt.getQueryStatement());
  }
This test will check grant/revoke simple privilege on/from paths.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGeneratorTest.java