[ https://issues.apache.org/jira/browse/FLINK-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14296972#comment-14296972 ]
ASF GitHub Bot commented on FLINK-1193: --------------------------------------- Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/348#discussion_r23773125 --- Diff: flink-tests/src/test/scala/org/apache/flink/api/scala/types/TypeInformationGenTest.scala --- @@ -255,6 +255,53 @@ class TypeInformationGenTest { Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0)) Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(1)) } + + @Test + def testMultidimensionalArrays(): Unit = { + // Tuple + { + val ti = createTypeInformation[Array[Array[(String, String)]]] + + Assert.assertTrue(ti.isInstanceOf[ObjectArrayTypeInfo[_, _]]) + val oati = ti.asInstanceOf[ObjectArrayTypeInfo[_, _]] + Assert.assertTrue(oati.getComponentInfo.isInstanceOf[ObjectArrayTypeInfo[_, _]]) + val oati2 = oati.getComponentInfo.asInstanceOf[ObjectArrayTypeInfo[_, _]] + Assert.assertTrue(oati2.getComponentInfo.isTupleType) + val tti = oati2.getComponentInfo.asInstanceOf[TupleTypeInfoBase[_]] + Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0)) + Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(1)) + } + + // primitives + { + val ti = createTypeInformation[Array[Array[Int]]] + + Assert.assertTrue(ti.isInstanceOf[ObjectArrayTypeInfo[_, _]]) + val oati = ti.asInstanceOf[ObjectArrayTypeInfo[_, _]] + Assert.assertEquals(oati.getComponentInfo, PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO) --- End diff -- This line is too long. That's why mvn verify fails. > InvalidTypesException for Array[Array[Tuple2[Int, Double]]] > ----------------------------------------------------------- > > Key: FLINK-1193 > URL: https://issues.apache.org/jira/browse/FLINK-1193 > Project: Flink > Issue Type: Bug > Reporter: Till Rohrmann > Assignee: Timo Walther > > The TypeExtractor cannot handle nested arrays with non-trivial element types. > For example, the following code cannot be run > {code} > val input = env.fromCollection(List(1,2,3,4)) > val mapped = input.map{ > id => { > val pair = (1,1.0) > val a = Array(pair) > val b = Array(a) > b > } > } > {code} > The resulting type Array[Array[Tuple2[Int, Double]]] cannot be extracted. It > would be nice, if Flink supported these types. -- This message was sent by Atlassian JIRA (v6.3.4#6332)