This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 6dac123277f [fix](catalog) fix invalid getPartitionNames() methods 
(#39878)
6dac123277f is described below

commit 6dac123277f9df43638dd576175d19a11d05948d
Author: Mingyu Chen <morning...@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 c3b2f01448b..906a710f369 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
@@ -54,7 +54,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 ea651df9fef..87ab3655534 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
@@ -110,7 +110,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-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to