clickhouse-grafana icon indicating copy to clipboard operation
clickhouse-grafana copied to clipboard

Corner case in AST parser affects toTimeSeries serialization

Open Slach opened this issue 1 year ago • 0 comments

Query Example

WITH
  /* splitByChar('(', user_metadata_map['rp_prescreenStep'])[1] as prescreen, */
  user_metadata_map['rocketStage'] AS stage,
  stage AS keys
SELECT
  (intDiv(toUInt32(_time), 3600) * 3600) * 1000 as t,
  keys,
  sum(alloc_cost) as cost
FROM default.test_barchart
WHERE
  cluster NOT LIKE '%-sleep'
  AND cluster NOT LIKE '%_test'
  AND hpcod_resource_name != 'INTERACTIVE'
GROUP BY keys, t
ORDER BY keys, t

root reason is

  /* splitByChar('(', user_metadata_map['rp_prescreenStep'])[1] as prescreen, */
                ^^^^ brackets here pass corner case to AST parser (!isClousered)

whole query parsed as one single WITH, miss parse SELECT, FROM, ORDER BY, GROUP BY this is not affect query execution pipeline but affect query result serialization to grafana timeSeries format, replacing ( to any other char, resolves issue

Slach avatar Oct 24 '24 13:10 Slach