public final class CsvSchema extends Object implements TableSchema
Constructor and Description |
---|
CsvSchema(@NotNull ArrayList<FieldSchema> schema)
CsvReader uses AvroCSVReader to read records from
CSV. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
ArrayList<FieldSchema> |
getAlluxioSchema() |
org.apache.avro.Schema |
getReadSchema() |
org.apache.avro.Schema |
getWriteSchema() |
int |
hashCode() |
ParquetSchema |
toParquet() |
public CsvSchema(@NotNull @NotNull ArrayList<FieldSchema> schema) throws IOException
CsvReader
uses AvroCSVReader
to read records from
CSV. AvroCSVReader
internally uses
RecordBuilder
, which does not support BYTES, and some
logical types such as DECIMAL. So we use readSchema to let AvroCSVReader be able to read the
record, then when writing out the record, we interpret the record according to
writeSchema.
For example, if a column is of type DECIMAL, in readSchema, the type will be STRING,
but in writeSchema, it's logical type DECIMAL backed by BYTES.schema
- the schema from Alluxio table masterIOException
- when failed to initialize schemapublic ArrayList<FieldSchema> getAlluxioSchema()
public org.apache.avro.Schema getReadSchema()
public org.apache.avro.Schema getWriteSchema()
public ParquetSchema toParquet()
toParquet
in interface TableSchema
Copyright © 2023. All Rights Reserved.