BigQuery API Java客户端库不支持;JobConfigurationLoad.decimalTargetTypes“;?
我在将数据从Oracle数据库加载到GCP BigQuery时遇到了一个问题,数据是通过Avro格式传输的。 Oracle表中有很多列是BigQuery API Java客户端库不支持;JobConfigurationLoad.decimalTargetTypes“;?,java,google-cloud-platform,google-bigquery,apache-nifi,Java,Google Cloud Platform,Google Bigquery,Apache Nifi,我在将数据从Oracle数据库加载到GCP BigQuery时遇到了一个问题,数据是通过Avro格式传输的。 Oracle表中有很多列是number(38,10)数据类型,根据,我应该使用bignumeric数据类型来存储此类列 然后我在中看到了下面的描述,认为这应该是解决我问题的解决方案 对于使用jobs.insert API的加载作业:使用 JobConfigurationLoad.decimalTargetTypes字段 我检查了,它确实包含配置,但是我们的应用程序通过ApacheNIFI
number(38,10)
数据类型,根据,我应该使用bignumeric
数据类型来存储此类列
然后我在中看到了下面的描述,认为这应该是解决我问题的解决方案
对于使用jobs.insert API的加载作业:使用
JobConfigurationLoad.decimalTargetTypes字段
我检查了,它确实包含配置,但是我们的应用程序通过ApacheNIFI加载数据,后者通过BigQueryAPI Java客户端库加载数据,所以问题来了
我在Java客户端库中找不到任何设置decimalTargetTypes
列表的选项,无论是WriteChannelConfiguration
类还是JobConfigurationLoad
类,甚至是
我错过什么了吗?
如有任何意见和建议,将不胜感激
下面是apachenifiPutBigQueryBatch
处理器中的部分代码,该处理器导入bigqueryjava客户端库以与BigQuery交互
......
final WriteChannelConfiguration writeChannelConfiguration = WriteChannelConfiguration.newBuilder(tableId)
.setCreateDisposition(JobInfo.CreateDisposition.valueOf(context.getProperty(CREATE_DISPOSITION).getValue()))
.setWriteDisposition(JobInfo.WriteDisposition.valueOf(context.getProperty(WRITE_DISPOSITION).getValue()))
.setIgnoreUnknownValues(context.getProperty(IGNORE_UNKNOWN).evaluateAttributeExpressions(flowFile).asBoolean())
.setUseAvroLogicalTypes(context.getProperty(AVRO_USE_LOGICAL_TYPES).asBoolean())
.setMaxBadRecords(context.getProperty(MAXBAD_RECORDS).asInteger())
.setSchema(schema)
.setFormatOptions(formatOption)
.build();
try (TableDataWriteChannel writer = getCloudService().writer(writeChannelConfiguration)) {
session.read(flowFile, rawIn -> {
ReadableByteChannel readableByteChannel = Channels.newChannel(rawIn);
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(BUFFER_SIZE);
while (readableByteChannel.read(byteBuffer) >= 0) {
byteBuffer.flip();
writer.write(byteBuffer);
byteBuffer.clear();
}
});
// writer must be closed to get the job
writer.close();
Job job = writer.getJob();
Long timePeriod = context.getProperty(READ_TIMEOUT).evaluateAttributeExpressions(flowFile).asTimePeriod(TimeUnit.SECONDS);
Duration waitFor = Duration.of(timePeriod, ChronoUnit.SECONDS);
job = job.waitFor(RetryOption.totalTimeout(waitFor));
......
您好,您是否可以使用其他库来实现此功能?我在中找到了您需要的参数。看看它的特点。