ConfigurationException:列 above_size 的无效类型 int:不能在同一 table 中混合计数器和非计数器列

ConfigurationException: Invalid type int for column above_size: Cannot mix counter and non counter columns in the same table

为什么我在创建 table 时收到此错误消息?

items_by_name
    item_id uuid
    user_id uuid
    name TEXT
    image VARCHAR
    desc TEXT
    price DECIMAL
    category TEXT
    trouser_size INT
    shoe_size INT
    above_size INT
    color TEXT,
    liked_user_id INT,
    like_count counter,
    PRIMARY KEY (name, item_id)

................................ .................................. ................................... ..................................... .....................

带有计数器的表在 Cassandra 中进行了特殊处理,因此,您可能将非计数器类型仅作为主键的一部分,而不是作为常规列。来自 documentation:

A table that contains a counter can only contain counters. In other words, either all the columns of a table outside the PRIMARY KEY have the counter type, or none of them have it.

还有其他限制 - 请参阅文档。

在您的情况下,您需要有两张表 - 一张用于计数器,一张用于非计数器类型。只需对两个表使用相同的主键即可。