Skip to content

range_calendar / date filters cannot filter a TIMESTAMP column on BigQuery (DATE vs TIMESTAMP) #3333

Description

@saghatelian

Summary

On BigQuery, a date filter pointed at a TIMESTAMP column fails at query time. Evidence emits a DATE literal, and BigQuery does not implicitly coerce DATE to TIMESTAMP in a comparison.

Environment

  • Evidence CLI v0.9.3 (latest)
  • BigQuery direct connector

Steps to reproduce

Given a table whose time column is TIMESTAMP (start_time):

{% range_calendar id="dates" value_column="start_time" default_range="last 7 days" /%}

{% pie_chart data="my_table" category="some_column" value="count(*)" filters=["dates"] /%}

Actual

Every component bound to that filter renders an error instead of a chart:

No matching signature for operator >= for argument types: TIMESTAMP, DATE
Signature: T1 >= T1
Unable to find common supertype for templated argument <T1>
  Input types for <T1>: {DATE, TIMESTAMP} at [18:9]

Expected

The filter should work against a TIMESTAMP column — either by casting the column (DATE(col) >= DATE '…') or by emitting a TIMESTAMP literal.

Workaround

Cast in the query and point value_column at the cast column:

select date(start_time) as start_date, ...
from my_dataset.my_table
{% range_calendar id="dates" value_column="start_date" default_range="last 7 days" /%}

Impact

Medium. There is a clean workaround, but the failure mode is confusing: the calendar and every dependent component break at once, and the error surfaces as a SQL type error with no hint that it originates in the date filter. TIMESTAMP is the natural type for event time columns in BigQuery, so this is likely to hit most BigQuery users.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions