Nagesh Singh Chauhan
Nagesh Singh Chauhan

Reputation: 784

BeamSql output format

The output of my beamSql program is getting written in a file stored in Google storage in below format :

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]]]

Column names are : SalesComponent, DuetoValue, ModelIteration and their values are CPSPS02, 0, 1 respectively. Is it possible that the output should not contain all the extra string like BeamRecord [dataValues=[ , dataType=BeamRecordSqlType [fieldNames= ?

Upvotes: 0

Views: 65

Answers (1)

Andrew Nguonly
Andrew Nguonly

Reputation: 2621

Is it possible that the output should not contain all the extra string like BeamRecord [dataValues=[ , dataType=BeamRecordSqlType [fieldNames= ?

Yes.

If you just want the values of the columns you can do access them like this:

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

You'll have to modify your transform step to do this before writing to GCS.

Reference: BeamRecord

Upvotes: 1

Related Questions