使用CQL fromJson函数时的JSON格式是什么?

时间:2015-12-21 23:31:19

标签: json cassandra cql

我正在使用Cassandra的CQL fromJson函数,并有以下插入内容:

INSERT INTO promotions.promotion (id, siteid, clientid, type, name, code, description, created, 
duestart, dueend, status, resolution, typespec, currencies
) 
VALUES (
    uuid(), 100000, 100000, 'FS', 'One', 'ONE', 'One description', 
    dateof(now()), dateof(now()), dateof(now()), 'WAITING', 'UNRESOLVED', { 'spins':'10' },
    fromJson('{
        "currencyId" : "123",
        "currencyCode" : "GBP",
        "currencyGames" : [{
            "gameConfigId" : 123,
            "typeSpec" : { "numSpins" : 10, "dummy" : "yes" }
        }]           
    }')
);

当我在DevCenter或cqlsh中运行时,我收到以下错误:

enter image description here

我是Cassandra的初学者,我只是在学习它的潜力,但这让我很难过。我尝试过不同的括号组合,但无济于事。我必须做些蠢事。

架构如下:

CREATE TYPE promotions.promotion_currency_game (
    gameConfigId bigint,
    typeSpec MAP<text,text>
);

CREATE TYPE promotions.promotion_currency (
    currencyId bigint,
    currencyCode text,
    currencyGames set<FROZEN<promotion_currency_game>>
);

CREATE TABLE promotions.promotion (
    id uuid,
    siteid bigint,
    clientid bigint,
    type text,
    name text,
    code text,
    description text,
    created timestamp,
    duestart timestamp,
    dueend timestamp,
    status text,
    resolution text,
    typespec MAP<text,text>,
    currencies SET<FROZEN<promotion_currency>>, 
    PRIMARY KEY (id)
) WITH compression = {
    'class' : 'LZ4Compressor',
    'enabled' : true
};

0 个答案:

没有答案