當前位置: 首頁>>代碼示例>>Java>>正文


Java PrimitiveObjectInspector.PrimitiveCategory方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory方法的典型用法代碼示例。如果您正苦於以下問題:Java PrimitiveObjectInspector.PrimitiveCategory方法的具體用法?Java PrimitiveObjectInspector.PrimitiveCategory怎麽用?Java PrimitiveObjectInspector.PrimitiveCategory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector的用法示例。


在下文中一共展示了PrimitiveObjectInspector.PrimitiveCategory方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSupportedType

import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; //導入方法依賴的package包/類
public static boolean isSupportedType(TypeInfo typeInfo)
{
    switch (typeInfo.getCategory()) {
        case PRIMITIVE:
            PrimitiveObjectInspector.PrimitiveCategory primitiveCategory = ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory();
            return getPrimitiveType(primitiveCategory) != null;
        case MAP:
            MapTypeInfo mapTypeInfo = checkType(typeInfo, MapTypeInfo.class, "typeInfo");
            return isSupportedType(mapTypeInfo.getMapKeyTypeInfo()) && isSupportedType(mapTypeInfo.getMapValueTypeInfo());
        case LIST:
            ListTypeInfo listTypeInfo = checkType(typeInfo, ListTypeInfo.class, "typeInfo");
            return isSupportedType(listTypeInfo.getListElementTypeInfo());
        case STRUCT:
            StructTypeInfo structTypeInfo = checkType(typeInfo, StructTypeInfo.class, "typeInfo");
            return structTypeInfo.getAllStructFieldTypeInfos().stream()
                    .allMatch(HiveType::isSupportedType);
    }
    return false;
}
 
開發者ID:y-lan,項目名稱:presto,代碼行數:20,代碼來源:HiveType.java

示例2: getDataType

import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; //導入方法依賴的package包/類
static
private DataType getDataType(ObjectInspector inspector) throws UDFArgumentException {
	PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector)inspector;

	PrimitiveObjectInspector.PrimitiveCategory primitiveCategory = primitiveInspector.getPrimitiveCategory();
	switch(primitiveCategory){
		case STRING:
		case VARCHAR:
			return DataType.STRING;
		case BYTE:
		case SHORT:
		case INT:
			return DataType.INTEGER;
		case FLOAT:
			return DataType.FLOAT;
		case DOUBLE:
			return DataType.DOUBLE;
		case BOOLEAN:
			return DataType.BOOLEAN;
		default:
			throw new UDFArgumentException();
	}
}
 
開發者ID:jpmml,項目名稱:jpmml-hive,代碼行數:24,代碼來源:PMMLUtil.java

示例3: getEqualsExecuter

import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; //導入方法依賴的package包/類
public static IFilter getEqualsExecuter( final List<ExprNodeDesc> nodeDescList , final int start ){
  PrimitiveObjectInspector rootPrimitiveObjectInspector = getPrimitiveObjectInspector( nodeDescList.get( start ) );
  if( rootPrimitiveObjectInspector == null ){
    return null;
  }
  PrimitiveObjectInspector.PrimitiveCategory primitiveCategory = rootPrimitiveObjectInspector.getPrimitiveCategory();
  IFilter filter = null;
  switch( rootPrimitiveObjectInspector.getPrimitiveCategory() ){
    case STRING:
      Set<String> stringDic = new HashSet<String>();
      for( int i = start ; i < nodeDescList.size() ; i++ ){
        PrimitiveObjectInspector primitiveObjectInspector  = getPrimitiveObjectInspector( nodeDescList.get( i ) );
        if( primitiveObjectInspector == null || primitiveObjectInspector.getPrimitiveCategory() != rootPrimitiveObjectInspector.getPrimitiveCategory() ){
          return null;
        }
        stringDic.add( ( (WritableConstantStringObjectInspector)primitiveObjectInspector ).getWritableConstantValue().toString() );
      }
      return new StringDictionaryFilter( stringDic );
    case BYTE:
     // byte byteObj = ( (WritableConstantByteObjectInspector)primitiveObjectInspector ).getWritableConstantValue().get();
    case SHORT:
      //short shortObj = ( (WritableConstantShortObjectInspector)primitiveObjectInspector ).getWritableConstantValue().get();
    case INT:
      //int intObj = ( (WritableConstantIntObjectInspector)primitiveObjectInspector ).getWritableConstantValue().get();
    case LONG:
      //long longObj = ( (WritableConstantLongObjectInspector)primitiveObjectInspector ).getWritableConstantValue().get();
    case FLOAT:
      //float floatObj = ( (WritableConstantFloatObjectInspector)primitiveObjectInspector ).getWritableConstantValue().get();
    case DOUBLE:
      //double doubleObj = ( (WritableConstantDoubleObjectInspector)primitiveObjectInspector ).getWritableConstantValue().get();
    default:
      return null;
  }
}
 
