本文整理匯總了Java中org.apache.avro.Schema.Type.DOUBLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Type.DOUBLE屬性的具體用法?Java Type.DOUBLE怎麽用?Java Type.DOUBLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.avro.Schema.Type
的用法示例。
在下文中一共展示了Type.DOUBLE屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toAvroType
private Type toAvroType(String columnName, int sqlType) {
Properties mapping = options.getMapColumnJava();
if (mapping.containsKey(columnName)) {
String type = mapping.getProperty(columnName);
if (LOG.isDebugEnabled()) {
LOG.info("Overriding type of column " + columnName + " to " + type);
}
if (type.equalsIgnoreCase("INTEGER")) { return Type.INT; }
if (type.equalsIgnoreCase("LONG")) { return Type.LONG; }
if (type.equalsIgnoreCase("BOOLEAN")) { return Type.BOOLEAN; }
if (type.equalsIgnoreCase("FLOAT")) { return Type.FLOAT; }
if (type.equalsIgnoreCase("DOUBLE")) { return Type.DOUBLE; }
if (type.equalsIgnoreCase("STRING")) { return Type.STRING; }
if (type.equalsIgnoreCase("BYTES")) { return Type.BYTES; }
// Mapping was not found
throw new IllegalArgumentException("Cannot convert to AVRO type " + type);
}
return connManager.toAvroType(tableName, columnName, sqlType);
}
示例2: getSerializer
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> Serializer<T> getSerializer(Type type) {
Serializer serializer = null;
if (type == Type.STRING) {
serializer = CharSequenceSerializer.get();
} else if (type == Type.BOOLEAN) {
serializer = BooleanSerializer.get();
} else if (type == Type.BYTES) {
serializer = ByteBufferSerializer.get();
} else if (type == Type.DOUBLE) {
serializer = DoubleSerializer.get();
} else if (type == Type.FLOAT) {
serializer = FloatSerializer.get();
} else if (type == Type.INT) {
serializer = IntegerSerializer.get();
} else if (type == Type.LONG) {
serializer = LongSerializer.get();
} else if (type == Type.FIXED) {
serializer = SpecificFixedSerializer.get();
} else {
serializer = null;
}
return serializer;
}
示例3: getType
public static Type getType(Class<?> clazz) {
if (clazz.equals(Utf8.class)) {
return Type.STRING;
} else if (clazz.equals(Boolean.class) || clazz.equals(boolean.class)) {
return Type.BOOLEAN;
} else if (clazz.equals(ByteBuffer.class)) {
return Type.BYTES;
} else if (clazz.equals(Double.class) || clazz.equals(double.class)) {
return Type.DOUBLE;
} else if (clazz.equals(Float.class) || clazz.equals(float.class)) {
return Type.FLOAT;
} else if (clazz.equals(Integer.class) || clazz.equals(int.class)) {
return Type.INT;
} else if (clazz.equals(Long.class) || clazz.equals(long.class)) {
return Type.LONG;
} else if (clazz.isAssignableFrom(List.class)) {
return Type.ARRAY;
} else if (clazz.isAssignableFrom(Map.class)) {
return Type.MAP;
} else if (clazz.equals(Persistent.class)) {
return Type.RECORD;
} else if (clazz.getSuperclass().equals(SpecificFixed.class)) {
return Type.FIXED;
} else {
return null;
}
}
示例4: getClass
public static Class<?> getClass(Type type) {
if (type == Type.STRING) {
return Utf8.class;
} else if (type == Type.BOOLEAN) {
return Boolean.class;
} else if (type == Type.BYTES) {
return ByteBuffer.class;
} else if (type == Type.DOUBLE) {
return Double.class;
} else if (type == Type.FLOAT) {
return Float.class;
} else if (type == Type.INT) {
return Integer.class;
} else if (type == Type.LONG) {
return Long.class;
} else if (type == Type.ARRAY) {
return List.class;
} else if (type == Type.MAP) {
return Map.class;
} else if (type == Type.RECORD) {
return Persistent.class;
} else if (type == Type.FIXED) {
// return SpecificFixed.class;
return null;
} else {
return null;
}
}
示例5: getFixedSize
public static int getFixedSize(Type type) {
if (type == Type.BOOLEAN) {
return 1;
} else if (type == Type.DOUBLE) {
return 8;
} else if (type == Type.FLOAT) {
return 4;
} else if (type == Type.INT) {
return 4;
} else if (type == Type.LONG) {
return 8;
} else {
return -1;
}
}
示例6: toAvroType
/**
* Resolve a database-specific type to Avro data type.
* @param sqlType sql type
* @return avro type
*/
public Type toAvroType(int sqlType) {
switch (sqlType) {
case Types.TINYINT:
case Types.SMALLINT:
case Types.INTEGER:
return Type.INT;
case Types.BIGINT:
return Type.LONG;
case Types.BIT:
case Types.BOOLEAN:
return Type.BOOLEAN;
case Types.REAL:
return Type.FLOAT;
case Types.FLOAT:
case Types.DOUBLE:
return Type.DOUBLE;
case Types.NUMERIC:
case Types.DECIMAL:
return Type.STRING;
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.LONGNVARCHAR:
case Types.NVARCHAR:
case Types.NCHAR:
return Type.STRING;
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
return Type.LONG;
case Types.BLOB:
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
return Type.BYTES;
default:
throw new IllegalArgumentException("Cannot convert SQL type "
+ sqlType);
}
}