jinxing64 commented on a change in pull request #1138: [CALCITE-1581] UDTF like
in hive
URL: https://github.com/apache/calcite/pull/1138#discussion_r341084650
##########
File path: core/src/main/java/org/apache/calcite/sql/SqlAsOperator.java
##########
@@ -102,12 +103,26 @@ public void validateCall(
// we don't want to validate the identifier.
final List<SqlNode> operands = call.getOperandList();
assert operands.size() == 2;
- assert operands.get(1) instanceof SqlIdentifier;
operands.get(0).validateExpr(validator, scope);
- SqlIdentifier id = (SqlIdentifier) operands.get(1);
- if (!id.isSimple()) {
- throw validator.newValidationError(id,
- RESOURCE.aliasMustBeSimpleIdentifier());
+
+ SqlNode asIdentifier = operands.get(1);
+ assert asIdentifier instanceof SqlIdentifier
+ || (asIdentifier instanceof SqlNodeList
+ && validator.getConformance().allowSelectTableFunction());
+
+ List<SqlNode> ids = new ArrayList<>();
+ if (asIdentifier instanceof SqlIdentifier) {
+ ids.add(operands.get(1));
+ } else {
+ ids.addAll(((SqlNodeList) operands.get(1)).getList());
+ }
+ for (int i = 0; i < ids.size(); i++) {
+ assert ids.get(i) instanceof SqlIdentifier;
+ SqlIdentifier id = (SqlIdentifier) ids.get(i);
+ if (!id.isSimple()) {
+ throw validator.newValidationError(id,
+ RESOURCE.aliasMustBeSimpleIdentifier());
Review comment:
indent -- 4 spaces
----------------------------------------------------------------
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