BeamSql输出格式

时间:2018-03-14 06:49:05

标签: apache-beam

我的beamSql程序的输出以下面的格式写入存储在Google存储中的文件中:

BeamRecord [dataValues=[CPSPS02, 0, 1], dataType=BeamRecordSqlType [fieldNames=[SalesComponent, DuetoValue, ModelIteration], fieldTypes=[12, 12, 12]]]
BeamRecord [dataValues=[CPSPS02, 0, 1], dataType=BeamRecordSqlType [fieldNames=[SalesComponent, DuetoValue, ModelIteration], fieldTypes=[12, 12, 12]]] 
BeamRecord [dataValues=[CPSPS02, 0, 1], dataType=BeamRecordSqlType [fieldNames=[SalesComponent, DuetoValue, ModelIteration], fieldTypes=[12, 12, 12]]]
BeamRecord [dataValues=[CPSPS02, 0, 1], dataType=BeamRecordSqlType [fieldNames=[SalesComponent, DuetoValue, ModelIteration], fieldTypes=[12, 12, 12]]]

列名称为:SalesComponent,DuetoValue,ModelIteration,它们的值分别为CPSPS02,0,1。 是否有可能输出不应包含所有额外的字符串,如BeamRecord [dataValues = [,dataType = BeamRecordSqlType [fieldNames =?

1 个答案:

答案 0 :(得分:1)

  

输出是否可能不包含所有额外的字符串,如BeamRecord [dataValues = [,dataType = BeamRecordSqlType [fieldNames =?

如果您只想要列的值,您可以像这样访问它们:

String salesComponent = beamRecord.getString("SalesComponent");
Integer dueToValue = beamRecord.getInteger("DuetoValue");
Integer modelIteration = beamRecord.getInteger("ModelIteration");

在写入GCS之前,您必须修改转换步骤才能执行此操作。

参考:BeamRecord