kasakrisz commented on code in PR #2916: URL: https://github.com/apache/calcite/pull/2916#discussion_r977434703
########## core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java: ########## @@ -551,17 +529,15 @@ public interface JoinRightEmptyRuleConfig extends PruneEmptyRule.Config { // "select * from emp left join dept" is not necessarily empty if // dept is empty // join can be removed and take the left branch, all columns come from dept are null - List<RexNode> projects = new ArrayList<>( - left.getRowType().getFieldCount() + empty.getRowType().getFieldCount()); - List<String> columnNames = new ArrayList<>( - left.getRowType().getFieldCount() + empty.getRowType().getFieldCount()); - // left - copyProjects( - rexBuilder, left.getRowType(), join.getRowType(), 0, projects, columnNames); - // right - addNullLiterals(rexBuilder, empty, projects, columnNames); - - RelNode project = call.builder().push(left).project(projects, columnNames).build(); + List<Pair<? extends RexNode, String>> projects = + Stream.concat( + getProjectStream(left.getRowType(), join.getRowType(), 0, rexBuilder), + getNullLiteralStream(empty, rexBuilder)).collect(Collectors.toList()); + + RelNode project = call.builder() + .push(left) + .project(Pair.left(projects), Pair.right(projects)) + .build(); Review Comment: Adding the cast only in case of full outer join enabled replacing the `getProjectStream` method to a simpler `castToNullable` . I kept `Stream.concat()` otherwise converting from `stream` to `iterable` is required or if everything is `iterable` we loose the functional style in `castToNullable` and `getNullLiteralStream` -- 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...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org