public void setReturnTupleInfo(RelDataType rowType, ColumnRowType columnRowType) { TupleInfo info = new TupleInfo(); List<RelDataTypeField> fieldList = rowType.getFieldList(); for (int i = 0; i < fieldList.size(); i++) { RelDataTypeField field = fieldList.get(i); TblColRef col = columnRowType == null ? null : columnRowType.getColumnByIndex(i); info.setField(field.getName(), col, i); } this.returnTupleInfo = info; }
protected Collection<Tuple> generateTuple(int number, List<TblColRef> columns, int[] matches) { Collection<Tuple> tuples = new ArrayList<Tuple>(number); TupleInfo info = new TupleInfo(); for (int i = 0; i < columns.size(); i++) { TblColRef column = columns.get(i); info.setField(column.getName(), column, i); } int allMatches = 0; Random rand = new Random(); for (int i = 0; i < number; i++) { Tuple t = new Tuple(info); boolean isFullMatch = true; for (int k = 0; k < columns.size(); k++) { TblColRef column = columns.get(k); int index = Math.abs(rand.nextInt()) % SAMPLE_DATA[k].length; t.setDimensionValue(column.getName(), SAMPLE_DATA[k][index]); if (index == 0) { matches[k]++; } else { isFullMatch = false; } } if (isFullMatch) { allMatches++; } tuples.add(t); } matches[2] = allMatches; return tuples; }
public TupleInfo newTupleInfo(List<TblColRef> groups, List<FunctionDesc> aggregations) { TupleInfo info = new TupleInfo(); int idx = 0; for (TblColRef col : groups) { info.setField(col.getName(), col, idx++); } TableRef sourceTable = groups.get(0).getTableRef(); for (FunctionDesc func : aggregations) { ColumnDesc colDesc = func.newFakeRewriteColumn(sourceTable.getTableDesc()); TblColRef col = sourceTable.makeFakeColumn(colDesc); info.setField(col.getName(), col, idx++); } return info; }
public void setReturnTupleInfo(RelDataType rowType, ColumnRowType columnRowType) { TupleInfo info = new TupleInfo(); List<RelDataTypeField> fieldList = rowType.getFieldList(); for (int i = 0; i < fieldList.size(); i++) { RelDataTypeField field = fieldList.get(i); TblColRef col = columnRowType == null ? null : columnRowType.getColumnByIndex(i); info.setField(field.getName(), col, i); } this.returnTupleInfo = info; }