Skip to content

Commit 565a2eb

Browse files
committed
commit-2
1 parent f6c7409 commit 565a2eb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public void setTTable(org.apache.hadoop.hive.metastore.api.Table tTable) {
255255
org.apache.hadoop.hive.metastore.api.Table t = new org.apache.hadoop.hive.metastore.api.Table();
256256
{
257257
t.setSd(sd);
258-
t.setPartitionKeys(null);
258+
t.setPartitionKeys(new ArrayList<FieldSchema>());
259259
t.setParameters(new HashMap<String, String>());
260260
t.setTableType(TableType.MANAGED_TABLE.toString());
261261
t.setDbName(databaseName);

ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,6 +3048,7 @@ private RelNode genTableLogicalPlan(String tableAlias, QB qb) throws SemanticExc
30483048
final NotNullConstraint nnc = tabMetaData.getNotNullConstraint();
30493049
final PrimaryKeyInfo pkc = tabMetaData.getPrimaryKeyInfo();
30503050

3051+
Set<String> alreadyAdded = new HashSet<>();
30513052
for (StructField structField : fields) {
30523053
colName = structField.getFieldName();
30533054
colInfo = new ColumnInfo(
@@ -3056,6 +3057,7 @@ private RelNode genTableLogicalPlan(String tableAlias, QB qb) throws SemanticExc
30563057
isNullable(colName, nnc, pkc), tableAlias, false);
30573058
colInfo.setSkewedCol(isSkewedCol(tableAlias, qb, colName));
30583059
rr.put(tableAlias, colName, colInfo);
3060+
alreadyAdded.add(colName);
30593061
cInfoLst.add(colInfo);
30603062
}
30613063
// TODO: Fix this
@@ -3065,6 +3067,9 @@ private RelNode genTableLogicalPlan(String tableAlias, QB qb) throws SemanticExc
30653067
// 3.2 Add column info corresponding to partition columns
30663068
for (FieldSchema part_col : tabMetaData.getPartCols()) {
30673069
colName = part_col.getName();
3070+
if (alreadyAdded.contains(colName)) {
3071+
continue;
3072+
}
30683073
colInfo = new ColumnInfo(colName,
30693074
TypeInfoFactory.getPrimitiveTypeInfo(part_col.getType()),
30703075
isNullable(colName, nnc, pkc), tableAlias, true);

0 commit comments

Comments
 (0)