Skip to content

chore: Comet + Iceberg (1.8.1) CI #1715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

hsiang-c
Copy link
Contributor

@hsiang-c hsiang-c commented May 5, 2025

Which issue does this PR close?

Closes #. #1685

Rationale for this change

Run Iceberg Spark' tests as part of Comet CI

What changes are included in this PR?

  • Produce a git diff bases on Iceberg version 1.8.1 (will work on other Iceberg versions (e.g. 1.9.x) later)
  • Change the default value of Parquet Reader Type from ICEBERG to COMET
  • Disable testMergeSchemaIgnoreCastingLongToInt and testMergeSchemaIgnoreCastingDoubleToFloat in TestDataFrameWriterV2 for both Iceberg Spark 3.4 and Iceberg Spark 3.5
  • Run Iceberg Spark's tests, based on Iceberg's GitHub workflow: https://github.com/apache/iceberg/blob/main/.github/workflows/spark-ci.yml

How are these changes tested?

At the moment, locally:

# Spark 3.5
./gradlew -DsparkVersions=3.5 -DscalaVersion=2.12 -DflinkVersions= -DkafkaVersions= :iceberg-spark:iceberg-spark-3.5_2.12:check -Pquick=true -x javadoc

BUILD SUCCESSFUL in 26m 10s
46 actionable tasks: 7 executed, 39 up-to-date

./gradlew -DsparkVersions=3.5 -DscalaVersion=2.12 -DflinkVersions= -DkafkaVersions= :iceberg-spark:iceberg-spark-extensions-3.5_2.12:check -Pquick=true -x javadoc

BUILD SUCCESSFUL in 23m 44s
52 actionable tasks: 9 executed, 4 from cache, 39 up-to-date

./gradlew -DsparkVersions=3.5 -DscalaVersion=2.12 -DflinkVersions= -DkafkaVersions= :iceberg-spark:iceberg-spark-runtime-3.5_2.12:check -Pquick=true -x javadoc

BUILD SUCCESSFUL in 15s
65 actionable tasks: 4 executed, 61 up-to-date
# Spark 3.4
./gradlew -DsparkVersions=3.4 -DscalaVersion=2.12 -DflinkVersions= -DkafkaVersions= :iceberg-spark:iceberg-spark-3.4_2.12:check -Pquick=true -x javadoc

BUILD SUCCESSFUL in 21m 32s
45 actionable tasks: 7 executed, 1 from cache, 37 up-to-date

./gradlew -DsparkVersions=3.4 -DscalaVersion=2.12 -DflinkVersions= -DkafkaVersions= :iceberg-spark:iceberg-spark-extensions-3.4_2.12:check -Pquick=true -x javadoc

BUILD SUCCESSFUL in 22m 6s
51 actionable tasks: 5 executed, 2 from cache, 44 up-to-date

./gradlew -DsparkVersions=3.4 -DscalaVersion=2.12 -DflinkVersions= -DkafkaVersions= :iceberg-spark:iceberg-spark-runtime-3.4_2.12:check -Pquick=true -x javadoc

BUILD SUCCESSFUL in 18s
64 actionable tasks: 4 executed, 1 from cache, 59 up-to-date

run: |
cd apache-iceberg
rm -rf /root/.m2/repository/org/apache/parquet # somehow parquet cache requires cleanups
ENABLE_COMET=true ENABLE_COMET_SHUFFLE=true ../../gradlew -DsparkVersions=${{ matrix.spark-version.short }} -DscalaVersion=${{ matrix.scala-version }} -DflinkVersions= -DkafkaVersions= \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

