GitHub user younghwan91 added a comment to the discussion: what different 
between 'hoodie.datasource.query.type = incremental' and 
'read.streaming.enabled = true'

The two options control different things. `read.streaming.enabled` decides 
whether the source is bounded. `hoodie.datasource.query.type` decides what a 
batch read returns. In 0.15.0 you can see it in 
[`HoodieTableSource`](https://github.com/apache/hudi/blob/38832854be37cb78ad1edd87f515f01ca5ea6a8a/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSource.java#L199-L230):
 `isBounded()` is simply `!read.streaming.enabled`.

**`hoodie.datasource.query.type = incremental`** (with `read.streaming.enabled 
= false`, the default) is a bounded, one-shot batch query:
- It reads the records changed by the commits in `[read.start-commit, 
read.end-commit]`. The splits are computed once at job start 
([L424-L440](https://github.com/apache/hudi/blob/38832854be37cb78ad1edd87f515f01ca5ea6a8a/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSource.java#L424-L440)).
- The job finishes after reading that range. If the range has no commits, you 
get an empty result.
- Typical use: a scheduled batch job that processes "what changed since the 
last run".

**`read.streaming.enabled = true`** is an unbounded streaming source:
- A single `split_monitor` task polls the timeline every 
`read.streaming.check-interval` seconds (default 60). It emits the files of 
each new commit to the `split_reader` tasks, and the job never finishes.
- The start position is `read.start-commit`: by default the latest instant, or 
`'earliest'` to read the whole history first and then follow new commits.
- In streaming mode, `query.type` `snapshot` and `incremental` behave the same 
([L460-L461](https://github.com/apache/hudi/blob/38832854be37cb78ad1edd87f515f01ca5ea6a8a/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSource.java#L460-L461)),
 because streaming is already a continuous incremental read.
- The consumed position is kept in Flink state, so it resumes from the 
checkpoint after a restart.

For a COW table on 0.15.0 / Flink 1.20:

```sql
-- batch: changes between two commits, then the job ends
SELECT * FROM t /*+ OPTIONS('hoodie.datasource.query.type'='incremental',
  'read.start-commit'='20260101000000', 'read.end-commit'='20260120000000') */;

-- streaming: all history, then keep following new commits
SELECT * FROM t /*+ OPTIONS('read.streaming.enabled'='true',
  'read.start-commit'='earliest', 'read.streaming.check-interval'='10') */;
```

Rule of thumb: use the incremental query type for periodic batch ETL over a 
commit range, and streaming read for a continuously running consumer.

If this solves it, please mark it as the answer so others with the same problem 
can find it.


GitHub link: 
https://github.com/apache/hudi/discussions/17990#discussioncomment-19895282

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to