Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
import org.apache.paimon.table.FormatTable;
import org.apache.paimon.table.Table;
import org.apache.paimon.table.sink.BatchTableCommit;
import org.apache.paimon.table.source.DataTableScan;
import org.apache.paimon.table.source.ReadBuilder;
import org.apache.paimon.utils.FileStorePathFactory;
import org.apache.paimon.utils.Filter;
import org.apache.paimon.utils.InternalRowPartitionComputer;
import org.apache.paimon.utils.Preconditions;
import org.apache.paimon.utils.StringUtils;
Expand Down Expand Up @@ -1227,7 +1229,8 @@ private List<PartitionEntry> getPartitionEntries(
if (partitionSpec != null && partitionSpec.getPartitionSpec() != null) {
readBuilder.withPartitionFilter(partitionSpec.getPartitionSpec());
}
return readBuilder.newScan().listPartitionEntries();
DataTableScan tableScan = (DataTableScan) readBuilder.newScan();
return tableScan.withLevelFilter(Filter.alwaysTrue()).listPartitionEntries();
}

private List<CatalogPartitionSpec> getPartitionSpecs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,35 @@ public void testShowPartitions() {

result = sql("SHOW PARTITIONS PartitionTable partition (dt='2020-01-02', hh='11')");
assertThat(result).containsExactlyInAnyOrder(Row.of("dt=2020-01-02/hh=11"));

sql(
"CREATE TABLE PartitionTableWithDVEnabled (\n"
+ " user_id BIGINT,\n"
+ " item_id BIGINT,\n"
+ " behavior STRING,\n"
+ " dt STRING,\n"
+ " hh STRING,\n"
+ " PRIMARY KEY (dt, hh, user_id) NOT ENFORCED\n"
+ ") PARTITIONED BY (dt, hh) WITH ('deletion-vectors.enabled'='true', 'write-only'='true')");
sql("INSERT INTO PartitionTableWithDVEnabled select 1,1,'a','2020-01-01','10'");
sql("INSERT INTO PartitionTableWithDVEnabled select 2,2,'b','2020-01-02','11'");
sql("INSERT INTO PartitionTableWithDVEnabled select 3,3,'c','2020-01-03','11'");
result = sql("SHOW PARTITIONS PartitionTableWithDVEnabled");
assertThat(result)
.containsExactlyInAnyOrder(
Row.of("dt=2020-01-01/hh=10"),
Row.of("dt=2020-01-02/hh=11"),
Row.of("dt=2020-01-03/hh=11"));

result = sql("SHOW PARTITIONS PartitionTableWithDVEnabled partition (hh='11')");
assertThat(result)
.containsExactlyInAnyOrder(
Row.of("dt=2020-01-02/hh=11"), Row.of("dt=2020-01-03/hh=11"));

result =
sql(
"SHOW PARTITIONS PartitionTableWithDVEnabled partition (dt='2020-01-02', hh='11')");
assertThat(result).containsExactlyInAnyOrder(Row.of("dt=2020-01-02/hh=11"));
}

@Test
Expand Down