use of org.apache.calcite.util.Pair in project hive by apache.
the class HiveTableScan method buildColIndxsFrmReloptHT.
private static Pair<ImmutableList<Integer>, ImmutableSet<Integer>> buildColIndxsFrmReloptHT(RelOptHiveTable relOptHTable, RelDataType scanRowType) {
RelDataType relOptHtRowtype = relOptHTable.getRowType();
ImmutableList<Integer> neededColIndxsFrmReloptHT;
Builder<Integer> neededColIndxsFrmReloptHTBldr = new ImmutableList.Builder<Integer>();
ImmutableSet<Integer> viurtualOrPartColIndxsInTS;
ImmutableSet.Builder<Integer> viurtualOrPartColIndxsInTSBldr = new ImmutableSet.Builder<Integer>();
Map<String, Integer> colNameToPosInReloptHT = HiveCalciteUtil.getRowColNameIndxMap(relOptHtRowtype.getFieldList());
List<String> colNamesInScanRowType = scanRowType.getFieldNames();
int partOrVirtualColStartPosInrelOptHtRowtype = relOptHTable.getNonPartColumns().size();
int tmp;
for (int i = 0; i < colNamesInScanRowType.size(); i++) {
tmp = colNameToPosInReloptHT.get(colNamesInScanRowType.get(i));
neededColIndxsFrmReloptHTBldr.add(tmp);
if (tmp >= partOrVirtualColStartPosInrelOptHtRowtype) {
viurtualOrPartColIndxsInTSBldr.add(i);
}
}
neededColIndxsFrmReloptHT = neededColIndxsFrmReloptHTBldr.build();
viurtualOrPartColIndxsInTS = viurtualOrPartColIndxsInTSBldr.build();
return new Pair<ImmutableList<Integer>, ImmutableSet<Integer>>(neededColIndxsFrmReloptHT, viurtualOrPartColIndxsInTS);
}
Aggregations