開發者ID:yahoojapan,項目名稱:multiple-dimension-spread,代碼行數:35,代碼來源:InHiveExpr.java

示例4: getTypeSignature

import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; //導入方法依賴的package包/類
@Nonnull
private static TypeSignature getTypeSignature(TypeInfo typeInfo)
{
    switch (typeInfo.getCategory()) {
        case PRIMITIVE:
            PrimitiveObjectInspector.PrimitiveCategory primitiveCategory = ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory();
            Type primitiveType = getPrimitiveType(primitiveCategory);
            if (primitiveType == null) {
                break;
            }
            return primitiveType.getTypeSignature();
        case MAP:
            MapTypeInfo mapTypeInfo = checkType(typeInfo, MapTypeInfo.class, "fieldInspector");
            TypeSignature keyType = getTypeSignature(mapTypeInfo.getMapKeyTypeInfo());
            TypeSignature valueType = getTypeSignature(mapTypeInfo.getMapValueTypeInfo());
            return new TypeSignature(
                    StandardTypes.MAP,
                    ImmutableList.of(TypeSignatureParameter.of(keyType), TypeSignatureParameter.of(valueType)));
        case LIST:
            ListTypeInfo listTypeInfo = checkType(typeInfo, ListTypeInfo.class, "fieldInspector");
            TypeSignature elementType = getTypeSignature(listTypeInfo.getListElementTypeInfo());
            return new TypeSignature(
                    StandardTypes.ARRAY,
                    ImmutableList.of(TypeSignatureParameter.of(elementType)));
        case STRUCT:
            StructTypeInfo structTypeInfo = checkType(typeInfo, StructTypeInfo.class, "fieldInspector");
            List<TypeSignature> fieldTypes = structTypeInfo.getAllStructFieldTypeInfos()
                    .stream()
                    .map(HiveType::getTypeSignature)
                    .collect(toList());
            return new TypeSignature(StandardTypes.ROW, fieldTypes, structTypeInfo.getAllStructFieldNames());
    }
    throw new PrestoException(NOT_SUPPORTED, format("Unsupported Hive type: %s", typeInfo));
}
 
開發者ID:y-lan,項目名稱:presto,代碼行數:35,代碼來源:HiveType.java

示例5: getPrimitiveType

import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; //導入方法依賴的package包/類
private static Type getPrimitiveType(PrimitiveObjectInspector.PrimitiveCategory primitiveCategory)
{
    switch (primitiveCategory) {
        case BOOLEAN:
            return BOOLEAN;
        case BYTE:
            return BIGINT;
        case SHORT:
            return BIGINT;
        case INT:
            return BIGINT;
        case LONG:
            return BIGINT;
        case FLOAT:
            return DOUBLE;
        case DOUBLE:
            return DOUBLE;
        case STRING:
            return VARCHAR;
        case DATE:
            return DATE;
        case TIMESTAMP:
            return TIMESTAMP;
        case BINARY:
            return VARBINARY;
        default:
            return null;
    }
}
 
開發者ID:y-lan,項目名稱:presto,代碼行數:30,代碼來源:HiveType.java

示例6: validateGivenPrimitiveCategory

import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; //導入方法依賴的package包/類
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws UDFArgumentTypeException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as parameter "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}
 
開發者ID:DataSketches,項目名稱:sketches-hive,代碼行數:11,代碼來源:ObjectInspectorValidator.java

示例7: validateGivenPrimitiveCategory

import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; //導入方法依賴的package包/類
static void validateGivenPrimitiveCategory(final ObjectInspector inspector, final int index,
    final PrimitiveObjectInspector.PrimitiveCategory category) throws SemanticException
{
  validateCategoryPrimitive(inspector, index);
  final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspector;
  if (primitiveInspector.getPrimitiveCategory() != category) {
    throw new UDFArgumentTypeException(index, category.name() + " value expected as the argument "
        + (index + 1) + " but " + primitiveInspector.getPrimitiveCategory().name() + " was received");
  }
}
 
開發者ID:DataSketches,項目名稱:sketches-hive,代碼行數:11,代碼來源:ObjectInspectorValidator.java


注:本文中的org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。