private void initializeFullOuterObjects() throws HiveException { // The Small Table key type jnfo is the same as Big Table's. TypeInfo[] smallTableKeyTypeInfos = bigTableKeyTypeInfos; final int allKeysSize = smallTableKeyTypeInfos.length; /* * The VectorMapJoinFullOuter{Long|MultiKey|String}Operator outputs 0, 1, or more * Small Key columns in the join result. */ allSmallTableKeyColumnNums = new int[allKeysSize]; Arrays.fill(allSmallTableKeyColumnNums, -1); allSmallTableKeyColumnIncluded = new boolean[allKeysSize]; final int outputKeysSize = fullOuterSmallTableKeyMapping.getCount(); int[] outputKeyNums = fullOuterSmallTableKeyMapping.getInputColumns(); int[] outputKeyOutputColumns = fullOuterSmallTableKeyMapping.getOutputColumns(); for (int i = 0; i < outputKeysSize; i++) { final int outputKeyNum = outputKeyNums[i]; allSmallTableKeyColumnNums[outputKeyNum] = outputKeyOutputColumns[i]; allSmallTableKeyColumnIncluded[outputKeyNum] = true; } if (hashTableKeyType == HashTableKeyType.MULTI_KEY && outputKeysSize > 0) { smallTableKeyOuterVectorDeserializeRow = new VectorDeserializeRow<BinarySortableDeserializeRead>( new BinarySortableDeserializeRead( smallTableKeyTypeInfos, /* useExternalBuffer */ true)); smallTableKeyOuterVectorDeserializeRow.init( allSmallTableKeyColumnNums, allSmallTableKeyColumnIncluded); } }
protected void determineCommonInfo(boolean isOuter) throws HiveException { smallTableOutputVectorColumns = smallTableMapping.getOutputColumns(); outputProjection = projectionMapping.getOutputColumns(); outputTypeInfos = projectionMapping.getTypeInfos(); LOG.debug(getLoggingPrefix() + " VectorMapJoinCommonOperator constructor smallTableMapping " + smallTableMapping.toString());
new VectorColumnSourceMapping("Full Outer Small Table Key Mapping"); new VectorColumnSourceMapping("Small Table Value Mapping"); VectorColumnSourceMapping projectionMapping = new VectorColumnSourceMapping("Projection Mapping"); projectionMapping.add(nextOutputColumn, batchColumnIndex, typeInfo); projectionMapping.add(nextOutputColumn, bigTableKeyColumn, typeInfo); projectionMapping.add(nextOutputColumn, scratchColumn, typeInfo); fullOuterSmallTableKeyMapping.add(keyIndex, scratchColumn, typeInfo); projectionMapping.add(nextOutputColumn, scratchColumn, typeInfo); smallTableValueMapping.add(smallTableValueIndex, scratchColumn, typeInfo); projectionMapping.add(nextOutputColumn, scratchColumn, typeInfo); smallTableValueMapping.add(smallTableValueIndex, scratchColumn, typeInfo); nextOutputColumn++; fullOuterSmallTableKeyMapping.finalize(); smallTableValueMapping.finalize(); projectionMapping.finalize();
smallTableMapping = new VectorColumnSourceMapping("Small Table Mapping"); VectorColumnSourceMapping projectionMapping = new VectorColumnSourceMapping("Projection Mapping"); projectionMapping.add(nextOutputColumn, batchColumnIndex, typeName); projectionMapping.add(nextOutputColumn, batchKeyColumn, typeName); projectionMapping.add(nextOutputColumn, scratchColumn, typeName); projectionMapping.add(nextOutputColumn, scratchColumn, typeName); smallTableMapping.add(smallTableValueIndex, scratchColumn, typeName); projectionMapping.add(nextOutputColumn, scratchColumn, typeName); smallTableMapping.add(smallTableValueIndex, scratchColumn, typeName); nextOutputColumn++; smallTableMapping.finalize(); smallTableOutputVectorColumns = smallTableMapping.getOutputColumns(); projectionMapping.finalize(); assert projectionMapping.isSourceSequenceGood(); outputProjection = projectionMapping.getOutputColumns(); outputTypeNames = projectionMapping.getTypeNames();
if (smallTableMapping.getCount() > 0) { smallTableVectorDeserializeRow = new VectorDeserializeRow<LazyBinaryDeserializeRead>( new LazyBinaryDeserializeRead( smallTableMapping.getTypeInfos(), /* useExternalBuffer */ true)); smallTableVectorDeserializeRow.init(smallTableMapping.getOutputColumns());
if (smallTableMapping.getCount() > 0) { smallTableVectorDeserializeRow = new VectorDeserializeRow( new LazyBinaryDeserializeRead( VectorizedBatchUtil.primitiveTypeInfosFromTypeNames( smallTableMapping.getTypeNames()))); smallTableVectorDeserializeRow.init(smallTableMapping.getOutputColumns());
new VectorColumnSourceMapping("Small Table Mapping"); VectorColumnSourceMapping projectionMapping = new VectorColumnSourceMapping("Projection Mapping"); projectionMapping.add(nextOutputColumn, batchColumnIndex, typeInfo); projectionMapping.add(nextOutputColumn, batchKeyColumn, typeInfo); projectionMapping.add(nextOutputColumn, scratchColumn, typeInfo); projectionMapping.add(nextOutputColumn, scratchColumn, typeInfo); smallTableMapping.add(smallTableValueIndex, scratchColumn, typeInfo); int scratchColumn = vContext.allocateScratchColumn(typeInfo); projectionMapping.add(nextOutputColumn, scratchColumn, typeInfo); smallTableMapping.add(smallTableValueIndex, scratchColumn, typeInfo); nextOutputColumn++; smallTableMapping.finalize(); vectorMapJoinInfo.setSmallTableMapping(smallTableMapping); projectionMapping.finalize(); assert projectionMapping.isSourceSequenceGood();
if (smallTableValueMapping.getCount() > 0) { smallTableValueVectorDeserializeRow = new VectorDeserializeRow<LazyBinaryDeserializeRead>( new LazyBinaryDeserializeRead( smallTableValueMapping.getTypeInfos(), /* useExternalBuffer */ true)); smallTableValueVectorDeserializeRow.init(smallTableValueMapping.getOutputColumns());
new VectorColumnSourceMapping("Full Outer Small Table Key Mapping"); new VectorColumnSourceMapping("Projection Mapping"); final int batchColumnIndex = testDesc.bigTableRetainColumnNums[i]; TypeInfo typeInfo = testDesc.bigTableTypeInfos[i]; projectionMapping.add( nextOutputColumn, batchColumnIndex, typeInfo); projectionMapping.add(nextOutputColumn, bigTableKeyColumnNum, keyTypeInfo); if (!bigTableRetainMapping.containsOutputColumn(bigTableKeyColumnNum)) { nonOuterSmallTableKeyMapping.add(bigTableKeyColumnNum, bigTableKeyColumnNum, keyTypeInfo); projectionMapping.add(nextOutputColumn, emulateScratchColumn, keyTypeInfo); fullOuterSmallTableKeyMapping.add(smallTableKeyColumnNum, emulateScratchColumn, keyTypeInfo); emulateScratchColumn++; new VectorColumnSourceMapping("Small Table Value Mapping"); for (int i = 0; i < testDesc.smallTableValueTypeInfos.length; i++) { smallTableValueMapping.add(i, emulateScratchColumn, testDesc.smallTableValueTypeInfos[i]); projectionMapping.add(nextOutputColumn, emulateScratchColumn, testDesc.smallTableValueTypeInfos[i]); emulateScratchColumn++; nextOutputColumn++; fullOuterSmallTableKeyMapping.finalize(); smallTableValueMapping.finalize();
smallTableValueColumnMap = smallTableValueMapping.getOutputColumns(); getByteColumnVectorColumns(smallTableValueMapping); outputProjection = projectionMapping.getOutputColumns(); outputTypeInfos = projectionMapping.getTypeInfos(); fullOuterSmallTableKeyMapping.toString()); smallTableValueMapping.toString());