本文整理了Java中org.talend.daikon.avro.AvroUtils.isSameType()
方法的一些代码示例,展示了AvroUtils.isSameType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AvroUtils.isSameType()
方法的具体详情如下:
包路径:org.talend.daikon.avro.AvroUtils
类名称:AvroUtils
方法名:isSameType
暂无
代码示例来源:origin: org.talend.components/components-jdbc-runtime
Schema basicSchema = AvroUtils.unwrapIfNullable(f.schema());
if (AvroUtils.isSameType(basicSchema, AvroUtils._string())) {
return Types.VARCHAR;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._int())) {
return Types.INTEGER;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._date())) {
return Types.DATE;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._decimal())) {
return Types.DECIMAL;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._long())) {
return Types.BIGINT;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._double())) {
return Types.DOUBLE;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._float())) {
return Types.FLOAT;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._boolean())) {
return Types.BOOLEAN;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._short())) {
return Types.SMALLINT;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._character())) {
return Types.CHAR;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._byte())) {
return Types.TINYINT;
} else {
代码示例来源:origin: Talend/components
Schema basicSchema = AvroUtils.unwrapIfNullable(f.schema());
if (AvroUtils.isSameType(basicSchema, AvroUtils._string())) {
return Types.VARCHAR;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._int())) {
return Types.INTEGER;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._date())) {
return Types.DATE;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._decimal())) {
return Types.DECIMAL;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._long())) {
return Types.BIGINT;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._double())) {
return Types.DOUBLE;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._float())) {
return Types.FLOAT;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._boolean())) {
return Types.BOOLEAN;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._short())) {
return Types.SMALLINT;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._character())) {
return Types.CHAR;
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._byte())) {
return Types.TINYINT;
} else {
代码示例来源:origin: Talend/components
@Override
public String convertToDatum(T value) {
if (value == null) {
return null;
}
if (thousandsSepChar != null || decimalSepChar != null) {
return FormatterUtils.formatNumber(new BigDecimal(String.valueOf(value)).toPlainString(), thousandsSepChar,
decimalSepChar);
} else {
if (value instanceof BigDecimal) {
String precision = field.getProp(SchemaConstants.TALEND_COLUMN_PRECISION);
if (precision != null) {
return ((BigDecimal) value).setScale(Integer.valueOf(precision), RoundingMode.HALF_UP).toPlainString();
} else {
return ((BigDecimal) value).toPlainString();
}
} else if (AvroUtils.isSameType(AvroUtils._decimal(), AvroUtils.unwrapIfNullable(field.schema()))) {
String precision = field.getProp(SchemaConstants.TALEND_COLUMN_PRECISION);
if (precision != null) {
return new BigDecimal(String.valueOf(value)).setScale(Integer.valueOf(precision), RoundingMode.HALF_UP)
.toPlainString();
}
}
return String.valueOf(value);
}
}
代码示例来源:origin: org.talend.components/components-azurestorage
public static DTEConverter createConverter(final Field f, final String mappedName) {
Schema basicSchema = AvroUtils.unwrapIfNullable(f.schema());
AzureStorageDTEConverters converters = new AzureStorageDTEConverters();
DTEConverter dteConverter;
if (AvroUtils.isSameType(basicSchema, AvroUtils._string()) || AvroUtils.isSameType(basicSchema, AvroUtils._character())) {
dteConverter = converters.new StringDTEConverter(f, mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._int()) || AvroUtils.isSameType(basicSchema, AvroUtils._short())
|| AvroUtils.isSameType(basicSchema, AvroUtils._byte())) {
dteConverter = converters.new IntegerDTEConverter(mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._date())) {
dteConverter = converters.new DateDTEConverter(f, mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._decimal())
|| AvroUtils.isSameType(basicSchema, AvroUtils._double())
|| AvroUtils.isSameType(basicSchema, AvroUtils._float())) {
dteConverter = converters.new DoubleDTEConverter(mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._long())) {
dteConverter = converters.new LongDTEConverter(f, mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._boolean())) {
dteConverter = converters.new BooleanDTEConverter(mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._bytes())) {
dteConverter = converters.new ByteArrayDTEConverter(mappedName);
} else {
dteConverter = converters.new StringDTEConverter(f, mappedName);
}
return dteConverter;
}
代码示例来源:origin: Talend/components
public static DTEConverter createConverter(final Field f, final String mappedName) {
Schema basicSchema = AvroUtils.unwrapIfNullable(f.schema());
AzureStorageDTEConverters converters = new AzureStorageDTEConverters();
DTEConverter dteConverter;
if (AvroUtils.isSameType(basicSchema, AvroUtils._string()) || AvroUtils.isSameType(basicSchema, AvroUtils._character())) {
dteConverter = converters.new StringDTEConverter(f, mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._int()) || AvroUtils.isSameType(basicSchema, AvroUtils._short())
|| AvroUtils.isSameType(basicSchema, AvroUtils._byte())) {
dteConverter = converters.new IntegerDTEConverter(mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._date())) {
dteConverter = converters.new DateDTEConverter(f, mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._decimal())
|| AvroUtils.isSameType(basicSchema, AvroUtils._double())
|| AvroUtils.isSameType(basicSchema, AvroUtils._float())) {
dteConverter = converters.new DoubleDTEConverter(mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._long())) {
dteConverter = converters.new LongDTEConverter(f, mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._boolean())) {
dteConverter = converters.new BooleanDTEConverter(mappedName);
} else if (AvroUtils.isSameType(basicSchema, AvroUtils._bytes())) {
dteConverter = converters.new ByteArrayDTEConverter(mappedName);
} else {
dteConverter = converters.new StringDTEConverter(f, mappedName);
}
return dteConverter;
}
代码示例来源:origin: org.talend.components/components-dataprep
/**
* A helper method to convert the String representation of a datum in the DataPrep system to the Avro type that
* matches the Schema generated for it.
*
* @param f is field in Avro Schema.
* @return converter for a given type.
*/
public AvroConverter<String, ?> getConverterFromString(org.apache.avro.Schema.Field f) {
Schema fieldSchema = AvroUtils.unwrapIfNullable(f.schema());
// FIXME use avro type to decide the converter is not correct if the user change the avro type, Date to String
// for instance
if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) {
return new StringToBooleanConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._decimal())) {
return new StringToDecimalConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) {
return new StringToDoubleConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._int())) {
return new StringToIntegerConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._date())) {
return new StringToDateConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._string())) {
return super.getConverter(String.class);
}
throw new UnsupportedOperationException("The type " + fieldSchema.getType() + " is not supported."); //$NON-NLS-1$ //$NON-NLS-2$
}
代码示例来源:origin: org.talend.components/components-salesforce
/**
* A helper method to convert the String representation of a datum in the Salesforce system to the Avro type that
* matches the Schema generated for it.
*
* @param f
* @return
*/
public AvroConverter<String, ?> getConverterFromString(org.apache.avro.Schema.Field f) {
Schema fieldSchema = AvroUtils.unwrapIfNullable(f.schema());
// FIXME use avro type to decide the converter is not correct if the user change the avro type, Date to String
// for instance
if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) {
return new StringToBooleanConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._decimal())) {
return new StringToDecimalConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) {
return new StringToDoubleConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._int())) {
return new StringToIntegerConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._date())) {
return new StringToDateConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._bytes())) {
return new StringToBytesConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._string())) {
return super.getConverter(String.class);
}
throw new UnsupportedOperationException("The type " + fieldSchema.getType() + " is not supported."); //$NON-NLS-1$ //$NON-NLS-2$
}
代码示例来源:origin: Talend/components
public AvroConverter<String, ?> getConverter(Schema.Field f, FileDelimitedProperties properties) {
Schema fieldSchema = AvroUtils.unwrapIfNullable(f.schema());
if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) {
return new BooleanConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._decimal())) {
return new DecimalConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) {
return new DoubleConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._float())) {
return new FloatConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._int())) {
return new IntegerConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._date())) {
return new DateConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._long())) {
return new LongConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._bytes())) {
return new BytesConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._byte())) {
return new ByteConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._short())) {
return new ShortConverter(f, properties);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._character())) {
return new CharacterConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._string())) {
return super.getConverter(String.class);
}
throw new UnsupportedOperationException("The type " + fieldSchema.getType() + " is not supported."); //$NON-NLS-1$ //$NON-NLS-2$
}
代码示例来源:origin: org.talend.components/components-salesforce-runtime
if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) {
return new StringToBooleanConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._decimal())) {
return new StringToDecimalConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) {
return new StringToDoubleConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._float())) {
return new StringToFloatConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._int())) {
return new StringToIntegerConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._byte())) {
return new StringToByteConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._short())) {
return new StringToShortConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._long())) {
return new StringToLongConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._date())) {
return new StringToDateConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._bytes())) {
return new StringToBytesConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._string())) {
return super.getConverter(String.class);
代码示例来源:origin: Talend/components
if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) {
return new StringToBooleanConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._decimal())) {
return new StringToDecimalConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) {
return new StringToDoubleConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._float())) {
return new StringToFloatConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._int())) {
return new StringToIntegerConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._byte())) {
return new StringToByteConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._short())) {
return new StringToShortConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._long())) {
return new StringToLongConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._date())) {
return new StringToDateConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._bytes())) {
return new StringToBytesConverter(f);
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._string())) {
return super.getConverter(String.class);
代码示例来源:origin: Talend/components
} else if (null == inputValue || inputValue instanceof String) {
return inputValue;
} else if (AvroUtils.isSameType(s, AvroUtils._date())) {//TODO improve the performance as no need to get the runtimefield object from map every time
代码示例来源:origin: org.talend.components/processing-runtime
return new CountAccumulatorFn();
case SUM:
if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._int())
|| AvroUtils.isSameType(inputFieldSchema, AvroUtils._long())) {
return new SumLongAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._float())
|| AvroUtils.isSameType(inputFieldSchema, AvroUtils._double())) {
return new SumDoubleAccumulatorFn();
return new AvgAccumulatorFn();
case MIN:
if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._int())) {
return new MinIntegerAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._long())) {
return new MinLongAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._float())) {
return new MinFloatAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._double())) {
return new MinDoubleAccumulatorFn();
if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._int())) {
return new MaxIntegerAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._long())) {
return new MaxLongAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._float())) {
return new MaxFloatAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._double())) {
return new MaxDoubleAccumulatorFn();
代码示例来源:origin: Talend/components
return new CountAccumulatorFn();
case SUM:
if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._int())
|| AvroUtils.isSameType(inputFieldSchema, AvroUtils._long())) {
return new SumLongAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._float())
|| AvroUtils.isSameType(inputFieldSchema, AvroUtils._double())) {
return new SumDoubleAccumulatorFn();
return new AvgAccumulatorFn();
case MIN:
if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._int())) {
return new MinIntegerAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._long())) {
return new MinLongAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._float())) {
return new MinFloatAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._double())) {
return new MinDoubleAccumulatorFn();
if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._int())) {
return new MaxIntegerAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._long())) {
return new MaxLongAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._float())) {
return new MaxFloatAccumulatorFn();
} else if (AvroUtils.isSameType(inputFieldSchema, AvroUtils._double())) {
return new MaxDoubleAccumulatorFn();
代码示例来源:origin: org.talend.components/components-snowflake-runtime
protected Object getFieldValue(Object inputValue, Field field) {
Schema s = AvroUtils.unwrapIfNullable(field.schema());
if (inputValue != null && inputValue instanceof String && ((String) inputValue).isEmpty()) {
return emptyStringValue;
} else if (null == inputValue || inputValue instanceof String) {
return inputValue;
} else if (AvroUtils.isSameType(s, AvroUtils._date())) {
Date date = (Date) inputValue;
return date.getTime();
} else if (LogicalTypes.fromSchemaIgnoreInvalid(s) == LogicalTypes.timeMillis()) {
return formatter.formatTimeMillis(inputValue);
} else if (LogicalTypes.fromSchemaIgnoreInvalid(s) == LogicalTypes.date()) {
return formatter.formatDate(inputValue);
} else if (LogicalTypes.fromSchemaIgnoreInvalid(s) == LogicalTypes.timestampMillis()) {
return formatter.formatTimestampMillis(inputValue);
} else {
return inputValue;
}
}
代码示例来源:origin: Talend/components
Assert.assertEquals(11, schemaOnlyDynamic.getFields().size());
Assert.assertEquals("TestBoolean", schemaOnlyDynamic.getFields().get(0).name());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils._string(), schemaOnlyDynamic.getFields().get(0).schema()));
Assert.assertEquals("TestObject", schemaOnlyDynamic.getFields().get(10).name());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils._string(), schemaOnlyDynamic.getFields().get(10).schema()));
Assert.assertEquals(11, schemaDynamicInFirst.getFields().size());
Assert.assertEquals("TestBoolean", schemaDynamicInFirst.getFields().get(0).name());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils._string(), schemaDynamicInFirst.getFields().get(0).schema()));
Assert.assertEquals("test_end", schemaDynamicInFirst.getFields().get(10).name());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils.wrapAsNullable(AvroUtils._int()),
schemaDynamicInFirst.getFields().get(10).schema()));
Assert.assertEquals(11, schemaDynamicInMiddle.getFields().size());
Assert.assertEquals("test_begin", schemaDynamicInMiddle.getFields().get(0).name());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils.wrapAsNullable(AvroUtils._int()),
schemaDynamicInMiddle.getFields().get(0).schema()));
Assert.assertEquals("TestByte", schemaDynamicInMiddle.getFields().get(1).name());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils._string(), schemaDynamicInMiddle.getFields().get(1).schema()));
Assert.assertEquals("TestLong", schemaDynamicInMiddle.getFields().get(9).name());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils._string(), schemaDynamicInMiddle.getFields().get(9).schema()));
Assert.assertEquals(10, schemaDynamicInFirst.getField("test_end").pos());
Assert.assertTrue(AvroUtils.isSameType(AvroUtils.wrapAsNullable(AvroUtils._int()),
schemaDynamicInMiddle.getFields().get(10).schema()));
Assert.assertEquals("test_begin", schemaDynamicInEnd.getFields().get(0).name());
Assert.assertTrue(
AvroUtils.isSameType(AvroUtils.wrapAsNullable(AvroUtils._int()), schemaDynamicInEnd.getFields().get(0).schema()));
Assert.assertEquals("TestObject", schemaDynamicInEnd.getFields().get(10).name());
代码示例来源:origin: org.talend.components/bigquery-runtime
private Object convertField(FieldValue fieldValue, org.apache.avro.Schema fieldSchema) {
boolean nullable = AvroUtils.isNullable(fieldSchema);
if (nullable && fieldValue.isNull()) {
return null;
}
fieldSchema = AvroUtils.unwrapIfNullable(fieldSchema);
switch (fieldValue.getAttribute()) {
case PRIMITIVE:
if (BigQueryType.TIMESTAMP.toString().equals(fieldSchema.getProp(TALEND_COLUMN_DB_TYPE))) {
Double doubleValue = ((Long) fieldValue.getTimestampValue()) / 1000000.0;
return formatTimestamp(doubleValue.toString());
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) {
return fieldValue.getDoubleValue();
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) {
return fieldValue.getBooleanValue();
} else {
return fieldValue.getValue();
}
case REPEATED:
List<Object> listValue = new ArrayList<>();
List<FieldValue> repeatedChildValue = fieldValue.getRepeatedValue();
for (FieldValue childValue : repeatedChildValue) {
listValue.add(convertField(childValue, fieldSchema.getElementType()));
}
return listValue;
case RECORD:
return convertFileds(fieldValue.getRecordValue(), fieldSchema);
}
throw TalendRuntimeException.build(CommonErrorCodes.UNEXPECTED_ARGUMENT).create();
}
代码示例来源:origin: Talend/components
private Object convertField(FieldValue fieldValue, org.apache.avro.Schema fieldSchema) {
boolean nullable = AvroUtils.isNullable(fieldSchema);
if (nullable && fieldValue.isNull()) {
return null;
}
fieldSchema = AvroUtils.unwrapIfNullable(fieldSchema);
switch (fieldValue.getAttribute()) {
case PRIMITIVE:
if (BigQueryType.TIMESTAMP.toString().equals(fieldSchema.getProp(TALEND_COLUMN_DB_TYPE))) {
Double doubleValue = ((Long) fieldValue.getTimestampValue()) / 1000000.0;
return formatTimestamp(doubleValue.toString());
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) {
return fieldValue.getDoubleValue();
} else if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) {
return fieldValue.getBooleanValue();
} else {
return fieldValue.getValue();
}
case REPEATED:
List<Object> listValue = new ArrayList<>();
List<FieldValue> repeatedChildValue = fieldValue.getRepeatedValue();
for (FieldValue childValue : repeatedChildValue) {
listValue.add(convertField(childValue, fieldSchema.getElementType()));
}
return listValue;
case RECORD:
return convertFileds(fieldValue.getRecordValue(), fieldSchema);
}
throw TalendRuntimeException.build(CommonErrorCodes.UNEXPECTED_ARGUMENT).create();
}
代码示例来源:origin: org.talend.components/processing-runtime
if (AvroUtils.isSameType(fieldType, AvroUtils._int())) {
return AvroUtils._long();
} else if (AvroUtils.isSameType(fieldType, AvroUtils._float())) {
return AvroUtils._double();
代码示例来源:origin: Talend/components
if (AvroUtils.isSameType(fieldType, AvroUtils._int())) {
return AvroUtils._long();
} else if (AvroUtils.isSameType(fieldType, AvroUtils._float())) {
return AvroUtils._double();
代码示例来源:origin: org.talend.components/components-snowflake
if (null == inputValue || inputValue instanceof String) {
row[i] = inputValue;
} else if (AvroUtils.isSameType(s, AvroUtils._date())) {
Date date = (Date) inputValue;
row[i] = date.getTime();
内容来源于网络,如有侵权,请联系作者删除!