Explorar el Código

HPCC-14845 Cassandra cpp driver 2.2.2 list type issue

Newest Cassandra driver is stricter about checking collection types, so we
need to be a bit more careful about guessing whether an ECL set corresponds to
a Cassandra list or set column.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman hace 9 años
padre
commit
001b9002ea
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      plugins/cassandra/cassandraembed.cpp

+ 6 - 1
plugins/cassandra/cassandraembed.cpp

@@ -1114,7 +1114,12 @@ public:
     {
     {
         if (isAll)
         if (isAll)
             UNSUPPORTED("SET(ALL)");
             UNSUPPORTED("SET(ALL)");
-        collection.setown(new CassandraCollection(cass_collection_new(CASS_COLLECTION_TYPE_SET, numElements)));
+        // We don't know whether the corresponding field in Cassandra is a list or a set. Try binding a dummy list to tell which.
+        CassandraCollection temp(cass_collection_new(CASS_COLLECTION_TYPE_LIST, 0));
+        if (cass_statement_bind_collection(stmtInfo->queryStatement(), thisParam, temp) == CASS_OK)
+            collection.setown(new CassandraCollection(cass_collection_new(CASS_COLLECTION_TYPE_LIST, numElements)));
+        else
+            collection.setown(new CassandraCollection(cass_collection_new(CASS_COLLECTION_TYPE_SET, numElements)));
         return true;
         return true;
     }
     }
     virtual bool processBeginDataset(const RtlFieldInfo * field, unsigned numRows)
     virtual bool processBeginDataset(const RtlFieldInfo * field, unsigned numRows)