Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when running a query in Metabase "No Matching Signature for Operator >= for Argument Types: TIMESTAMP, DATE" #8993

Open
itestyoy opened this issue Nov 26, 2024 · 0 comments
Labels
api:sql Issues related to SQL API

Comments

@itestyoy
Copy link

itestyoy commented Nov 26, 2024

Hi!

We encountered an issue when running a query in Metabase. The query fails due to a type mismatch between TIMESTAMP and DATE.

Example Metabase Query:

SELECT
  CAST("public"."cube_1"."activity_date" AS date) AS "activity_date",
  SUM("public"."cube_1"."metric_revenue") AS "sum"
FROM
  "public"."cube_1"
WHERE
  "public"."cube_1"."activity_date" >= CAST((NOW() + INTERVAL '-30 day') AS date)
  AND "public"."cube_1"."activity_date" < CAST(NOW() AS date)
GROUP BY
  CAST("public"."cube_1"."activity_date" AS date)
ORDER BY
  CAST("public"."cube_1"."activity_date" AS date) ASC;

Error:

ERROR: Arrow error: Compute error: Error: No matching signature for operator >= for argument types: TIMESTAMP, DATE. Supported signature: ANY >= ANY at [6:65]

Query Generated by Cube:

SELECT `cast_cube_1` `activity_date`, `sum_cube_1` `sum` 
FROM (
  SELECT       
    CAST(DATETIME(TIMESTAMP(date), 'UTC') AS DATE) `cast_cube_1`, 
    sum(`cube_1`.revenue) `sum_cube_1`     
  FROM bi.table AS `cube_1`  
  WHERE (((TIMESTAMP(date) >= DATE('2024-10-27')) AND (TIMESTAMP(date) < DATE('2024-11-26')))) 
  GROUP BY 1
) AS `cube_1`
ORDER BY `cast_cube_1` ASC NULLS LAST 
LIMIT 50000;

Model:

cube(`cube_1`, {
  sql_table: `bi.table`,

  data_source: `default`,

  dimensions: {
    activity_date: {
      sql: `TIMESTAMP(date)`,
      type: `time`,
    },

  },

  measures: {

    metric_revenue: {
      sql: `revenue`,
      type: `sum`
    },
  },
});

Cube Version: v1.1.5
Metabase Version: v0.50.30
Database: BigQuery

@itestyoy itestyoy added the api:sql Issues related to SQL API label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:sql Issues related to SQL API
Projects
None yet
Development

No branches or pull requests

1 participant