In cqlsh I'm trying to insert a record with:
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 );
Looks fine, but I'm getting a number exception:
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)
Looks like DecimalSerializer.deserialize
is the real issue here. If I try to surround the decimals in quotes (worth a shot, I thought) I get:
Bad Request: Invalid STRING constant (140.72) for product_price of type decimal
So that didn't help. What do I need to do to insert a decimal? Should I post up the COLUMNFAMILY def?
Here's the DESCRIBE TABLE:
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)
)
If I take off the quotes around 140.72 I get: Request did not complete within rpc_timeout.
and the logs show the deserialize
error. If I try to just insert a few columns it's fine -- until I try to insert the product_price field.