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


Java PrimitiveObjectInspectorFactory.writableFloatObjectInspector方法代碼示例

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


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

示例1: getObjectInspector

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
private ObjectInspector getObjectInspector(final TypeInfo typeInfo) {
    if (typeInfo.equals(TypeInfoFactory.doubleTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
    } else if (typeInfo.equals(TypeInfoFactory.booleanTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
    } else if (typeInfo.equals(TypeInfoFactory.floatTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
    } else if (typeInfo.equals(TypeInfoFactory.intTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableIntObjectInspector;
    } else if (typeInfo.equals(TypeInfoFactory.longTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableLongObjectInspector;
    } else if (typeInfo.equals(TypeInfoFactory.stringTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
    } else if (typeInfo.equals(TypeInfoFactory.timestampTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableTimestampObjectInspector;
    } else if (typeInfo.equals(TypeInfoFactory.dateTypeInfo)) {
        return PrimitiveObjectInspectorFactory.writableDateObjectInspector;
    } else {
        throw new UnsupportedOperationException("Unknown field type: " + typeInfo);
    }
}
 
開發者ID:shunfei,項目名稱:indexr,代碼行數:22,代碼來源:ArrayWritableObjectInspector.java

示例2: newObjectInspectorFromHiveType

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
private static ObjectInspector newObjectInspectorFromHiveType(final ASTNode type) {
	// matching by token names, because token IDs (which are static final) drastically change between versions.
	switch (type.getToken().getText()) {
		case "TOK_STRING":
			return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
		case "TOK_INT":
			return PrimitiveObjectInspectorFactory.writableIntObjectInspector;
		case "TOK_DOUBLE":
			return PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
		case "TOK_FLOAT":
			return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
		case "TOK_BIGINT":
			return PrimitiveObjectInspectorFactory.writableLongObjectInspector;
		case "TOK_BOOLEAN": {
			return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
		}
		case "TOK_STRUCT": {
			final ASTNode tabColList = (ASTNode) type.getChild(0);
			final List<String> names = new ArrayList<>();
			final List<ObjectInspector> ois = new ArrayList<>();
			for (final Node tabCol : tabColList.getChildren()) {
				final ASTNode a = (ASTNode) tabCol;
				names.add(a.getChild(0).toString());
				ois.add(newObjectInspectorFromHiveType((ASTNode) a.getChild(1)));
			}
			return ObjectInspectorFactory.getStandardStructObjectInspector(names, ois);
		}
		case "TOK_MAP": {
			final ObjectInspector keyType = newObjectInspectorFromHiveType((ASTNode) type.getChild(0));
			final ObjectInspector valueType = newObjectInspectorFromHiveType((ASTNode) type.getChild(1));
			return ObjectInspectorFactory.getStandardMapObjectInspector(keyType, valueType);
		}
		case "TOK_LIST": {
			final ObjectInspector itemType = newObjectInspectorFromHiveType((ASTNode) type.getChild(0));
			return ObjectInspectorFactory.getStandardListObjectInspector(itemType);
		}
		default:
			throw new IllegalArgumentException("unsupported type: " + type.toStringTree());
	}
}
 
開發者ID:CyberAgent,項目名稱:hive-jq-udtf,代碼行數:41,代碼來源:ObjectInspectors.java

示例3: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(@Nonnull ObjectInspector[] argOIs)
        throws UDFArgumentException {
    if (argOIs.length != 1) {
        throw new UDFArgumentException("_FUNC_ takes 1 argument");
    }
    this.argOI = HiveUtils.asDoubleCompatibleOI(argOIs[0]);
    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:10,代碼來源:SigmoidGenericUDF.java

示例4: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 2) {
        throw new UDFArgumentException("angular_similarity takes 2 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:11,代碼來源:AngularSimilarityUDF.java

示例5: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 2) {
        throw new UDFArgumentException("euclid_similarity takes 2 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:11,代碼來源:EuclidSimilarity.java

示例6: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 1) {
        throw new UDFArgumentException("distance2similarity takes 1 argument");
    }
    this.distanceOI = HiveUtils.asDoubleCompatibleOI(argOIs[0]);
    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:9,代碼來源:Distance2SimilarityUDF.java

示例7: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 2) {
        throw new UDFArgumentException("cosine_similarity takes 2 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:11,代碼來源:CosineSimilarityUDF.java

示例8: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 3) {
        throw new UDFArgumentException("minkowski_distance takes 3 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);
    this.order_p = HiveUtils.getAsConstDouble(argOIs[2]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:12,代碼來源:MinkowskiDistanceUDF.java

示例9: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 2) {
        throw new UDFArgumentException("euclid_distance takes 2 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:11,代碼來源:EuclidDistanceUDF.java

示例10: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 2) {
        throw new UDFArgumentException("cosine_distance takes 2 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:11,代碼來源:CosineDistanceUDF.java

示例11: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 2) {
        throw new UDFArgumentException("manhattan_distance takes 2 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:11,代碼來源:ManhattanDistanceUDF.java

示例12: initialize

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 2) {
        throw new UDFArgumentException("angular_distance takes 2 arguments");
    }
    this.arg0ListOI = HiveUtils.asListOI(argOIs[0]);
    this.arg1ListOI = HiveUtils.asListOI(argOIs[1]);

    return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
}
 
開發者ID:apache,項目名稱:incubator-hivemall,代碼行數:11,代碼來源:AngularDistanceUDF.java

示例13: craeteObjectInspectorFromTypeInfo

import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; //導入方法依賴的package包/類
public static ObjectInspector craeteObjectInspectorFromTypeInfo( final TypeInfo typeInfo ){
  switch ( typeInfo.getCategory() ){
    case STRUCT:
      return new MDSStructObjectInspector( (StructTypeInfo)typeInfo );
    case MAP:
      return new MDSMapObjectInspector( (MapTypeInfo)typeInfo );
    case LIST:
      return new MDSListObjectInspector( (ListTypeInfo)typeInfo );
    case UNION:
      UnionTypeInfo unionTypeInfo = (UnionTypeInfo)typeInfo;
      List<ObjectInspector> unionList = new ArrayList<ObjectInspector>();
      for( TypeInfo childTypeInfo : unionTypeInfo.getAllUnionObjectTypeInfos() ){
        unionList.add( craeteObjectInspectorFromTypeInfo( childTypeInfo ) );
      }
      return ObjectInspectorFactory.getStandardUnionObjectInspector( unionList );
    case PRIMITIVE:
      PrimitiveTypeInfo primitiveTypeInfo = (PrimitiveTypeInfo)typeInfo;
      switch( primitiveTypeInfo.getPrimitiveCategory() ){
        case STRING:
          return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
        case BINARY:
          return PrimitiveObjectInspectorFactory.writableBinaryObjectInspector;
        case BOOLEAN:
          return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
        case BYTE:
          return PrimitiveObjectInspectorFactory.writableByteObjectInspector;
        case DOUBLE:
          return PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
        case FLOAT:
          return PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
        case INT:
          return PrimitiveObjectInspectorFactory.writableIntObjectInspector;
        case LONG:
          return PrimitiveObjectInspectorFactory.writableLongObjectInspector;
        case SHORT:
          return PrimitiveObjectInspectorFactory.writableShortObjectInspector;

        case DATE:
        case DECIMAL:
        case TIMESTAMP:
        case VOID:
        default:
        throw new UnsupportedOperationException( "Unknown primitive category " + primitiveTypeInfo.getPrimitiveCategory() );
      }
    default:
      throw new UnsupportedOperationException( "Unknown category " + typeInfo.getCategory() );
  }
}
 
開發者ID:yahoojapan,項目名稱:multiple-dimension-spread,代碼行數:49,代碼來源:MDSObjectInspectorFactory.java


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