Skip to content

Map type issues #40

@Deep1998

Description

@Deep1998

I was testing out the map type with the following configuration:

CREATE TABLE map_text_boolean_table (
 id INT64 NOT NULL,
 val JSON
) PRIMARY KEY(id);


CREATE TABLE map_text_text_table (
 id INT64 NOT NULL,
 val JSON
) PRIMARY KEY(id);


CREATE TABLE map_text_timestamp_table (
 id INT64 NOT NULL,
 val JSON
) PRIMARY KEY(id);


-- map_text_boolean_table
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence)
VALUES ('testkeyspace', 'map_text_boolean_table', 'id', 'int', TRUE, 1);
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence)
VALUES ('testkeyspace', 'map_text_boolean_table', 'val', 'map<text, boolean>', FALSE, 0);


-- map_text_text_table
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence)
VALUES ('testkeyspace', 'map_text_text_table', 'id', 'int', TRUE, 1);
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence)
VALUES ('testkeyspace', 'map_text_text_table', 'val', 'map<text, text>', FALSE, 0);


-- map_text_timestamp_table
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence)
VALUES ('testkeyspace', 'map_text_timestamp_table', 'id', 'int', TRUE, 1);
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence)
VALUES ('testkeyspace', 'map_text_timestamp_table', 'val', 'map<text, timestamp>', FALSE, 0);


I ran into the following issues:

map<text, boolean> : corrupted value

cqlsh:testkeyspace> INSERT INTO map_text_boolean_table (id, val) VALUES (1, {'key1': TRUE, 'key2': FALSE});
cqlsh:testkeyspace>  SELECT * FROM map_text_boolean_table;

 id | val
----+-----------------
  1 | {'key1': False}

(1 rows)

map<text, text> : read failure, spanner val seems corrupted {"key1":"value1,key2:value2"}

cqlsh:testkeyspace> INSERT INTO map_text_text_table (id, val) VALUES (1, {'key1': 'value1', 'key2': 'value2'});
cqlsh:testkeyspace> select * from map_text_text_table;
InvalidRequest: Error from server: code=2200 [Invalid query] message="error while encoding data - error deserializing JSON to map[string]string: invalid character '<' looking for beginning of value, 1, {fields: [name:"id"  type:{code:INT64} name:"val"  type:{code:JSON}], values: [string_value:"2" null_value:NULL_VALUE]} "

map<text, timestamp> : read failure, spanner val seems correct {"key1":"2025-02-06T10:00:00Z"}

INSERT INTO map_text_timestamp_table (id, val) VALUES (1, {'key1': '2025-02-06T10:00:00Z'});
cqlsh:testkeyspace> SELECT * FROM map_text_timestamp_table;
InvalidRequest: Error from server: code=2200 [Invalid query] message="error while encoding data - error deserializing JSON to map[string]time.Time: invalid character '<' looking for beginning of value, 1, {fields: [name:"id"  type:{code:INT64} name:"val"  type:{code:JSON}], values: [string_value:"2" null_value:NULL_VALUE]} "

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions