@@ -651,13 +651,15 @@ public void testSchema(String ksName) throws InterruptedException, IOException {
651651 // force udt values to be null by populating 1 item, using zudt.newValue() without explicitly setting
652652 // any field to non-null value will cause the udt column itself to be null in the C* table
653653 UdtValue zudtOptionalValues = zudt .newValue (dataSpecMap .get ("text" ).cqlValue );
654- TupleType tupleType = DataTypes .tupleOf (DataTypes .TEXT , DataTypes .TEXT , DataTypes .BIGINT , DataTypes .DOUBLE , DataTypes .TEXT );
655- TupleValue tupleValue = tupleType .newValue (dataSpecMap .get ("text" ).cqlValue , dataSpecMap .get ("text" ).cqlValue , dataSpecMap .get ("bigint" ).cqlValue , dataSpecMap .get ("double" ).cqlValue , dataSpecMap .get ("text" ).cqlValue );
654+ TupleType tupleTypeForMap = DataTypes .tupleOf (DataTypes .TEXT , DataTypes .TEXT , DataTypes .BIGINT , DataTypes .DOUBLE , DataTypes .TEXT );
655+ TupleValue tupleValueForMap = tupleTypeForMap .newValue (dataSpecMap .get ("text" ).cqlValue , dataSpecMap .get ("text" ).cqlValue , dataSpecMap .get ("bigint" ).cqlValue , dataSpecMap .get ("double" ).cqlValue , dataSpecMap .get ("text" ).cqlValue );
656656 Map <String , TupleValue > mapOfTuple = new HashMap <>();
657- mapOfTuple .put ("a" , tupleValue );
657+ mapOfTuple .put ("a" , tupleValueForMap );
658+ TupleType tupleType = DataTypes .tupleOf (DataTypes .INT , DataTypes .TEXT );
659+ TupleValue tupleValue = tupleType .newValue (dataSpecMap .get ("int" ).cqlValue , dataSpecMap .get ("text" ).cqlValue );
658660 cqlSession .execute ("CREATE TABLE IF NOT EXISTS " + ksName + ".table3 (" +
659661 "xtext text, xascii ascii, xboolean boolean, xblob blob, xtimestamp timestamp, xtime time, xdate date, xuuid uuid, xtimeuuid timeuuid, xtinyint tinyint, xsmallint smallint, xint int, xbigint bigint, xvarint varint, xdecimal decimal, xdouble double, xfloat float, xinet4 inet, xinet6 inet, " +
660- "ytext text, yascii ascii, yboolean boolean, yblob blob, ytimestamp timestamp, ytime time, ydate date, yuuid uuid, ytimeuuid timeuuid, ytinyint tinyint, ysmallint smallint, yint int, ybigint bigint, yvarint varint, ydecimal decimal, ydouble double, yfloat float, yinet4 inet, yinet6 inet, yduration duration, yudt zudt, yudtoptional zudt, ylist list<text>, yset set<int>, ymap map<text, double>, ytuple frozen<tuple<text, text, bigint, double , text>>, ymapoftuple map<text, frozen<tuple<text, text, bigint, double, text>>>, ylistofmap list<frozen<map<text,double>>>, ysetofudt set<frozen<zudt>>," +
662+ "ytext text, yascii ascii, yboolean boolean, yblob blob, ytimestamp timestamp, ytime time, ydate date, yuuid uuid, ytimeuuid timeuuid, ytinyint tinyint, ysmallint smallint, yint int, ybigint bigint, yvarint varint, ydecimal decimal, ydouble double, yfloat float, yinet4 inet, yinet6 inet, yduration duration, yudt zudt, yudtoptional zudt, ylist list<text>, yset set<int>, ymap map<text, double>, ytuple frozen<tuple<int , text>>, ymapoftuple map<text, frozen<tuple<text, text, bigint, double, text>>>, ylistofmap list<frozen<map<text,double>>>, ysetofudt set<frozen<zudt>>," +
661663 "primary key (xtext, xascii, xboolean, xblob, xtimestamp, xtime, xdate, xuuid, xtimeuuid, xtinyint, xsmallint, xint, xbigint, xvarint, xdecimal, xdouble, xfloat, xinet4, xinet6)) " +
662664 "WITH CLUSTERING ORDER BY (xascii ASC, xboolean DESC, xblob ASC, xtimestamp DESC, xtime DESC, xdate ASC, xuuid DESC, xtimeuuid ASC, xtinyint DESC, xsmallint ASC, xint DESC, xbigint ASC, xvarint DESC, xdecimal ASC, xdouble DESC, xfloat ASC, xinet4 ASC, xinet6 DESC) AND cdc=true" );
663665 cqlSession .execute ("INSERT INTO " + ksName + ".table3 (" +
@@ -825,15 +827,9 @@ void assertField(String fieldName, Object value) {
825827 if (fieldName .startsWith ("index_" )) {
826828 int idx = Integer .parseInt (fieldName .substring ("index_" .length ()));
827829 if (idx == 0 ) {
828- Assert .assertEquals (dataSpecMap .get ("text " ).avroValue , value );
830+ Assert .assertEquals (dataSpecMap .get ("int " ).avroValue , value );
829831 } else if (idx == 1 ) {
830832 Assert .assertEquals (dataSpecMap .get ("text" ).avroValue , value );
831- } else if (idx == 2 ) {
832- Assert .assertEquals (dataSpecMap .get ("bigint" ).avroValue , value );
833- } else if (idx == 3 ) {
834- Assert .assertEquals (dataSpecMap .get ("double" ).avroValue , value );
835- } else if (idx == 4 ) {
836- Assert .assertEquals (dataSpecMap .get ("text" ).avroValue , value );
837833 }
838834 return ;
839835 }
@@ -1036,10 +1032,25 @@ void assertJsonNode(String field, JsonNode node) {
10361032 }
10371033 }
10381034 return ;
1035+ case "mapoftuple" : {
1036+ for (Iterator <Map .Entry <String , JsonNode >> it = node .fields (); it .hasNext (); ) {
1037+ Map .Entry <String , JsonNode > f = it .next ();
1038+ assertJsonTupleRecord (f .getValue ());
1039+ }
1040+ }
1041+ return ;
10391042 }
10401043 Assert .assertTrue ("Unexpected field=" +field , false );
10411044 }
10421045
1046+ void assertJsonTupleRecord (JsonNode value ) {
1047+ Assert .assertEquals (dataSpecMap .get ("text" ).jsonValue (), value .get ("index_0" ).asText ());
1048+ Assert .assertEquals (dataSpecMap .get ("text" ).jsonValue (), value .get ("index_1" ).asText ());
1049+ Assert .assertEquals (dataSpecMap .get ("bigint" ).jsonValue (), value .get ("index_2" ).asLong ());
1050+ Assert .assertEquals (dataSpecMap .get ("double" ).jsonValue (), value .get ("index_3" ).asDouble ());
1051+ Assert .assertEquals (dataSpecMap .get ("text" ).jsonValue (), value .get ("index_4" ).asText ());
1052+ }
1053+
10431054 public void testBatchInsert (String ksName ) throws InterruptedException , IOException {
10441055 try {
10451056 try (CqlSession cqlSession = cassandraContainer1 .getCqlSession ()) {
0 commit comments