@Override public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException { MaterializedField field = MaterializedField.create(ref.getAsNamePart().getName(), Types.repeated(TypeProtos.MinorType.VARCHAR)); try { vector = output.addField(field, RepeatedVarCharVector.class); } catch (Exception e) { handleAndRaise("Failure in setting up reader", e); } }
@Override boolean materialize(final NamedExpression ne, final VectorContainer batch, FunctionLookupContext registry) throws SchemaChangeException { final MaterializedField outputField = MaterializedField.create(ne.getRef().getAsNamePart().getName(), getMajorType()); batch.addOrGet(outputField).allocateNew(); fieldId = batch.getValueVectorId(ne.getRef()); return true; }
new FieldReference("dummy", ExpressionPosition.UNKNOWN, valueFieldIds.get(0).getIntermediateType()); for (TypedFieldId id : valueFieldIds) { materializedValueFields[i++] = MaterializedField.create(ref.getAsNamePart().getName(), id.getIntermediateType());
if (unnestField instanceof RepeatedMapVector) { tp = ((RepeatedMapVector) unnestField) .getTransferPairToSingleMap(reference.getAsNamePart().getName(), oContext.getAllocator()); } else if (!(unnestField instanceof RepeatedValueVector)) { if (incoming.getRecordCount() != 0) { .getTransferPair(reference.getAsNamePart().getName(), oContext.getAllocator()); } else { final ValueVector vvIn = RepeatedValueVector.class.cast(unnestField).getDataVector(); tp = vvIn.getTransferPair(reference.getAsNamePart().getName(), oContext.getAllocator());
tp = ((RepeatedMapVector)flattenField).getTransferPairToSingleMap(reference.getAsNamePart().getName(), oContext.getAllocator()); } else if ( !(flattenField instanceof RepeatedValueVector) ) { if(incoming.getRecordCount() != 0) { tp = RepeatedValueVector.class.cast(vv).getTransferPair(reference.getAsNamePart().getName(), oContext.getAllocator()); } else { final ValueVector vvIn = RepeatedValueVector.class.cast(flattenField).getDataVector(); tp = vvIn.getTransferPair(reference.getAsNamePart().getName(), oContext.getAllocator());
@Override boolean materialize(final NamedExpression ne, final VectorContainer batch, final FunctionLookupContext registry) throws SchemaChangeException { final FunctionCall call = (FunctionCall) ne.getExpr(); final LogicalExpression argument = call.args.get(0); final MaterializedField outputField = MaterializedField.create(ne.getRef().getAsNamePart().getName(), argument.getMajorType()); batch.addOrGet(outputField).allocateNew(); fieldId = batch.getValueVectorId(ne.getRef()); numTiles = numTilesFromExpression(argument); return true; }
@Override boolean materialize(final NamedExpression ne, final VectorContainer batch, final FunctionLookupContext registry) throws SchemaChangeException { final LogicalExpression aggregate = ExpressionTreeMaterializer.materializeAndCheckErrors(ne.getExpr(), batch, registry); if (aggregate == null) { return false; } // add corresponding ValueVector to container final MaterializedField output = MaterializedField.create(ne.getRef().getAsNamePart().getName(), aggregate.getMajorType()); batch.addOrGet(output).allocateNew(); TypedFieldId outputId = batch.getValueVectorId(ne.getRef()); writeAggregationToOutput = new ValueVectorWriteExpression(outputId, aggregate, true); return true; }
@Override boolean materialize(final NamedExpression ne, final VectorContainer batch, final FunctionLookupContext registry) throws SchemaChangeException { final FunctionCall call = (FunctionCall) ne.getExpr(); final LogicalExpression input = ExpressionTreeMaterializer.materializeAndCheckErrors(call.args.get(0), batch, registry); if (input == null) { return false; } final MaterializedField output = MaterializedField.create(ne.getRef().getAsNamePart().getName(), input.getMajorType()); batch.addOrGet(output).allocateNew(); final TypedFieldId outputId = batch.getValueVectorId(ne.getRef()); // write incoming.source[inIndex] to outgoing.last_value[outIndex] writeSourceToLastValue = new ValueVectorWriteExpression(outputId, input, true); return true; }
MaterializedField field = MaterializedField.create(fieldReference.getAsNamePart().getName(), UntypedNullHolder.TYPE); container.add(new UntypedNullVector(field, container.getAllocator()));
final MaterializedField outputField = MaterializedField.create(ne.getRef().getAsNamePart().getName(), expr.getMajorType()); @SuppressWarnings("resource") ValueVector vv = TypeHelper.getNewVector(outputField, oContext.getAllocator()); final MaterializedField outputField = MaterializedField.create(ne.getRef().getAsNamePart().getName(), expr.getMajorType()); @SuppressWarnings("resource") ValueVector vv = TypeHelper.getNewVector(outputField, oContext.getAllocator()); aggrOutFieldIds[i] = container.add(vv); columnMapping.put(outputField.getName(), ne.getRef().getAsNamePart().getName());
@Override boolean materialize(final NamedExpression ne, final VectorContainer batch, final FunctionLookupContext registry) throws SchemaChangeException { final FunctionCall call = (FunctionCall) ne.getExpr(); final LogicalExpression input = ExpressionTreeMaterializer.materializeAndCheckErrors(call.args.get(0), batch, registry); if (input == null) { return false; } final MaterializedField output = MaterializedField.create(ne.getRef().getAsNamePart().getName(), input.getMajorType()); batch.addOrGet(output).allocateNew(); final TypedFieldId outputId = batch.getValueVectorId(ne.getRef()); // write incoming.first_value[inIndex] to outgoing.first_value[outIndex] writeFirstValueToFirstValue = new ValueVectorWriteExpression(outputId, new ValueVectorReadExpression(outputId), true); // write incoming.source[inIndex] to outgoing.first_value[outIndex] writeInputToFirstValue = new ValueVectorWriteExpression(outputId, input, true); return true; }
@Override boolean materialize(final NamedExpression ne, final VectorContainer batch, final FunctionLookupContext registry) throws SchemaChangeException { final FunctionCall call = (FunctionCall) ne.getExpr(); final LogicalExpression input = ExpressionTreeMaterializer.materializeAndCheckErrors(call.args.get(0), batch, registry); if (input == null) { return false; } // make sure output vector type is Nullable, because we will write a null value in the first row of each partition TypeProtos.MajorType majorType = input.getMajorType(); if (majorType.getMode() == TypeProtos.DataMode.REQUIRED) { majorType = Types.optional(majorType.getMinorType()); } // add corresponding ValueVector to container final MaterializedField output = MaterializedField.create(ne.getRef().getAsNamePart().getName(), majorType); batch.addOrGet(output).allocateNew(); final TypedFieldId outputId = batch.getValueVectorId(ne.getRef()); writeInputToLead = new ValueVectorWriteExpression(outputId, input, true); return true; }
@Override boolean materialize(final NamedExpression ne, final VectorContainer batch, final FunctionLookupContext registry) throws SchemaChangeException { final FunctionCall call = (FunctionCall) ne.getExpr(); final LogicalExpression input = ExpressionTreeMaterializer.materializeAndCheckErrors(call.args.get(0), batch, registry); if (input == null) { return false; } // make sure output vector type is Nullable, because we will write a null value in the first row of each partition TypeProtos.MajorType majorType = input.getMajorType(); if (majorType.getMode() == TypeProtos.DataMode.REQUIRED) { majorType = Types.optional(majorType.getMinorType()); } // add lag output ValueVector to container final MaterializedField output = MaterializedField.create(ne.getRef().getAsNamePart().getName(), majorType); batch.addOrGet(output).allocateNew(); final TypedFieldId outputId = batch.getValueVectorId(ne.getRef()); writeInputToLag = new ValueVectorWriteExpression(outputId, input, true); writeLagToLag = new ValueVectorWriteExpression(outputId, new ValueVectorReadExpression(outputId), true); return true; }
final MaterializedField outputField = MaterializedField.create(fieldReference.getAsNamePart().getName(), Types.OPTIONAL_INT); final ValueVector vector = TypeHelper.getNewVector(outputField, oContext.getAllocator());
final ValueVector vvOut = container.addOrGet(MaterializedField.create(ref.getAsNamePart().getName(), vvIn.getField().getType()), callBack); final TransferPair tp = vvIn.makeTransferPair(vvOut);
MaterializedField field = MaterializedField.create(ne.getRef().getAsNamePart().getName(), UntypedNullHolder.TYPE); container.add(new UntypedNullVector(field, container.getAllocator())); valueExprs[i] = expr;