Author: eevans Date: Wed Mar 9 22:00:04 2011 New Revision: 1080020 URL: http://svn.apache.org/viewvc?rev=1080020&view=rev Log: CASSANDRA-2027 single-quoted string literals
Patch by eevans for CASSANDRA-2027 Modified: cassandra/trunk/drivers/py/cql/marshal.py cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g cassandra/trunk/test/system/test_cql.py Modified: cassandra/trunk/drivers/py/cql/marshal.py URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/py/cql/marshal.py?rev=1080020&r1=1080019&r2=1080020&view=diff ============================================================================== --- cassandra/trunk/drivers/py/cql/marshal.py (original) +++ cassandra/trunk/drivers/py/cql/marshal.py Wed Mar 9 22:00:04 2011 @@ -51,9 +51,9 @@ def marshal(term): elif isinstance(term, int): return "%d" % term elif isinstance(term, unicode): - return "u\"%s\"" % term + return "u'%s'" % term elif isinstance(term, str): - return "\"%s\"" % term + return "'%s'" % term elif isinstance(term, UUID): if term.version == 1: return "timeuuid(\"%s\")" % str(term) Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g?rev=1080020&r1=1080019&r2=1080020&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g (original) +++ cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g Wed Mar 9 22:00:04 2011 @@ -375,12 +375,12 @@ fragment Y: ('y'|'Y'); fragment Z: ('z'|'Z'); STRING_LITERAL - : '"' + : '\'' { StringBuilder b = new StringBuilder(); } - ( c=~('"'|'\r'|'\n') { b.appendCodePoint(c);} - | '"' '"' { b.appendCodePoint('"');} + ( c=~('\''|'\r'|'\n') { b.appendCodePoint(c);} + | '\'' '\'' { b.appendCodePoint('"');} )* - '"' + '\'' { setText(b.toString()); } ; Modified: cassandra/trunk/test/system/test_cql.py URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_cql.py?rev=1080020&r1=1080019&r2=1080020&view=diff ============================================================================== --- cassandra/trunk/test/system/test_cql.py (original) +++ cassandra/trunk/test/system/test_cql.py Wed Mar 9 22:00:04 2011 @@ -27,43 +27,43 @@ def load_sample(dbconn): dbconn.execute(query, "cd1", "vd1", "col", "val", "kd") dbconn.execute(""" - UPDATE Standard2 SET u"%s" = "ve1", "col" = "val" WHERE KEY = "kd" + UPDATE Standard2 SET u'%s' = 've1', 'col' = 'val' WHERE KEY = 'kd' """ % u'\xa9'.encode('utf8')) dbconn.execute(""" - UPDATE Standard2 SET u"cf1" = "vf1", "col" = "val" WHERE KEY = "kd" + UPDATE Standard2 SET u'cf1' = 'vf1', 'col' = 'val' WHERE KEY = 'kd' """) dbconn.execute(""" BEGIN BATCH USING CONSISTENCY ONE - UPDATE StandardLong1 SET 1L="1", 2L="2", 3L="3", 4L="4" WHERE KEY="aa"; - UPDATE StandardLong1 SET 5L="5", 6L="6", 7L="8", 9L="9" WHERE KEY="ab"; - UPDATE StandardLong1 SET 9L="9", 8L="8", 7L="7", 6L="6" WHERE KEY="ac"; - UPDATE StandardLong1 SET 5L="5", 4L="4", 3L="3", 2L="2" WHERE KEY="ad"; - UPDATE StandardLong1 SET 1L="1", 2L="2", 3L="3", 4L="4" WHERE KEY="ae"; - UPDATE StandardLong1 SET 1L="1", 2L="2", 3L="3", 4L="4" WHERE KEY="af"; - UPDATE StandardLong1 SET 5L="5", 6L="6", 7L="8", 9L="9" WHERE KEY="ag"; + UPDATE StandardLong1 SET 1L='1', 2L='2', 3L='3', 4L='4' WHERE KEY='aa'; + UPDATE StandardLong1 SET 5L='5', 6L='6', 7L='8', 9L='9' WHERE KEY='ab'; + UPDATE StandardLong1 SET 9L='9', 8L='8', 7L='7', 6L='6' WHERE KEY='ac'; + UPDATE StandardLong1 SET 5L='5', 4L='4', 3L='3', 2L='2' WHERE KEY='ad'; + UPDATE StandardLong1 SET 1L='1', 2L='2', 3L='3', 4L='4' WHERE KEY='ae'; + UPDATE StandardLong1 SET 1L='1', 2L='2', 3L='3', 4L='4' WHERE KEY='af'; + UPDATE StandardLong1 SET 5L='5', 6L='6', 7L='8', 9L='9' WHERE KEY='ag'; APPLY BATCH """) dbconn.execute(""" BEGIN BATCH USING CONSISTENCY ONE - UPDATE StandardInteger1 SET 10="a", 20="b", 30="c", 40="d" WHERE KEY="k1"; - UPDATE StandardInteger1 SET 10="e", 20="f", 30="g", 40="h" WHERE KEY="k2"; - UPDATE StandardInteger1 SET 10="i", 20="j", 30="k", 40="l" WHERE KEY="k3"; - UPDATE StandardInteger1 SET 10="m", 20="n", 30="o", 40="p" WHERE KEY="k4"; - UPDATE StandardInteger1 SET 10="q", 20="r", 30="s", 40="t" WHERE KEY="k5"; - UPDATE StandardInteger1 SET 10="u", 20="v", 30="w", 40="x" WHERE KEY="k6"; - UPDATE StandardInteger1 SET 10="y", 20="z", 30="A", 40="B" WHERE KEY="k7"; + UPDATE StandardInteger1 SET 10='a', 20='b', 30='c', 40='d' WHERE KEY='k1'; + UPDATE StandardInteger1 SET 10='e', 20='f', 30='g', 40='h' WHERE KEY='k2'; + UPDATE StandardInteger1 SET 10='i', 20='j', 30='k', 40='l' WHERE KEY='k3'; + UPDATE StandardInteger1 SET 10='m', 20='n', 30='o', 40='p' WHERE KEY='k4'; + UPDATE StandardInteger1 SET 10='q', 20='r', 30='s', 40='t' WHERE KEY='k5'; + UPDATE StandardInteger1 SET 10='u', 20='v', 30='w', 40='x' WHERE KEY='k6'; + UPDATE StandardInteger1 SET 10='y', 20='z', 30='A', 40='B' WHERE KEY='k7'; APPLY BATCH """) dbconn.execute(""" BEGIN BATCH - UPDATE Indexed1 SET "birthdate"=100L, "unindexed"=250L WHERE KEY="asmith"; - UPDATE Indexed1 SET "birthdate"=100L, "unindexed"=200L WHERE KEY="dozer"; - UPDATE Indexed1 SET "birthdate"=175L, "unindexed"=200L WHERE KEY="morpheus"; - UPDATE Indexed1 SET "birthdate"=150L, "unindexed"=250L WHERE KEY="neo"; - UPDATE Indexed1 SET "birthdate"=125L, "unindexed"=200L WHERE KEY="trinity"; + UPDATE Indexed1 SET 'birthdate'=100L, 'unindexed'=250L WHERE KEY='asmith'; + UPDATE Indexed1 SET 'birthdate'=100L, 'unindexed'=200L WHERE KEY='dozer'; + UPDATE Indexed1 SET 'birthdate'=175L, 'unindexed'=200L WHERE KEY='morpheus'; + UPDATE Indexed1 SET 'birthdate'=150L, 'unindexed'=250L WHERE KEY='neo'; + UPDATE Indexed1 SET 'birthdate'=125L, 'unindexed'=200L WHERE KEY='trinity'; APPLY BATCH """) @@ -76,7 +76,7 @@ class TestCql(ThriftTester): def test_select_simple(self): "retrieve a column" conn = init() - r = conn.execute('SELECT "ca1" FROM Standard1 WHERE KEY="ka"') + r = conn.execute("SELECT 'ca1' FROM Standard1 WHERE KEY='ka'") assert r[0].key == 'ka' assert r[0].columns[0].name == 'ca1' assert r[0].columns[0].value == 'va1' @@ -84,14 +84,14 @@ class TestCql(ThriftTester): def test_select_columns(self): "retrieve multiple columns" conn = init() - r = conn.execute('SELECT "cd1", "col" FROM Standard1 WHERE KEY = "kd"') + r = conn.execute("SELECT 'cd1', 'col' FROM Standard1 WHERE KEY = 'kd'") assert "cd1" in [i.name for i in r[0].columns] assert "col" in [i.name for i in r[0].columns] def test_select_row_range(self): "retrieve a range of rows with columns" conn = init() - r = conn.execute('SELECT 4L FROM StandardLong1 WHERE KEY > "ad" AND KEY < "ag";') + r = conn.execute("SELECT 4L FROM StandardLong1 WHERE KEY > 'ad' AND KEY < 'ag';") assert len(r) == 3 assert r[0].key == "ad" assert r[1].key == "ae" @@ -104,13 +104,13 @@ class TestCql(ThriftTester): "retrieve a limited range of rows with columns" conn = init() r = conn.execute(""" - SELECT 1L,5L,9L FROM StandardLong1 WHERE KEY > "aa" AND KEY < "ag" LIMIT 3 + SELECT 1L,5L,9L FROM StandardLong1 WHERE KEY > 'aa' AND KEY < 'ag' LIMIT 3 """) assert len(r) == 3 r = conn.execute(""" - SELECT 20,40 FROM StandardInteger1 WHERE KEY > "k1" - AND KEY < "k7" LIMIT 5 + SELECT 20,40 FROM StandardInteger1 WHERE KEY > 'k1' + AND KEY < 'k7' LIMIT 5 """) assert len(r) == 5 r[0].key == "k1" @@ -119,13 +119,13 @@ class TestCql(ThriftTester): def test_select_columns_slice(self): "range of columns (slice) by row" conn = init() - r = conn.execute('SELECT 1L..3L FROM StandardLong1 WHERE KEY = "aa";') + r = conn.execute("SELECT 1L..3L FROM StandardLong1 WHERE KEY = 'aa';") assert len(r) == 1 assert r[0].columns[0].value == "1" assert r[0].columns[1].value == "2" assert r[0].columns[2].value == "3" - r = conn.execute('SELECT 10..30 FROM StandardInteger1 WHERE KEY="k1"') + r = conn.execute("SELECT 10..30 FROM StandardInteger1 WHERE KEY='k1'") assert len(r) == 1 assert r[0].columns[0].value == "a" assert r[0].columns[1].value == "b" @@ -134,7 +134,9 @@ class TestCql(ThriftTester): def test_select_columns_slice_with_limit(self): "range of columns (slice) by row with limit" conn = init() - r = conn.execute('SELECT FIRST 1 1L..3L FROM StandardLong1 WHERE KEY = "aa";') + r = conn.execute(""" + SELECT FIRST 1 1L..3L FROM StandardLong1 WHERE KEY = 'aa'; + """) assert len(r) == 1 assert len(r[0].columns) == 1 assert r[0].columns[0].value == "1" @@ -142,7 +144,9 @@ class TestCql(ThriftTester): def test_select_columns_slice_reversed(self): "range of columns (slice) by row reversed" conn = init() - r = conn.execute('SELECT FIRST 2 REVERSED 3L..1L FROM StandardLong1 WHERE KEY = "aa";') + r = conn.execute(""" + SELECT FIRST 2 REVERSED 3L..1L FROM StandardLong1 WHERE KEY = 'aa'; + """) assert len(r) == 1, "%d != 1" % len(r) assert len(r[0].columns) == 2 assert r[0].columns[0].value == "3" @@ -151,13 +155,13 @@ class TestCql(ThriftTester): def test_error_on_multiple_key_by(self): "ensure multiple key-bys in where clause excepts" conn = init() - query = 'SELECT "col" FROM Standard1 WHERE KEY = "ka" AND KEY = "kb";' + query = "SELECT 'col' FROM Standard1 WHERE KEY = 'ka' AND KEY = 'kb';" assert_raises(CQLException, conn.execute, query) def test_index_scan_equality(self): "indexed scan where column equals value" conn = init() - r = conn.execute('SELECT "birthdate" FROM Indexed1 WHERE "birthdate" = 100L') + r = conn.execute("SELECT 'birthdate' FROM Indexed1 WHERE 'birthdate' = 100L") assert len(r) == 2 assert r[0].key == "asmith" assert r[1].key == "dozer" @@ -168,7 +172,7 @@ class TestCql(ThriftTester): "indexed scan where a column is greater than a value" conn = init() r = conn.execute(""" - SELECT "birthdate" FROM Indexed1 WHERE "birthdate" = 100L AND "unindexed" > 200L + SELECT 'birthdate' FROM Indexed1 WHERE 'birthdate' = 100L AND 'unindexed' > 200L """) assert len(r) == 1 assert r[0].key == "asmith" @@ -177,7 +181,7 @@ class TestCql(ThriftTester): "indexed scan with a starting key" conn = init() r = conn.execute(""" - SELECT "birthdate" FROM Indexed1 WHERE "birthdate" = 100L AND KEY > "asmithZ" + SELECT 'birthdate' FROM Indexed1 WHERE 'birthdate' = 100L AND KEY > 'asmithZ' """) assert len(r) == 1 assert r[0].key == "dozer" @@ -185,7 +189,7 @@ class TestCql(ThriftTester): def test_no_where_clause(self): "empty where clause (range query w/o start key)" conn = init() - r = conn.execute('SELECT "col" FROM Standard1 LIMIT 3') + r = conn.execute("SELECT 'col' FROM Standard1 LIMIT 3") assert len(r) == 3 assert r[0].key == "ka" assert r[1].key == "kb" @@ -194,55 +198,55 @@ class TestCql(ThriftTester): def test_column_count(self): "getting a result count instead of results" conn = init() - r = conn.execute('SELECT COUNT(1L..4L) FROM StandardLong1 WHERE KEY = "aa";') + r = conn.execute("SELECT COUNT(1L..4L) FROM StandardLong1 WHERE KEY = 'aa';") assert r == 4, "expected 4 results, got %d" % (r and r or 0) def test_truncate_columnfamily(self): "truncating a column family" conn = init() conn.execute('TRUNCATE Standard1;') - r = conn.execute('SELECT "cd1" FROM Standard1 WHERE KEY = "kd"') + r = conn.execute("SELECT 'cd1' FROM Standard1 WHERE KEY = 'kd'") assert len(r) == 0 def test_delete_columns(self): "delete columns from a row" conn = init() - r = conn.execute('SELECT "cd1", "col" FROM Standard1 WHERE KEY = "kd"') + r = conn.execute("SELECT 'cd1', 'col' FROM Standard1 WHERE KEY = 'kd'") assert "cd1" in [i.name for i in r[0].columns] assert "col" in [i.name for i in r[0].columns] - conn.execute('DELETE "cd1", "col" FROM Standard1 WHERE KEY = "kd"') - r = conn.execute('SELECT "cd1", "col" FROM Standard1 WHERE KEY = "kd"') + conn.execute("DELETE 'cd1', 'col' FROM Standard1 WHERE KEY = 'kd'") + r = conn.execute("SELECT 'cd1', 'col' FROM Standard1 WHERE KEY = 'kd'") assert len(r[0].columns) == 0 def test_delete_columns_multi_rows(self): "delete columns from multiple rows" conn = init() - r = conn.execute('SELECT "col" FROM Standard1 WHERE KEY = "kc"') + r = conn.execute("SELECT 'col' FROM Standard1 WHERE KEY = 'kc'") assert len(r[0].columns) == 1 - r = conn.execute('SELECT "col" FROM Standard1 WHERE KEY = "kd"') + r = conn.execute("SELECT 'col' FROM Standard1 WHERE KEY = 'kd'") assert len(r[0].columns) == 1 - conn.execute('DELETE "col" FROM Standard1 WHERE KEY IN ("kc", "kd")') - r = conn.execute('SELECT "col" FROM Standard1 WHERE KEY = "kc"') + conn.execute("DELETE 'col' FROM Standard1 WHERE KEY IN ('kc', 'kd')") + r = conn.execute("SELECT 'col' FROM Standard1 WHERE KEY = 'kc'") assert len(r[0].columns) == 0 - r = conn.execute('SELECT "col" FROM Standard1 WHERE KEY = "kd"') + r = conn.execute("SELECT 'col' FROM Standard1 WHERE KEY = 'kd'") assert len(r[0].columns) == 0 def test_delete_rows(self): "delete entire rows" conn = init() - r = conn.execute('SELECT "cd1", "col" FROM Standard1 WHERE KEY = "kd"') + r = conn.execute("SELECT 'cd1', 'col' FROM Standard1 WHERE KEY = 'kd'") assert "cd1" in [i.name for i in r[0].columns] assert "col" in [i.name for i in r[0].columns] - conn.execute('DELETE FROM Standard1 WHERE KEY = "kd"') - r = conn.execute('SELECT "cd1", "col" FROM Standard1 WHERE KEY = "kd"') + conn.execute("DELETE FROM Standard1 WHERE KEY = 'kd'") + r = conn.execute("SELECT 'cd1', 'col' FROM Standard1 WHERE KEY = 'kd'") assert len(r[0].columns) == 0 def test_create_keyspace(self): "create a new keyspace" init().execute(""" - CREATE KEYSPACE TestKeyspace42 WITH strategy_options:DC1 = 1" - AND strategy_class = "SimpleStrategy" AND replication_factor = 3 + CREATE KEYSPACE TestKeyspace42 WITH strategy_options:DC1 = '1' + AND strategy_class = 'SimpleStrategy' AND replication_factor = 3 """) # TODO: temporary (until this can be done with CQL). @@ -258,7 +262,7 @@ class TestCql(ThriftTester): conn = init() conn.execute(""" CREATE KEYSPACE Keyspace4Drop - WITH strategy_class = "SimpleStrategy" AND replication_factor = 1 + WITH strategy_class = 'SimpleStrategy' AND replication_factor = 1 """) # TODO: temporary (until this can be done with CQL). @@ -277,17 +281,17 @@ class TestCql(ThriftTester): conn = init() conn.execute(""" CREATE KEYSPACE CreateCFKeyspace WITH replication_factor = 1 - AND strategy_class = "SimpleStrategy"; + AND strategy_class = 'SimpleStrategy'; """) conn.execute("USE CreateCFKeyspace;") conn.execute(""" CREATE COLUMNFAMILY NewCf1 ( - "username" utf8, - "age" int, - "birthdate" long, - "id" uuid - ) WITH comparator = utf8 AND comment = "shiny, new, cf" AND + 'username' utf8, + 'age' int, + 'birthdate' long, + 'id' uuid + ) WITH comparator = utf8 AND comment = 'shiny, new, cf' AND default_validation = ascii; """) @@ -317,7 +321,7 @@ class TestCql(ThriftTester): assert cfam.comparator_type == "org.apache.cassandra.db.marshal.LongType" # Column defs, defaults otherwise - conn.execute("CREATE COLUMNFAMILY NewCf4 (\"a\" int, \"b\" int)") + conn.execute("CREATE COLUMNFAMILY NewCf4 ('a' int, 'b' int)") ksdef = thrift_client.describe_keyspace("CreateCFKeyspace") assert len(ksdef.cf_defs) == 4, \ "expected 4 column families total, found %d" % len(ksdef.cf_defs) @@ -333,7 +337,7 @@ class TestCql(ThriftTester): conn = init() conn.execute(""" CREATE KEYSPACE Keyspace4CFDrop WITH replication_factor = 1 - AND strategy_class = "SimpleStrategy"; + AND strategy_class = 'SimpleStrategy'; """) conn.execute('USE Keyspace4CFDrop;') conn.execute('CREATE COLUMNFAMILY CF4Drop;') @@ -352,8 +356,8 @@ class TestCql(ThriftTester): conn = init() conn.execute("USE Keyspace1") conn.execute("CREATE COLUMNFAMILY CreateIndex1") - conn.execute("CREATE INDEX namedIndex ON CreateIndex1 (\"items\")") - conn.execute("CREATE INDEX ON CreateIndex1 (\"stuff\")") + conn.execute("CREATE INDEX namedIndex ON CreateIndex1 ('items')") + conn.execute("CREATE INDEX ON CreateIndex1 ('stuff')") # TODO: temporary (until this can be done with CQL). ksdef = thrift_client.describe_keyspace("Keyspace1") @@ -377,30 +381,30 @@ class TestCql(ThriftTester): # Store and retrieve a timeuuid using it's hex-formatted string timeuuid = uuid.uuid1() conn.execute(""" - UPDATE Standard2 SET timeuuid("%s") = 10 WHERE KEY = "uuidtest" + UPDATE Standard2 SET timeuuid('%s') = 10 WHERE KEY = 'uuidtest' """ % str(timeuuid)) r = conn.execute(""" - SELECT timeuuid("%s") FROM Standard2 WHERE KEY = "uuidtest" + SELECT timeuuid('%s') FROM Standard2 WHERE KEY = 'uuidtest' """ % str(timeuuid)) assert r[0].columns[0].name == timeuuid.bytes # Tests a node-side conversion from long to UUID. ms = uuid1bytes_to_millis(uuid.uuid1().bytes) conn.execute(""" - UPDATE Standard2 SET "id" = timeuuid(%d) WHERE KEY = "uuidtest" + UPDATE Standard2 SET 'id' = timeuuid(%d) WHERE KEY = 'uuidtest' """ % ms) - r = conn.execute('SELECT "id" FROM Standard2 WHERE KEY = "uuidtest"') + r = conn.execute("SELECT 'id' FROM Standard2 WHERE KEY = 'uuidtest'") assert uuid1bytes_to_millis(r[0].columns[0].value) == ms # Tests a node-side conversion from ISO8601 to UUID. conn.execute(""" - UPDATE Standard2 SET "id2" = timeuuid("2011-01-31 17:00:00-0000") - WHERE KEY = "uuidtest" + UPDATE Standard2 SET 'id2' = timeuuid('2011-01-31 17:00:00-0000') + WHERE KEY = 'uuidtest' """) - r = conn.execute('SELECT "id2" FROM Standard2 WHERE KEY = "uuidtest"') + r = conn.execute("SELECT 'id2' FROM Standard2 WHERE KEY = 'uuidtest'") # 2011-01-31 17:00:00-0000 == 1296493200000ms ms = uuid1bytes_to_millis(r[0].columns[0].value) assert ms == 1296493200000, \ @@ -408,20 +412,20 @@ class TestCql(ThriftTester): # Tests node-side conversion of empty term to UUID conn.execute(""" - UPDATE Standard2 SET "id3" = timeuuid() WHERE KEY = "uuidtest" + UPDATE Standard2 SET 'id3' = timeuuid() WHERE KEY = 'uuidtest' """) - r = conn.execute('SELECT "id3" FROM Standard2 WHERE KEY = "uuidtest"') + r = conn.execute("SELECT 'id3' FROM Standard2 WHERE KEY = 'uuidtest'") ms = uuid1bytes_to_millis(r[0].columns[0].value) assert ((time.time() * 1e3) - ms) < 100, \ "timeuuid() not within 100ms of now (UPDATE vs. SELECT)" # Tests node-side conversion of timeuuid("now") to UUID conn.execute(""" - UPDATE Standard2 SET "id4" = timeuuid("now") WHERE KEY = "uuidtest" + UPDATE Standard2 SET 'id4' = timeuuid('now') WHERE KEY = 'uuidtest' """) - r = conn.execute('SELECT "id4" FROM Standard2 WHERE KEY = "uuidtest"') + r = conn.execute("SELECT 'id4' FROM Standard2 WHERE KEY = 'uuidtest'") ms = uuid1bytes_to_millis(r[0].columns[0].value) assert ((time.time() * 1e3) - ms) < 100, \ "timeuuid(\"now\") not within 100ms of now (UPDATE vs. SELECT)" @@ -433,11 +437,11 @@ class TestCql(ThriftTester): conn = init() uid = uuid.uuid4() conn.execute(""" - UPDATE Standard2 SET uuid("%s") = 10 WHERE KEY = "uuidtest" + UPDATE Standard2 SET uuid('%s') = 10 WHERE KEY = 'uuidtest' """ % str(uid)) r = conn.execute(""" - SELECT uuid("%s") FROM Standard2 WHERE KEY = "uuidtest" + SELECT uuid('%s') FROM Standard2 WHERE KEY = 'uuidtest' """ % str(uid)) assert r[0].columns[0].name == uid.bytes