public class DelimitedStringsRecordFormat extends AbstractStreamEventRecordFormat<co.cask.cdap.api.data.format.StructuredRecord>
The delimiter can be explicitly set through the "delimiter" setting, and the character set can also be set through the "charset" setting. By default, the format will use a schema of one field, where the field is an array of strings. The schema can be set to a schema of fields, with the i'th field corresponding to the i'th value in the delimited text. Fields can also be parsed as scalar types - boolean, integer, long, double, float, bytes, and string. In addition, the very last field can be an array of strings.
If the "mapping" setting is provided, then we will use the mapping to parse the stream events rather than
the order of the schema fields. "mapping" is in the format "index0:field0,index1:field1,..".
For example, if "mapping" is "1:name,2:age", then a stream event like "sdf,bob,32,sdf,lkj" would be transformed into
a record {"name":"bob", "age":32}.
| Modifier and Type | Field and Description |
|---|---|
static String |
CHARSET |
static String |
DELIMITER |
static String |
MAPPING |
schema| Constructor and Description |
|---|
DelimitedStringsRecordFormat() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure(Map<String,String> settings) |
protected co.cask.cdap.api.data.schema.Schema |
getDefaultSchema() |
co.cask.cdap.api.data.format.StructuredRecord |
read(StreamEvent event) |
protected void |
validateSchema(co.cask.cdap.api.data.schema.Schema desiredSchema) |
getSchema, initializepublic static final String CHARSET
public static final String DELIMITER
public static final String MAPPING
public co.cask.cdap.api.data.format.StructuredRecord read(StreamEvent event) throws co.cask.cdap.api.data.format.UnexpectedFormatException
protected co.cask.cdap.api.data.schema.Schema getDefaultSchema()
protected void validateSchema(co.cask.cdap.api.data.schema.Schema desiredSchema) throws co.cask.cdap.api.data.schema.UnsupportedTypeException
Copyright © 2017 Cask Data, Inc. Licensed under the Apache License, Version 2.0.