【发布时间】:2020-09-26 02:35:14
【问题描述】:
我正在寻找一种基于数据流作业中的当前时间进行过滤的方法。
我有以下代码要从 bigtable 读取,但我找不到生成动态扫描器或可调用函数或 lamda 的方法,以便能够将日期作为搜索参数传递。
RowFilter filter = RowFilter.newBuilder().setRowKeyRegexFilter(ByteString.copyFromUtf8("2020-06-05#.*#")).build();
PCollection<ObjectDto> collection = pipeline.apply("Read",
BigtableIO.read()
.withBigtableOptions(optionsBuilder)
.withTableId("table")
.withRowFilter(filter));
我需要这样的东西
PCollection<ObjectDto> collection = pipeline.apply("Read",
BigtableIO.read()
.withBigtableOptions(optionsBuilder)
.withTableId("table")
.withRowFilter(RowFilter.newBuilder().setRowKeyRegexFilter(
new SerializableFunction(){
Date d = new Date();
return DateFormat.getDate(d) + "#.*#"+DateFormat.getTime(d);
}
));
【问题讨论】:
标签: google-cloud-platform google-cloud-dataflow google-cloud-bigtable apache-beam-io