Class BeamTableUtils
- java.lang.Object
-
- org.apache.beam.sdk.extensions.sql.impl.schema.BeamTableUtils
-
public final class BeamTableUtils extends java.lang.ObjectUtility methods for working withBeamTable.TODO: Does not yet support nested types.
-
-
Constructor Summary
Constructors Constructor Description BeamTableUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectautoCastField(org.apache.beam.sdk.schemas.Schema.Field field, @Nullable java.lang.Object rawObj)Attempt to cast an object to a specified Schema.Field.Type.static java.lang.StringbeamRow2CsvLine(org.apache.beam.sdk.values.Row row, org.apache.commons.csv.CSVFormat csvFormat)static java.lang.Iterable<org.apache.beam.sdk.values.Row>csvLines2BeamRows(org.apache.commons.csv.CSVFormat csvFormat, java.lang.String line, org.apache.beam.sdk.schemas.Schema schema)Decode zero or more CSV records from the given string, according to the specifiedCSVFormat, and converts them toRowswith the specifiedSchema.
-
-
-
Method Detail
-
csvLines2BeamRows
public static java.lang.Iterable<org.apache.beam.sdk.values.Row> csvLines2BeamRows(org.apache.commons.csv.CSVFormat csvFormat, java.lang.String line, org.apache.beam.sdk.schemas.Schema schema)Decode zero or more CSV records from the given string, according to the specifiedCSVFormat, and converts them toRowswith the specifiedSchema.A single "line" read from e.g.
TextIOcan have zero or more records, depending on whether the line was split on the same characters that delimite CSV records, and whether theCSVFormatignores blank lines.
-
beamRow2CsvLine
public static java.lang.String beamRow2CsvLine(org.apache.beam.sdk.values.Row row, org.apache.commons.csv.CSVFormat csvFormat)
-
autoCastField
public static java.lang.Object autoCastField(org.apache.beam.sdk.schemas.Schema.Field field, @Nullable java.lang.Object rawObj)Attempt to cast an object to a specified Schema.Field.Type.- Returns:
- The casted object in Schema.Field.Type.
- Throws:
java.lang.IllegalArgumentException- if the value cannot be cast to that type.
-
-