Search in sources :

Example 1 with BasicFormatInfo

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();
}
Also used : ValidationException(org.apache.flink.table.api.ValidationException) FormatInfo(org.apache.inlong.sort.formats.common.FormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo) RowFormatInfo(org.apache.inlong.sort.formats.common.RowFormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo)

Example 2 with BasicFormatInfo

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();
}
Also used : ValidationException(org.apache.flink.table.api.ValidationException) FormatInfo(org.apache.inlong.sort.formats.common.FormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo) RowFormatInfo(org.apache.inlong.sort.formats.common.RowFormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo)

Example 3 with BasicFormatInfo

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();
}
Also used : ValidationException(org.apache.flink.table.api.ValidationException) FormatInfo(org.apache.inlong.sort.formats.common.FormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo) RowFormatInfo(org.apache.inlong.sort.formats.common.RowFormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo)

Example 4 with BasicFormatInfo

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();
}
Also used : ValidationException(org.apache.flink.table.api.ValidationException) FormatInfo(org.apache.inlong.sort.formats.common.FormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo) RowFormatInfo(org.apache.inlong.sort.formats.common.RowFormatInfo) BasicFormatInfo(org.apache.inlong.sort.formats.common.BasicFormatInfo)

Aggregations

ValidationException (org.apache.flink.table.api.ValidationException)4 BasicFormatInfo (org.apache.inlong.sort.formats.common.BasicFormatInfo)4 FormatInfo (org.apache.inlong.sort.formats.common.FormatInfo)4 RowFormatInfo (org.apache.inlong.sort.formats.common.RowFormatInfo)4