Skip to content

Add Support of non String Keys for Maps #55

@clun

Description

@clun

Core tenets:

  • Must be {} for empty maps
  • Always list-of-pairs if nonempty (language- and codec-options- dependent in general)
CREATE TABLE collectiontype.allmap (
  id text PRIMARY KEY,
  ascii_map map<ascii, ascii>,
  bigint_map map<bigint, bigint>,
  blob_map map<blob, blob>,
  boolean_map map<boolean, boolean>,
  date_map map<date, date>,
  decimal_map map<decimal, decimal>,
  double_map map<double, double>,
  duration_map map<text, duration>,
  float_map map<float, float>,
  inet_map map<inet, inet>,
  int_map map<int, int>,
  smallint_map map<smallint, smallint>,
  text_map map<text, text>,
  time_map map<time, time>,
  timestamp_map map<timestamp, timestamp>,
  tinyint_map map<tinyint, tinyint>,
  uuid_map map<uuid, uuid>,
  varint_map map<varint, varint>
)
  • Insert one with Tuple format
{
    "insertOne": {
        "document": {
            "id": "sample",
            "text_map": {
                "text key": "text value"
            },
            "ascii_map": {
                "ascii key": "ascii value"
            },
            "inet_map": {
                "192.168.1.1": "10.0.0.1"
            },
            
            "date_map": {
                "2025-01-01": "2026-01-01"
            },
            "duration_map": {
                "duration text key": "1h20m"
            },
            "time_map": {
                "12:00:00.000000000": "23:59:59.999999999"
            },
            "timestamp_map": {
                "2025-01-01T12:00:00.000Z": "2026-01-01T12:00:00.000Z"
            },
            "uuid_map": {
                "123e4567-e89b-12d3-a456-426614174000": "550e8400-e29b-41d4-a716-446655440000"
            },
            "tinyint_map": [
                [
                    5,
                    10
                ]
            ],
            "varint_map": [
                [
                    100000000,
                    200000000000
                ]
            ],
            "decimal_map": [
                [
                    1.23,
                    4.56
                ]
            ],
            "double_map": [
                [
                    1.1,
                    2.2
                ]
            ],
            "int_map": [
                [
                    42,
                    99
                ]
            ],
            "smallint_map": [
                [
                    12,
                    34
                ]
            ],
            "bigint_map": [
                [
                    1,
                    1
                ]
            ],
            "boolean_map": [
                [
                    true,
                    false
                ]
            ],
            "float_map": [
                [
                    3.14,
                    6.28
                ]
            ],
            "blob_map": [
                [
                    {
                        "$binary": "SGVsbG8gV29ybGQ="
                    },
                    {
                        "$binary": "SGVsbG8gV29ybGQ="
                    }
                ]
            ]
        }
    }
}
  • Insert One with all tuples
{
    "insertOne": {
        "document": {
            "id": "sample1",
            "text_map": [
                [
                    "text key",
                    "text value"
                ]
            ],
            "ascii_map": [
                [
                    "ascii key",
                    "ascii value"
                ]
            ],
            "inet_map": [
                [
                    "192.168.1.1",
                    "10.0.0.1"
                ]
            ],
            "date_map": [
                [
                    "2025-01-01",
                    "2026-01-01"
                ]
            ],
            "duration_map": [
                [
                    "duration text key",
                    "1h20m"
                ]
            ],
            "time_map": [
                [
                    "12:00:00.000000000",
                    "23:59:59.999999999"
                ]
            ],
            "timestamp_map": [
                [
                    "2025-01-01T12:00:00.000Z",
                    "2026-01-01T12:00:00.000Z"
                ]
            ],
            "uuid_map": [
                [
                    "123e4567-e89b-12d3-a456-426614174000",
                    "550e8400-e29b-41d4-a716-446655440000"
                ]
            ],
            "tinyint_map": [
                [
                    5,
                    10
                ]
            ],
            "varint_map": [
                [
                    100000000,
                    200000000000
                ]
            ],
            "decimal_map": [
                [
                    1.23,
                    4.56
                ]
            ],
            "double_map": [
                [
                    1.1,
                    2.2
                ]
            ],
            "int_map": [
                [
                    42,
                    99
                ]
            ],
            "smallint_map": [
                [
                    12,
                    34
                ]
            ],
            "bigint_map": [
                [
                    1,
                    1
                ]
            ],
            "boolean_map": [
                [
                    true,
                    false
                ]
            ],
            "float_map": [
                [
                    3.14,
                    6.28
                ]
            ],
            "blob_map": [
                [
                    {
                        "$binary": "SGVsbG8gV29ybGQ="
                    },
                    {
                        "$binary": "SGVsbG8gV29ybGQ="
                    }
                ]
            ]
        }
    }
}

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