@@ -63,18 +63,20 @@ public void flattenNestedArrays() {
63
63
RelDataTypeFactory .Builder builder3 = new RelDataTypeFactory .Builder (typeFactory );
64
64
builder3 .add ("FOO" , typeFactory .createArrayType (builder1 .build (), -1 ));
65
65
builder3 .add ("BAR" , typeFactory .createArrayType (builder2 .build (), -1 ));
66
+ builder3 .add ("CAR" , typeFactory .createArrayType (
67
+ typeFactory .createSqlType (SqlTypeName .FLOAT ), -1 ));
66
68
RelDataType rowType = builder3 .build ();
67
- Assertions .assertEquals (2 , rowType .getFieldList ().size ());
69
+ Assertions .assertEquals (3 , rowType .getFieldList ().size ());
68
70
RelDataType flattenedType = DataTypeUtils .flatten (rowType , typeFactory );
69
- Assertions .assertEquals (2 , flattenedType .getFieldList ().size ());
71
+ Assertions .assertEquals (3 , flattenedType .getFieldList ().size ());
70
72
List <String > flattenedNames = flattenedType .getFieldList ().stream ().map (x -> x .getName ())
71
73
.collect (Collectors .toList ());
72
- Assertions .assertIterableEquals (Arrays .asList (new String []{"FOO" , "BAR" }),
74
+ Assertions .assertIterableEquals (Arrays .asList (new String []{"FOO" , "BAR" , "CAR" }),
73
75
flattenedNames );
74
76
String flattenedConnector = new ScriptImplementor .ConnectorImplementor ("T1" ,
75
77
flattenedType , Collections .emptyMap ()).sql ();
76
78
Assertions .assertEquals ("CREATE TABLE IF NOT EXISTS `T1` (`FOO` ANY ARRAY, "
77
- + "`BAR` ANY ARRAY) WITH ();" , flattenedConnector ,
79
+ + "`BAR` ANY ARRAY, `CAR` FLOAT ARRAY ) WITH ();" , flattenedConnector ,
78
80
"Flattened connector should have simplified arrays" );
79
81
}
80
82
}
0 commit comments