Skip to content

Commit

Permalink
Add test for yearly partitioned table in BigQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr authored and martint committed Sep 25, 2020
1 parent 08695f9 commit 1fdad59
Showing 1 changed file with 14 additions and 0 deletions.
Expand Up @@ -73,6 +73,20 @@ public void testSelectFromHourlyPartitionedTable()
assertEquals((long) actualValues.getOnlyValue(), 1L);
}

@Test(enabled = false)
public void testSelectFromYearlyPartitionedTable()
{
BigQuery client = createBigQueryClient();

executeBigQuerySql(client, "DROP TABLE IF EXISTS test.yearly_partitioned");
executeBigQuerySql(client, "CREATE TABLE test.yearly_partitioned (value INT64, ts TIMESTAMP) PARTITION BY TIMESTAMP_TRUNC(ts, YEAR)");
executeBigQuerySql(client, "INSERT INTO test.yearly_partitioned (value, ts) VALUES (1000, '2018-01-01 10:00:00')");

MaterializedResult actualValues = computeActual("SELECT COUNT(1) FROM test.yearly_partitioned");

assertEquals((long) actualValues.getOnlyValue(), 1L);
}

private static void executeBigQuerySql(BigQuery bigquery, String query)
{
QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query)
Expand Down

0 comments on commit 1fdad59

Please sign in to comment.