tibrewalpratik17 commented on code in PR #10336: URL: https://github.com/apache/pinot/pull/10336#discussion_r1118731073
########## pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java: ########## @@ -135,6 +135,24 @@ public static SqlNodeAndOptions compileToSqlNodeAndOptions(String sql) } } + public static List<String> extractTableNamesFromNode(SqlNode sqlNode) { + List<String> tableNames = new ArrayList<>(); + if (sqlNode instanceof SqlSelect) { + SqlNode fromNode = ((SqlSelect) sqlNode).getFrom(); + tableNames.addAll(((SqlIdentifier) fromNode).names); + tableNames.addAll(extractTableNamesFromNode(((SqlSelect) sqlNode).getWhere())); + } else if (sqlNode instanceof SqlBasicCall) { + for (SqlNode node: ((SqlBasicCall) sqlNode).getOperandList()) { + tableNames.addAll(extractTableNamesFromNode(node)); + } + } else if (sqlNode instanceof SqlOrderBy) { Review Comment: There are a lot of extensions of `SqlNode`. I have tried to cover the ones which are hit through most common query patterns. In cases of `SqlDelete`, `SqlCreate` we would hit else clause. In those cases, we would return an empty list for now. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org