wuchong commented on a change in pull request #15005:
URL: https://github.com/apache/flink/pull/15005#discussion_r582530305
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/calcite/FlinkPlannerImpl.scala
##########
@@ -36,11 +35,11 @@ import org.apache.calcite.sql.validate.SqlValidator
import org.apache.calcite.sql.{SqlExplain, SqlKind, SqlNode, SqlOperatorTable}
import org.apache.calcite.sql2rel.{SqlRexConvertletTable, SqlToRelConverter}
import org.apache.calcite.tools.{FrameworkConfig, RelConversionException}
+import org.apache.flink.sql.parser.ddl.SqlUseModules
Review comment:
Please reorder the imports.
##########
File path:
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/api/TableEnvironmentTest.scala
##########
@@ -33,6 +33,7 @@ import org.apache.flink.types.Row
import org.apache.calcite.plan.RelOptUtil
import org.apache.calcite.sql.SqlExplainLevel
import org.apache.flink.core.testutils.FlinkMatchers.containsMessage
+import org.apache.flink.table.module.ModuleEntry
Review comment:
Please reorder the imports.
##########
File path:
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/api/TableEnvironmentTest.scala
##########
@@ -592,6 +593,66 @@ class TableEnvironmentTest {
tableEnv.executeSql("UNLOAD MODULE dummy")
}
+ @Test
+ def testExecuteSqlWithUseModules(): Unit = {
+ tableEnv.executeSql("LOAD MODULE dummy")
+ assert(tableEnv.listModules().sameElements(Array[String]("core", "dummy")))
Review comment:
Personally, I don't like Scala `assert` because it doesn't provide
mismatch information when assertion failed. Besides, `sameElements` sounds like
it doesn't care about the elements order, but the order is critical here.
Therefore, it would be better to use `assertArrayEquals`. We may also need to
update the tests added in previous PR.
##########
File path:
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/LocalExecutor.java
##########
@@ -428,6 +429,13 @@ public ProgramTargetDescriptor executeUpdate(String
sessionId, String statement)
return executeUpdateInternal(sessionId, context, statement);
}
+ @VisibleForTesting
+ List<ModuleEntry> listFullModules(String sessionId) throws
SqlExecutionException {
Review comment:
I think we will need this interface in the next `SHOW FULL MODULES` PR,
we can add this method into base interface and implement it beside
`listModules`.
##########
File path: flink-table/flink-sql-parser-hive/src/main/codegen/data/Parser.tdd
##########
@@ -129,6 +130,7 @@
"LINES"
"LOAD"
"LOCATION"
+ "MODULES"
Review comment:
We should also add `MODULES` into non-reserved-keywords, otherwise it
will break user jobs which uses `modules` as column name. For example, `select
a, b, modules from T` will parse failed.
----------------------------------------------------------------
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]