-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the bug
I have a string measure (it's supported https://cube.dev/docs/reference/data-model/types-and-formats#string) in my schema and I'm trying to run a query which contains a filter by this measure ("equals" operator). Cubejs returns following error message:
Query failed: Error: Cannot parse string 'device_A' as Float64: syntax error at begin of string. Note: there are toFloat64OrZero and toFloat64OrNull functions, which returns zero/NULL instead of throwing exception.: While processing argMax(device_name, max_timestamp) = toFloat64('device_A'). ; query id: d9ca2185-8df2-4638-8470-7b919d33bd5b
Query I'm running:
{
"dimensions": [
"Cube.id"
],
"measures": [
"Cube.latest_device_name"
],
"filters": [
{
"member": "Cube.latest_device_name",
"operator": "equals",
"values": [
"device_A"
]
}
]
}
Noticed also that "operator": "contains" works as expected.
Expected behavior
Filter by string measure works.
Minimally reproducible Cube Schema
cube(`Cube`, {
measures: {
latest_device_name: {
sql: `argMax(device_name, timestamp)`,
type: `string`
},
},
dimensions: {
device_name: {
sql: `device_name`,
type: `string`
},
id: {
sql: `id`,
type: `string`
},
timestamp: {
sql: `timestamp`,
type: `time`
}
}
});Version:
[e.g. 1.3.16]
Additional context
Previosly I had a similar issue with time measures and it has been fixed: #9435
