Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
28 changes: 14 additions & 14 deletions .github/workflows/bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
include:
- scalaProfile: "scala-2.12"
sparkProfile: "spark3.5"
flinkProfile: "flink2.2"
flinkProfile: "flink2.3"

steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
include:
- scalaProfile: "scala-2.12"
sparkProfile: "spark3.5"
flinkProfile: "flink2.2"
flinkProfile: "flink2.3"

steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -293,7 +293,7 @@ jobs:
include:
- scalaProfile: "scala-2.12"
sparkProfile: "spark3.5"
flinkProfile: "flink2.2"
flinkProfile: "flink2.3"

steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -381,7 +381,7 @@ jobs:
include:
- scalaProfile: "scala-2.12"
sparkProfile: "spark3.5"
flinkProfile: "flink2.2"
flinkProfile: "flink2.3"

env:
UT_MODULES: >-
Expand Down Expand Up @@ -1497,7 +1497,7 @@ jobs:
# - flinkProfile: "flink2.0"
# flinkAvroVersion: "1.11.4"
# flinkParquetVersion: '1.14.4'
- flinkProfile: "flink2.2"
- flinkProfile: "flink2.3"
flinkAvroVersion: "1.11.4"
flinkParquetVersion: '1.15.2'
steps:
Expand Down Expand Up @@ -1531,7 +1531,7 @@ jobs:
FLINK_PROFILE: ${{ matrix.flinkProfile }}
FLINK_AVRO_VERSION: ${{ matrix.flinkAvroVersion }}
FLINK_PARQUET_VERSION: ${{ matrix.flinkParquetVersion }}
if: ${{ endsWith(env.FLINK_PROFILE, '2.2') }}
if: ${{ endsWith(env.FLINK_PROFILE, '2.3') }}
run: |
mvn clean install -T 2 -Pintegration-tests -D"$SCALA_PROFILE" -D"$FLINK_PROFILE" -pl hudi-flink-datasource/hudi-flink -am -Davro.version="$FLINK_AVRO_VERSION" -Dparquet.version="$FLINK_PARQUET_VERSION" -DskipTests=true $MVN_ARGS
mvn verify -Pintegration-tests -D"$SCALA_PROFILE" -D"$FLINK_PROFILE" -Davro.version="$FLINK_AVRO_VERSION" -Dparquet.version="$FLINK_PARQUET_VERSION" $FLINK_IT_FILTER1 -pl hudi-flink-datasource/hudi-flink $MVN_ARGS -Djacoco.skip=false
Expand All @@ -1542,10 +1542,10 @@ jobs:
if: always()
run: python3 scripts/ci/test_timing_summary.py --title "${{ github.job }}"
- name: Generate merged coverage report
if: always() && endsWith(matrix.flinkProfile, '2.2') && github.event_name != 'merge_group'
if: always() && endsWith(matrix.flinkProfile, '2.3') && github.event_name != 'merge_group'
run: ./scripts/jacoco/generate_merged_coverage_report.sh $GITHUB_WORKSPACE
- name: Upload coverage to Codecov
if: always() && endsWith(matrix.flinkProfile, '2.2') && github.event_name != 'merge_group'
if: always() && endsWith(matrix.flinkProfile, '2.3') && github.event_name != 'merge_group'
uses: ./.github/actions/upload-coverage
with:
flags: flink-integration-tests
Expand All @@ -1559,7 +1559,7 @@ jobs:
strategy:
matrix:
include:
- flinkProfile: "flink2.2"
- flinkProfile: "flink2.3"
flinkAvroVersion: "1.11.4"
flinkParquetVersion: '1.15.2'
steps:
Expand All @@ -1585,18 +1585,18 @@ jobs:
FLINK_PROFILE: ${{ matrix.flinkProfile }}
FLINK_AVRO_VERSION: ${{ matrix.flinkAvroVersion }}
FLINK_PARQUET_VERSION: ${{ matrix.flinkParquetVersion }}
if: ${{ endsWith(env.FLINK_PROFILE, '2.2') }}
if: ${{ endsWith(env.FLINK_PROFILE, '2.3') }}
run: |
mvn clean install -T 2 -Pintegration-tests -D"$SCALA_PROFILE" -D"$FLINK_PROFILE" -pl hudi-flink-datasource/hudi-flink -am -Davro.version="$FLINK_AVRO_VERSION" -Dparquet.version="$FLINK_PARQUET_VERSION" -DskipTests=true $MVN_ARGS
mvn verify -Pintegration-tests -D"$SCALA_PROFILE" -D"$FLINK_PROFILE" -Davro.version="$FLINK_AVRO_VERSION" -Dparquet.version="$FLINK_PARQUET_VERSION" $FLINK_IT_FILTER2 -pl hudi-flink-datasource/hudi-flink $MVN_ARGS -Djacoco.skip=false
- name: Test timing summary
if: always()
run: python3 scripts/ci/test_timing_summary.py --title "${{ github.job }}"
- name: Generate merged coverage report
if: always() && endsWith(matrix.flinkProfile, '2.2') && github.event_name != 'merge_group'
if: always() && endsWith(matrix.flinkProfile, '2.3') && github.event_name != 'merge_group'
run: ./scripts/jacoco/generate_merged_coverage_report.sh $GITHUB_WORKSPACE
- name: Upload coverage to Codecov
if: always() && endsWith(matrix.flinkProfile, '2.2') && github.event_name != 'merge_group'
if: always() && endsWith(matrix.flinkProfile, '2.3') && github.event_name != 'merge_group'
uses: ./.github/actions/upload-coverage
with:
flags: flink-integration-tests
Expand Down Expand Up @@ -1676,7 +1676,7 @@ jobs:
sparkProfile: 'spark3.5'
sparkRuntime: 'spark3.5.9'
- scalaProfile: 'scala-2.12'
flinkProfile: 'flink2.2'
flinkProfile: 'flink2.3'
flinkAvroVersion: '1.11.4'
flinkParquetVersion: '1.15.2'
sparkProfile: 'spark3.5'
Expand Down Expand Up @@ -1872,7 +1872,7 @@ jobs:
matrix:
include:
- sparkProfile: 'spark3.5'
flinkProfile: 'flink2.2'
flinkProfile: 'flink2.3'
sparkArchive: 'spark-3.5.9/spark-3.5.9-bin-hadoop3.tgz'
env:
# The only modules with integration-test classes besides hudi-flink, whose ITs run in the
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/maven_artifact_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
strategy:
matrix:
include:
- scalaProfile: 'scala-2.12'
flinkProfile: 'flink2.3'
sparkProfile: 'spark3.5'
sparkRuntime: 'spark3.5.9'
- scalaProfile: 'scala-2.12'
flinkProfile: 'flink2.2'
sparkProfile: 'spark3.5'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release_candidate_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ jobs:
flinkProfile: 'flink2.2'
sparkProfile: 'spark3.5'
sparkRuntime: 'spark3.5.9'
- scalaProfile: 'scala-2.12'
flinkProfile: 'flink2.3'
sparkProfile: 'spark3.5'
sparkRuntime: 'spark3.5.9'
steps:
- uses: actions/checkout@v5
- name: Set up JDK 11
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Prerequisites for building Apache Hudi:
```
# Checkout code and build
git clone https://github.com/apache/hudi.git && cd hudi
mvn clean package -DskipTests -Dspark3.5 -Dflink2.2
mvn clean package -DskipTests -Dspark3.5 -Dflink2.3

# Start command
spark-3.5.0-bin-hadoop3/bin/spark-shell \
Expand Down Expand Up @@ -163,10 +163,10 @@ mvn clean package -DskipTests -Dspark3.5 -Dscala-2.13 -pl packaging/hudi-spark-b
For example,
```
# Build against Spark 3.5.x
mvn clean package -DskipTests -Dspark3.5 -Dflink2.2
mvn clean package -DskipTests -Dspark3.5 -Dflink2.3

