xiangfu0 commented on code in PR #11330:
URL: https://github.com/apache/pinot/pull/11330#discussion_r1292603843


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java:
##########
@@ -290,4 +302,52 @@ public static Map<String, String> 
getOptionsFromJson(JsonNode request, String op
   public static Map<String, String> getOptionsFromString(String optionStr) {
     return 
Splitter.on(';').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(optionStr);
   }
+
+  public static Set<String> getTableNames(SqlNode sqlNode) {

Review Comment:
   Yes, this logic is used in `pinot-java-client`, which depends on 
`pinot-common` not `pinot-query-planner`.
   
   So the table name extraction logic there only works for v1 query and some 
simple v2 queries.
   
   There are 3 possible options to solve this:
   1. Let `pinot-java-client` depends `pinot-query-planner`, use v2 
`QueryEnvironment` from `pinot-query-planner` to compile `SqlNode` -> 
`RelNode`, then extract table names. But it requires the full initialization of 
Calcite PlannerContext with FrameworkConfig, Prepare.CatalogReader, 
RelDataTypeFactory, HepProgram. And the compilation time might take 10+ms, 
which is 10-100 times more than extracting from SqlNode.
   2. Create a separated getTableName logic to `pinot-common`, hence is this PR.



##########
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java:
##########
@@ -290,4 +302,52 @@ public static Map<String, String> 
getOptionsFromJson(JsonNode request, String op
   public static Map<String, String> getOptionsFromString(String optionStr) {
     return 
Splitter.on(';').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(optionStr);
   }
+
+  public static Set<String> getTableNames(SqlNode sqlNode) {

Review Comment:
   Yes, this logic is used in `pinot-java-client`, which depends on 
`pinot-common` not `pinot-query-planner`.
   
   So the table name extraction logic there only works for v1 query and some 
simple v2 queries.
   
   There are 3 possible options to solve this:
   1. Let `pinot-java-client` depends `pinot-query-planner`, use v2 
`QueryEnvironment` from `pinot-query-planner` to compile `SqlNode` -> 
`RelNode`, then extract table names. But it requires the full initialization of 
Calcite PlannerContext with FrameworkConfig, Prepare.CatalogReader, 
RelDataTypeFactory, HepProgram. And the compilation time might take 10+ms, 
which is 10-100 times more than extracting from SqlNode.
   2. Create a separated getTableName logic to `pinot-common`, hence this PR.



##########
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java:
##########
@@ -290,4 +302,52 @@ public static Map<String, String> 
getOptionsFromJson(JsonNode request, String op
   public static Map<String, String> getOptionsFromString(String optionStr) {
     return 
Splitter.on(';').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(optionStr);
   }
+
+  public static Set<String> getTableNames(SqlNode sqlNode) {

Review Comment:
   Yes, this logic is used in `pinot-java-client`, which depends on 
`pinot-common` not `pinot-query-planner`.
   
   So the table name extraction logic there only works for v1 query and some 
simple v2 queries.
   
   There are 2 possible options to solve this:
   1. Let `pinot-java-client` depends `pinot-query-planner`, use v2 
`QueryEnvironment` from `pinot-query-planner` to compile `SqlNode` -> 
`RelNode`, then extract table names. But it requires the full initialization of 
Calcite PlannerContext with FrameworkConfig, Prepare.CatalogReader, 
RelDataTypeFactory, HepProgram. And the compilation time might take 10+ms, 
which is 10-100 times more than extracting from SqlNode.
   2. Create a separated getTableName logic to `pinot-common`, hence this PR.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to