zabetak commented on code in PR #5249: URL: https://github.com/apache/hive/pull/5249#discussion_r1668721580
########## ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java: ########## @@ -77,9 +77,11 @@ public static ASTNode table(final RelNode scan) { assert hts != null; RelOptHiveTable hTbl = (RelOptHiveTable) hts.getTable(); - ASTBuilder tableNameBuilder = ASTBuilder.construct(HiveParser.TOK_TABNAME, "TOK_TABNAME") - .add(HiveParser.Identifier, hTbl.getHiveTableMD().getDbName()) - .add(HiveParser.Identifier, hTbl.getHiveTableMD().getTableName()); + ASTBuilder tableNameBuilder = ASTBuilder.construct(HiveParser.TOK_TABNAME, "TOK_TABNAME"); + if (!hTbl.getHiveTableMD().isTemporary()) { Review Comment: Actually, temporary tables are not used only by CTEs; users can also create them explicitly (see [CREATE TEMPORARY syntax](https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-TemporaryTables)). In https://github.com/apache/hive/pull/5249/commits/5c5002bd7e4e422d69afd5e1c6ecc84e8e843c1b I modified a bit the logic to rely on a field that is set only when we are dealing with a materialized CTE table. Please check the refactoring and let me know if you feel that a comment is still necessary. -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org