konstantinb commented on code in PR #6014: URL: https://github.com/apache/hive/pull/6014#discussion_r2274862663
########## ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTConverter.java: ########## @@ -602,12 +604,26 @@ private QueryBlockInfo convertSource(RelNode r) throws CalciteSemanticException // retrieve the base table source. QueryBlockInfo tableFunctionSource = convertSource(tfs.getInput(0)); - String sqAlias = tableFunctionSource.schema.get(0).table; - // the schema will contain the base table source fields - s = new Schema(tfs, sqAlias); - ast = createASTLateralView(tfs, s, tableFunctionSource, sqAlias); + // Create schema that preserves base table columns with original alias, + // but gives new UDTF columns the unique lateral view alias + int baseFieldCount = tableFunctionSource.schema.size(); + List<RelDataTypeField> allOutputFields = tfs.getRowType().getFieldList(); Review Comment: Doh, made my comment with not fully recompiled code. It is very essential to preserve the initial tableAlias for all base table columns; before the change, the whole new schema was constructed with it, see `String sqAlias = tableFunctionSource.schema.get(0).table; ` in the old code. The fix is to have _fewer_ columns to be assigned to the original tableAlias. I have changed the variable name to better match with pre-existing code -- 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