julianhyde commented on a change in pull request #1811: [CALCITE-3789] Support
validation of UNNEST multiple array columns like Presto
URL: https://github.com/apache/calcite/pull/1811#discussion_r404217847
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -2219,6 +2207,42 @@ protected void convertFrom(
}
}
+ private List<String> getFieldAliases(SqlCall asCall) {
+ if (!validator.getConformance().allowAliasUnnestColumns()) {
+ return null;
+ }
+
+ List<String> columnAliases = new ArrayList<>();
+ for (SqlNode sqlNode : Util.skip(asCall.getOperandList(), 2)) {
+ columnAliases.add(((SqlIdentifier) sqlNode).getSimple());
+ }
+ return columnAliases;
+ }
+
+ private void convertUnnest(Blackboard bb, SqlCall from, List<String>
fieldAliases) {
+ SqlCall call;
+ call = from;
+ final List<SqlNode> nodes = call.getOperandList();
+ final SqlUnnestOperator operator = (SqlUnnestOperator) call.getOperator();
+ for (SqlNode node : nodes) {
+ replaceSubQueries(bb, node, RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
+ }
+ final List<RexNode> exprs = new ArrayList<>();
+ final List<String> fieldNames = new ArrayList<>();
+ for (Ord<SqlNode> node : Ord.zip(nodes)) {
+ exprs.add(bb.convertExpression(node.e));
+ fieldNames.add(validator.deriveAlias(node.e, node.i));
+ }
+ RelNode child =
+ (null != bb.root) ? bb.root : LogicalValues.createOneRow(cluster);
+ relBuilder.push(child).projectNamed(exprs, fieldNames, false);
+
+ Uncollect uncollect =
Review comment:
it's about time we added `RelBuilder.uncollect`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services