use of org.apache.apex.malhar.contrib.parser.DelimitedSchema in project apex-malhar by apache.
the class CsvFormatter method setup.
@Override
public void setup(Context.OperatorContext context) {
super.setup(context);
delimitedParserSchema = new DelimitedSchema(schema);
preference = new CsvPreference.Builder(delimitedParserSchema.getQuoteChar(), delimitedParserSchema.getDelimiterChar(), delimitedParserSchema.getLineDelimiter()).build();
nameMapping = delimitedParserSchema.getFieldNames().toArray(new String[delimitedParserSchema.getFieldNames().size()]);
processors = getProcessor(delimitedParserSchema.getFields());
}
use of org.apache.apex.malhar.contrib.parser.DelimitedSchema in project apex-malhar by apache.
the class DelimitedFSLoader method init.
private void init() {
delimitedParserSchema = new DelimitedSchema(schema);
preference = new CsvPreference.Builder(delimitedParserSchema.getQuoteChar(), delimitedParserSchema.getDelimiterChar(), delimitedParserSchema.getLineDelimiter()).build();
nameMapping = delimitedParserSchema.getFieldNames().toArray(new String[delimitedParserSchema.getFieldNames().size()]);
header = StringUtils.join(nameMapping, (char) delimitedParserSchema.getDelimiterChar() + "");
processors = getProcessor(delimitedParserSchema.getFields());
csvStringReader = new ReusableStringReader();
csvMapReader = new CsvMapReader(csvStringReader, preference);
}
use of org.apache.apex.malhar.contrib.parser.DelimitedSchema in project apex-malhar by apache.
the class CSVMessageFormat method getRowType.
@Override
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
String schema = (String) operands.get(CSV_SCHEMA);
RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder();
DelimitedSchema delimitedSchema = new DelimitedSchema(schema);
for (DelimitedSchema.Field field : delimitedSchema.getFields()) {
builder.add(field.getName(), convertField(typeFactory, field.getType()));
}
return builder.build();
}
Aggregations