Search in sources :

Example 6 with SortCol

use of org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.SortCol in project hive by apache.

the class BucketingSortingOpProcFactory method getNewSortCols.

/**
   * This is used to construct new lists of sorted columns where the order of the columns
   * hasn't changed, only possibly the name
   * @param bucketCols - input sorted columns
   * @param colInfos - List of column infos
   * @return output sorted columns
   */
private static List<SortCol> getNewSortCols(List<SortCol> sortCols, List<ColumnInfo> colInfos) {
    List<SortCol> newSortCols = new ArrayList<SortCol>(sortCols.size());
    for (int i = 0; i < sortCols.size(); i++) {
        SortCol sortCol = new SortCol(sortCols.get(i).getSortOrder());
        for (Integer index : sortCols.get(i).getIndexes()) {
            // The only time this condition should be false is in the case of dynamic partitioning
            if (index < colInfos.size()) {
                sortCol.addAlias(colInfos.get(index).getInternalName(), index);
            } else {
                return null;
            }
        }
        newSortCols.add(sortCol);
    }
    return newSortCols;
}
Also used : ArrayList(java.util.ArrayList) SortCol(org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.SortCol) BucketSortCol(org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.BucketSortCol)

Aggregations

SortCol (org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.SortCol)6 BucketCol (org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.BucketCol)4 BucketSortCol (org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.BucketSortCol)4 ArrayList (java.util.ArrayList)3 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)3 FileStatus (org.apache.hadoop.fs.FileStatus)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 ExprNodeColumnDesc (org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc)2 IOException (java.io.IOException)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Path (org.apache.hadoop.fs.Path)1 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)1 InvalidOperationException (org.apache.hadoop.hive.metastore.api.InvalidOperationException)1 Order (org.apache.hadoop.hive.metastore.api.Order)1 ColumnInfo (org.apache.hadoop.hive.ql.exec.ColumnInfo)1 SelectOperator (org.apache.hadoop.hive.ql.exec.SelectOperator)1 MapRedTask (org.apache.hadoop.hive.ql.exec.mr.MapRedTask)1 MapredLocalTask (org.apache.hadoop.hive.ql.exec.mr.MapredLocalTask)1 DataContainer (org.apache.hadoop.hive.ql.hooks.LineageInfo.DataContainer)1