Skip to content

[bug][EC][spark] fix type conversion error in executor spark session retrieval #1054

Description

@v-kkhuang

Search before asking

  • I had searched in the issues and found no similar issues.

Linkis Component

  • linkis-commons
  • linkis-computation-governance
  • linkis-dist
  • linkis-engineconn-plugin
  • linkis-extensions
  • linkis-orchestrator
  • linkis-public-enhancements
  • linkis-spring-cloud-services
  • linkis-web

Description

The SparkEngineConnExecutor code assumes all executors are SparkSqlExecutor and uses asInstanceOf[SparkSqlExecutor] to retrieve the SparkSession. This causes type conversion errors for other executor types like SparkScalaExecutor, SparkPythonExecutor, and SparkDataCalcExecutor.

Steps to reproduce

  1. Use SparkScalaExecutor, SparkPythonExecutor, or SparkDataCalcExecutor
  2. Trigger the spark executor params setting code path
  3. Type conversion exception occurs due to incorrect casting

Expected behavior

Each executor type should be able to correctly retrieve its own SparkSession without type conversion errors.

Your environment

  • Linkis version used: 2.0.0
  • Environment name and version:
    • hadoop-3.3.4
    • hive-2.3.3
    • spark-2.4.3 / 3.3.0
    • scala-2.11.12 / 2.12.17
    • jdk 1.8.0_xxx

Anything else

This PR adds a getSparkEngineSession method to each executor subclass and uses pattern matching to safely retrieve the SparkSession based on the actual executor type.

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions