Github user walterddr commented on a diff in the pull request:
https://github.com/apache/flink/pull/5015#discussion_r151851733
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/map.scala
---
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.expressions
+
+import org.apache.calcite.rex.RexNode
+import org.apache.calcite.sql.fun.SqlStdOperatorTable
+import org.apache.calcite.tools.RelBuilder
+import org.apache.flink.api.common.typeinfo.TypeInformation
+import org.apache.flink.api.java.typeutils.{GenericTypeInfo, MapTypeInfo}
+import org.apache.flink.table.calcite.{FlinkRelBuilder, FlinkTypeFactory}
+import org.apache.flink.table.plan.schema.MapRelDataType
+import org.apache.flink.table.validate.{ValidationFailure,
ValidationResult, ValidationSuccess}
+
+import scala.collection.JavaConverters._
+
+case class MapConstructor(elements: Seq[Expression]) extends Expression {
+ override private[flink] def children: Seq[Expression] = elements
+
+ private[flink] var mapResultType: TypeInformation[_] = new MapTypeInfo(
+ new GenericTypeInfo[AnyRef](classOf[AnyRef]),
+ new GenericTypeInfo[AnyRef](classOf[AnyRef]))
+
+ override private[flink] def toRexNode(implicit relBuilder: RelBuilder):
RexNode = {
+ val typeFactory =
relBuilder.asInstanceOf[FlinkRelBuilder].getTypeFactory
+ val entryRelDataTypes = elements
+ .map(x => typeFactory.createTypeFromTypeInfo(x.resultType,
isNullable = false))
+ val relDataType = SqlStdOperatorTable
--- End diff --
You are right, since both ARRAY and MAP require explicit type match.
This actually prompts the question: "should we support implicit type case
like Calcite did?
---