Search in sources :

Example 6 with BucketCol

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

the class BucketingSortingOpProcFactory method getNewBucketCols.

/**
   * This is used to construct new lists of bucketed columns where the order of the columns
   * hasn't changed, only possibly the name
   * @param bucketCols - input bucketed columns
   * @param colInfos - List of column infos
   * @return output bucketed columns
   */
private static List<BucketCol> getNewBucketCols(List<BucketCol> bucketCols, List<ColumnInfo> colInfos) {
    List<BucketCol> newBucketCols = new ArrayList<BucketCol>(bucketCols.size());
    for (int i = 0; i < bucketCols.size(); i++) {
        BucketCol bucketCol = new BucketCol();
        for (Integer index : bucketCols.get(i).getIndexes()) {
            // greater than or equal to colInfos.size().
            if (index < colInfos.size()) {
                bucketCol.addAlias(colInfos.get(index).getInternalName(), index);
            } else {
                return null;
            }
        }
        newBucketCols.add(bucketCol);
    }
    return newBucketCols;
}
Also used : BucketCol(org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.BucketCol) ArrayList(java.util.ArrayList)

Aggregations

BucketCol (org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.BucketCol)6 SortCol (org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.SortCol)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 BucketSortCol (org.apache.hadoop.hive.ql.optimizer.physical.BucketingSortingCtx.BucketSortCol)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