private MapVector getOrCreateFamilyVector(String familyName, boolean allocateOnCreate) { try { MapVector v = familyVectorMap.get(familyName); if(v == null) { SchemaPath column = SchemaPath.getSimplePath(familyName); MaterializedField field = MaterializedField.create(column.getAsNamePart().getName(), COLUMN_FAMILY_TYPE); v = outputMutator.addField(field, MapVector.class); if (allocateOnCreate) { v.allocateNew(); } getColumns().add(column); familyVectorMap.put(familyName, v); } return v; } catch (SchemaChangeException e) { throw new DrillRuntimeException(e); } }
@Override public TypeProtos.MajorType getVectorType(SchemaPath column, PlannerSettings plannerSettings) { HiveScan hiveScan = (HiveScan) scanRel.getGroupScan(); String partitionName = column.getAsNamePart().getName(); Map<String, String> partitionNameTypeMap = hiveScan.getHiveReadEntry().table.getPartitionNameTypeMap(); String hiveType = partitionNameTypeMap.get(partitionName); PrimitiveTypeInfo primitiveTypeInfo = (PrimitiveTypeInfo) TypeInfoUtils.getTypeInfoFromTypeString(hiveType); TypeProtos.MinorType partitionType = HiveUtilities.getMinorTypeFromHivePrimitiveTypeInfo(primitiveTypeInfo, plannerSettings.getOptions()); return TypeProtos.MajorType.newBuilder().setMode(TypeProtos.DataMode.OPTIONAL).setMinorType(partitionType).build(); }
MaterializedField field = MaterializedField.create(column.getAsNamePart().getName(), ROW_KEY_TYPE); rowKeyVector = outputMutator.addField(field, VarBinaryVector.class); } else {
if (column.getAsNamePart().hasChild()) { throw UserException .validationError() String name = column.getAsNamePart().getName();
private MapVector getOrCreateFamilyVector(String familyName, boolean allocateOnCreate) { try { MapVector v = familyVectorMap.get(familyName); if(v == null) { SchemaPath column = SchemaPath.getSimplePath(familyName); MaterializedField field = MaterializedField.create(column.getAsNamePart().getName(), COLUMN_FAMILY_TYPE); v = outputMutator.addField(field, MapVector.class); if (allocateOnCreate) { v.allocateNew(); } getColumns().add(column); familyVectorMap.put(familyName, v); } return v; } catch (SchemaChangeException e) { throw new DrillRuntimeException(e); } }
public RangePartitionRecordBatch(RangePartitionSender popConfig, RecordBatch incoming, FragmentContext context) throws OutOfMemoryException { super(popConfig, context, incoming); this.numPartitions = popConfig.getDestinations().size(); SchemaPath outputPath = popConfig.getPartitionFunction().getPartitionFieldRef(); MaterializedField outputField = MaterializedField.create(outputPath.getAsNamePart().getName(), Types.required(TypeProtos.MinorType.INT)); this.partitionIdVector = (IntVector) TypeHelper.getNewVector(outputField, oContext.getAllocator()); this.transfers = Lists.newArrayList(); }
MaterializedField field = MaterializedField.create(column.getAsNamePart().getName(), ROW_KEY_TYPE); rowKeyVector = outputMutator.addField(field, VarBinaryVector.class); } else {
public OrderedPartitionRecordBatch(OrderedPartitionSender pop, RecordBatch incoming, FragmentContext context) throws OutOfMemoryException { super(pop, context); this.incoming = incoming; this.partitions = pop.getDestinations().size(); this.sendingMajorFragmentWidth = pop.getSendingWidth(); this.recordsToSample = pop.getRecordsToSample(); this.samplingFactor = pop.getSamplingFactor(); this.completionFactor = pop.getCompletionFactor(); DistributedCache cache = null; // Clearly, this code is not used! this.mmap = cache.getMultiMap(MULTI_CACHE_CONFIG); this.tableMap = cache.getMap(SINGLE_CACHE_CONFIG); Preconditions.checkNotNull(tableMap); this.mapKey = String.format("%s_%d", context.getHandle().getQueryId(), context.getHandle().getMajorFragmentId()); this.minorFragmentSampleCount = cache.getCounter(mapKey); SchemaPath outputPath = popConfig.getRef(); MaterializedField outputField = MaterializedField.create(outputPath.getAsNamePart().getName(), Types.required(TypeProtos.MinorType.INT)); this.partitionKeyVector = (IntVector) TypeHelper.getNewVector(outputField, oContext.getAllocator()); }
columnMapping.put(outputField.getName(), ((SchemaPath) ((FunctionCall) ne.getExpr()).args.get(0)).getAsNamePart().getName()); } else if (((FunctionCall) ne.getExpr()).args.get(0) instanceof FunctionCall) { FunctionCall functionCall = (FunctionCall) ((FunctionCall) ne.getExpr()).args.get(0); if (functionCall.args.get(0) instanceof SchemaPath) { columnMapping.put(outputField.getName(), ((SchemaPath) functionCall.args.get(0)).getAsNamePart().getName());