bigquery-emulator icon indicating copy to clipboard operation
bigquery-emulator copied to clipboard

CREATE TABLE with PARTITION BY is unsupported

Open oleksii-karpukhin-w3w opened this issue 2 years ago • 5 comments

Any attempt to create a table with a partition column[s] specified produces this error. For example: CREATE TABLE test_events_date (ID date) PARTITION BY ID

Result:

BigQuery error in query operation: Error processing job 'test:bqjob_r3d26e65599bb2335_000001867f166412_1': failed to analyze: INVALID_ARGUMENT: CREATE TABLE with PARTITION BY is unsupported [at 1:41]

PS: used docker image ghcr.io/goccy/bigquery-emulator:0.2.13

oleksii-karpukhin-w3w avatar Feb 23 '23 16:02 oleksii-karpukhin-w3w

It seems that any feature related to PARTITIONED TABLES has issues, such as the _PARTITIONTIME pseudo column.

leonasdev avatar May 05 '23 07:05 leonasdev

Encounter something similar googleapi: Error 400: failed to analyze: INVALID_ARGUMENT: Unrecognized name: _PARTITIONTIME [at 44:23], jobInternalError

Shuanglu avatar Oct 19 '23 00:10 Shuanglu

The same is true for me. Are there any updates on this issue ?

prismec avatar Dec 19 '23 14:12 prismec

At the moment, I can create a partitioned table using the client libraries. At least, I won't get an error (what already helps in tests and local emulation!). The emulator, however, accepts queries that would not work with BigQuery for the schema.

Here's an example. Given the following table definition

{
    "type": "TABLE",
    "schema": {
      "fields": [
        {
          "mode": "REQUIRED",
          "name": "value",
          "type": "DATE"
        }
      ]
    },
    "timePartitioning": {
      "field": "value",
      "type": "DAY",
      "expirationMs": 315569260000,
      "requirePartitionFilter": true
    }
  }

BigQuery would reject a query that does not contain the value field within its' WHERE clause, where the emulator accepts such a query.

I guess it is a lot of work to support all the partitioning features of BigQuery, but I could imagine that it's easier to check if the query is valid according to requirePartitionFilter fields of the schema. This would at least help to ensure that queries are well formed. Would this be a first step into the direction of better partitioning support ?

prismec avatar Dec 19 '23 14:12 prismec

Are there any updates on this topic ?

prismec avatar Mar 05 '24 12:03 prismec