Skip to content

[GLUTEN-11341][CORE] Support Scala 2.13 with IntelliJ IDE#11342

Merged
baibaichen merged 7 commits intoapache:mainfrom
baibaichen:feature/intellij-java17
Dec 31, 2025
Merged

[GLUTEN-11341][CORE] Support Scala 2.13 with IntelliJ IDE#11342
baibaichen merged 7 commits intoapache:mainfrom
baibaichen:feature/intellij-java17

Conversation

@baibaichen
Copy link
Contributor

@baibaichen baibaichen commented Dec 29, 2025

Fixes #11341

What changes were proposed in this pull request?

This PR includes several improvements for Scala 2.13 compatibility and code modernization:

Change Description Files
Update Java compiler release version Changed from hardcoded 8 to ${java.version} in the Scala 2.13 profiler to align with maven.compiler.target pom.xml
Replace deprecated file reading method Migrated from deprecated fileToString to Files.readString in GlutenSQLQueryTestSuite (see apache/spark#51911) gluten-ut/spark40/src/test/scala/org/apache/spark/GlutenSQLQueryTestSuite.scala
Fix symbol literal deprecation Refactored to use Symbol() for column references to fix compilation error in Scala 2.13 with IntelliJ compiler GlutenDataSourceV2Suite.scala, ClickHouseAdaptiveQueryExecSuite.scala, VeloxAdaptiveQueryExecSuite.scala
Suppress warnings Added suppressions for ContextAwareIterator initialization and ContentFile::path warnings in Scala 2.13 ColumnarArrowEvalPythonExec.scala, GlutenIcebergSourceUtil.scala
Remove obsolete suppressions Removed suppression for lint-multiarg-infix warnings from pom.xml (see apache/spark#43332) pom.xml

Why are the changes needed?

These changes are necessary to:

  • Maintain compatibility with Scala 2.13 and IntelliJ compiler to accelerate development speed
  • Remove deprecated code that was removed from Spark codebase
  • Improve build configuration consistency

How was this patch tested?

  • Existing test suites
  • Manual testing

@github-actions github-actions bot added CORE works for Gluten Core VELOX DATA_LAKE labels Dec 29, 2025
@github-actions
Copy link

Run Gluten Clickhouse CI on x86

Copy link
Contributor

@jinchengchenghh jinchengchenghh Dec 30, 2025

Choose a reason for hiding this comment

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

Can we use col("b")? The warning may be caused by b with single quote

Copy link
Contributor

Choose a reason for hiding this comment

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

Syntax Valid Notes
df.repartition(4, 'b) Old-style, works
df.repartition(4, Symbol("b")) Same as above
df.repartition(4, col("b")) Recommended
df.repartition(4, 'b), Syntax error

}
}

@nowarn
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the warning message? Can we fix the warning?

Copy link
Contributor Author

@baibaichen baibaichen Dec 30, 2025

Choose a reason for hiding this comment

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

org.apache.iceberg.ContentFile::path() is marked as deprecated. Without introducing a shim, it's hard to fix properly, so we'll suppress the warning for now.

        asFileScanTask(tasks.toList).foreach {
          task =>
            paths.add(
              BackendsApiManager.getTransformerApiInstance
                .encodeFilePathIfNeed(task.file().path().toString))  // => deprecated

Additionally, @nowarn can only be added before method names; it cannot be applied before individual statements.

Copy link
Contributor

Choose a reason for hiding this comment

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

As the comment indicates, please use location

  /**
   * Returns fully qualified path to the file, suitable for constructing a Hadoop Path.
   *
   * @deprecated since 1.7.0, will be removed in 2.0.0; use {@link #location()} instead.
   */
  @Deprecated
  CharSequence path();

  /** Return the fully qualified path to the file. */
  default String location() {
    return path().toString();
  }

Copy link
Contributor

Choose a reason for hiding this comment

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

There is shim for iceberg like this PR, #11146, we can accept current workaround, and fix it after #11146 merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the comment indicates, please use location

  /**
   * Returns fully qualified path to the file, suitable for constructing a Hadoop Path.
   *
   * @deprecated since 1.7.0, will be removed in 2.0.0; use {@link #location()} instead.
   */
  @Deprecated
  CharSequence path();

  /** Return the fully qualified path to the file. */
  default String location() {
    return path().toString();
  }

No, location doesn't work in profiles in Spark 3.3 and earlier.

@github-actions
Copy link

Run Gluten Clickhouse CI on x86

1 similar comment
@baibaichen
Copy link
Contributor Author

Run Gluten Clickhouse CI on x86

baibaichen and others added 7 commits December 30, 2025 20:52
…o fix compilation error in Scala 2.13 with IntelliJ compiler: symbol literal is deprecated; use Symbol("i")
…reading in GlutenSQLQueryTestSuite

see apache/spark#51911 which removes Spark's fileToString method from Spark code base.
…8 to `${java.version}` in the Scala 2.13 profiler to align it with `maven.compiler.target`
@baibaichen baibaichen force-pushed the feature/intellij-java17 branch from 85960a4 to 6d3e250 Compare December 30, 2025 12:52
@github-actions
Copy link

Run Gluten Clickhouse CI on x86

Copy link
Contributor

@jinchengchenghh jinchengchenghh left a comment

Choose a reason for hiding this comment

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

Thanks for your fix!

@baibaichen baibaichen merged commit 173bbbf into apache:main Dec 31, 2025
61 checks passed
@baibaichen baibaichen deleted the feature/intellij-java17 branch December 31, 2025 00:42
QCLyu pushed a commit to QCLyu/incubator-gluten that referenced this pull request Jan 8, 2026
* [Scala 2.13][IntelliJ] Remove suppression for lint-multiarg-infix warnings in pom.xml

see apache/spark#43332

* [Scala 2.13][IntelliJ] Suppress warning for `ContentFile::path`

* [Scala 2.13][IntelliJ] Suppress warning for ContextAwareIterator initialization

* [Scala 2.13][IntelliJ] Refactor to use Symbol for column references to fix compilation error in Scala 2.13 with IntelliJ compiler: symbol literal is deprecated; use Symbol("i")

* [Fix] Replace deprecated fileToString with Files.readString for file reading in GlutenSQLQueryTestSuite

see apache/spark#51911 which removes Spark's fileToString method from Spark code base.

* [Scala 2.13][IntelliJ] Update the Java compiler release version from 8 to `${java.version}` in the Scala 2.13 profiler to align it with `maven.compiler.target`

* [Refactor] Replace usage of `Symbol` with `col` for column references to align with Spark API best practices

---------

Co-authored-by: Chang chen <chenchang@apache.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core DATA_LAKE VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Java 17 and scala 2.13 with Intellij IDE

2 participants

Comments