You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1/ If I execute this as a prepared query, and supply {0, TimeStamp, 0} as the argument, it works.
2/ If I execute this as an ad-hoc query, and supply Timestamp as the argument, seestar_cqltypes:encode_value_with_size() encodes it as a 32-bit integer.
This fails with a Cassandra error message "Expected 8 or 0 byte long for date (4)", presumably because it's expecting a 64-bit value because it's a timestamp column.
3/ If I execute this as an ad-hoc query and supply <<TimeStamp:64/signed>> as the argument, it works.
So now, here's my question ...
Whilst I can use method (3) to do what I want ... is it worth considering whether a better solution is to support providing argument typing for ad-hoc queries?
(It might also be useful for prepared queries as well.)
One possibility is ... Instead of supplying arguments as Timestamp, they could also be supplied as {timestamp, Timestamp} where the first element is the argument type.
Another possibility is to supply (optional) typing in the query string ie.
SELECT COUNT(*) foo WHERE timestamp > %t
where %t means a timestamp argument, %s means a string argument etc.
Do you think this is a good idea, maybe for the long-term?
The text was updated successfully, but these errors were encountered:
Suppose I have a query like this:
and a variable
TimeStamp
.1/ If I execute this as a prepared query, and supply
{0, TimeStamp, 0}
as the argument, it works.2/ If I execute this as an ad-hoc query, and supply
Timestamp
as the argument, seestar_cqltypes:encode_value_with_size() encodes it as a 32-bit integer.This fails with a Cassandra error message "Expected 8 or 0 byte long for date (4)", presumably because it's expecting a 64-bit value because it's a timestamp column.
3/ If I execute this as an ad-hoc query and supply
<<TimeStamp:64/signed>>
as the argument, it works.So now, here's my question ...
Whilst I can use method (3) to do what I want ... is it worth considering whether a better solution is to support providing argument typing for ad-hoc queries?
(It might also be useful for prepared queries as well.)
One possibility is ... Instead of supplying arguments as
Timestamp
, they could also be supplied as{timestamp, Timestamp}
where the first element is the argument type.Another possibility is to supply (optional) typing in the query string ie.
where %t means a timestamp argument, %s means a string argument etc.
Do you think this is a good idea, maybe for the long-term?
The text was updated successfully, but these errors were encountered: