Hi all,
happy new year, just hoping it will be better than 2020 …
I’m still running crate 2.3.11 (I know, it’s old) and I’ve just stumbled on a weird behavior : When I’m setting an object’s property which is a Float to a specific value, it’s rounded. If I insert it into a different property name, then it’s not rounded anymore.
The weird thing is that both properties have the same underlying type (as shown by "
show create table
).
CREATE TABLE IF NOT EXISTS "sc"."indicators" (
"date_created" TIMESTAMP,
"date_processed" TIMESTAMP,
"id" STRING,
"index1_monthly" FLOAT,
"indicator_source_id" INTEGER NOT NULL,
"indicators" OBJECT (DYNAMIC) AS (
"battery" FLOAT,
"battery_low" LONG,
"battery_state" LONG,
"cfg_switch_error" LONG,
"co2level" FLOAT,
"co2level_invalid" LONG,
"co2level_max" FLOAT,
"co2level_mean" FLOAT,
"conf_done" LONG,
"conf_err_state" LONG,
"contact_state" FLOAT,
"disposable" FLOAT,
"distance" FLOAT,
"distance_low_alert_end" LONG,
"distance_low_alert_start" LONG,
"frameCounter" LONG,
"humidity" FLOAT,
"humidity_invalid" LONG,
"hw_error" LONG,
"index" FLOAT,
"index1" FLOAT,
"index1_daily" FLOAT,
"index1_hourly" FLOAT,
"index1_live" FLOAT,
"index1_monthly" FLOAT,
"index1_raw" LONG,
"index1_type" LONG,
"index2" FLOAT,
"index2_daily" FLOAT,
"index2_hourly" FLOAT,
"index2_live" FLOAT,
"index2_monthly" FLOAT,
"index2_type" LONG,
"index3" FLOAT,
"index4" FLOAT,
"index5" FLOAT,
"index_daily" FLOAT,
"index_hourly" FLOAT,
"index_live" FLOAT,
"index_monthly" FLOAT,
"izair_src" LONG,
"iziair" LONG,
"low_battery" LONG,
"luminosity" LONG,
"max_flow1" FLOAT,
"max_flow2" FLOAT,
"min_flow1" FLOAT,
"min_flow2" FLOAT,
"motion_count" LONG,
"parking_state" LONG,
"peak_sound_level" FLOAT,
"pressure" FLOAT,
"raw_index" FLOAT,
"raw_index1" LONG,
"raw_index2" LONG,
"raw_max_flow1" FLOAT,
"raw_max_flow2" FLOAT,
"raw_min_flow1" FLOAT,
"raw_min_flow2" FLOAT,
"sensor_reset_cause" LONG,
"sn" LONG,
"snr" LONG,
"sound_level" FLOAT,
"temperature" FLOAT,
"temperature_ext" FLOAT,
"temperature_high_alert_end" LONG,
"temperature_high_alert_start" FLOAT,
"temperature_int" FLOAT,
"temperature_invalid" LONG,
"temperature_low_alert_end" FLOAT,
"temperature_low_alert_start" LONG,
"temperature_max" FLOAT,
"temperature_mean" FLOAT,
"triggered" LONG,
"usb_off" LONG,
"user_triggered" LONG,
"voclevel" FLOAT,
"voltage" FLOAT,
"voltage_idle" FLOAT,
"wirecut" LONG
),
"message_id" STRING,
"month" TIMESTAMP GENERATED ALWAYS AS date_trunc('month', "date_created"),
"sensor_id" STRING,
PRIMARY KEY ("id", "month")
)
CLUSTERED INTO 4 SHARDS
PARTITIONED BY ("month");
Then if I perform the following insert :
For example : If I insert my raw (properties index1, index2, index3 having already been created before for other raws, index4 being a “new” property):
insert into sc.indicators (date_created, date_processed, id, indicator_source_id ,indicators, message_id, sensor_id) values (1610176002521, 1610370232881, 'test-id, 0, {“index1”=28670.1892"index2"=28670.1892,“index3”=28670.1892,“index4”=28670.1892,“index_live”=0,“raw_index”=28670188}, ‘msg-test’, ‘s-test’);
index1, index2, index3 will have the value 28670.19 while index4 will have the value 28670.1892
Now if I delete the raw and create it again, index4 will have the value 28670.19.
From now on, for every raw, the property “index4” will also be truncated like the others … The value is correct only for the first insert, after it’s truncated !
Any hints ? known bug ?
Thanks