我正在尝试构建分区的大查询表,以前它是使用时间分区类型DAY构建的,但我想将它更改为week,我只是将Day更改为WEEEk,但得到了编译错误:
cannot find symbol
symbol: variable WEEk
location: class com.google.cloud.bigquery.TimePartitioning.Type所用的守则:
TimePartitioning.newBuilder(TimePartitioning.Type.DAY)
.setField("partition_year_month_day") // name of the column used for partitioning
.build();
StandardTableDefinition tableDefinition = StandardTableDefinition.newBuilder()
.setSchema(schema)
.setTimePartitioning(partitioning)
.build();
TableInfo tableInfo = TableInfo.of(tableId, tableDefinition);
bigquery.create(tableInfo);知道怎么把它按周划分吗?我知道可以根据这个链接将类型设置为月份、小时:https://googleapis.dev/python/bigquery/latest/generated/google.cloud.bigquery.table.TimePartitioning.html,但是有办法将分区划分为周吗?更新:我尝试按月进行分区,并得到了相同的错误:
cannot find symbol
[ERROR] symbol: variable MONTH
[ERROR] location: class com.google.cloud.bigquery.TimePartitioning.Type发布于 2022-03-17 10:52:45
目前不支持每周。根据关于TimePartitioning类型的正式java文档
受支持的类型是日、小时、月和年,这将分别生成一个分区(每天、小时、月份和年份)。未指定间隔时,默认行为为“天”。
另外,bigquery库的版本是什么?最新版本只支持月老版本(<= v1.117.3)日/小时。
注意事项:您可以在官方的github项目页面上检查bigquery库的TimePartitioning.java的当前代码。
正如注释中提到的,在google官方页面上有一个很好的代码示例来创建一个分区表。请查看有关创建时间单位列分区表的页面。另外,分区表的另一种选择是sharded tables,但我认为它不如分区与切分上记录的分区表那么理想。
https://stackoverflow.com/questions/71494288
复制相似问题