private String convertBytesToString(List<Byte> bytes) { Collections.reverse(bytes); Byte[] byteArray = bytes.toArray(new Byte[bytes.size()]); return new String(ArrayUtils.toPrimitive(byteArray), getCharset()); }
public int[] currentScratchColumns() { TreeSet<Integer> treeSet = new TreeSet<>(); for (Integer col : usedOutputColumns) { treeSet.add(initialOutputCol + col); } return ArrayUtils.toPrimitive(treeSet.toArray(new Integer[0])); }
public int[] currentScratchColumns() { TreeSet<Integer> treeSet = new TreeSet<Integer>(); for (Integer col : usedOutputColumns) { treeSet.add(initialOutputCol + col); } return ArrayUtils.toPrimitive(treeSet.toArray(new Integer[0])); } }
public static int[] getStreamingEvaluatorNums(VectorPTFEvaluatorBase[] evaluators) { final int evaluatorCount = evaluators.length; ArrayList<Integer> streamingEvaluatorNums = new ArrayList<Integer>(); for (int i = 0; i < evaluatorCount; i++) { final VectorPTFEvaluatorBase evaluator = evaluators[i]; if (evaluator.streamsResult()) { streamingEvaluatorNums.add(i); } } return ArrayUtils.toPrimitive(streamingEvaluatorNums.toArray(new Integer[0])); }
public Mapping getMapping() { ArrayList<Integer> orderedColumns = new ArrayList<Integer>(); ArrayList<Integer> valueColumns = new ArrayList<Integer>(); ArrayList<TypeInfo> typeInfos = new ArrayList<TypeInfo>(); for (Map.Entry<Integer, Value> entry : orderedTreeMap.entrySet()) { orderedColumns.add(entry.getKey()); Value value = entry.getValue(); valueColumns.add(value.valueColumn); typeInfos.add(value.typeInfo); } return new Mapping( ArrayUtils.toPrimitive(orderedColumns.toArray(new Integer[0])), ArrayUtils.toPrimitive(valueColumns.toArray(new Integer[0])), typeInfos.toArray(new TypeInfo[0])); } }
/** * <p>Performs an xor on an array of Booleans.</p> * * <pre> * BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE }) = Boolean.FALSE * BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE * BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE }) = Boolean.TRUE * </pre> * * @param array an array of <code>Boolean<code>s * @return <code>true</code> if the xor is successful. * @throws IllegalArgumentException if <code>array</code> is <code>null</code> * @throws IllegalArgumentException if <code>array</code> is empty. * @throws IllegalArgumentException if <code>array</code> contains a <code>null</code> */ public static Boolean xor(Boolean[] array) { if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array is empty"); } boolean[] primitive = null; try { primitive = ArrayUtils.toPrimitive(array); } catch (NullPointerException ex) { throw new IllegalArgumentException("The array must not contain any null elements"); } return xor(primitive) ? Boolean.TRUE : Boolean.FALSE; }
public Mapping getMapping() { ArrayList<Integer> orderedColumns = new ArrayList<Integer>(); ArrayList<Integer> valueColumns = new ArrayList<Integer>(); ArrayList<TypeInfo> typeInfos = new ArrayList<TypeInfo>(); for (Map.Entry<Integer, Value> entry : orderedTreeMap.entrySet()) { orderedColumns.add(entry.getKey()); Value value = entry.getValue(); valueColumns.add(value.valueColumn); typeInfos.add(value.typeInfo); } return new Mapping( ArrayUtils.toPrimitive(orderedColumns.toArray(new Integer[0])), ArrayUtils.toPrimitive(valueColumns.toArray(new Integer[0])), typeInfos.toArray(new TypeInfo[0])); } }
private int[] getByteColumnVectorColumns(int[] outputColumns, TypeInfo[] typeInfos) { // Search mapping for any strings and return their output columns. ArrayList<Integer> list = new ArrayList<Integer>(); final int count = outputColumns.length; for (int i = 0; i < count; i++) { int outputColumn = outputColumns[i]; String typeName = typeInfos[i].getTypeName(); if (VectorizationContext.isStringFamily(typeName)) { list.add(outputColumn); } } return ArrayUtils.toPrimitive(list.toArray(new Integer[0])); }
private int[] getAllBoundaries() { List<Integer> boundaries = new ArrayList<Integer>(1); Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC")); c.setTimeInMillis(0); // c.set doesn't reset millis for (int year = 1902; year <= 2038; year++) { c.set(year, Calendar.JANUARY, 1, 0, 0, 0); int exactly = (int) (c.getTimeInMillis() / (24 * 60 * 60 * 1000)); int before = exactly - 1; int after = exactly + 1; boundaries.add(Integer.valueOf(before)); boundaries.add(Integer.valueOf(exactly)); boundaries.add(Integer.valueOf(after)); } Integer[] indices = boundaries.toArray(new Integer[1]); return ArrayUtils.toPrimitive(indices); }
midLens = ArrayUtils.toPrimitive(lengths.toArray(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY)); middle = checkers.toArray(new MiddleChecker[0]); minLen = len;
/** * Determine from a mapping which columns are BytesColumnVector columns. */ private int[] getByteColumnVectorColumns(VectorColumnMapping mapping) { // Search mapping for any strings and return their output columns. ArrayList<Integer> list = new ArrayList<Integer>(); int count = mapping.getCount(); int[] outputColumns = mapping.getOutputColumns(); TypeInfo[] typeInfos = mapping.getTypeInfos(); for (int i = 0; i < count; i++) { int outputColumn = outputColumns[i]; String typeName = typeInfos[i].getTypeName(); if (VectorizationContext.isStringFamily(typeName)) { list.add(outputColumn); } } return ArrayUtils.toPrimitive(list.toArray(new Integer[0])); }
public static Operator<? extends OperatorDesc> vectorizeTableScanOperator( Operator<? extends OperatorDesc> tableScanOp, VectorizationContext vContext) throws HiveException { TableScanDesc tableScanDesc = (TableScanDesc) tableScanOp.getConf(); VectorTableScanDesc vectorTableScanDesc = new VectorTableScanDesc(); tableScanDesc.setVectorDesc(vectorTableScanDesc); vectorTableScanDesc.setProjectedOutputColumns( ArrayUtils.toPrimitive(vContext.getProjectedColumns().toArray(new Integer[0]))); return tableScanOp; }
int[] noNullsProjection = ArrayUtils.toPrimitive(noNullsProjectionList.toArray(new Integer[0])); int noNullsProjectionSize = noNullsProjection.length; bigTableTypeInfos = typeInfoList.toArray(new TypeInfo[0]);
public void transferToBaseWork(BaseWork baseWork) { String[] allColumnNameArray = allColumnNames.toArray(new String[0]); TypeInfo[] allTypeInfoArray = allTypeInfos.toArray(new TypeInfo[0]); int[] dataColumnNumsArray; if (dataColumnNums != null) { dataColumnNumsArray = ArrayUtils.toPrimitive(dataColumnNums.toArray(new Integer[0])); } else { dataColumnNumsArray = null; } VectorizedRowBatchCtx vectorizedRowBatchCtx = new VectorizedRowBatchCtx( allColumnNameArray, allTypeInfoArray, dataColumnNumsArray, partitionColumnCount, scratchTypeNameArray); baseWork.setVectorizedRowBatchCtx(vectorizedRowBatchCtx); if (baseWork instanceof MapWork) { MapWork mapWork = (MapWork) baseWork; mapWork.setUseVectorizedInputFileFormat(useVectorizedInputFileFormat); } baseWork.setAllNative(allNative); baseWork.setGroupByVectorOutput(groupByVectorOutput); baseWork.setUsesVectorUDFAdaptor(usesVectorUDFAdaptor); } }
groupingSets = ArrayUtils.toPrimitive(conf.getListGroupingSets().toArray(new Long[0])); groupingSetsPosition = conf.getGroupingSetPosition();
List<Integer> projectedColumns = vContext.getProjectedColumns(); vectorTableScanDesc.setProjectedColumns( ArrayUtils.toPrimitive(projectedColumns.toArray(new Integer[0]))); List<String> allColumnNameList = vectorTaskColumnInfo.allColumnNames; List<TypeInfo> allTypeInfoList = vectorTaskColumnInfo.allTypeInfos;
int[] noNullsProjection = ArrayUtils.toPrimitive(noNullsProjectionList.toArray(new Integer[0])); int noNullsProjectionSize = noNullsProjection.length; bigTableTypeInfos = typeInfoList.toArray(new TypeInfo[0]);
writePartitions = ArrayUtils.toPrimitive(localPartitions.toArray(new Integer[localPartitions.size()]));
groupingSets = ArrayUtils.toPrimitive(conf.getListGroupingSets().toArray(new Integer[0])); groupingSetsPosition = conf.getGroupingSetPosition();
ArrayUtils.toPrimitive( vOutContext.getProjectedColumns().subList(0, bigTableRetainSize). toArray(new Integer[0]));