-
Notifications
You must be signed in to change notification settings - Fork 292
Add shims layer, Delete command base classes and refactor delta-33x Delete #13620
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
Merged
nartal1
merged 2 commits into
NVIDIA:branch-25.12
from
nartal1:delta_lake_400_shims_and_delete_cmd
Oct 20, 2025
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,35 +22,57 @@ import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan | |
|
|
||
| /** | ||
| * Trait to abstract version-specific Spark API differences between Delta 3.3.x and 4.0.x. | ||
| * Mainly handles SparkSession type changes and Column/DataFrame creation APIs introduced | ||
| * in Spark 4.0. | ||
| * | ||
| * Key API differences handled: | ||
| * 1. SparkSession types: Spark 4.0 split SparkSession to support both classic and connect | ||
| * execution modes. It introduced: | ||
| * - org.apache.spark.sql.SparkSession (SqlSparkSession): unified API interface | ||
| * - org.apache.spark.sql.classic.SparkSession (ClassicSparkSession): classic execution mode | ||
| * - org.apache.spark.sql.connect.SparkSession: Spark Connect remote execution | ||
| * Spark 3.x uses a single SparkSession type for all purposes. | ||
| * 2. DataFrame creation: Spark 3.x uses Dataset.ofRows(), Spark 4.0 uses | ||
| * TrampolineConnectShims.createDataFrame(). | ||
| * 3. Column creation: Spark 3.x uses new Column(expr), Spark 4.0 uses DFUDFShims.exprToColumn(). | ||
| */ | ||
| trait DeltaCommandShims { | ||
|
|
||
| /** | ||
| * Type alias for the version-specific SparkSession type used in run() methods. | ||
| * Delta 3.3.x uses SparkSession, Delta 4.0.x uses SqlSparkSession. | ||
| * Type alias for the version-specific SparkSession type used in the shimming layer. | ||
| * This type is used when: | ||
| * 1. Casting the SparkSession parameter inside run() method body | ||
| * 2. As parameter type for shim methods (toOperationSparkSession, recacheByPlan) | ||
| * | ||
| */ | ||
| type RunSparkSession <: SparkSession | ||
| type ShimSparkSession <: SparkSession | ||
|
|
||
| /** | ||
| * Type alias for the version-specific SparkSession type used in operations. | ||
| * Delta 3.3.x uses SparkSession, Delta 4.0.x uses ClassicSparkSession. | ||
| * Type alias for the version-specific SparkSession type used for internal operations. | ||
| * This is the SparkSession type used within command execution for operations like: | ||
|
Comment on lines
+49
to
+50
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| * - Creating DataFrames from LogicalPlans (via createDataFrame method) | ||
| * - Utility operations (splitMetadataAndDataPredicates, createSetTransaction) | ||
| * | ||
| * Version mapping: | ||
| * - Delta 3.3.x (Spark 3.x): org.apache.spark.sql.SparkSession | ||
| * - Delta 4.0.x (Spark 4.0): org.apache.spark.sql.classic.SparkSession (ClassicSparkSession) | ||
| */ | ||
| type OperationSparkSession <: SparkSession | ||
|
|
||
| /** | ||
| * Convert RunSparkSession to OperationSparkSession. | ||
| * Convert ShimSparkSession to OperationSparkSession. | ||
| * In Spark 4.0, this converts SqlSparkSession to ClassicSparkSession. | ||
| * In Spark 3.x, Both types are SparkSession. | ||
| */ | ||
| def toOperationSparkSession(spark: RunSparkSession): OperationSparkSession | ||
| def toOperationSparkSession(spark: ShimSparkSession): OperationSparkSession | ||
|
|
||
| /** | ||
| * Get the active OperationSparkSession. | ||
| */ | ||
| def getActiveOperationSparkSession: OperationSparkSession | ||
|
|
||
| /** | ||
| * Create a DataFrame from a LogicalPlan (version-specific API). | ||
| * Create a DataFrame from a LogicalPlan using version-specific API. | ||
| * - Spark 3.x: Dataset.ofRows(spark, logicalPlan) | ||
| * - Spark 4.0: TrampolineConnectShims.createDataFrame(spark, logicalPlan) | ||
| */ | ||
| def createDataFrame(spark: OperationSparkSession, logicalPlan: LogicalPlan): DataFrame | ||
|
|
||
|
|
@@ -62,5 +84,5 @@ trait DeltaCommandShims { | |
| /** | ||
| * Recache by plan with the correct SparkSession type. | ||
| */ | ||
| def recacheByPlan(spark: RunSparkSession, plan: LogicalPlan): Unit | ||
| def recacheByPlan(spark: ShimSparkSession, plan: LogicalPlan): Unit | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