Skip to content

Distinct Value Cache error when using WHERE clause #26318

@hiltontj

Description

@hiltontj

Problem

A user reported getting an error in response to a query to the distinct_cache when a WHERE clause was provided.

Here is the error:

Query command failed: server responded with error [500 Internal Server Error]: query error: error while planning query: Arrow error: Invalid argument error: all columns in a record batch must have the same length

Here is the query:

select t2 from distinct_cache('home18', 'home18_cache')  where t1 = 'BB'

Steps to reproduce

The following CSV data was written to the database:

cat /path/to/sample2.csv

t1,t2,t3,f1,f2,time
AA,"(1, 2]",None,-0.0621216848940003,160.75626873391323,2025-01-01 17:00:00-05:00
BB,"(0, 1]","(2.0, 4.0]",0.0183506941911869,60.72371267622072,2025-01-01 17:00:00-05:00

Querying this data results in:

influxdb3 query --database influx_poc --token foo "select * from home18"

+---------------------+--------------------+----+--------+------------+---------------------+
| f1                  | f2                 | t1 | t2     | t3         | time                |
+---------------------+--------------------+----+--------+------------+---------------------+
| -0.0621216848940003 | 160.75626873391323 | AA | (1, 2] | None       | 2025-01-01T22:00:00 |
| 0.0183506941911869  | 60.72371267622072  | BB | (0, 1] | (2.0, 4.0] | 2025-01-01T22:00:00 |
+---------------------+--------------------+----+--------+------------+---------------------+

The create a distinct cache:

influxdb3 create distinct_cache --database influx_poc --table home18 --columns t1,t2,t3 --token foo home18_cache --max-age 1y

Querying without a WHERE clause succeeds:

influxdb3 query --database influx_poc --token foo "select * from distinct_cache('home18', 'home18_cache')"

+----+--------+------------+
| t1 | t2     | t3         |
+----+--------+------------+
| AA | (1, 2] | None       |
| BB | (0, 1] | (2.0, 4.0] |
+----+--------+------------+

Querying with WHERE clause produces the above error.

Additional context

See slack thread.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions