return TypeDescription.createFloat(); case DOUBLE: return TypeDescription.createDouble(); case STRING: return TypeDescription.createString();
return TypeDescription.createFloat(); case DOUBLE: return TypeDescription.createDouble(); case STRING: return TypeDescription.createString();
private static TypeDescription getSchema(Schema schema) { TypeDescription result = TypeDescription.createStruct(); for (String col : schema.getColumnNames()) { ColumnDescription cd = schema.getDescription(col); TypeDescription current; switch (cd.kind) { case None: default: throw new RuntimeException("Unexpected data type " + cd.kind); case String: case Json: current = TypeDescription.createString(); break; case Date: current = TypeDescription.createTimestamp(); break; case Integer: current = TypeDescription.createInt(); break; case Duration: case Double: current = TypeDescription.createDouble(); break; } result.addField(col, current); } return result; }
break; case DOUBLE: typeDescription.addField(colName, TypeDescription.createDouble()); break; case BOOLEAN:
private static TypeDescription convertType(final DataType fieldType) { if (fieldType instanceof BooleanType) { return TypeDescription.createBoolean(); } else if (fieldType instanceof ByteType) { return TypeDescription.createByte(); } else if (fieldType instanceof ShortType) { return TypeDescription.createShort(); } else if (fieldType instanceof IntType) { return TypeDescription.createInt(); } else if (fieldType instanceof LongType) { return TypeDescription.createLong(); } else if (fieldType instanceof FloatType) { return TypeDescription.createFloat(); } else if (fieldType instanceof DoubleType) { return TypeDescription.createDouble(); } else if (fieldType instanceof StringType || fieldType instanceof ByteArrayType) { return TypeDescription.createString(); } else if (fieldType instanceof DateType) { return TypeDescription.createDate(); } else if (fieldType instanceof TimestampType) { return TypeDescription.createTimestamp(); } else if (fieldType instanceof DecimalType) { int precision = ((DecimalType) fieldType).precision(); int scale = ((DecimalType) fieldType).scale(); return TypeDescription.createDecimal().withPrecision(precision).withScale(scale); } else { throw new UnsupportedOperationException("Unsupported category: " + fieldType); } } }
return TypeDescription.createFloat(); case DOUBLE: return TypeDescription.createDouble(); case DECIMAL: return TypeDescription.createDecimal();
return TypeDescription.createFloat(); case FLOAT8: return TypeDescription.createDouble(); case TEXT: return TypeDescription.createString();
return TypeDescription.createFloat(); case FLOAT8: return TypeDescription.createDouble(); case TEXT: return TypeDescription.createString();
return TypeDescription.createFloat(); case DOUBLE: return TypeDescription.createDouble(); case STRING: return TypeDescription.createString();
break; case DOUBLE: result = TypeDescription.createDouble(); break; case DATE: