Class BeamTableUtils
java.lang.Object
org.apache.beam.sdk.extensions.sql.impl.schema.BeamTableUtils
Utility methods for working with
BeamTable
.
TODO: Does not yet support nested types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
autoCastField
(Schema.Field field, @Nullable Object rawObj) Attempt to cast an object to a specified Schema.Field.Type.static String
beamRow2CsvLine
(Row row, CSVFormat csvFormat) csvLines2BeamRows
(CSVFormat csvFormat, String line, Schema schema)
-
Constructor Details
-
BeamTableUtils
public BeamTableUtils()
-
-
Method Details
-
csvLines2BeamRows
Decode zero or more CSV records from the given string, according to the specifiedCSVFormat
, and converts them toRows
with the specifiedSchema
.A single "line" read from e.g.
TextIO
can have zero or more records, depending on whether the line was split on the same characters that delimite CSV records, and whether theCSVFormat
ignores blank lines. -
beamRow2CsvLine
-
autoCastField
Attempt to cast an object to a specified Schema.Field.Type.- Returns:
- The casted object in Schema.Field.Type.
- Throws:
IllegalArgumentException
- if the value cannot be cast to that type.
-