Skip to content

Commit 0c737b8

Browse files
committed
Fix Bug from comments
1 parent 858c506 commit 0c737b8

File tree

4 files changed

+41
-20
lines changed

4 files changed

+41
-20
lines changed

paimon-core/src/main/java/org/apache/paimon/KeyValueFileStore.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
public class KeyValueFileStore extends AbstractFileStore<KeyValue> {
5454

5555
private final boolean crossPartitionUpdate;
56-
private final RowType bucketKeyType;
5756
private final RowType keyType;
5857
private final RowType valueType;
5958
private final KeyValueFieldsExtractor keyValueFieldsExtractor;
@@ -68,7 +67,6 @@ public KeyValueFileStore(
6867
boolean crossPartitionUpdate,
6968
CoreOptions options,
7069
RowType partitionType,
71-
RowType bucketKeyType,
7270
RowType keyType,
7371
RowType valueType,
7472
KeyValueFieldsExtractor keyValueFieldsExtractor,
@@ -77,7 +75,6 @@ public KeyValueFileStore(
7775
CatalogEnvironment catalogEnvironment) {
7876
super(fileIO, schemaManager, schema, tableName, options, partitionType, catalogEnvironment);
7977
this.crossPartitionUpdate = crossPartitionUpdate;
80-
this.bucketKeyType = bucketKeyType;
8178
this.keyType = keyType;
8279
this.valueType = valueType;
8380
this.keyValueFieldsExtractor = keyValueFieldsExtractor;
@@ -203,7 +200,7 @@ public KeyValueFileStoreScan newScan() {
203200
options.bucketFunctionType(),
204201
schema.logicalRowType(),
205202
partitionType,
206-
bucketKeyType);
203+
schema.logicalBucketKeyType());
207204

208205
return new KeyValueFileStoreScan(
209206
newManifestsReader(),

paimon-core/src/main/java/org/apache/paimon/table/PrimaryKeyFileStoreTable.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ public KeyValueFileStore store() {
9393
tableSchema.crossPartitionUpdate(),
9494
options,
9595
tableSchema.logicalPartitionType(),
96-
PrimaryKeyTableUtils.addKeyNamePrefix(
97-
tableSchema.logicalBucketKeyType()),
9896
keyType,
9997
rowType,
10098
extractor,

paimon-core/src/test/java/org/apache/paimon/TestFileStore.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ private TestFileStore(
134134
options,
135135
partitionType,
136136
keyType,
137-
keyType,
138137
valueType,
139138
keyValueFieldsExtractor,
140139
mfFactory,

paimon-core/src/test/java/org/apache/paimon/table/BucketFilterScanTest.java

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package org.apache.paimon.table;
2020

21-
import org.apache.paimon.CoreOptions;
2221
import org.apache.paimon.catalog.Identifier;
2322
import org.apache.paimon.data.GenericRow;
2423
import org.apache.paimon.predicate.Predicate;
@@ -32,6 +31,8 @@
3231
import java.util.Set;
3332
import java.util.stream.Collectors;
3433

34+
import static org.apache.paimon.CoreOptions.BUCKET;
35+
import static org.apache.paimon.CoreOptions.BUCKET_KEY;
3536
import static org.assertj.core.api.Assertions.assertThat;
3637

3738
/**
@@ -40,6 +41,26 @@
4041
*/
4142
public class BucketFilterScanTest extends TableTestBase {
4243

44+
@Test
45+
public void testBucketFilterWithCompoundPredicateOnAppendTable() throws Exception {
46+
testBucketFilterWithCompoundPredicate(false);
47+
}
48+
49+
@Test
50+
public void testBucketFilterWithCompoundPredicateOnPkTable() throws Exception {
51+
testBucketFilterWithCompoundPredicate(true);
52+
}
53+
54+
@Test
55+
public void testCompositeBucketFilterWithCompoundPredicateOnAppendTable() throws Exception {
56+
testCompositeBucketFilterWithCompoundPredicate(false);
57+
}
58+
59+
@Test
60+
public void testCompositeBucketFilterWithCompoundPredicateOnPkTable() throws Exception {
61+
testCompositeBucketFilterWithCompoundPredicate(true);
62+
}
63+
4364
/**
4465
* Tests bucket filtering with compound predicates on a single-field bucket key.
4566
*
@@ -67,18 +88,21 @@ public class BucketFilterScanTest extends TableTestBase {
6788
* partition-b combination.
6889
* </ol>
6990
*/
70-
@Test
71-
public void testBucketFilterWithCompoundPredicate() throws Exception {
91+
private void testBucketFilterWithCompoundPredicate(boolean pk) throws Exception {
7292
// ---- schema & table ----
73-
Schema schema =
93+
Schema.Builder builder =
7494
Schema.newBuilder()
7595
.column("a", DataTypes.INT())
7696
.column("b", DataTypes.INT())
7797
.column("c", DataTypes.INT())
7898
.partitionKeys("a")
79-
.option(CoreOptions.BUCKET.key(), "10")
80-
.option(CoreOptions.BUCKET_KEY.key(), "b")
81-
.build();
99+
.option(BUCKET.key(), "10");
100+
if (pk) {
101+
builder.primaryKey("a", "b");
102+
} else {
103+
builder.option(BUCKET_KEY.key(), "b");
104+
}
105+
Schema schema = builder.build();
82106

83107
Identifier tableId = identifier("test_bucket_filter");
84108
catalog.createTable(tableId, schema, false);
@@ -148,18 +172,21 @@ public void testBucketFilterWithCompoundPredicate() throws Exception {
148172
* targeting.
149173
* </ol>
150174
*/
151-
@Test
152-
public void testCompositeBucketFilterWithCompoundPredicate() throws Exception {
175+
private void testCompositeBucketFilterWithCompoundPredicate(boolean pk) throws Exception {
153176
// ---- schema & table ----
154-
Schema schema =
177+
Schema.Builder builder =
155178
Schema.newBuilder()
156179
.column("a", DataTypes.INT())
157180
.column("b", DataTypes.INT())
158181
.column("c", DataTypes.INT())
159182
.partitionKeys("a")
160-
.option(CoreOptions.BUCKET.key(), "10")
161-
.option(CoreOptions.BUCKET_KEY.key(), "b,c")
162-
.build();
183+
.option(BUCKET.key(), "10");
184+
if (pk) {
185+
builder.primaryKey("a", "b", "c");
186+
} else {
187+
builder.option(BUCKET_KEY.key(), "b,c");
188+
}
189+
Schema schema = builder.build();
163190

164191
Identifier tableId = identifier("test_composite_bucket_filter");
165192
catalog.createTable(tableId, schema, false);

0 commit comments

Comments
 (0)