private static int[] projectVariablesImpl(IOperatorSchema opSchema, Iterable<LogicalVariable> variables, int variableCount) { int[] projectionList = new int[variableCount]; int k = 0; for (LogicalVariable v : variables) { projectionList[k++] = opSchema.findVariable(v); } return projectionList; } }
protected int[] getKeysAndDecs(IOperatorSchema inputSchema) { int keys[] = JobGenHelper.variablesToFieldIndexes(columnList, inputSchema); int sz = inputSchema.getSize(); int fdSz = sz - columnList.size(); int[] fdColumns = new int[fdSz]; int j = 0; for (LogicalVariable v : inputSchema) { if (!columnList.contains(v)) { fdColumns[j++] = inputSchema.findVariable(v); } } int[] keysAndDecs = new int[keys.length + fdColumns.length]; for (int i = 0; i < keys.length; i++) { keysAndDecs[i] = keys[i]; } for (int i = 0; i < fdColumns.length; i++) { keysAndDecs[i + keys.length] = fdColumns[i]; } return keysAndDecs; }
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) { int n = sources.length; for (int i = 0; i < n; i++) { target.addAllNewVariables(sources[i]); } } };
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) throws AlgebricksException { if (sources.length > 0) { target.addAllVariables(sources[0]); } for (LogicalVariable v : variables) { target.addVariable(v); } } };
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) { for (IOperatorSchema s : sources) { for (LogicalVariable v : s) { if (target.findVariable(v) < 0) { target.addVariable(v); } } } } };
int numKeys = inputSchema.getSize(); if (inputSchema.getSize() > 0) { for (int k = 0; k < inputSchema.getSize(); k++) { boolean found = false; for (LogicalVariable varKey : primaryKeys) { if (varKey.equals(inputSchema.getVariable(k))) { found = true; break; if (varKey.equals(inputSchema.getVariable(k))) { found = true; break; otherKeys.add(inputSchema.getVariable(k)); int j = 0; for (LogicalVariable varKey : primaryKeys) { int idx = propagatedSchema.findVariable(varKey); fieldPermutation[i] = idx; modificationCallbackPrimaryKeyFields[j] = i; int idx = propagatedSchema.findVariable(varKey); fieldPermutation[i] = idx; i++; int idx = propagatedSchema.findVariable(varKey); fieldPermutation[i] = idx; i++;
public static int[] projectAllVariables(IOperatorSchema opSchema) { return projectVariablesImpl(opSchema, opSchema, opSchema.getSize()); }
public static IPrinterFactory[] mkPrinterFactories(IOperatorSchema opSchema, IVariableTypeEnvironment env, JobGenContext context, int[] printColumns) throws AlgebricksException { IPrinterFactory[] pf = new IPrinterFactory[printColumns.length]; IPrinterFactoryProvider pff = context.getPrinterFactoryProvider(); try { for (int i = 0; i < pf.length; i++) { LogicalVariable v = opSchema.getVariable(printColumns[i]); Object t = env.getVarType(v); pf[i] = pff.getPrinterFactory(t); } return pf; } catch (HyracksDataException e) { throw new AlgebricksException(e); } }
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) throws AlgebricksException { for (LogicalVariable v : outputVariables) { target.addVariable(v); } } };
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) throws AlgebricksException { // propagate the variables of the data source at idx 0 if (sources.length > 0) { target.addAllVariables(sources[0]); } } };
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) throws AlgebricksException { /** make sure distinct key vars laid-out first */ for (LogicalVariable keyVar : getDistinctByVarList()) { target.addVariable(keyVar); } /** add other source vars */ for (IOperatorSchema srcSchema : sources) { for (LogicalVariable srcVar : srcSchema) if (target.findVariable(srcVar) < 0) { target.addVariable(srcVar); } } } };
@SuppressWarnings("rawtypes") public static RecordDescriptor mkRecordDescriptor(IVariableTypeEnvironment env, IOperatorSchema opSchema, JobGenContext context) throws AlgebricksException { ISerializerDeserializer[] fields = new ISerializerDeserializer[opSchema.getSize()]; ITypeTraits[] typeTraits = new ITypeTraits[opSchema.getSize()]; ISerializerDeserializerProvider sdp = context.getSerializerDeserializerProvider(); ITypeTraitProvider ttp = context.getTypeTraitProvider(); int i = 0; for (LogicalVariable var : opSchema) { Object t = env.getVarType(var); if (t == null) { LOGGER.warn("No type for variable " + var); } fields[i] = sdp.getSerializerDeserializer(t); typeTraits[i] = ttp.getTypeTrait(t); i++; } return new RecordDescriptor(fields, typeTraits); }
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) { if (propagateInputVars) { target.addAllVariables(sources[0]); } for (LogicalVariable v : variables) { target.addVariable(v); } } };
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) throws AlgebricksException { for (Triple<LogicalVariable, LogicalVariable, LogicalVariable> t : varMap) { target.addVariable(t.third); } } };
JobGenContext context = pc.getContext(); IOperatorSchema topOpInSubplanScm = context.getSchema(topOpInSubplan); opSchema.addAllVariables(topOpInSubplanScm);
public static int[] variablesToFieldIndexes(Collection<LogicalVariable> varLogical, IOperatorSchema opSchema) { int[] tuplePos = new int[varLogical.size()]; int i = 0; for (LogicalVariable var : varLogical) { tuplePos[i] = opSchema.findVariable(var); i++; } return tuplePos; }
fdColumns[j++] = inputSchemas[0].findVariable(decor); localInputSchemas[0].addVariable(keyVar); localInputSchemas[0].addVariable(usedVar);
@Override public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getScannerRuntime(IDataSource<String> dataSource, List<LogicalVariable> scanVariables, List<LogicalVariable> projectVariables, boolean projectPushed, List<LogicalVariable> minFilterVars, List<LogicalVariable> maxFilterVars, IOperatorSchema opSchema, IVariableTypeEnvironment typeEnv, JobGenContext context, JobSpecification jobSpec, Object implConfig) throws AlgebricksException { VXQueryCollectionDataSource ds = (VXQueryCollectionDataSource) dataSource; if (sourceFileMap != null) { final int len = ds.getPartitions().length; String[] collectionPartitions = new String[len]; for (int i = 0; i < len; ++i) { String partition = ds.getPartitions()[i]; File mapped = sourceFileMap.get(partition); collectionPartitions[i] = mapped != null ? mapped.toString() : partition; } ds.setPartitions(collectionPartitions); } RecordDescriptor rDesc = new RecordDescriptor(new ISerializerDeserializer[opSchema.getSize()]); IOperatorDescriptor scanner = new VXQueryCollectionOperatorDescriptor(jobSpec, ds, rDesc, this.hdfsConf, this.nodeControllerInfos); AlgebricksPartitionConstraint constraint = getClusterLocations(nodeList, ds.getPartitionCount()); return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(scanner, constraint); }
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) { target.addAllVariables(sources[0]); for (LogicalVariable v : variables) { target.addVariable(v); } } };
@Override public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) { for (LogicalVariable v : toPropagate) { target.addVariable(v); } }