Java Code Examples for org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory#longTypeInfo()

The following examples show how to use org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory#longTypeInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlurObjectInspectorGenerator.java    From incubator-retired-blur with Apache License 2.0 6 votes vote down vote up
private TypeInfo getTypeInfo(String fieldType) {
  if (fieldType.equals(TEXT) || fieldType.equals(STRING) || fieldType.equals(STORED)) {
    return TypeInfoFactory.stringTypeInfo;
  } else if (fieldType.equals(LONG)) {
    return TypeInfoFactory.longTypeInfo;
  } else if (fieldType.equals(INT)) {
    return TypeInfoFactory.intTypeInfo;
  } else if (fieldType.equals(FLOAT)) {
    return TypeInfoFactory.floatTypeInfo;
  } else if (fieldType.equals(DOUBLE)) {
    return TypeInfoFactory.doubleTypeInfo;
  } else if (fieldType.equals(DATE)) {
    return TypeInfoFactory.dateTypeInfo;
  } else if (fieldType.equals(GEO_POINTVECTOR) || fieldType.equals(GEO_RECURSIVEPREFIX)
      || fieldType.equals(GEO_TERMPREFIX)) {
    List<TypeInfo> typeInfos = Arrays.asList((TypeInfo) TypeInfoFactory.floatTypeInfo,
        (TypeInfo) TypeInfoFactory.floatTypeInfo);
    return TypeInfoFactory.getStructTypeInfo(Arrays.asList(LATITUDE, LONGITUDE), typeInfos);
  }
  // Return string for anything that is not a built in type.
  return TypeInfoFactory.stringTypeInfo;
}
 
Example 2
Source File: HiveTypeUtil.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TypeInfo visit(BigIntType bigIntType) {
	return TypeInfoFactory.longTypeInfo;
}
 
Example 3
Source File: HiveInspectors.java    From flink with Apache License 2.0 4 votes vote down vote up
public static ObjectInspector getObjectInspector(Class clazz) {
	TypeInfo typeInfo;

	if (clazz.equals(String.class) || clazz.equals(Text.class)) {

		typeInfo = TypeInfoFactory.stringTypeInfo;
	} else if (clazz.equals(Boolean.class) || clazz.equals(BooleanWritable.class)) {

		typeInfo = TypeInfoFactory.booleanTypeInfo;
	} else if (clazz.equals(Byte.class) || clazz.equals(ByteWritable.class)) {

		typeInfo = TypeInfoFactory.byteTypeInfo;
	} else if (clazz.equals(Short.class) || clazz.equals(ShortWritable.class)) {

		typeInfo = TypeInfoFactory.shortTypeInfo;
	} else if (clazz.equals(Integer.class) || clazz.equals(IntWritable.class)) {

		typeInfo = TypeInfoFactory.intTypeInfo;
	} else if (clazz.equals(Long.class) || clazz.equals(LongWritable.class)) {

		typeInfo = TypeInfoFactory.longTypeInfo;
	} else if (clazz.equals(Float.class) || clazz.equals(FloatWritable.class)) {

		typeInfo = TypeInfoFactory.floatTypeInfo;
	} else if (clazz.equals(Double.class) || clazz.equals(DoubleWritable.class)) {

		typeInfo = TypeInfoFactory.doubleTypeInfo;
	} else if (clazz.equals(Date.class) || clazz.equals(DateWritable.class)) {

		typeInfo = TypeInfoFactory.dateTypeInfo;
	} else if (clazz.equals(Timestamp.class) || clazz.equals(TimestampWritable.class)) {

		typeInfo = TypeInfoFactory.timestampTypeInfo;
	} else if (clazz.equals(byte[].class) || clazz.equals(BytesWritable.class)) {

		typeInfo = TypeInfoFactory.binaryTypeInfo;
	} else if (clazz.equals(HiveChar.class) || clazz.equals(HiveCharWritable.class)) {

		typeInfo = TypeInfoFactory.charTypeInfo;
	} else if (clazz.equals(HiveVarchar.class) || clazz.equals(HiveVarcharWritable.class)) {

		typeInfo = TypeInfoFactory.varcharTypeInfo;
	} else if (clazz.equals(HiveDecimal.class) || clazz.equals(HiveDecimalWritable.class)) {

		typeInfo = TypeInfoFactory.decimalTypeInfo;
	} else {
		throw new FlinkHiveUDFException(
			String.format("Class %s is not supported yet", clazz.getName()));
	}

	return getObjectInspector(typeInfo);
}
 
Example 4
Source File: HiveTypeUtil.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TypeInfo visit(BigIntType bigIntType) {
	return TypeInfoFactory.longTypeInfo;
}
 
Example 5
Source File: OrcLazyLongObjectInspector.java    From hive-dwrf with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({"override", "UnusedDeclaration", "RedundantCast"}) // FB Hive
public PrimitiveTypeInfo getTypeInfo() {
  return (PrimitiveTypeInfo) TypeInfoFactory.longTypeInfo;
}