org.apache.hadoop.hive.ql.plan
Class PlanUtils

java.lang.Object
  extended by org.apache.hadoop.hive.ql.plan.PlanUtils

public class PlanUtils
extends Object


Nested Class Summary
static class PlanUtils.ExpressionTypes
           
 
Constructor Summary
PlanUtils()
           
 
Method Summary
static tableDesc getDefaultTableDesc(String separatorCode)
          Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode.
static tableDesc getDefaultTableDesc(String separatorCode, String columns)
          Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode and column names (comma separated string).
static tableDesc getDefaultTableDesc(String separatorCode, String columns, boolean lastColumnTakesRestOfTheLine)
          Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode and column names (comma separated string), and whether the last column should take the rest of the line.
static tableDesc getDefaultTableDesc(String separatorCode, String columns, String columnTypes, boolean lastColumnTakesRestOfTheLine)
          Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode and column names (comma separated string), and whether the last column should take the rest of the line.
static List<FieldSchema> getFieldSchemasFromColumnInfo(Vector<ColumnInfo> cols, String fieldPrefix)
          Convert the ColumnInfo to FieldSchema.
static List<FieldSchema> getFieldSchemasFromColumnList(List<exprNodeDesc> cols, List<String> outputColumnNames, int start, String fieldPrefix)
          Convert the ColumnList to FieldSchema list.
static List<FieldSchema> getFieldSchemasFromColumnList(List<exprNodeDesc> cols, String fieldPrefix)
          Convert the ColumnList to FieldSchema list.
static List<FieldSchema> getFieldSchemasFromRowSchema(RowSchema row, String fieldPrefix)
          Convert the RowSchema to FieldSchema list.
static tableDesc getIntermediateFileTableDesc(List<FieldSchema> fieldSchemas)
          Generate the table descriptor for intermediate files.
static tableDesc getMapJoinKeyTableDesc(List<FieldSchema> fieldSchemas)
          Generate the table descriptor for Map-side join key.
static tableDesc getMapJoinValueTableDesc(List<FieldSchema> fieldSchemas)
          Generate the table descriptor for Map-side join key.
static mapredWork getMapRedWork()
           
static tableDesc getReduceKeyTableDesc(List<FieldSchema> fieldSchemas, String order)
          Generate the table descriptor for reduce key.
static reduceSinkDesc getReduceSinkDesc(ArrayList<exprNodeDesc> keyCols, ArrayList<exprNodeDesc> valueCols, List<String> outputColumnNames, boolean includeKeyCols, int tag, ArrayList<exprNodeDesc> partitionCols, String order, int numReducers)
          Create the reduce sink descriptor.
static reduceSinkDesc getReduceSinkDesc(ArrayList<exprNodeDesc> keyCols, ArrayList<exprNodeDesc> valueCols, List<String> outputColumnNames, boolean includeKey, int tag, int numPartitionFields, int numReducers)
          Create the reduce sink descriptor.
static tableDesc getReduceValueTableDesc(List<FieldSchema> fieldSchemas)
          Generate the table descriptor for intermediate files.
static tableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns)
          Generate the table descriptor of given serde with the separatorCode and column names (comma separated string).
static tableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns, boolean lastColumnTakesRestOfTheLine)
          Generate the table descriptor of the serde specified with the separatorCode and column names (comma separated string), and whether the last column should take the rest of the line.
static tableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns, String columnTypes, boolean lastColumnTakesRestOfTheLine)
           
static List<FieldSchema> sortFieldSchemas(List<FieldSchema> schema)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlanUtils

public PlanUtils()
Method Detail

getMapRedWork

public static mapredWork getMapRedWork()

getDefaultTableDesc

public static tableDesc getDefaultTableDesc(String separatorCode,
                                            String columns)
Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode and column names (comma separated string).


getTableDesc

public static tableDesc getTableDesc(Class<? extends Deserializer> serdeClass,
                                     String separatorCode,
                                     String columns)
Generate the table descriptor of given serde with the separatorCode and column names (comma separated string).


getDefaultTableDesc

public static tableDesc getDefaultTableDesc(String separatorCode,
                                            String columns,
                                            boolean lastColumnTakesRestOfTheLine)
Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode and column names (comma separated string), and whether the last column should take the rest of the line.


getTableDesc

public static tableDesc getTableDesc(Class<? extends Deserializer> serdeClass,
                                     String separatorCode,
                                     String columns,
                                     boolean lastColumnTakesRestOfTheLine)
