You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "fresh-borzoni (via GitHub)" <gi...@apache.org> on 2026/07/25 20:46:31 UTC
Re: [PR] [Flink] Kvscan flink integration [fluss]
fresh-borzoni commented on code in PR #3383:
URL: https://github.com/apache/fluss/pull/3383#discussion_r3650862231
##########
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/source/FlinkTableSourceBatchITCase.java:
##########
@@ -250,8 +253,151 @@ void testScanSingleRowFilterException() throws Exception {
assertThatThrownBy(() -> tEnv.explainSql(query))
.isInstanceOf(UnsupportedOperationException.class)
.hasMessage(
- "Currently, Fluss only support queries on table with datalake enabled"
- + " or point queries on primary key when it's in batch execution mode.");
+ "Batch mode requires either datalake enabled"
+ + " (set '"
+ + ConfigOptions.TABLE_DATALAKE_ENABLED.key()
+ + "' = 'true') or server-side KV scan on a"
+ + " primary-key table (set '"
+ + ConfigOptions.CLIENT_SCANNER_KV_SERVER_SIDE_ENABLED.key()
+ + "' = 'true').");
+ }
+
+ @Test
+ void testKvBatchScanOnPkTable() throws Exception {
Review Comment:
All KV tests write each key exactly once, so a log read would return the same rows and still pass. Shall we add an update + a delete before the scan, so the test can tell KV state from the changelog?
##########
fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java:
##########
@@ -1418,6 +1418,18 @@ public class ConfigOptions {
+ KV_SCANNER_MAX_BATCH_SIZE.key()
+ "'.");
+ public static final ConfigOption<Boolean> CLIENT_SCANNER_KV_SERVER_SIDE_ENABLED =
+ key("client.scanner.kv.server-side.enabled")
+ .booleanType()
+ .defaultValue(false)
+ .withDescription(
+ "Master switch for using the server-side KV scan in bounded reads "
+ + "of primary-key tables. When true, bounded primary-key reads "
+ + "scan the current KV state directly via the server-side KV scan. "
Review Comment:
"scan the current KV state directly" reads as if the flag forces a KV scan, but when a lake snapshot exists the union read still wins and the flag is never consulted and it only really applies when there's no lake data yet.
Shall we add "has no effect when a lake snapshot already exists" or smth similar? Same- in options.md.
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/source/enumerator/FlinkSourceEnumerator.java:
##########
@@ -583,41 +585,65 @@ private void startInBatchMode() {
context.callAsync(
() -> {
List<SourceSplitBase> splits = generateHybridLakeFlussSplits();
- // No lake snapshot exists, fall back to Fluss-only splits
if (splits == null) {
LOG.info(
"No lake snapshot found for table {},"
+ " falling back to Fluss-only splits.",
tablePath);
- if (isPartitioned) {
- Set<PartitionInfo> partitionInfos = listPartitions();
- Collection<Partition> partitions =
- partitionInfos.stream()
- .map(
- p ->
- new Partition(
- p.getPartitionId(),
- p.getPartitionName()))
- .collect(Collectors.toList());
- // Use log-only splits to avoid generating mixed split
- // types (HybridSnapshotLogSplit + LogSplit) for
- // primary-key tables, which is not supported.
- splits =
- this.initLogTablePartitionSplits(
- partitions, startingOffsetsInitializer);
- } else {
- splits = this.getLogSplit(null, null);
- }
+ splits = generateFlussOnlyBatchSplits(kvBatchEnabled);
Review Comment:
With lake enabled but no lake snapshot yet, flag off reads the whole log, so updates and deletes come back as extra rows (-U/+U/-D), and SELECT * returns the history, not the table.
Shall we KV-scan PK tables here regardless of the flag or fail? Silently wrong rows as the default seems wrong. WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org