public final class PlanUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PlanUtils.ExpressionTypes
ExpressionTypes.
|
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
LOG |
Modifier and Type | Method and Description |
---|---|
static void |
addExprToStringBuffer(ExprNodeDesc expr,
StringBuffer sb) |
static ReadEntity |
addInput(Set<ReadEntity> inputs,
ReadEntity newInput) |
static void |
addInputsForView(ParseContext parseCtx) |
static void |
configureInputJobPropertiesForStorageHandler(TableDesc tableDesc)
Loads the storage handler (if one exists) for the given table
and invokes
HiveStorageHandler.configureInputJobProperties(TableDesc, java.util.Map) . |
static void |
configureJobConf(TableDesc tableDesc,
org.apache.hadoop.mapred.JobConf jobConf) |
static void |
configureOutputJobPropertiesForStorageHandler(TableDesc tableDesc)
Loads the storage handler (if one exists) for the given table
and invokes
HiveStorageHandler.configureOutputJobProperties(TableDesc, java.util.Map) . |
static long |
getCountForMapJoinDumpFilePrefix() |
static TableDesc |
getDefaultQueryOutputTableDesc(String cols,
String colTypes,
String fileFormat) |
static TableDesc |
getDefaultTableDesc(CreateTableDesc directoryDesc,
String cols,
String colTypes) |
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 String |
getExprListString(Collection<? extends ExprNodeDesc> exprs) |
static List<FieldSchema> |
getFieldSchemasFromColumnInfo(ArrayList<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> |
getFieldSchemasFromColumnListWithLength(List<ExprNodeDesc> cols,
List<List<Integer>> distinctColIndices,
List<String> outputColumnNames,
int length,
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(org.apache.hadoop.conf.Configuration conf,
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 value.
|
static MapredWork |
getMapRedWork() |
static ReadEntity |
getParentViewInfo(String alias_id,
Map<String,ReadEntity> viewAliasToInput) |
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,
AcidUtils.Operation writeType)
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,
AcidUtils.Operation writeType)
Create the reduce sink descriptor.
|
static ReduceSinkDesc |
getReduceSinkDesc(ArrayList<ExprNodeDesc> keyCols,
int numKeys,
ArrayList<ExprNodeDesc> valueCols,
List<List<Integer>> distinctColIndices,
List<String> outputKeyColumnNames,
List<String> outputValueColumnNames,
boolean includeKeyCols,
int tag,
ArrayList<ExprNodeDesc> partitionCols,
String order,
int numReducers,
AcidUtils.Operation writeType)
Create the reduce sink descriptor.
|
static ReduceSinkDesc |
getReduceSinkDesc(ArrayList<ExprNodeDesc> keyCols,
int numKeys,
ArrayList<ExprNodeDesc> valueCols,
List<List<Integer>> distinctColIndices,
List<String> outputKeyColumnNames,
List<String> outputValueColumnNames,
boolean includeKey,
int tag,
int numPartitionFields,
int numReducers,
AcidUtils.Operation writeType)
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 TableDesc |
getTableDesc(Class<? extends Deserializer> serdeClass,
String separatorCode,
String columns,
String columnTypes,
boolean lastColumnTakesRestOfTheLine,
boolean useDelimitedJSON) |
static TableDesc |
getTableDesc(Class<? extends Deserializer> serdeClass,
String separatorCode,
String columns,
String columnTypes,
boolean lastColumnTakesRestOfTheLine,
boolean useDelimitedJSON,
String fileFormat) |
static TableDesc |
getTableDesc(CreateTableDesc crtTblDesc,
String cols,
String colTypes)
Generate a table descriptor from a createTableDesc.
|
static String |
removePrefixFromWarehouseConfig(String origiKey)
Remove prefix from "Path -> Alias"
This is required for testing.
|
static List<FieldSchema> |
sortFieldSchemas(List<FieldSchema> schema) |
static String |
stripQuotes(String val) |
public static long getCountForMapJoinDumpFilePrefix()
public static MapredWork getMapRedWork()
public static TableDesc getDefaultTableDesc(CreateTableDesc directoryDesc, String cols, String colTypes)
public static TableDesc getDefaultTableDesc(String separatorCode, String columns)
public static TableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns)
public static TableDesc getDefaultTableDesc(String separatorCode, String columns, boolean lastColumnTakesRestOfTheLine)
public static TableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns, boolean lastColumnTakesRestOfTheLine)
public static TableDesc getDefaultTableDesc(String separatorCode, String columns, String columnTypes, boolean lastColumnTakesRestOfTheLine)
public static TableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns, String columnTypes, boolean lastColumnTakesRestOfTheLine)
public static TableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns, String columnTypes, boolean lastColumnTakesRestOfTheLine, boolean useDelimitedJSON)
public static TableDesc getTableDesc(Class<? extends Deserializer> serdeClass, String separatorCode, String columns, String columnTypes, boolean lastColumnTakesRestOfTheLine, boolean useDelimitedJSON, String fileFormat)
public static TableDesc getDefaultQueryOutputTableDesc(String cols, String colTypes, String fileFormat)
public static TableDesc getTableDesc(CreateTableDesc crtTblDesc, String cols, String colTypes)
public static TableDesc getDefaultTableDesc(String separatorCode)
public static TableDesc getReduceKeyTableDesc(List<FieldSchema> fieldSchemas, String order)
public static TableDesc getMapJoinKeyTableDesc(org.apache.hadoop.conf.Configuration conf, List<FieldSchema> fieldSchemas)
public static TableDesc getMapJoinValueTableDesc(List<FieldSchema> fieldSchemas)
public static TableDesc getIntermediateFileTableDesc(List<FieldSchema> fieldSchemas)
public static TableDesc getReduceValueTableDesc(List<FieldSchema> fieldSchemas)
public static List<FieldSchema> getFieldSchemasFromColumnListWithLength(List<ExprNodeDesc> cols, List<List<Integer>> distinctColIndices, List<String> outputColumnNames, int length, String fieldPrefix)
public static List<FieldSchema> getFieldSchemasFromColumnList(List<ExprNodeDesc> cols, List<String> outputColumnNames, int start, String fieldPrefix)
public static List<FieldSchema> getFieldSchemasFromColumnList(List<ExprNodeDesc> cols, String fieldPrefix)
public static List<FieldSchema> getFieldSchemasFromRowSchema(RowSchema row, String fieldPrefix)
public static List<FieldSchema> getFieldSchemasFromColumnInfo(ArrayList<ColumnInfo> cols, String fieldPrefix)
public static List<FieldSchema> sortFieldSchemas(List<FieldSchema> schema)
public static ReduceSinkDesc getReduceSinkDesc(ArrayList<ExprNodeDesc> keyCols, ArrayList<ExprNodeDesc> valueCols, List<String> outputColumnNames, boolean includeKeyCols, int tag, ArrayList<ExprNodeDesc> partitionCols, String order, int numReducers, AcidUtils.Operation writeType)
keyCols
- The columns to be stored in the keyvalueCols
- The columns to be stored in the valueoutputColumnNames
- The output columns namestag
- The tag for this reducesinkpartitionCols
- The columns for partitioning.numReducers
- The number of reducers, set to -1 for automatic inference based on
input data size.writeType
- Whether this is an Acid write, and if so whether it is insert, update,
or delete.public static ReduceSinkDesc getReduceSinkDesc(ArrayList<ExprNodeDesc> keyCols, int numKeys, ArrayList<ExprNodeDesc> valueCols, List<List<Integer>> distinctColIndices, List<String> outputKeyColumnNames, List<String> outputValueColumnNames, boolean includeKeyCols, int tag, ArrayList<ExprNodeDesc> partitionCols, String order, int numReducers, AcidUtils.Operation writeType)
keyCols
- The columns to be stored in the keynumKeys
- number of distribution key numbers. Equals to group-by-key
numbers usually.valueCols
- The columns to be stored in the valuedistinctColIndices
- column indices for distinct aggregate parametersoutputKeyColumnNames
- The output key columns namesoutputValueColumnNames
- The output value columns namestag
- The tag for this reducesinkpartitionCols
- The columns for partitioning.numReducers
- The number of reducers, set to -1 for automatic inference based on
input data size.writeType
- Whether this is an Acid write, and if so whether it is insert, update,
or delete.public static ReduceSinkDesc getReduceSinkDesc(ArrayList<ExprNodeDesc> keyCols, ArrayList<ExprNodeDesc> valueCols, List<String> outputColumnNames, boolean includeKey, int tag, int numPartitionFields, int numReducers, AcidUtils.Operation writeType) throws SemanticException
keyCols
- The columns to be stored in the keyvalueCols
- The columns to be stored in the valueoutputColumnNames
- The output columns namestag
- The tag for this reducesinknumPartitionFields
- 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.writeType
- Whether this is an Acid write, and if so whether it is insert, update,
or delete.SemanticException
public static ReduceSinkDesc getReduceSinkDesc(ArrayList<ExprNodeDesc> keyCols, int numKeys, ArrayList<ExprNodeDesc> valueCols, List<List<Integer>> distinctColIndices, List<String> outputKeyColumnNames, List<String> outputValueColumnNames, boolean includeKey, int tag, int numPartitionFields, int numReducers, AcidUtils.Operation writeType) throws SemanticException
keyCols
- The columns to be stored in the keynumKeys
- number of distribution keys. Equals to group-by-key
numbers usually.valueCols
- The columns to be stored in the valuedistinctColIndices
- column indices for distinct aggregatesoutputKeyColumnNames
- The output key columns namesoutputValueColumnNames
- The output value columns namestag
- The tag for this reducesinknumPartitionFields
- 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.writeType
- Whether this is an Acid write, and if so whether it is insert, update,
or delete.SemanticException
public static void configureInputJobPropertiesForStorageHandler(TableDesc tableDesc)
HiveStorageHandler.configureInputJobProperties(TableDesc, java.util.Map)
.tableDesc
- table descriptorpublic static void configureOutputJobPropertiesForStorageHandler(TableDesc tableDesc)
HiveStorageHandler.configureOutputJobProperties(TableDesc, java.util.Map)
.tableDesc
- table descriptorpublic static void configureJobConf(TableDesc tableDesc, org.apache.hadoop.mapred.JobConf jobConf)
public static String removePrefixFromWarehouseConfig(String origiKey)
origiKey
- public static ReadEntity addInput(Set<ReadEntity> inputs, ReadEntity newInput)
public static String getExprListString(Collection<? extends ExprNodeDesc> exprs)
public static void addExprToStringBuffer(ExprNodeDesc expr, StringBuffer sb)
public static void addInputsForView(ParseContext parseCtx) throws HiveException
HiveException
public static ReadEntity getParentViewInfo(String alias_id, Map<String,ReadEntity> viewAliasToInput)
Copyright © 2017 The Apache Software Foundation. All rights reserved.