Generate the table descriptor of the serde specified with the separatorCode and column names (comma separated string), and whether the last column should take the rest of the line.


getDefaultTableDesc

public static tableDesc getDefaultTableDesc(String separatorCode,
                                            String columns,
                                            String columnTypes,
                                            boolean lastColumnTakesRestOfTheLine)
Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode and column names (comma separated string), and whether the last column should take the rest of the line.


getTableDesc

public static tableDesc getTableDesc(Class<? extends Deserializer> serdeClass,
                                     String separatorCode,
                                     String columns,
                                     String columnTypes,
                                     boolean lastColumnTakesRestOfTheLine)

getDefaultTableDesc

public static tableDesc getDefaultTableDesc(String separatorCode)
Generate the table descriptor of MetadataTypedColumnsetSerDe with the separatorCode. MetaDataTypedColumnsetSerDe is used because LazySimpleSerDe does not support a table with a single column "col" with type "array".


getReduceKeyTableDesc

public static tableDesc getReduceKeyTableDesc(List<FieldSchema> fieldSchemas,
                                              String order)
Generate the table descriptor for reduce key.


getMapJoinKeyTableDesc

public static tableDesc getMapJoinKeyTableDesc(List<FieldSchema> fieldSchemas)
Generate the table descriptor for Map-side join key.


getMapJoinValueTableDesc

public static tableDesc getMapJoinValueTableDesc(List<FieldSchema> fieldSchemas)
Generate the table descriptor for Map-side join key.


getIntermediateFileTableDesc

public static tableDesc getIntermediateFileTableDesc(List<FieldSchema> fieldSchemas)
Generate the table descriptor for intermediate files.


getReduceValueTableDesc

public static tableDesc getReduceValueTableDesc(List<FieldSchema> fieldSchemas)
Generate the table descriptor for intermediate files.


getFieldSchemasFromColumnList

public static List<FieldSchema> getFieldSchemasFromColumnList(List<exprNodeDesc> cols,
                                                              List<String> outputColumnNames,
                                                              int start,
                                                              String fieldPrefix)
Convert the ColumnList to FieldSchema list.


getFieldSchemasFromColumnList

public static List<FieldSchema> getFieldSchemasFromColumnList(List<exprNodeDesc> cols,
                                                              String fieldPrefix)
Convert the ColumnList to FieldSchema list.


getFieldSchemasFromRowSchema

public static List<FieldSchema> getFieldSchemasFromRowSchema(RowSchema row,
                                                             String fieldPrefix)
Convert the RowSchema to FieldSchema list.


getFieldSchemasFromColumnInfo

public static List<FieldSchema> getFieldSchemasFromColumnInfo(Vector<ColumnInfo> cols,
                                                              String fieldPrefix)
Convert the ColumnInfo to FieldSchema.


sortFieldSchemas

public static List<FieldSchema> sortFieldSchemas(List<FieldSchema> schema)

getReduceSinkDesc

public static reduceSinkDesc getReduceSinkDesc(ArrayList<exprNodeDesc> keyCols,
                                               ArrayList<exprNodeDesc> valueCols,
                                               List<String> outputColumnNames,
                                               boolean includeKeyCols,
                                               int tag,
                                               ArrayList<exprNodeDesc> partitionCols,
                                               String order,
                                               int numReducers)
Create the reduce sink descriptor.

Parameters:
keyCols - The columns to be stored in the key
valueCols - The columns to be stored in the value
outputColumnNames - The output columns names
tag - The tag for this reducesink
partitionCols - The columns for partitioning.
numReducers - The number of reducers, set to -1 for automatic inference based on input data size.
Returns:
The reduceSinkDesc object.

getReduceSinkDesc

public static reduceSinkDesc getReduceSinkDesc(ArrayList<exprNodeDesc> keyCols,
                                               ArrayList<exprNodeDesc> valueCols,
                                               List<String> outputColumnNames,
                                               boolean includeKey,
                                               int tag,
                                               int numPartitionFields,
                                               int numReducers)
Create the reduce sink descriptor.

Parameters:
keyCols - The columns to be stored in the key
valueCols - The columns to be stored in the value
outputColumnNames - The output columns names
tag - The tag for this reducesink
numPartitionFields - The first numPartitionFields of keyCols will be partition columns. If numPartitionFields=-1, then partition randomly.
numReducers - The number of reducers, set to -1 for automatic inference based on input data size.
Returns:
The reduceSinkDesc object.


Copyright © 2009 The Apache Software Foundation