use of org.apache.asterix.om.base.AInt32 in project asterixdb by apache.
the class RTreeAccessMethod method createSecondaryToPrimaryPlan.
private ILogicalOperator createSecondaryToPrimaryPlan(OptimizableOperatorSubTree indexSubTree, OptimizableOperatorSubTree probeSubTree, Index chosenIndex, AccessMethodAnalysisContext analysisCtx, boolean retainInput, boolean retainNull, boolean requiresBroadcast, IOptimizationContext context) throws AlgebricksException {
IOptimizableFuncExpr optFuncExpr = AccessMethodUtils.chooseFirstOptFuncExpr(chosenIndex, analysisCtx);
Dataset dataset = indexSubTree.getDataset();
ARecordType recordType = indexSubTree.getRecordType();
ARecordType metaRecordType = indexSubTree.getMetaRecordType();
int optFieldIdx = AccessMethodUtils.chooseFirstOptFuncVar(chosenIndex, analysisCtx);
Pair<IAType, Boolean> keyPairType = Index.getNonNullableOpenFieldType(optFuncExpr.getFieldType(optFieldIdx), optFuncExpr.getFieldName(optFieldIdx), recordType);
if (keyPairType == null) {
return null;
}
// Get the number of dimensions corresponding to the field indexed by chosenIndex.
IAType spatialType = keyPairType.first;
int numDimensions = NonTaggedFormatUtil.getNumDimensions(spatialType.getTypeTag());
int numSecondaryKeys = numDimensions * 2;
// we made sure indexSubTree has datasource scan
AbstractDataSourceOperator dataSourceOp = (AbstractDataSourceOperator) indexSubTree.getDataSourceRef().getValue();
RTreeJobGenParams jobGenParams = new RTreeJobGenParams(chosenIndex.getIndexName(), IndexType.RTREE, dataset.getDataverseName(), dataset.getDatasetName(), retainInput, requiresBroadcast);
// A spatial object is serialized in the constant of the func expr we are optimizing.
// The R-Tree expects as input an MBR represented with 1 field per dimension.
// Here we generate vars and funcs for extracting MBR fields from the constant into fields of a tuple (as the
// R-Tree expects them).
// List of variables for the assign.
ArrayList<LogicalVariable> keyVarList = new ArrayList<>();
// List of expressions for the assign.
ArrayList<Mutable<ILogicalExpression>> keyExprList = new ArrayList<>();
Pair<ILogicalExpression, Boolean> returnedSearchKeyExpr = AccessMethodUtils.createSearchKeyExpr(optFuncExpr, indexSubTree, probeSubTree);
ILogicalExpression searchKeyExpr = returnedSearchKeyExpr.first;
for (int i = 0; i < numSecondaryKeys; i++) {
// The create MBR function "extracts" one field of an MBR around the given spatial object.
AbstractFunctionCallExpression createMBR = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.CREATE_MBR));
// Spatial object is the constant from the func expr we are optimizing.
createMBR.getArguments().add(new MutableObject<>(searchKeyExpr));
// The number of dimensions.
createMBR.getArguments().add(new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(numDimensions)))));
// Which part of the MBR to extract.
createMBR.getArguments().add(new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(i)))));
// Add a variable and its expr to the lists which will be passed into an assign op.
LogicalVariable keyVar = context.newVar();
keyVarList.add(keyVar);
keyExprList.add(new MutableObject<ILogicalExpression>(createMBR));
}
jobGenParams.setKeyVarList(keyVarList);
// Assign operator that "extracts" the MBR fields from the func-expr constant into a tuple.
AssignOperator assignSearchKeys = new AssignOperator(keyVarList, keyExprList);
if (probeSubTree == null) {
// We are optimizing a selection query.
// Input to this assign is the EmptyTupleSource (which the dataSourceScan also must have had as input).
assignSearchKeys.getInputs().add(new MutableObject<>(OperatorManipulationUtil.deepCopy(dataSourceOp.getInputs().get(0).getValue())));
assignSearchKeys.setExecutionMode(dataSourceOp.getExecutionMode());
} else {
// We are optimizing a join, place the assign op top of the probe subtree.
assignSearchKeys.getInputs().add(probeSubTree.getRootRef());
}
ILogicalOperator secondaryIndexUnnestOp = AccessMethodUtils.createSecondaryIndexUnnestMap(dataset, recordType, metaRecordType, chosenIndex, assignSearchKeys, jobGenParams, context, false, retainInput, retainNull);
// Generate the rest of the upstream plan which feeds the search results into the primary index.
return dataset.getDatasetType() == DatasetType.EXTERNAL ? AccessMethodUtils.createExternalDataLookupUnnestMap(dataSourceOp, dataset, recordType, secondaryIndexUnnestOp, context, retainInput, retainNull) : AccessMethodUtils.createPrimaryIndexUnnestMap(dataSourceOp, dataset, recordType, metaRecordType, secondaryIndexUnnestOp, context, true, retainInput, false, false);
}
use of org.apache.asterix.om.base.AInt32 in project asterixdb by apache.
the class InvertedIndexAccessMethod method isEditDistanceFuncSelectOptimizable.
private boolean isEditDistanceFuncSelectOptimizable(Index index, IOptimizableFuncExpr optFuncExpr) throws AlgebricksException {
// Check for panic in selection query.
// TODO: Panic also depends on prePost which is currently hardcoded to be true.
AsterixConstantValue listOrStrConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr.getConstantExpr(0)).getValue();
IAObject listOrStrObj = listOrStrConstVal.getObject();
ATypeTag typeTag = listOrStrObj.getType().getTypeTag();
if (!isEditDistanceFuncCompatible(typeTag, index.getIndexType())) {
return false;
}
AsterixConstantValue intConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr.getConstantExpr(1)).getValue();
IAObject intObj = intConstVal.getObject();
AInt32 edThresh = null;
// Apply type casting based on numeric types of the input to INTEGER type.
try {
edThresh = (AInt32) ATypeHierarchy.convertNumericTypeObject(intObj, ATypeTag.INTEGER);
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
}
int mergeThreshold = 0;
if (typeTag == ATypeTag.STRING) {
AString astr = (AString) listOrStrObj;
// Compute merge threshold depending on the query grams contain pre- and postfixing
if (optFuncExpr.containsPartialField()) {
mergeThreshold = (astr.getStringValue().length() - index.getGramLength() + 1) - edThresh.getIntegerValue() * index.getGramLength();
} else {
mergeThreshold = (astr.getStringValue().length() + index.getGramLength() - 1) - edThresh.getIntegerValue() * index.getGramLength();
}
}
if ((typeTag == ATypeTag.ARRAY) && (index.getIndexType() == IndexType.SINGLE_PARTITION_WORD_INVIX || index.getIndexType() == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
IACollection alist = (IACollection) listOrStrObj;
// Compute merge threshold.
mergeThreshold = alist.size() - edThresh.getIntegerValue();
}
if (mergeThreshold <= 0) {
// We cannot use index to optimize expr.
return false;
}
return true;
}
use of org.apache.asterix.om.base.AInt32 in project asterixdb by apache.
the class SimilarityCheckRule method replaceWithVariableArg.
private boolean replaceWithVariableArg(Mutable<ILogicalExpression> expRef, FunctionIdentifier normFuncIdent, AsterixConstantValue constVal, VariableReferenceExpression varRefExpr, List<AssignOperator> assigns, IOptimizationContext context) throws AlgebricksException {
// Find variable in assigns to determine its originating function.
LogicalVariable var = varRefExpr.getVariableReference();
Mutable<ILogicalExpression> simFuncExprRef = null;
ScalarFunctionCallExpression simCheckFuncExpr = null;
AssignOperator matchingAssign = null;
for (int i = 0; i < assigns.size(); i++) {
AssignOperator assign = assigns.get(i);
for (int j = 0; j < assign.getVariables().size(); j++) {
// Check if variables match.
if (var != assign.getVariables().get(j)) {
continue;
}
// Check if corresponding expr is a function call.
if (assign.getExpressions().get(j).getValue().getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
continue;
}
simFuncExprRef = assign.getExpressions().get(j);
// Analyze function expression and get equivalent similarity check function.
simCheckFuncExpr = getSimilarityCheckExpr(normFuncIdent, constVal, (AbstractFunctionCallExpression) simFuncExprRef.getValue());
matchingAssign = assign;
break;
}
if (simCheckFuncExpr != null) {
break;
}
}
// Only non-null if we found that varRefExpr refers to an optimizable similarity function call.
if (simCheckFuncExpr != null) {
// Create a new assign under matchingAssign which assigns the result of our similarity-check function to a variable.
LogicalVariable newVar = context.newVar();
AssignOperator newAssign = new AssignOperator(newVar, new MutableObject<ILogicalExpression>(simCheckFuncExpr));
// Hook up inputs.
newAssign.getInputs().add(new MutableObject<ILogicalOperator>(matchingAssign.getInputs().get(0).getValue()));
matchingAssign.getInputs().get(0).setValue(newAssign);
// Replace select condition with a get-item on newVarFromExpression.
List<Mutable<ILogicalExpression>> selectGetItemArgs = new ArrayList<Mutable<ILogicalExpression>>();
// First arg is a variable reference expr on newVarFromExpression.
selectGetItemArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(newVar)));
// Second arg is the item index to be accessed, here 0.
selectGetItemArgs.add(new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(0)))));
ILogicalExpression selectGetItemExpr = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.GET_ITEM), selectGetItemArgs);
// Replace the old similarity function call with the new getItemExpr.
expRef.setValue(selectGetItemExpr);
// Replace expr corresponding to original variable in the original assign with a get-item on
// newVarFromExpression.
List<Mutable<ILogicalExpression>> assignGetItemArgs = new ArrayList<Mutable<ILogicalExpression>>();
// First arg is a variable reference expr on newVarFromExpression.
assignGetItemArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(newVar)));
// Second arg is the item index to be accessed, here 1.
assignGetItemArgs.add(new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(1)))));
ILogicalExpression assignGetItemExpr = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.GET_ITEM), assignGetItemArgs);
// Replace the original assign expr with the get-item expr.
simFuncExprRef.setValue(assignGetItemExpr);
context.computeAndSetTypeEnvironmentForOperator(newAssign);
context.computeAndSetTypeEnvironmentForOperator(matchingAssign);
return true;
}
return false;
}
use of org.apache.asterix.om.base.AInt32 in project asterixdb by apache.
the class SqlppExpressionToPlanTranslator method visit.
@Override
public Pair<ILogicalOperator, LogicalVariable> visit(JoinClause joinClause, Mutable<ILogicalOperator> inputRef) throws CompilationException {
Mutable<ILogicalOperator> leftInputRef = uncorrelatedLeftBranchStack.pop();
if (joinClause.getJoinType() == JoinType.INNER) {
Pair<ILogicalOperator, LogicalVariable> rightBranch = generateUnnestForBinaryCorrelateRightBranch(joinClause, inputRef, true);
// A join operator with condition TRUE.
AbstractBinaryJoinOperator joinOperator = new InnerJoinOperator(new MutableObject<ILogicalExpression>(ConstantExpression.TRUE), leftInputRef, new MutableObject<ILogicalOperator>(rightBranch.first));
Mutable<ILogicalOperator> joinOpRef = new MutableObject<>(joinOperator);
// Add an additional filter operator.
Pair<ILogicalExpression, Mutable<ILogicalOperator>> conditionExprOpPair = langExprToAlgExpression(joinClause.getConditionExpression(), joinOpRef);
SelectOperator filter = new SelectOperator(new MutableObject<ILogicalExpression>(conditionExprOpPair.first), false, null);
filter.getInputs().add(conditionExprOpPair.second);
return new Pair<>(filter, rightBranch.second);
} else {
// Creates a subplan operator.
SubplanOperator subplanOp = new SubplanOperator();
Mutable<ILogicalOperator> ntsRef = new MutableObject<>(new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(subplanOp)));
subplanOp.getInputs().add(leftInputRef);
// Enters the translation for a subplan.
context.enterSubplan();
// Adds an unnest operator to unnest to right expression.
Pair<ILogicalOperator, LogicalVariable> rightBranch = generateUnnestForBinaryCorrelateRightBranch(joinClause, ntsRef, true);
AbstractUnnestNonMapOperator rightUnnestOp = (AbstractUnnestNonMapOperator) rightBranch.first;
// Adds an additional filter operator for the join condition.
Pair<ILogicalExpression, Mutable<ILogicalOperator>> conditionExprOpPair = langExprToAlgExpression(joinClause.getConditionExpression(), new MutableObject<ILogicalOperator>(rightUnnestOp));
SelectOperator filter = new SelectOperator(new MutableObject<ILogicalExpression>(conditionExprOpPair.first), false, null);
filter.getInputs().add(conditionExprOpPair.second);
ILogicalOperator currentTopOp = filter;
LogicalVariable varToListify;
boolean hasRightPosVar = rightUnnestOp.getPositionalVariable() != null;
if (hasRightPosVar) {
// Creates record to get correlation between the two aggregate variables.
ScalarFunctionCallExpression recordCreationFunc = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.CLOSED_RECORD_CONSTRUCTOR), // Field name for the listified right unnest var.
new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AString("unnestvar")))), // The listified right unnest var
new MutableObject<ILogicalExpression>(new VariableReferenceExpression(rightUnnestOp.getVariable())), // Field name for the listified right unnest positional var.
new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AString("posvar")))), // The listified right unnest positional var.
new MutableObject<ILogicalExpression>(new VariableReferenceExpression(rightUnnestOp.getPositionalVariable())));
// Assigns the record constructor function to a record variable.
LogicalVariable recordVar = context.newVar();
AssignOperator assignOp = new AssignOperator(recordVar, new MutableObject<ILogicalExpression>(recordCreationFunc));
assignOp.getInputs().add(new MutableObject<ILogicalOperator>(currentTopOp));
// Sets currentTopOp and varToListify for later usages.
currentTopOp = assignOp;
varToListify = recordVar;
} else {
varToListify = rightUnnestOp.getVariable();
}
// Adds an aggregate operator to listfy unnest variables.
AggregateFunctionCallExpression fListify = BuiltinFunctions.makeAggregateFunctionExpression(BuiltinFunctions.LISTIFY, mkSingletonArrayList(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(varToListify))));
LogicalVariable aggVar = context.newSubplanOutputVar();
AggregateOperator aggOp = new AggregateOperator(mkSingletonArrayList(aggVar), mkSingletonArrayList(new MutableObject<ILogicalExpression>(fListify)));
aggOp.getInputs().add(new MutableObject<ILogicalOperator>(currentTopOp));
// Exits the translation of a subplan.
context.exitSubplan();
// Sets the nested subplan of the subplan operator.
ILogicalPlan subplan = new ALogicalPlanImpl(new MutableObject<ILogicalOperator>(aggOp));
subplanOp.getNestedPlans().add(subplan);
// Outer unnest the aggregated var from the subplan.
LogicalVariable outerUnnestVar = context.newVar();
LeftOuterUnnestOperator outerUnnestOp = new LeftOuterUnnestOperator(outerUnnestVar, new MutableObject<ILogicalExpression>(makeUnnestExpression(new VariableReferenceExpression(aggVar))));
outerUnnestOp.getInputs().add(new MutableObject<ILogicalOperator>(subplanOp));
currentTopOp = outerUnnestOp;
if (hasRightPosVar) {
ScalarFunctionCallExpression fieldAccessForRightUnnestVar = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX), new MutableObject<ILogicalExpression>(new VariableReferenceExpression(outerUnnestVar)), new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(0)))));
ScalarFunctionCallExpression fieldAccessForRightPosVar = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX), new MutableObject<ILogicalExpression>(new VariableReferenceExpression(outerUnnestVar)), new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(1)))));
// Creates variables for assign.
LogicalVariable rightUnnestVar = context.newVar();
LogicalVariable rightPosVar = context.newVar();
// Relate the assigned variables to the variable expression in AST.
context.setVar(joinClause.getRightVariable(), rightUnnestVar);
context.setVar(joinClause.getPositionalVariable(), rightPosVar);
// Varaibles to assign.
List<LogicalVariable> assignVars = new ArrayList<>();
assignVars.add(rightUnnestVar);
assignVars.add(rightPosVar);
// Expressions for assign.
List<Mutable<ILogicalExpression>> assignExprs = new ArrayList<>();
assignExprs.add(new MutableObject<ILogicalExpression>(fieldAccessForRightUnnestVar));
assignExprs.add(new MutableObject<ILogicalExpression>(fieldAccessForRightPosVar));
// Creates the assign operator.
AssignOperator assignOp = new AssignOperator(assignVars, assignExprs);
assignOp.getInputs().add(new MutableObject<ILogicalOperator>(currentTopOp));
currentTopOp = assignOp;
} else {
context.setVar(joinClause.getRightVariable(), outerUnnestVar);
}
return new Pair<>(currentTopOp, null);
}
}
use of org.apache.asterix.om.base.AInt32 in project asterixdb by apache.
the class IndexTupleTranslator method getTupleFromMetadataEntity.
@Override
public ITupleReference getTupleFromMetadataEntity(Index instance) throws HyracksDataException {
// write the key in the first 3 fields of the tuple
tupleBuilder.reset();
aString.setValue(instance.getDataverseName());
stringSerde.serialize(aString, tupleBuilder.getDataOutput());
tupleBuilder.addFieldEndOffset();
aString.setValue(instance.getDatasetName());
stringSerde.serialize(aString, tupleBuilder.getDataOutput());
tupleBuilder.addFieldEndOffset();
aString.setValue(instance.getIndexName());
stringSerde.serialize(aString, tupleBuilder.getDataOutput());
tupleBuilder.addFieldEndOffset();
// write the payload in the fourth field of the tuple
recordBuilder.reset(MetadataRecordTypes.INDEX_RECORDTYPE);
// write field 0
fieldValue.reset();
aString.setValue(instance.getDataverseName());
stringSerde.serialize(aString, fieldValue.getDataOutput());
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_DATAVERSENAME_FIELD_INDEX, fieldValue);
// write field 1
fieldValue.reset();
aString.setValue(instance.getDatasetName());
stringSerde.serialize(aString, fieldValue.getDataOutput());
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_DATASETNAME_FIELD_INDEX, fieldValue);
// write field 2
fieldValue.reset();
aString.setValue(instance.getIndexName());
stringSerde.serialize(aString, fieldValue.getDataOutput());
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_INDEXNAME_FIELD_INDEX, fieldValue);
// write field 3
fieldValue.reset();
aString.setValue(instance.getIndexType().toString());
stringSerde.serialize(aString, fieldValue.getDataOutput());
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_INDEXSTRUCTURE_FIELD_INDEX, fieldValue);
// write field 4
primaryKeyListBuilder.reset((AOrderedListType) MetadataRecordTypes.INDEX_RECORDTYPE.getFieldTypes()[MetadataRecordTypes.INDEX_ARECORD_SEARCHKEY_FIELD_INDEX]);
List<List<String>> searchKey = instance.getKeyFieldNames();
for (List<String> field : searchKey) {
listBuilder.reset(stringList);
for (String subField : field) {
itemValue.reset();
aString.setValue(subField);
stringSerde.serialize(aString, itemValue.getDataOutput());
listBuilder.addItem(itemValue);
}
itemValue.reset();
listBuilder.write(itemValue.getDataOutput(), true);
primaryKeyListBuilder.addItem(itemValue);
}
fieldValue.reset();
primaryKeyListBuilder.write(fieldValue.getDataOutput(), true);
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_SEARCHKEY_FIELD_INDEX, fieldValue);
// write field 5
fieldValue.reset();
if (instance.isPrimaryIndex()) {
booleanSerde.serialize(ABoolean.TRUE, fieldValue.getDataOutput());
} else {
booleanSerde.serialize(ABoolean.FALSE, fieldValue.getDataOutput());
}
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_ISPRIMARY_FIELD_INDEX, fieldValue);
// write field 6
fieldValue.reset();
aString.setValue(Calendar.getInstance().getTime().toString());
stringSerde.serialize(aString, fieldValue.getDataOutput());
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_TIMESTAMP_FIELD_INDEX, fieldValue);
// write field 7
fieldValue.reset();
intSerde.serialize(new AInt32(instance.getPendingOp()), fieldValue.getDataOutput());
recordBuilder.addField(MetadataRecordTypes.INDEX_ARECORD_PENDINGOP_FIELD_INDEX, fieldValue);
// write optional field 8
if (instance.getGramLength() > 0) {
fieldValue.reset();
nameValue.reset();
aString.setValue(GRAM_LENGTH_FIELD_NAME);
stringSerde.serialize(aString, nameValue.getDataOutput());
intSerde.serialize(new AInt32(instance.getGramLength()), fieldValue.getDataOutput());
recordBuilder.addField(nameValue, fieldValue);
}
if (instance.isEnforcingKeyFileds()) {
// write optional field 9
OrderedListBuilder typeListBuilder = new OrderedListBuilder();
typeListBuilder.reset(new AOrderedListType(BuiltinType.ANY, null));
nameValue.reset();
aString.setValue(INDEX_SEARCHKEY_TYPE_FIELD_NAME);
stringSerde.serialize(aString, nameValue.getDataOutput());
List<IAType> searchKeyType = instance.getKeyFieldTypes();
for (IAType type : searchKeyType) {
itemValue.reset();
aString.setValue(type.getTypeName());
stringSerde.serialize(aString, itemValue.getDataOutput());
typeListBuilder.addItem(itemValue);
}
fieldValue.reset();
typeListBuilder.write(fieldValue.getDataOutput(), true);
recordBuilder.addField(nameValue, fieldValue);
// write optional field 10
fieldValue.reset();
nameValue.reset();
aString.setValue(INDEX_ISENFORCED_FIELD_NAME);
stringSerde.serialize(aString, nameValue.getDataOutput());
booleanSerde.serialize(ABoolean.TRUE, fieldValue.getDataOutput());
recordBuilder.addField(nameValue, fieldValue);
}
List<Integer> keySourceIndicator = instance.getKeyFieldSourceIndicators();
boolean needSerialization = false;
if (keySourceIndicator != null) {
for (int source : keySourceIndicator) {
if (source != 0) {
needSerialization = true;
break;
}
}
}
if (needSerialization) {
listBuilder.reset(int8List);
nameValue.reset();
aString.setValue(INDEX_SEARCHKEY_SOURCE_INDICATOR_FIELD_NAME);
stringSerde.serialize(aString, nameValue.getDataOutput());
for (int source : keySourceIndicator) {
itemValue.reset();
aInt8.setValue((byte) source);
int8Serde.serialize(aInt8, itemValue.getDataOutput());
listBuilder.addItem(itemValue);
}
fieldValue.reset();
listBuilder.write(fieldValue.getDataOutput(), true);
recordBuilder.addField(nameValue, fieldValue);
}
// write record
recordBuilder.write(tupleBuilder.getDataOutput(), true);
tupleBuilder.addFieldEndOffset();
tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());
return tuple;
}
Aggregations