You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ca...@codespot.com on 2012/08/05 07:12:09 UTC

[cassandra-dbapi2] push by pcannon@gmail.com - basic collections support on 2012-08-05 05:11 GMT

Revision: 2742a4d62ba4
Author:   paul cannon <pa...@datastax.com>
Date:     Sat Aug  4 22:11:27 2012
Log:      basic collections support

http://code.google.com/a/apache-extras.org/p/cassandra-dbapi2/source/detail?r=2742a4d62ba4

Modified:
  /cql/marshal.py

=======================================
--- /cql/marshal.py	Sat Jul  7 19:02:33 2012
+++ /cql/marshal.py	Sat Aug  4 22:11:27 2012
@@ -64,6 +64,9 @@
  UUID_TYPE = "org.apache.cassandra.db.marshal.UUIDType"
  LEXICAL_UUID_TYPE = "org.apache.cassandra.db.marshal.LexicalType"
  TIME_UUID_TYPE = "org.apache.cassandra.db.marshal.TimeUUIDType"
+LIST_TYPE = "org.apache.cassandra.db.marshal.ListType"
+MAP_TYPE = "org.apache.cassandra.db.marshal.MapType"
+SET_TYPE = "org.apache.cassandra.db.marshal.SetType"
  COUNTER_COLUMN_TYPE = "org.apache.cassandra.db.marshal.CounterColumnType"

  stringlit_re = re.compile(r"""('[^']*'|"[^"]*")""")
@@ -299,6 +302,13 @@
          return ''
      return uuid.bytes

+def unmarshal_json(j):
+    if j is None:
+        return None
+    return json.loads(j)
+
+unmarshal_list = unmarshal_map = unmarshal_set = unmarshal_json
+
  unmarshallers = {BYTES_TYPE:          unmarshal_noop,
                   ASCII_TYPE:          unmarshal_noop,
                   BOOLEAN_TYPE:        unmarshal_bool,
@@ -313,6 +323,9 @@
                   UUID_TYPE:           unmarshal_uuid,
                   LEXICAL_UUID_TYPE:   unmarshal_uuid,
                   TIME_UUID_TYPE:      unmarshal_uuid,
+                 LIST_TYPE:           unmarshal_list,
+                 MAP_TYPE:            unmarshal_map,
+                 SET_TYPE:            unmarshal_set,
                   COUNTER_COLUMN_TYPE: unmarshal_long}
  for name, typ in unmarshallers.items():
      short_name = name.split('.')[-1]