Search in sources :

Example 26 with Pair

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);
}
Also used : RelBuilder(org.apache.calcite.tools.RelBuilder) RexBuilder(org.apache.calcite.rex.RexBuilder) Builder(com.google.common.collect.ImmutableList.Builder) RelDataType(org.apache.calcite.rel.type.RelDataType) ImmutableSet(com.google.common.collect.ImmutableSet) Pair(org.apache.calcite.util.Pair)

Aggregations

Pair (org.apache.calcite.util.Pair)26 RexNode (org.apache.calcite.rex.RexNode)22 RelDataTypeField (org.apache.calcite.rel.type.RelDataTypeField)17 RelNode (org.apache.calcite.rel.RelNode)16 ArrayList (java.util.ArrayList)14 ImmutableBitSet (org.apache.calcite.util.ImmutableBitSet)9 HashMap (java.util.HashMap)8 RexInputRef (org.apache.calcite.rex.RexInputRef)8 RexBuilder (org.apache.calcite.rex.RexBuilder)7 AggregateCall (org.apache.calcite.rel.core.AggregateCall)6 JoinRelType (org.apache.calcite.rel.core.JoinRelType)5 RelBuilder (org.apache.calcite.tools.RelBuilder)5 ImmutableList (com.google.common.collect.ImmutableList)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)4 List (java.util.List)4 Map (java.util.Map)4 NavigableMap (java.util.NavigableMap)4 SortedMap (java.util.SortedMap)4 TreeMap (java.util.TreeMap)4