Skip to content

1st param of array_map cannot be a tuple #906

@Jasmine-ge

Description

@Jasmine-ge

Describe what's wrong

In latest timeplusd, you cannot run this SQL

 SELECT array_map((db, tbl, name) ->
        concat('{"schema":"', db, '"',
               ',"table":"', tbl, '"',
               ',"name":"', name, '"',
               ',"index_type":"",',
               '"cardinality":"",',
               '"size":"",',
               '"unique":"false"}'),
        group_array((idx.database, idx.table, idx.name))) AS indexes_metadata
    FROM system.data_skipping_indices AS idx

Error:
DB::ExceptionDB::Exception: First argument for this overload of array_map must be a function with 1 arguments, found Function((?, ?, ?) -> ?)

If we remove the array_map,

 SELECT 
        group_array((idx.database, idx.table, idx.name)) AS indexes_metadata
    FROM system.data_skipping_indices AS idx

This works
[(default,mysql_nation,_tp_time_index),(default,mysql_nation,_tp_sn_index),(system,license_validation_log,_tp_time_index),(system,license_validation_log,_tp_sn_index),(system,stream_metric_log,_tp_time_index),(system,stream_metric_log,_tp_sn_index),(system,stream_state_log,_tp_time_index),(system,stream_state_log,_tp_sn_index)]

So this is a limitation/bug in timeplusd that array_map cannot take a tuple as the single argument. From the log, it seems that AST treat this as a function

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions