use of org.apache.inlong.sort.formats.common.BasicFormatInfo in project incubator-inlong by apache.
the class CsvFormatFactory method buildSerializationSchema.
private static CsvSerializationSchema buildSerializationSchema(DescriptorProperties descriptorProperties, RowFormatInfo rowFormatInfo) {
for (FormatInfo formatInfo : rowFormatInfo.getFieldFormatInfos()) {
if (!(formatInfo instanceof BasicFormatInfo)) {
throw new ValidationException("Currently only basic formats " + "are supported in csv formats.");
}
}
CsvSerializationSchema.Builder builder = new CsvSerializationSchema.Builder(rowFormatInfo);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_CHARSET).ifPresent(builder::setCharset);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_DELIMITER).ifPresent(builder::setDelimiter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_ESCAPE_CHARACTER).ifPresent(builder::setEscapeCharacter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_QUOTE_CHARACTER).ifPresent(builder::setQuoteCharacter);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_NULL_LITERAL).ifPresent(builder::setNullLiteral);
return builder.build();
}
use of org.apache.inlong.sort.formats.common.BasicFormatInfo in project incubator-inlong by apache.
the class KvFormatFactory method buildSerializationSchema.
private static KvSerializationSchema buildSerializationSchema(DescriptorProperties descriptorProperties, RowFormatInfo rowFormatInfo) {
for (FormatInfo formatInfo : rowFormatInfo.getFieldFormatInfos()) {
if (!(formatInfo instanceof BasicFormatInfo)) {
throw new ValidationException("Currently only basic formats " + "are supported in kv formats.");
}
}
KvSerializationSchema.Builder builder = new KvSerializationSchema.Builder(rowFormatInfo);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_CHARSET).ifPresent(builder::setCharset);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_ENTRY_DELIMITER).ifPresent(builder::setEntryDelimiter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_KV_DELIMITER).ifPresent(builder::setKvDelimiter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_ESCAPE_CHARACTER).ifPresent(builder::setEscapeCharacter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_QUOTE_CHARACTER).ifPresent(builder::setQuoteCharacter);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_NULL_LITERAL).ifPresent(builder::setNullLiteral);
return builder.build();
}
use of org.apache.inlong.sort.formats.common.BasicFormatInfo in project incubator-inlong by apache.
the class CsvFormatFactory method buildDeserializationSchema.
private static CsvDeserializationSchema buildDeserializationSchema(DescriptorProperties descriptorProperties, RowFormatInfo rowFormatInfo) {
for (FormatInfo formatInfo : rowFormatInfo.getFieldFormatInfos()) {
if (!(formatInfo instanceof BasicFormatInfo)) {
throw new ValidationException("Currently only basic formats " + "are supported in csv formats.");
}
}
CsvDeserializationSchema.Builder builder = new CsvDeserializationSchema.Builder(rowFormatInfo);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_CHARSET).ifPresent(builder::setCharset);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_DELIMITER).ifPresent(builder::setDelimiter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_ESCAPE_CHARACTER).ifPresent(builder::setEscapeCharacter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_QUOTE_CHARACTER).ifPresent(builder::setQuoteCharacter);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_NULL_LITERAL).ifPresent(builder::setNullLiteral);
return builder.build();
}
use of org.apache.inlong.sort.formats.common.BasicFormatInfo in project incubator-inlong by apache.
the class KvFormatFactory method buildDeserializationSchema.
private static KvDeserializationSchema buildDeserializationSchema(DescriptorProperties descriptorProperties, RowFormatInfo rowFormatInfo) {
for (FormatInfo formatInfo : rowFormatInfo.getFieldFormatInfos()) {
if (!(formatInfo instanceof BasicFormatInfo)) {
throw new ValidationException("Currently only basic formats " + "are supported in kv formats.");
}
}
KvDeserializationSchema.Builder builder = new KvDeserializationSchema.Builder(rowFormatInfo);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_CHARSET).ifPresent(builder::setCharset);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_ENTRY_DELIMITER).ifPresent(builder::setEntryDelimiter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_KV_DELIMITER).ifPresent(builder::setKvDelimiter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_ESCAPE_CHARACTER).ifPresent(builder::setEscapeCharacter);
descriptorProperties.getOptionalCharacter(TableFormatConstants.FORMAT_QUOTE_CHARACTER).ifPresent(builder::setQuoteCharacter);
descriptorProperties.getOptionalString(TableFormatConstants.FORMAT_NULL_LITERAL).ifPresent(builder::setNullLiteral);
return builder.build();
}
Aggregations