【问题标题】:Cassandra Undefined name in where clauseCassandra 在 where 子句中未定义名称
【发布时间】:2017-08-12 02:03:49
【问题描述】:

我正在执行以下命令查询 cassandra 表: select * from oap.purchase_events where clientNumber = '100'

该表包含一行 clientNumber 100 ,但是我收到此错误:

InvalidRequest: code=2200 [Invalid query] message="Undefined name clientnumber in where 子句 ('clientnumber = 100')"

表定义:

    CREATE TABLE oap.purchase_events (
    "parentId" text,
    "childId" text,
    "clientNumber" text,
    cost double,
    description text,
    "eventDate" timestamp,
    "logDate" timestamp,
    message text,
    "operationalChannel" text,
    "productDuration" bigint,
    "productId" text,
    "transactionId" text,
    volume double,
    "volumeUnit" text,
    PRIMARY KEY ("parentId", "childId")
) WITH CLUSTERING ORDER BY ("childId" ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';
CREATE INDEX purchase_events_clientNumber_idx ON gestor.purchase_events ("clientNumber");

有什么帮助吗?

【问题讨论】:

    标签: cassandra nosql


    【解决方案1】:

    只需用双引号将 clientNumber 括起来

    例如:select * from purchase_events where "clientNumber" = '100';

    【讨论】:

    • @RafaelReyes 立即查看
    猜你喜欢
    • 2023-03-27
    • 2018-09-19
    • 2021-08-30
    • 1970-01-01
    • 2020-10-30
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多