sbroeder commented on code in PR #5271:
URL: https://github.com/apache/calcite/pull/5271#discussion_r4579392309


##########
core/src/main/java/org/apache/calcite/rel/type/SingleColumnAliasRelDataType.java:
##########
@@ -26,22 +26,30 @@
 import java.nio.charset.Charset;
 import java.util.List;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 /**
- * Specific type of RelDataType that corresponds to a single column table,
- * where column can have alias.
+ * Specific type of RelDataType where the first column can also be
+ * referenced by an alias.
  *
  * <p>For instance:
  * <blockquote><pre>select rmp, rmp.i from table(ramp(3)) as 
rmp;</pre></blockquote>
  *
+ * <p>The wrapped type may have more than one field, for example
+ * UNNEST WITH ORDINALITY of a collection of single-field ROW values, whose
+ * second field is ORDINALITY; only the first field gets the extra alias name.
+ * If the alias equals the name of another field, that field wins (see
+ * {@link #getField}).
+ *
  * @see org.apache.calcite.sql.validate.AliasNamespace
  */
 public class SingleColumnAliasRelDataType implements RelDataType {
   private final RelDataType original;
   private final RelDataType alias;
 
   public SingleColumnAliasRelDataType(RelDataType original, RelDataType alias) 
{
-    assert original.isStruct() && original.getFieldCount() == 1;
-    assert alias.isStruct() && alias.getFieldCount() == 1;
+    checkArgument(original.isStruct() && original.getFieldCount() >= 1);
+    checkArgument(alias.isStruct() && alias.getFieldCount() == 1);

Review Comment:
   Resolved in c0aac8317767b5b85706228ff72c55dc5a492e4f



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to