cqlsh で、次のレコードを挿入しようとしています。
INSERT INTO data
(order_id,order_ts,transaction_id,transaction_discount,transaction_qty,
transaction_total,
product_category,product_profit,product_upc,product_name,product_price,
product_distributor,
store_id,store_name,store_state,store_region,id)
values ('YBC8RWE18',1368438171000,'LQKLVVI4E', 0, 1, 140.72,
'Office Supplies', 12.42,
'YT8899H3357', 'Casio USB Model FX-9860GII', 140.72, 'QR0', '2YOYWMR28Q',
'BigLots', 'AZ',
'Southwest', 2259a88e-b62d-4625-a86e-b86d77418a34 );
問題ないように見えますが、番号の例外が発生しています:
Caused by: java.lang.NumberFormatException: Zero length BigInteger
at java.math.BigInteger.<init>(BigInteger.java:190)
at org.apache.cassandra.serializers.DecimalSerializer.deserialize(DecimalSerializer.java:41)
at org.apache.cassandra.serializers.DecimalSerializer.deserialize(DecimalSerializer.java:26)
at org.apache.cassandra.db.marshal.AbstractType.compose(AbstractType.java:142)
at org.apache.cassandra.db.marshal.DecimalType.compare(DecimalType.java:46)
DecimalSerializer.deserialize
本当の問題はここにあるようです。小数を引用符で囲もうとすると(一見の価値があると思いました)、次のようになります。
Bad Request: Invalid STRING constant (140.72) for product_price of type decimal
それで、それは助けにはなりませんでした。小数を挿入するにはどうすればよいですか? COLUMNFAMILY の定義を投稿する必要がありますか?
DESCRIBE テーブルは次のとおりです。
CREATE TABLE data (
id uuid,
order_id text,
order_ts timestamp,
product_category text,
product_distributor text,
product_name text,
product_price decimal,
product_profit decimal,
product_upc text,
store_id text,
store_name text,
store_region text,
store_state text,
transaction_discount decimal,
transaction_id text,
transaction_qty int,
transaction_total decimal,
PRIMARY KEY (id)
)
140.72 付近の引用符を外すRequest did not complete within rpc_timeout.
と、ログにdeserialize
エラーが表示されます。いくつかの列を挿入するだけなら問題ありませんが、product_price フィールドを挿入するまでは問題ありません。