doitintl/bigquery-grafana

Tables Partitioned by Field are Broken

bacheson opened this issue · 2 comments

Bug Report

I mentioned this in another somewhat related bug. I thought I'd create this here as it's a critical bug that's been ongoing for months now.

Expected Behavior

I should be able to query a field partitioned table using $__timeFilter.

Actual Behavior

The plugin automatically adds _PARTITIONTIME functions. This is only supported by tables partitioned by ingestion time, NOT tables partitioned on a date/time field.

results in the error:
Unrecognized name: _PARTITIONTIME

Steps to Reproduce the Problem

  1. Create table with a timestamp field
  2. Partition on the timestamp field (DO NOT partition by ingestion time)
  3. Query the table using $__timeFilter

Specifications

  • Version: 2.0.2
  • Platform: Linux
  • Grafana Version:8
hqm commented

This does not appear to be fixed, I installed 2.0.3 plugin and I still get this error

My query is getting incorrectly rewritten to include _PARTITIONTIME

SELECT timestamp_trunc(start_time, second) time ,
cast(ceiling(count(id)/15) as int) workers,
cast(ceiling(sum(case when person.in_front_of_press then 1 else 0 end)/15) as int) at_press
FROM leela-vision.factory1.vsrc_C16_6A
CROSS JOIN
UNNEST(objects) as person
where _PARTITIONTIME >= '2022-01-09 05:09:54' AND _PARTITIONTIME < '2022-01-09 11:09:54' AND
start_time between 1641704974 and 1641726574
AND person.class_name = 'person'
-- AND person.in_front_of_closed_press
GROUP BY time
order by time asc

Please update to v2.0.3 (Available on Grafana cloud) and let me know if it persist