godfreyhe commented on a change in pull request #12475:
URL: https://github.com/apache/flink/pull/12475#discussion_r435663365
##########
File path:
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/gateway/local/DependencyTest.java
##########
@@ -82,6 +87,44 @@
@Test
public void testTableFactoryDiscovery() throws Exception {
+ final LocalExecutor executor = createExecutor();
+ final SessionContext session = new
SessionContext("test-session", new Environment());
+ String sessionId = executor.openSession(session);
+ try {
+ final TableSchema result =
executor.getTableSchema(sessionId, "TableNumber1");
+ final TableSchema expected = TableSchema.builder()
+ .field("IntegerField1", Types.INT())
+ .field("StringField1", Types.STRING())
+ .field("rowtimeField", Types.SQL_TIMESTAMP())
+ .build();
+
+ assertEquals(expected, result);
+ } finally {
+ executor.closeSession(sessionId);
+ }
+ }
+
+ @Test
+ public void testSqlParseWithUserClassloader() throws Exception {
+ final LocalExecutor executor = createExecutor();
+ final SessionContext session = new
SessionContext("test-session", new Environment());
+ String sessionId = executor.openSession(session);
+ try {
+ String expectedPlan =
"LogicalProject(IntegerField1=[$0], StringField1=[$1])\n" +
+ " LogicalTableScan(table=[[default_catalog,
default_database, TableNumber1, source: [TestTableSource]]])\n";
+ final Parser sqlParser =
executor.getSqlParser(sessionId);
+ List<Operation> operations = sqlParser.parse("SELECT
IntegerField1, StringField1 FROM TableNumber1");
+
+ assertTrue(operations != null && operations.size() ==
1);
+ String actualPlan =
RelOptUtil.toString(((PlannerQueryOperation)
operations.get(0)).getCalciteTree());
Review comment:
I think plan validation is not necessary, only checking parser is enough.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]