with:
repository: apache/iceberg
path: apache-iceberg
ref: apache-iceberg-${{inputs.iceberg-version}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on Iceberg's release tag: https://github.com/apache/iceberg/tags

@codecov-commenter
Copy link

codecov-commenter commented May 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.66%. Comparing base (f09f8af) to head (aaf62c5).
Report is 183 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1715      +/-   ##
============================================
+ Coverage     56.12%   58.66%   +2.53%     
- Complexity      976     1135     +159     
============================================
  Files           119      129      +10     
  Lines         11743    12640     +897     
  Branches       2251     2363     +112     
============================================
+ Hits           6591     7415     +824     
- Misses         4012     4049      +37     
- Partials       1140     1176      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -986,6 +986,7 @@ under the License.
<exclude>**/build/**</exclude>
<exclude>**/target/**</exclude>
<exclude>**/apache-spark/**</exclude>
<exclude>**/apache-iceberg/**</exclude>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot to exclude the iceberg repo

Copy link
Contributor

@kazuyukitanimura kazuyukitanimura left a comment

Choose a reason for hiding this comment

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

Thanks @hsiang-c

run: |
cd apache-iceberg
rm -rf /root/.m2/repository/org/apache/parquet # somehow parquet cache requires cleanups
ENABLE_COMET=true ENABLE_COMET_SHUFFLE=true COMET_PARQUET_SCAN_IMPL=native_datafusion ./gradlew -DsparkVersions=${{ matrix.spark-version.short }} -DscalaVersion=${{ matrix.scala-version }} -DflinkVersions= -DkafkaVersions= \
Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm do we expect native_datafusion works for iceberg?

Copy link
Contributor

Choose a reason for hiding this comment

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

Native execution doesn't work for iceberg yet. Iceberg uses ParquetReaderType to control whether to use Comet or not. The default is ParquetReaderType.ICEBERG. We need to set to ParquetReaderType.COMET to turn on Comet, but currently it's for Comet reader only, not for native execution yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @kazuyukitanimura @huaxingao, I will remove native_dafafusion and native_iceberg_compact builds for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

but currently it's for Comet reader only, not for native execution yet.

Correct. I plan to work with @huaxingao once the Spark sql tests pass for native_iceberg_compat.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@parthchandra Please feel free to involve me, happy to help here.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's great @hsiang-c ! We can discuss this offline.

// Controls which Parquet reader implementation to use
public static final String PARQUET_READER_TYPE = "spark.sql.iceberg.parquet.reader-type";
- public static final ParquetReaderType PARQUET_READER_TYPE_DEFAULT = ParquetReaderType.ICEBERG;
+ public static final ParquetReaderType PARQUET_READER_TYPE_DEFAULT = ParquetReaderType.COMET;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@huaxingao I changed the default to COMET.

}

- @TestTemplate
+ @Disabled
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@huaxingao Disabled 2 unit tests b/c they fail with Comet reader.

integrationImplementation project(path: ':iceberg-hive-metastore', configuration: 'testArtifacts')
integrationImplementation project(path: ":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}", configuration: 'testArtifacts')
integrationImplementation project(path: ":iceberg-spark:iceberg-spark-extensions-${sparkMajorVersion}_${scalaVersion}", configuration: 'testArtifacts')
+ integrationImplementation project(path: ':iceberg-parquet')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only in Spark 3.4, I need to include iceberg-parquet otherwise the iceberg-spark-runtime-3.4 tests throw the following errors

org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 2.0 failed 1 times, most recent failure: Lost task 0.0 in stage 2.0 (TID 4) (17.115.161.202 executor driver): java.lang.NoSuchMethodError: 'org.apache.parquet.column.ParquetProperties$Builder org.apache.parquet.column.ParquetProperties$Builder.withBloomFilterFPP(java.lang.String, double)'
	at org.apache.iceberg.parquet.Parquet$WriteBuilder.build(Parquet.java:389)
	at org.apache.iceberg.parquet.Parquet$DataWriteBuilder.build(Parquet.java:787)
	at org.apache.iceberg.data.BaseFileWriterFactory.newDataWriter(BaseFileWriterFactory.java:131)
	at org.apache.iceberg.io.RollingDataWriter.newWriter(RollingDataWriter.java:52)
	at org.apache.iceberg.io.RollingDataWriter.newWriter(RollingDataWriter.java:32)
	at org.apache.iceberg.io.RollingFileWriter.openCurrentWriter(RollingFileWriter.java:108)
	at org.apache.iceberg.io.RollingDataWriter.<init>(RollingDataWriter.java:47)
	at org.apache.iceberg.spark.source.SparkWrite$UnpartitionedDataWriter.<init>(SparkWrite.java:701)
	at org.apache.iceberg.spark.source.SparkWrite$WriterFactory.createWriter(SparkWrite.java:675)
	at org.apache.iceberg.spark.source.SparkWrite$WriterFactory.createWriter(SparkWrite.java:652)
	at org.apache.spark.sql.execution.datasources.v2.WritingSparkTask.run(WriteToDataSourceV2Exec.scala:459)
	at org.apache.spark.sql.execution.datasources.v2.WritingSparkTask.run$(WriteToDataSourceV2Exec.scala:448)
	at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$.run(WriteToDataSourceV2Exec.scala:514)
	at org.apache.spark.sql.execution.datasources.v2.V2TableWriteExec.$anonfun$writeWithV2$2(WriteToDataSourceV2Exec.scala:411)
	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:92)
	at org.apache.spark.TaskContext.runTaskWithListeners(TaskContext.scala:161)
	at org.apache.spark.scheduler.Task.run(Task.scala:139)
	at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:554)
	at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1529)
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:557)

run: |
cd apache-iceberg
rm -rf /root/.m2/repository/org/apache/parquet # somehow parquet cache requires cleanups
ENABLE_COMET=true ENABLE_COMET_SHUFFLE=true ./gradlew -DsparkVersions=${{ matrix.spark-version.short }} -DscalaVersion=${{ matrix.scala-version }} -DflinkVersions= -DkafkaVersions= \
Copy link
Contributor

@kazuyukitanimura kazuyukitanimura May 8, 2025

Choose a reason for hiding this comment

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

ENABLE_COMET is available only for the patched Spark (with the diff) through setup-spark-builder
Which Spark is combined with this Iceberg test?
Also I just realized ENABLE_COMET_SHUFFLE is not used at all looks like

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kazuyukitanimura You're right, I don't read both env vars with the diff I made.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need to update the Spark referred in Iceberg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kazuyukitanimura

Sorry I don't get it.

Do you mean the build comamnd -DsparkVersions=${{ matrix.spark-version.short }} or in the diff?

In the diff, I modified the Iceberg Spark Gradle module according to the doc

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, the spark version provided by -DsparkVersions= is OSS Spark. do we need to let it load comet library?
Not sure if this test automatically load the Comet library in Spark referred by Iceberg...
@huaxingao ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants