当前位置: 首页>>代码示例>>Java>>正文


Java ListObjectInspector.getListElementObjectInspector方法代码示例

本文整理汇总了Java中org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector.getListElementObjectInspector方法的典型用法代码示例。如果您正苦于以下问题:Java ListObjectInspector.getListElementObjectInspector方法的具体用法?Java ListObjectInspector.getListElementObjectInspector怎么用?Java ListObjectInspector.getListElementObjectInspector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector的用法示例。


在下文中一共展示了ListObjectInspector.getListElementObjectInspector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 4 && argOIs.length != 5) {
        throw new UDFArgumentException("_FUNC_ takes 4 or 5 arguments");
    }

    this.modelTypeOI = HiveUtils.asIntegerOI(argOIs[1]);
    this.stringOI = HiveUtils.asStringOI(argOIs[2]);
    ListObjectInspector listOI = HiveUtils.asListOI(argOIs[3]);
    this.featureListOI = listOI;
    ObjectInspector elemOI = listOI.getListElementObjectInspector();
    this.featureElemOI = HiveUtils.asDoubleCompatibleOI(elemOI);

    boolean classification = false;
    if (argOIs.length == 5) {
        classification = HiveUtils.getConstBoolean(argOIs[4]);
    }
    this.classification = classification;

    if (classification) {
        return PrimitiveObjectInspectorFactory.writableIntObjectInspector;
    } else {
        return PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
    }
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:26,代码来源:TreePredictUDFv1.java

示例2: readListOfOutputsFromTable

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
/**
* Read list of Bitcoin transaction outputs from a table in Hive in any format (e.g. ORC, Parquet)
*
* @param loi ObjectInspector for processing the Object containing a list
* @param listOfOutputsObject object containing the list of outputs to a Bitcoin Transaction
*
* @return a list of BitcoinTransactionOutputs 
*
*/

private List<BitcoinTransactionOutput> readListOfOutputsFromTable(ListObjectInspector loi, Object listOfOutputsObject) {
int listLength=loi.getListLength(listOfOutputsObject);
List<BitcoinTransactionOutput> result=new ArrayList<>(listLength);
StructObjectInspector listOfOutputsElementObjectInspector = (StructObjectInspector)loi.getListElementObjectInspector();
	for (int i=0;i<listLength;i++) {
		Object currentListOfOutputsObject = loi.getListElement(listOfOutputsObject,i);
		StructField valueSF = listOfOutputsElementObjectInspector.getStructFieldRef("value");
		StructField txoutscriptlengthSF = listOfOutputsElementObjectInspector.getStructFieldRef("txoutscriptlength");
		StructField txoutscriptSF = listOfOutputsElementObjectInspector.getStructFieldRef("txoutscript");
		if ((valueSF==null) || (txoutscriptlengthSF==null) || (txoutscriptSF==null)) {
			LOG.warn("Invalid BitcoinTransactionOutput detected at position "+i);
			return new ArrayList<>();
		}
		long currentValue=wloi.get(listOfOutputsElementObjectInspector.getStructFieldData(currentListOfOutputsObject,valueSF));	
		byte[] currentTxOutScriptLength=wboi.getPrimitiveJavaObject(listOfOutputsElementObjectInspector.getStructFieldData(currentListOfOutputsObject,txoutscriptlengthSF));
		byte[] currentTxOutScript=wboi.getPrimitiveJavaObject(listOfOutputsElementObjectInspector.getStructFieldData(currentListOfOutputsObject,txoutscriptSF));
		BitcoinTransactionOutput currentBitcoinTransactionOutput = new BitcoinTransactionOutput(currentValue,currentTxOutScriptLength,currentTxOutScript);
		result.add(currentBitcoinTransactionOutput);
	}
return result;
}
 
开发者ID:ZuInnoTe,项目名称:hadoopcryptoledger,代码行数:32,代码来源:BitcoinTransactionHashUDF.java

示例3: getByteBuffers

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
/**
 * This method currently supports BinarySet data type of DynamoDB
 */
public List<ByteBuffer> getByteBuffers(Object data, ObjectInspector objectInspector, String
    ddType) {
  ListObjectInspector listObjectInspector = (ListObjectInspector) objectInspector;
  List<?> dataList = listObjectInspector.getList(data);

  if (dataList == null) {
    return null;
  }

  ObjectInspector itemObjectInspector = listObjectInspector.getListElementObjectInspector();
  List<ByteBuffer> itemList = new ArrayList<ByteBuffer>();
  for (Object dataItem : dataList) {
    if (dataItem == null) {
      throw new RuntimeException("Null element found in list: " + dataList);
    }

    if (ddType.equals("BS")) {
      itemList.add(getByteBuffer(dataItem, itemObjectInspector));
    } else {
      throw new RuntimeException("Expecting BinarySet type: " + ddType);
    }
  }

  return itemList;
}
 
开发者ID:awslabs,项目名称:emr-dynamodb-connector,代码行数:29,代码来源:DynamoDBDataParser.java

示例4: initialize

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
@Override
public StructObjectInspector initialize(@Nonnull ObjectInspector[] argOIs)
        throws UDFArgumentException {
    if (argOIs.length != 4 && argOIs.length != 5) {
        throw new UDFArgumentException(this.getClass().getSimpleName()
                + " takes 4 or 5 arguments: string rowid, string[] features, string model_id,"
                + " array<byte> pred_model [, string options]: " + argOIs.length);
    } else {
        this.processOptions(argOIs);
        this.rowIdOI = HiveUtils.asStringOI(argOIs[0]);
        final ListObjectInspector listOI = HiveUtils.asListOI(argOIs[1]);
        final ObjectInspector elemOI = listOI.getListElementObjectInspector();
        this.featureListOI = listOI;
        this.featureElemOI = HiveUtils.asStringOI(elemOI);
        this.modelIdOI = HiveUtils.asStringOI(argOIs[2]);
        this.modelOI = HiveUtils.asBinaryOI(argOIs[3]);
        this.mapToModel = new HashMap<String, Booster>();
        this.rowBuffer = new HashMap<String, List<LabeledPointWithRowId>>();
        return getReturnOI();
    }
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:22,代码来源:XGBoostPredictUDTF.java

示例5: getFeatureType

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
@Nonnull
private static FeatureType getFeatureType(@Nonnull ListObjectInspector featureListOI)
        throws UDFArgumentException {
    final ObjectInspector featureOI = featureListOI.getListElementObjectInspector();
    if (featureOI instanceof StringObjectInspector) {
        return FeatureType.STRING;
    } else if (featureOI instanceof IntObjectInspector) {
        return FeatureType.INT;
    } else if (featureOI instanceof LongObjectInspector) {
        return FeatureType.LONG;
    } else {
        throw new UDFArgumentException("Feature object inspector must be one of "
                + "[StringObjectInspector, IntObjectInspector, LongObjectInspector]: "
                + featureOI.toString());
    }
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:17,代码来源:GeneralLearnerBaseUDTF.java

示例6: evaluate

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
    ret.clear();

    for (int i = 0; i < arguments.length; i++) {
        final Object arrayObject = arguments[i].get();
        if (arrayObject == null) {
            continue;
        }

        final ListObjectInspector arrayOI = (ListObjectInspector) argumentOIs[i];
        final int arraylength = arrayOI.getListLength(arrayObject);
        for (int j = 0; j < arraylength; j++) {
            Object rawObj = arrayOI.getListElement(arrayObject, j);
            ObjectInspector elemOI = arrayOI.getListElementObjectInspector();
            Object obj = ObjectInspectorUtils.copyToStandardObject(rawObj, elemOI);
            ret.add(obj);
        }
    }

    return ret;
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:23,代码来源:ArrayConcatUDF.java

示例7: createArray

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
private ArrayWritable createArray(final Object obj, final ListObjectInspector inspector)
    throws SerDeException {
  final List<?> sourceArray = inspector.getList(obj);
  final ObjectInspector subInspector = inspector.getListElementObjectInspector();
  final List<Writable> array = new ArrayList<Writable>();
  if (sourceArray != null) {
    for (final Object curObj : sourceArray) {
      final Writable newObj = createObject(curObj, subInspector);
      if (newObj != null) {
        array.add(newObj);
      }
    }
  }
  if (array.size() > 0) {
    final ArrayWritable subArray = new ArrayWritable(array.get(0).getClass(),
        array.toArray(new Writable[array.size()]));
    return new ArrayWritable(Writable.class, new Writable[] {subArray});
  } else {
    return null;
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:22,代码来源:ParquetHiveSerDe.java

示例8: initialize

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
@Override
public ObjectInspector initialize(ObjectInspector[] arguments)
    throws UDFArgumentException {

  mapOI = (MapObjectInspector)arguments[0];
  arrayOI = (ListObjectInspector)arguments[1];

  // Check map against key.
  ObjectInspector mapItemOI = mapOI.getMapKeyObjectInspector();

  ObjectInspector listItemOI = arrayOI.getListElementObjectInspector();

  if (!ObjectInspectorUtils.compareTypes(mapItemOI, listItemOI)) {
    throw new UDFArgumentException("Map key type (" + mapItemOI + ") must match " + 
                                   "list element type (" + listItemOI + ").");
  }

  return ObjectInspectorUtils.getStandardObjectInspector(mapOI,
            ObjectInspectorCopyOption.WRITABLE);
}
 
开发者ID:brndnmtthws,项目名称:facebook-hive-udfs,代码行数:21,代码来源:UDFMapExclude.java

示例9: deparseObject

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
public static Object deparseObject(Object field, ObjectInspector fieldOI) throws SerDeException {
    switch(fieldOI.getCategory()) {
        case PRIMITIVE: {
            PrimitiveObjectInspector oi = (PrimitiveObjectInspector) fieldOI;
            return oi.getPrimitiveJavaObject(field);
        }
        case LIST: {
            ListObjectInspector listOI = (ListObjectInspector) fieldOI;
            List<?> elements = listOI.getList(field);
            List<Object> list = new ArrayList<Object>(elements.size());
            ObjectInspector elemOI = listOI.getListElementObjectInspector();
            for(Object elem : elements) {
                Object o = deparseObject(elem, elemOI);
                list.add(o);
            }
            return list;
        }
        default:
            throw new SerDeException("Unexpected fieldOI: " + fieldOI);
    }
}
 
开发者ID:myui,项目名称:HiveJdbcStorageHandler,代码行数:22,代码来源:HiveJdbcBridgeUtils.java

示例10: convert

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
/**
 * Convert the value using the ObjectInspector. The Writable values are converted to their
 * respective Java objects from using the provided inspector.
 *
 * @param oi the field object inspector
 * @param value the value
 * @return the corresponding Java object value
 */
public static Object convert(final ObjectInspector oi, final Object value) {
  if (value == null) {
    return null;
  }
  Object outValue = null;
  switch (oi.getCategory()) {
    case PRIMITIVE:
      outValue = OrcReadFunctionMap.get(oi.getTypeName()).apply(value);
      break;
    case LIST:
      final ListObjectInspector loi = (ListObjectInspector) oi;
      final ObjectInspector eoi = loi.getListElementObjectInspector();
      outValue =
          loi.getList(value).stream().map(e -> convert(eoi, e)).collect(Collectors.toList());
      break;
    case MAP:
      final MapObjectInspector moi = (MapObjectInspector) oi;
      final ObjectInspector koi = moi.getMapKeyObjectInspector();
      final ObjectInspector voi = moi.getMapValueObjectInspector();
      outValue = moi.getMap(value).entrySet().stream()
          .collect(Collectors.toMap(e -> convert(koi, e.getKey()),
              e -> convert(voi, e.getValue()), throwingMerger(), LinkedHashMap::new));
      break;
    case STRUCT:
      final StructObjectInspector soi = (StructObjectInspector) oi;
      outValue = soi.getAllStructFieldRefs().stream()
          .map(e -> convert(e.getFieldObjectInspector(), soi.getStructFieldData(value, e)))
          .toArray();
      break;
    case UNION:
      final UnionObjectInspector uoi = (UnionObjectInspector) oi;
      final List<? extends ObjectInspector> ois = uoi.getObjectInspectors();
      final byte tag = uoi.getTag(value);
      outValue = new Object[] {tag, convert(ois.get(tag), uoi.getField(value))};
      break;
  }
  return outValue;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:47,代码来源:OrcUtils.java

示例11: readListOfInputsFromTable

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
/**
* Read list of Bitcoin transaction inputs from a table in Hive in any format (e.g. ORC, Parquet)
*
* @param loi ObjectInspector for processing the Object containing a list
* @param listOfInputsObject object containing the list of inputs to a Bitcoin Transaction
*
* @return a list of BitcoinTransactionInputs 
*
*/

private List<BitcoinTransactionInput> readListOfInputsFromTable(ListObjectInspector loi, Object listOfInputsObject) {
int listLength=loi.getListLength(listOfInputsObject);
List<BitcoinTransactionInput> result = new ArrayList<>(listLength);
StructObjectInspector listOfInputsElementObjectInspector = (StructObjectInspector)loi.getListElementObjectInspector();
for (int i=0;i<listLength;i++) {
	Object currentlistofinputsObject = loi.getListElement(listOfInputsObject,i);
	StructField prevtransactionhashSF = listOfInputsElementObjectInspector.getStructFieldRef("prevtransactionhash");
	StructField previoustxoutindexSF = listOfInputsElementObjectInspector.getStructFieldRef("previoustxoutindex");
	StructField txinscriptlengthSF = listOfInputsElementObjectInspector.getStructFieldRef("txinscriptlength");
	StructField txinscriptSF = listOfInputsElementObjectInspector.getStructFieldRef("txinscript");
	StructField seqnoSF = listOfInputsElementObjectInspector.getStructFieldRef("seqno");
	boolean prevFieldsNull = (prevtransactionhashSF==null) || (previoustxoutindexSF==null);
	boolean inFieldsNull = (txinscriptlengthSF==null) || (txinscriptSF==null);
	boolean otherAttribNull = seqnoSF==null;
	if (prevFieldsNull || inFieldsNull  || otherAttribNull) {
		LOG.warn("Invalid BitcoinTransactionInput detected at position "+i);
		return new ArrayList<>();
	}
	byte[] currentPrevTransactionHash = wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,prevtransactionhashSF));
	long currentPreviousTxOutIndex = wloi.get(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,previoustxoutindexSF));
	byte[] currentTxInScriptLength= wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,txinscriptlengthSF));
	byte[] currentTxInScript= wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,txinscriptSF));
	long currentSeqNo = wloi.get(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,seqnoSF));
	BitcoinTransactionInput currentBitcoinTransactionInput = new BitcoinTransactionInput(currentPrevTransactionHash,currentPreviousTxOutIndex,currentTxInScriptLength,currentTxInScript,currentSeqNo);
	result.add(currentBitcoinTransactionInput);
}
return result;
}
 
开发者ID:ZuInnoTe,项目名称:hadoopcryptoledger,代码行数:39,代码来源:BitcoinTransactionHashUDF.java

示例12: readListOfBitcoinScriptWitnessFromTable

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
/**
* Read list of Bitcoin ScriptWitness items from a table in Hive in any format (e.g. ORC, Parquet)
*
* @param loi ObjectInspector for processing the Object containing a list
* @param listOfScriptWitnessItemObject object containing the list of scriptwitnessitems of a Bitcoin Transaction
*
* @return a list of BitcoinScriptWitnessItem 
*
*/

private List<BitcoinScriptWitnessItem> readListOfBitcoinScriptWitnessFromTable(ListObjectInspector loi, Object listOfScriptWitnessItemObject) {
int listLength=loi.getListLength(listOfScriptWitnessItemObject);
List<BitcoinScriptWitnessItem> result = new ArrayList<>(listLength);
StructObjectInspector listOfScriptwitnessItemElementObjectInspector = (StructObjectInspector)loi.getListElementObjectInspector();
for (int i=0;i<listLength;i++) {
	Object currentlistofscriptwitnessitemObject = loi.getListElement(listOfScriptWitnessItemObject,i);
	StructField stackitemcounterSF = listOfScriptwitnessItemElementObjectInspector.getStructFieldRef("stackitemcounter");
	StructField scriptwitnesslistSF = listOfScriptwitnessItemElementObjectInspector.getStructFieldRef("scriptwitnesslist");
	boolean scriptwitnessitemNull = (stackitemcounterSF==null) || (scriptwitnesslistSF==null) ; 
	if (scriptwitnessitemNull) {
		LOG.warn("Invalid BitcoinScriptWitnessItem detected at position "+i);
		return new ArrayList<>();
	}
	byte[] stackItemCounter = wboi.getPrimitiveJavaObject(listOfScriptwitnessItemElementObjectInspector.getStructFieldData(currentlistofscriptwitnessitemObject,stackitemcounterSF));
	Object listofscriptwitnessObject =  soi.getStructFieldData(currentlistofscriptwitnessitemObject,scriptwitnesslistSF);
	ListObjectInspector loiScriptWitness=(ListObjectInspector)scriptwitnesslistSF.getFieldObjectInspector();
	StructObjectInspector listOfScriptwitnessElementObjectInspector = (StructObjectInspector)loiScriptWitness.getListElementObjectInspector();
	int listWitnessLength = 	loiScriptWitness.getListLength(listofscriptwitnessObject);
	List<BitcoinScriptWitness> currentScriptWitnessList = new ArrayList<>(listWitnessLength);
	for (int j=0;j<listWitnessLength;j++) {
		Object currentlistofscriptwitnessObject = loi.getListElement(listofscriptwitnessObject,j);
		
		StructField witnessscriptlengthSF = listOfScriptwitnessElementObjectInspector.getStructFieldRef("witnessscriptlength");
		StructField witnessscriptSF = listOfScriptwitnessElementObjectInspector.getStructFieldRef("witnessscript");
		boolean scriptwitnessNull = (witnessscriptlengthSF==null)  || (witnessscriptSF==null);
		if (scriptwitnessNull) {
			LOG.warn("Invalid BitcoinScriptWitness detected at position "+j+ "for BitcoinScriptWitnessItem "+i);
			return new ArrayList<>();
		}
		byte[] scriptWitnessLength = wboi.getPrimitiveJavaObject(listOfScriptwitnessElementObjectInspector.getStructFieldData(currentlistofscriptwitnessObject,witnessscriptlengthSF));
		byte[] scriptWitness = wboi.getPrimitiveJavaObject(listOfScriptwitnessElementObjectInspector.getStructFieldData(currentlistofscriptwitnessObject,witnessscriptSF));
		currentScriptWitnessList.add(new BitcoinScriptWitness(scriptWitnessLength,scriptWitness));
	}
	BitcoinScriptWitnessItem currentBitcoinScriptWitnessItem = new BitcoinScriptWitnessItem(stackItemCounter,currentScriptWitnessList);
	result.add(currentBitcoinScriptWitnessItem);
}
return result;
}
 
开发者ID:ZuInnoTe,项目名称:hadoopcryptoledger,代码行数:49,代码来源:BitcoinTransactionHashSegwitUDF.java

示例13: getListAttribute

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
/**
 * This method currently supports StringSet and NumberSet data type of DynamoDB
 */
public List<String> getListAttribute(Object data, ObjectInspector objectInspector, String
    ddType) {
  ListObjectInspector listObjectInspector = (ListObjectInspector) objectInspector;
  List<?> dataList = listObjectInspector.getList(data);

  if (dataList == null) {
    return null;
  }

  ObjectInspector itemObjectInspector = listObjectInspector.getListElementObjectInspector();
  List<String> itemList = new ArrayList<String>();
  for (Object dataItem : dataList) {
    if (dataItem == null) {
      throw new RuntimeException("Null element found in list: " + dataList);
    }

    if (ddType.equals("SS")) {
      itemList.add(getString(dataItem, itemObjectInspector));
    } else if (ddType.equals("NS")) {
      itemList.add(getNumber(dataItem, itemObjectInspector));
    } else {
      throw new RuntimeException("Unsupported dynamodb type: " + ddType);
    }
  }

  return itemList;
}
 
开发者ID:awslabs,项目名称:emr-dynamodb-connector,代码行数:31,代码来源:DynamoDBDataParser.java

