You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2024/09/03 08:01:55 UTC
(doris) 05/05: [fix](catalog) fix invalid getPartitionNames() methods (#39878)
This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 07f60ed47bfd078bff1a9138d6e495ab1a4beae3
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Mon Aug 26 22:53:06 2024 +0800
[fix](catalog) fix invalid getPartitionNames() methods (#39878)
Some of `getPartitionNames()` is invalid can not used.
Remove these override methods to avoid unexpected behavior
---
fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java | 9 ---------
.../doris/datasource/iceberg/IcebergExternalTable.java | 10 ----------
.../doris/datasource/maxcompute/MaxComputeExternalTable.java | 12 ++----------
.../datasource/maxcompute/source/MaxComputeScanNode.java | 2 +-
4 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
index be990337043..548bea2c384 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
@@ -53,7 +53,6 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.time.Instant;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -599,14 +598,6 @@ public abstract class Table extends MetaObject implements Writable, TableIf, Gso
return table;
}
- public boolean isHasCompoundKey() {
- return hasCompoundKey;
- }
-
- public Set<String> getPartitionNames() {
- return Collections.EMPTY_SET;
- }
-
@Override
public BaseAnalysisTask createAnalysisTask(AnalysisInfo info) {
throw new NotImplementedException("createAnalysisTask not implemented");
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
index 06864bfe6a6..d4361a47797 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
@@ -28,14 +28,11 @@ import org.apache.doris.thrift.TIcebergTable;
import org.apache.doris.thrift.TTableDescriptor;
import org.apache.doris.thrift.TTableType;
-import org.apache.iceberg.PartitionField;
import org.apache.iceberg.Table;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
public class IcebergExternalTable extends ExternalTable {
@@ -92,11 +89,4 @@ public class IcebergExternalTable extends ExternalTable {
public Table getIcebergTable() {
return IcebergUtils.getIcebergTable(getCatalog(), getDbName(), getName());
}
-
- @Override
- public Set<String> getPartitionNames() {
- getIcebergTable();
- return IcebergUtils.getIcebergTable(getCatalog(), getDbName(), getName())
- .spec().fields().stream().map(PartitionField::name).collect(Collectors.toSet());
- }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java
index 297a4c0fa09..0edae9de23b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java
@@ -51,7 +51,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -92,14 +91,6 @@ public class MaxComputeExternalTable extends ExternalTable {
.getRecordCount();
}
- @Override
- public Set<String> getPartitionNames() {
- makeSureInitialized();
- Optional<SchemaCacheValue> schemaCacheValue = getSchemaCacheValue();
- return schemaCacheValue.map(value -> ((MaxComputeSchemaCacheValue) value).getPartitionColNames())
- .orElse(Collections.emptySet());
- }
-
public List<Column> getPartitionColumns() {
makeSureInitialized();
Optional<SchemaCacheValue> schemaCacheValue = getSchemaCacheValue();
@@ -129,7 +120,8 @@ public class MaxComputeExternalTable extends ExternalTable {
TablePartitionValues partitionValues = new TablePartitionValues();
partitionValues.addPartitions(partitionSpecs,
partitionSpecs.stream()
- .map(p -> parsePartitionValues(new ArrayList<>(getPartitionNames()), p))
+ .map(p -> parsePartitionValues(getPartitionColumns().stream().map(c -> c.getName()).collect(
+ Collectors.toList()), p))
.collect(Collectors.toList()),
partitionTypes);
return partitionValues;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
index 6521ecd3101..7c661ae748c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
@@ -123,7 +123,7 @@ public class MaxComputeScanNode extends FileQueryScanNode {
return result;
}
try {
- if (!table.getPartitionNames().isEmpty()) {
+ if (!table.getPartitionColumns().isEmpty()) {
if (conjuncts.isEmpty()) {
throw new IllegalArgumentException("Max Compute partition table need partition predicate.");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org