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 getBinarySortableTableDesc(List<FieldSchema> fieldSchemas, String order)
          Generate the table descriptor of DynamicSerDe and TBinarySortableProtocol.
static tableDesc getBinaryTableDesc(List<FieldSchema> fieldSchemas)
          Generate the table descriptor of DynamicSerDe and TBinaryProtocol.
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 List<FieldSchema> getFieldSchemasFromColumnInfo(Vector<ColumnInfo> cols, String fieldPrefix)
          Convert the ColumnInfo to FieldSchema.
static List<FieldSchema> getFieldSchemasFromColumnList(ArrayList<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 getLazySimpleSerDeTableDesc(List<FieldSchema> fieldSchemas)
          Generate the table descriptor of LazySimpleSerDe.
static mapredWork getMapRedWork()
           
static reduceSinkDesc getReduceSinkDesc(ArrayList<exprNodeDesc> keyCols, ArrayList<exprNodeDesc> valueCols, int tag, ArrayList<exprNodeDesc> partitionCols, String order, int numReducers)
          Create the reduce sink descriptor.
static reduceSinkDesc getReduceSinkDesc(ArrayList<exprNodeDesc> keyCols, ArrayList<exprNodeDesc> valueCols, int tag, int numPartitionFields, int numReducers)
          Create the reduce sink descriptor.
 
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).


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.


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".


getBinarySortableTableDesc

public static tableDesc getBinarySortableTableDesc(List<FieldSchema> fieldSchemas,
                                                   String order)
Generate the table descriptor of DynamicSerDe and TBinarySortableProtocol.


getBinaryTableDesc

public static tableDesc getBinaryTableDesc(List<FieldSchema> fieldSchemas)
Generate the table descriptor of DynamicSerDe and TBinaryProtocol.


getLazySimpleSerDeTableDesc

public static tableDesc getLazySimpleSerDeTableDesc(List<FieldSchema> fieldSchemas)
Generate the table descriptor of LazySimpleSerDe.


getFieldSchemasFromColumnList

public static List<FieldSchema> getFieldSchemasFromColumnList(ArrayList<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.


getReduceSinkDesc

public static reduceSinkDesc getReduceSinkDesc(ArrayList<exprNodeDesc> keyCols,
                                               ArrayList<exprNodeDesc> valueCols,
                                               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
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,
                                               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
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