Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deniskuzZ committed Oct 11, 2024
1 parent b4671b0 commit 68f1a7a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ public List<Partition> getPartitions(org.apache.hadoop.hive.ql.metadata.Table ta

public boolean isPartitioned(org.apache.hadoop.hive.ql.metadata.Table hmsTable) {
if (!Catalogs.hiveCatalog(conf, hmsTable::getProperty) ||
hmsTable.getSd().getLocation() == null) {
hmsTable.getSnapshotRef() == null) {
return false;
}
Table table = IcebergTableUtil.getTable(conf, hmsTable.getTTable());
Expand Down Expand Up @@ -2122,8 +2122,8 @@ public boolean canPerformMetadataDelete(org.apache.hadoop.hive.ql.metadata.Table

@Override
public List<FieldSchema> getPartitionKeys(org.apache.hadoop.hive.ql.metadata.Table hmsTable) {
if (hmsTable.getSd().getLocation() == null) {
return null;
if (hmsTable.getSnapshotRef() == null) {
return Collections.emptyList();
}
Table icebergTable = IcebergTableUtil.getTable(conf, hmsTable.getTTable());
return IcebergTableUtil.getPartitionKeys(icebergTable, icebergTable.spec().specId());
Expand Down
14 changes: 13 additions & 1 deletion ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class ColumnInfo implements Serializable {
* Indicates whether the column is a virtual column.
*/
private boolean isVirtualCol;

private boolean isPartitionCol;

private ObjectInspector objectInspector;

Expand Down Expand Up @@ -117,6 +119,7 @@ public ColumnInfo(String internalName, ObjectInspector objectInspector, boolean
this.isVirtualCol = isVirtualCol;
this.isHiddenVirtualCol = isHiddenVirtualCol;
this.nullable = nullable;

setTypeName(getType().getTypeName());
}

Expand All @@ -126,6 +129,7 @@ public ColumnInfo(ColumnInfo columnInfo) {
this.isSkewedCol = columnInfo.isSkewedCol();
this.tabAlias = columnInfo.getTabAlias();
this.isVirtualCol = columnInfo.getIsVirtualCol();
this.isPartitionCol = columnInfo.getIsPartitionCol();
this.isHiddenVirtualCol = columnInfo.isHiddenVirtualCol();
this.nullable = columnInfo.nullable;
this.setType(columnInfo.getType());
Expand Down Expand Up @@ -166,9 +170,13 @@ public String getTabAlias() {
}

public boolean getIsVirtualCol() {
return isVirtualCol;
return isVirtualCol || isPartitionCol;
}

public boolean getIsPartitionCol() {
return isPartitionCol;
}

public boolean isHiddenVirtualCol() {
return isHiddenVirtualCol;
}
Expand Down Expand Up @@ -197,6 +205,10 @@ public void setVirtualCol(boolean isVirtualCol) {
this.isVirtualCol = isVirtualCol;
}

public void setPartitionCol(boolean isPartitionCol) {
this.isPartitionCol = isPartitionCol;
}

public void setHiddenVirtualCol(boolean isHiddenVirtualCol) {
this.isHiddenVirtualCol = isHiddenVirtualCol;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

package org.apache.hadoop.hive.ql.metadata;

import java.util.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.hive.metastore.api.FieldSchema;

/**
Expand All @@ -34,10 +36,6 @@
*/
public class DummyPartition extends Partition {

@SuppressWarnings("nls")
private static final Logger LOG = LoggerFactory
.getLogger("hive.ql.metadata.DummyPartition");

private String name;
private LinkedHashMap<String, String> partSpec;
public DummyPartition() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ public static void setupNeededColumns(TableScanOperator scanOp, RowSchema inputR
continue;
}
referencedColumnNames.add(column);
if (colInfo.getIsVirtualCol()) {
if (colInfo.getIsVirtualCol() && !colInfo.getIsPartitionCol()) {
// part is also a virtual column, but part col should not in this
// list.
for (int j = 0; j < virtualCols.size(); j++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11963,7 +11963,7 @@ private Operator genTablePlan(String alias, QB qb) throws SemanticException {
TypeInfoUtils.getTypeInfoFromObjectInspector(fields.get(i)
.getFieldObjectInspector()), alias, false);
if (partCols.contains(colInfo.getInternalName())) {
colInfo.setVirtualCol(true);
colInfo.setPartitionCol(true);
}
colInfo.setSkewedCol(isSkewedCol(alias, qb, fields.get(i).getFieldName()));
rwsch.put(alias, fields.get(i).getFieldName(), colInfo);
Expand Down

0 comments on commit 68f1a7a

Please sign in to comment.