trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.32k stars 2.97k forks source link

Redis tableName should be case-sensitive #3999

Open dekelev opened 4 years ago

dekelev commented 4 years ago

When configuring Redis tableName option, upper-case chars are automatically treated as lower-case, so only lower-case keys are found when querying the table.

For example, I have 2 keys in Redis:

  1. Test:1 with value 1
  2. test:2 with value 2

redis/test.json

{
    "tableName": "Test",
    "schemaName": "default",
    "key": {
        "dataFormat": "raw",
        "fields": [
            {
                "name": "id",
                "mapping": "5",
                "type": "VARCHAR"
            }
        ]
    },
    "value": {
        "dataFormat": "raw",
        "fields": [
            {
                "name": "col",
                "type": "VARCHAR"
            }
        ]
    }
}

redis.properties

connector.name=redis
redis.table-names=Test
redis.database-index=0
redis.nodes=localhost:6379
redis.key-prefix-schema-table=true

Query

SELECT * FROM redis.default.test;

Problem: Only the second (lower-case) key will be returned.

Presto v334 Redis v4.0.11

findepi commented 4 years ago

Currently, all schema, table and column names in Presto are always lowercase. We are working on getting this right under https://github.com/prestosql/presto/issues/17. Before that is completed, there is unfortunately no way to access redis "tables" that differ in case only.

If the name is not in lower-case, and an all-lower-case name does not exist, it is still possible to do a match, and we do so in a bunch of connectors (probably not in Redis).