JiajunBernoulli commented on code in PR #3194:
URL: https://github.com/apache/calcite/pull/3194#discussion_r1192906717
##########
core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java:
##########
@@ -536,6 +536,26 @@ public static SqlCall stripSeparator(SqlCall call) {
public static final SqlReturnTypeInference TO_MAP =
ARG0.andThen(SqlTypeTransforms.TO_MAP);
+ /**
+ * Returns a ARRAY type.
+ *
+ * <p>For example, given {@code (INTEGER, DATE) MAP}, returns
+ * {@code INTEGER ARRAY}.
+ */
+ public static final SqlReturnTypeInference TO_MAP_KEYS_NULLABLE =
+ ARG0.andThen(SqlTypeTransforms.TO_MAP_KEYS)
+ .andThen(SqlTypeTransforms.TO_NULLABLE);
+
+ /**
+ * Returns a ARRAY type.
+ *
+ * <p>For example, given {@code (INTEGER, DATE) MAP}, returns
+ * {@code DATE ARRAY}.
+ */
+ public static final SqlReturnTypeInference TO_MAP_VALUES_NULLABLE =
Review Comment:
We should have two types: *not null* and *nullable*.
```
public static final SqlReturnTypeInference TO_MAP_KEYS =
ARG0.andThen(SqlTypeTransforms.TO_MAP_KEYS);
public static final SqlReturnTypeInference TO_MAP_KEYS_NULLABLE =
TO_MAP_KEYS.andThen(SqlTypeTransforms.TO_NULLABLE);
```
--
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]