diff --git a/examples/demo/cgi-bin/data.py b/examples/demo/cgi-bin/data.py
index cef5cdc808..a5482cef82 100755
--- a/examples/demo/cgi-bin/data.py
+++ b/examples/demo/cgi-bin/data.py
@@ -51,23 +51,12 @@ def exec_query(conn, title, query, response, keyspace=None, kr=None): # pylint:
cursor.begin()
cursor.execute(query, {})
cursor.commit()
- # sanatize results (index columns are binary blobs)
- sanatized_results = list(
- map(
- lambda row:
- list(
- map(
- lambda column:
- str(column).decode('unicode_escape').encode('ascii','replace'),
- row)),
- cursor.results)
- )
response[title] = {
"title": title,
"description": cursor.description,
"rowcount": cursor.rowcount,
"lastrowid": cursor.lastrowid,
- "results": sanatized_results,
+ "results": cursor.results,
}
cursor.close()
except Exception as e: # pylint: disable=broad-except
@@ -154,13 +143,13 @@ def main():
conn, "name_info1",
"select * from name_info", response, keyspace="user", kr="80-")
- # music_user_idx table
+ # music_keyspace_idx table
exec_query(
- conn, "music_user_idx0",
- "select * from music_user_idx", response, keyspace="user", kr="-80")
+ conn, "music_keyspace_idx0",
+ "select music_id, hex(keyspace_id) from music_keyspace_idx", response, keyspace="user", kr="-80")
exec_query(
- conn, "music_user_idx1",
- "select * from music_user_idx", response, keyspace="user", kr="80-")
+ conn, "music_keyspace_idx1",
+ "select music_id, hex(keyspace_id) from music_keyspace_idx", response, keyspace="user", kr="80-")
# lookup tables
exec_query(
@@ -170,7 +159,7 @@ def main():
conn, "music_seq", "select * from music_seq", response,
keyspace="lookup", kr="-")
exec_query(
- conn, "name_user_idx", "select * from name_user_idx", response,
+ conn, "name_keyspace_idx", "select name, hex(keyspace_id) from name_keyspace_idx", response,
keyspace="lookup", kr="-")
print json.dumps(response, default=decimal_default)
diff --git a/examples/demo/index.html b/examples/demo/index.html
index 5a18a012f6..8b282d4a44 100644
--- a/examples/demo/index.html
+++ b/examples/demo/index.html
@@ -57,7 +57,7 @@
data-ng-include="'result.html'">
-
@@ -73,7 +73,7 @@
data-ng-include="'result.html'">
-
@@ -81,7 +81,7 @@
data-ng-include="'result.html'">
-
diff --git a/examples/demo/schema/lookup/lookup_schema.sql b/examples/demo/schema/lookup/lookup_schema.sql
index 4c65e186d7..10ef4d3d16 100644
--- a/examples/demo/schema/lookup/lookup_schema.sql
+++ b/examples/demo/schema/lookup/lookup_schema.sql
@@ -2,4 +2,4 @@ create table user_seq(id int, next_id bigint, cache bigint, primary key(id)) com
insert into user_seq(id, next_id, cache) values(0, 1, 3);
create table music_seq(id int, next_id bigint, cache bigint, primary key(id)) comment 'vitess_sequence';
insert into music_seq(id, next_id, cache) values(0, 1, 2);
-create table name_user_idx(name varchar(128), user_id binary(8), primary key(name, user_id));
+create table name_keyspace_idx(name varchar(128), keyspace_id binary(8), primary key(name, keyspace_id));
diff --git a/examples/demo/schema/lookup/vschema.json b/examples/demo/schema/lookup/vschema.json
index 19a150ff73..b65f1f337c 100644
--- a/examples/demo/schema/lookup/vschema.json
+++ b/examples/demo/schema/lookup/vschema.json
@@ -7,6 +7,6 @@
"music_seq": {
"type": "sequence"
},
- "name_user_idx": {}
+ "name_keyspace_idx": {}
}
}
diff --git a/examples/demo/schema/user/user_schema.sql b/examples/demo/schema/user/user_schema.sql
index 1df9edd702..08c79a9f73 100644
--- a/examples/demo/schema/user/user_schema.sql
+++ b/examples/demo/schema/user/user_schema.sql
@@ -3,4 +3,4 @@ create table user_extra(user_id bigint, extra varchar(128), primary key(user_id)
create table music(user_id bigint, music_id bigint, primary key(user_id, music_id));
create table music_extra(music_id bigint, keyspace_id bigint unsigned, primary key(music_id));
create table name_info(name varchar(128), info varchar(128), primary key(name));
-create table music_user_idx(music_id bigint not null auto_increment, user_id binary(8), primary key(music_id));
+create table music_keyspace_idx(music_id bigint not null auto_increment, keyspace_id binary(8), primary key(music_id));
diff --git a/examples/demo/schema/user/vschema.json b/examples/demo/schema/user/vschema.json
index 7ae10ac63f..0cf0f42e6d 100644
--- a/examples/demo/schema/user/vschema.json
+++ b/examples/demo/schema/user/vschema.json
@@ -7,21 +7,21 @@
"unicode_loose_md5": {
"type": "unicode_loose_md5"
},
- "name_user_idx": {
+ "name_keyspace_idx": {
"type": "lookup",
"params": {
- "table": "name_user_idx",
+ "table": "name_keyspace_idx",
"from": "name",
- "to": "user_id"
+ "to": "keyspace_id"
},
"owner": "user"
},
- "music_user_idx": {
+ "music_keyspace_idx": {
"type": "lookup_unique",
"params": {
- "table": "music_user_idx",
+ "table": "music_keyspace_idx",
"from": "music_id",
- "to": "user_id"
+ "to": "keyspace_id"
},
"owner": "music"
},
@@ -38,7 +38,7 @@
},
{
"column": "name",
- "name": "name_user_idx"
+ "name": "name_keyspace_idx"
}
],
"auto_increment": {
@@ -62,7 +62,7 @@
},
{
"column": "music_id",
- "name": "music_user_idx"
+ "name": "music_keyspace_idx"
}
],
"auto_increment": {
@@ -74,7 +74,7 @@
"column_vindexes": [
{
"column": "music_id",
- "name": "music_user_idx"
+ "name": "music_keyspace_idx"
},
{
"column": "keyspace_id",
@@ -90,7 +90,7 @@
}
]
},
- "music_user_idx": {
+ "music_keyspace_idx": {
"column_vindexes": [
{
"column": "music_id",
diff --git a/go/vt/vtgate/vindexes/lookup_hash.go b/go/vt/vtgate/vindexes/lookup_hash.go
index 90ad720ec7..d05fb17674 100644
--- a/go/vt/vtgate/vindexes/lookup_hash.go
+++ b/go/vt/vtgate/vindexes/lookup_hash.go
@@ -37,10 +37,10 @@ func init() {
}
//====================================================================
-// Warning: This Vindex is being depcreated in favor of Lookup
// LookupHash defines a vindex that uses a lookup table.
// The table is expected to define the id column as unique. It's
// NonUnique and a Lookup.
+// Warning: This Vindex is being depcreated in favor of Lookup
type LookupHash struct {
name string
lkp lookupInternal
@@ -134,10 +134,10 @@ func unhashList(ksids [][]byte) ([]sqltypes.Value, error) {
//====================================================================
-// Warning: This Vindex is being depcreated in favor of LookupUnique
// LookupHashUnique defines a vindex that uses a lookup table.
// The table is expected to define the id column as unique. It's
// Unique and a Lookup.
+// Warning: This Vindex is being depcreated in favor of LookupUnique
type LookupHashUnique struct {
name string
lkp lookupInternal