示例14: initialize

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
@Override
public StructObjectInspector initialize(@Nonnull ObjectInspector[] argOIs)
        throws UDFArgumentException {
    processOptions(argOIs);
    final ListObjectInspector listOI = HiveUtils.asListOI(argOIs[0]);
    final ObjectInspector elemOI = listOI.getListElementObjectInspector();
    this.featureListOI = listOI;
    this.featureElemOI = HiveUtils.asStringOI(elemOI);
    this.targetOI = HiveUtils.asDoubleCompatibleOI(argOIs[1]);
    return getReturnOIs();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:12,代码来源:XGBoostUDTF.java

示例15: initialize

import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; //导入方法依赖的package包/类
@Override
public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
    if (argOIs.length != 3 && argOIs.length != 4) {
        throw new UDFArgumentException("_FUNC_ takes 3 or 4 arguments");
    }

    this.modelOI = HiveUtils.asStringOI(argOIs[1]);
    ListObjectInspector listOI = HiveUtils.asListOI(argOIs[2]);
    this.featureListOI = listOI;
    ObjectInspector elemOI = listOI.getListElementObjectInspector();
    if (HiveUtils.isNumberOI(elemOI)) {
        this.featureElemOI = HiveUtils.asDoubleCompatibleOI(elemOI);
        this.denseInput = true;
    } else if (HiveUtils.isStringOI(elemOI)) {
        this.featureElemOI = HiveUtils.asStringOI(elemOI);
        this.denseInput = false;
    } else {
        throw new UDFArgumentException(
            "_FUNC_ takes array<double> or array<string> for the second argument: "
                    + listOI.getTypeName());
    }

    boolean classification = false;
    if (argOIs.length == 4) {
        classification = HiveUtils.getConstBoolean(argOIs[3]);
    }
    this.classification = classification;

    if (classification) {
        List<String> fieldNames = new ArrayList<String>(2);
        List<ObjectInspector> fieldOIs = new ArrayList<ObjectInspector>(2);
        fieldNames.add("value");
        fieldOIs.add(PrimitiveObjectInspectorFactory.writableIntObjectInspector);
        fieldNames.add("posteriori");
        fieldOIs.add(ObjectInspectorFactory.getStandardListObjectInspector(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector));
        return ObjectInspectorFactory.getStandardStructObjectInspector(fieldNames, fieldOIs);
    } else {
        return PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
    }
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:41,代码来源:TreePredictUDF.java


注:本文中的org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector.getListElementObjectInspector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。