# Build against Spark 3.4.x
mvn clean package -DskipTests -Dspark3.4 -Dflink2.2
mvn clean package -DskipTests -Dspark3.4 -Dflink2.3
```

#### What about "spark-avro" module?
Expand All @@ -175,14 +175,15 @@ Starting from versions 0.11, Hudi no longer requires `spark-avro` to be specifie

### Build with different Flink versions

The default Flink version supported is 2.2. The default Flink 2.2.x version, corresponding to the `flink2.2` profile, is 2.2.1.
The default Flink version supported is 2.3. The default Flink 2.3.x version, corresponding to the `flink2.3` profile, is 2.3.0.
Flink is Scala-free since 1.15.x, there is no need to specify the Scala version for Flink 1.15.x and above versions.
Refer to the table below for building with different Flink and Scala versions.

| Maven build options | Expected Flink bundle jar name | Notes |
|:--------------------|:--------------------------------|:---------------------------------|
| (empty) | hudi-flink2.2-bundle | For Flink 2.2 (default options) |
| `-Dflink2.2` | hudi-flink2.2-bundle | For Flink 2.2 (same as default) |
| (empty) | hudi-flink2.3-bundle | For Flink 2.3 (default options) |
| `-Dflink2.3` | hudi-flink2.3-bundle | For Flink 2.3 (same as default) |
| `-Dflink2.2` | hudi-flink2.2-bundle | For Flink 2.2 |
| `-Dflink2.1` | hudi-flink2.1-bundle | For Flink 2.1 |
| `-Dflink2.0` | hudi-flink2.0-bundle | For Flink 2.0 |
| `-Dflink1.20` | hudi-flink1.20-bundle | For Flink 1.20 |
Expand All @@ -191,8 +192,8 @@ Refer to the table below for building with different Flink and Scala versions.

For example,
```
# Build against Flink 2.2.x
mvn clean package -DskipTests -Dflink2.2
# Build against Flink 2.3.x
mvn clean package -DskipTests -Dflink2.3
```

## Running Tests
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines-20230430.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

# NOTE:
# This config file defines how Azure CI runs tests with Spark 3.5 and Flink 2.2 profiles.
# This config file defines how Azure CI runs tests with Spark 3.5 and Flink 2.3 profiles.
# PRs will need to keep in sync with master's version to trigger the CI runs.
# See scripts/jacoco/README.md for how aggregated code coverage report works
# across multiple modules.
Expand Down Expand Up @@ -101,7 +101,7 @@ parameters:
- '!packaging/hudi-utilities-slim-bundle'

variables:
BUILD_PROFILES: '-Dscala-2.12 -Dspark3.5 -Dflink2.2'
BUILD_PROFILES: '-Dscala-2.12 -Dspark3.5 -Dflink2.3'
PLUGIN_OPTS: '-Dcheckstyle.skip=true -Drat.skip=true -ntp -B -V -Pwarn-log -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.shade=warn -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.dependency=warn'
# The aether.* properties drive maven-resolver's native HTTP transport (Maven 3.9+); the
# maven.wagon.* ones are kept because this image's Maven version is not pinned and Maven 3.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ public void initEnv() {
// configure not to retry after failure
execConf.setString("restart-strategy", "fixed-delay");
execConf.setString("restart-strategy.fixed-delay.attempts", "0");
// Flink 2.3 rejects an INSERT whose upsert key differs from the primary key of the sink table
// unless it has an ON CONFLICT clause (FLINK-38927), restore the behavior of earlier versions.
execConf.setString("table.exec.sink.require-on-conflict", "false");

@cshuo cshuo Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HoodieFlinkQuickstart.java:119 · HoodieTableSink.java:148–153

I’d prefer the default UPSERT branch to preserve the row kinds in requestedMode and filter out only UPDATE_BEFORE:

ChangelogMode.Builder builder = ChangelogMode.newBuilder();
for (RowKind kind : requestedMode.getContainedKinds()) {
  if (kind != RowKind.UPDATE_BEFORE) {
    builder.addContainedKind(kind);
  }
}
return builder.build();

With the current change, an insert-only streaming job that worked on 2.2 can fail at planning time on 2.3 when Flink cannot infer an upsert key for the keyed Hudi sink. Users must explicitly set table.exec.sink.require-on-conflict=false to keep the same SQL. Filtering the requested kinds keeps this input insert-only, so the job runs with default settings and avoids the extra SinkMaterializer on 2.3.0. Flink 2.4 also changed require-on-conflict to default to false to restore compatibility. Upstream change

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cshuo Makes sense, done. getChangelogMode now uses your snippet, and I removed the require-on-conflict setting from the quickstart, the tests and insert.sql.

this.tableEnvironment = streamTableEnv;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ public void testRemotePartitioner() throws Exception {
String tablePath = tempFile.getAbsolutePath();
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment().setParallelism(4);
TableEnvironment tableEnv = StreamTableEnvironment.create(env);
// Flink 2.3 rejects an INSERT whose upsert key differs from the primary key of the sink table
// unless it has an ON CONFLICT clause (FLINK-38927), restore the behavior of earlier versions.
tableEnv.getConfig().getConfiguration().setString("table.exec.sink.require-on-conflict", "false");
Map<String, String> options = new HashMap<>();
options.put(FlinkOptions.PATH.key(), tablePath);
options.put(FlinkOptions.TABLE_TYPE.key(), FlinkOptions.TABLE_TYPE_MERGE_ON_READ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ void beforeEach() {
execConf.setString("execution.checkpointing.interval", "2s");
execConf.setString("restart-strategy", "fixed-delay");
execConf.setString("restart-strategy.fixed-delay.attempts", "0");
// Flink 2.3 rejects an INSERT whose upsert key differs from the primary key of the sink table
// unless it has an ON CONFLICT clause (FLINK-38927), restore the behavior of earlier versions.
execConf.setString("table.exec.sink.require-on-conflict", "false");

batchTableEnv = TestTableEnvs.getBatchTableEnv();
batchTableEnv.getConfig().getConfiguration()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ void beforeEach() {
// configure not to retry after failure
execConf.setString("restart-strategy", "fixed-delay");
execConf.setString("restart-strategy.fixed-delay.attempts", "0");
// Flink 2.3 rejects an INSERT whose upsert key differs from the primary key of the sink table
// unless it has an ON CONFLICT clause (FLINK-38927), restore the behavior of earlier versions.
execConf.setString("table.exec.sink.require-on-conflict", "false");

batchTableEnv = TestTableEnvs.getBatchTableEnv();
batchTableEnv.getConfig().getConfiguration()
Expand Down
Loading