Skip to content

[SPARK-55983][SQL][FOLLOWUP] New single-pass analyzer functionality and bugfixes#54881

Open
mihailotim-db wants to merge 2 commits intoapache:masterfrom
mihailotim-db:resolver-pr2-core
Open

[SPARK-55983][SQL][FOLLOWUP] New single-pass analyzer functionality and bugfixes#54881
mihailotim-db wants to merge 2 commits intoapache:masterfrom
mihailotim-db:resolver-pr2-core

Conversation

@mihailotim-db
Copy link
Contributor

What changes were proposed in this pull request?

This PR ports additional single-pass resolver components from Databricks Runtime to OSS Spark, expanding the resolver package with new operator and expression
resolvers.

New resolver files (14):

  • PivotResolver - Resolves Pivot operators
  • UnpivotResolver - Resolves Unpivot operators
  • HigherOrderFunctionResolver - Resolves higher-order functions (e.g., transform, filter, aggregate)
  • LambdaFunctionResolver - Resolves lambda functions used in higher-order functions
  • TableValuedFunctionResolver - Resolves table-valued functions
  • ExtractValueResolver - Resolves UnresolvedExtractValue (array/map indexing)
  • GroupingAnalyticsResolver - Resolves grouping analytics expressions (GROUPING SETS, CUBE, ROLLUP)
  • RepartitionByExpressionResolver - Resolves RepartitionByExpression operators
  • NameParameterizedQueryResolver - Resolves name-parameterized queries
  • FunctionResolverUtils - Shared utilities for function resolution (star expansion in function args)
  • IdentifierFromUnresolvedNodeExtractor - Extracts identifiers from unresolved nodes
  • LogicalPlanDifference - Infrastructure for diffing logical plans (used in dual-run validation)
  • RecursiveCteState - State tracking for recursive CTE resolution
  • ResolverRunnerResult - Result type for resolver runner

Modified existing files (4):

  • ExpressionResolver - Added expandStarExpressions, resolvePivotAggregates, resolveUnpivotArguments methods
  • ExpressionResolutionContext - Added resolvingPivotAggregates, hasGroupingAnalyticsExpression, extractValueExtractionKey, lambdaVariableMap fields
  • NameScope - Added markScopeForHiddenOutputResolution() method
  • FunctionResolution - Added resolveBuiltinOrTempFunction, resolveTableValuedFunction methods

New test file (1):

  • LogicalPlanDifferenceSuite

Why are the changes needed?

The single-pass resolver is an alternative to the traditional fixed-point (iterative) analyzer that resolves SQL plans in a single bottom-up traversal. These
changes bring additional operator coverage to the OSS single-pass resolver, closing the gap between the Databricks Runtime implementation and the open-source
version. Without these resolvers, queries involving pivot/unpivot, higher-order functions, table-valued functions, grouping analytics, and other constructs would
fall back to the legacy fixed-point analyzer.

Does this PR introduce any user-facing change?

No. The single-pass resolver is gated behind configuration flags and these changes only expand internal resolver coverage.

How was this patch tested?

  • Verified that catalyst/compile, sql/compile, catalyst/Test/compile, and sql/Test/compile all pass cleanly.
  • Added LogicalPlanDifferenceSuite for the new LogicalPlanDifference infrastructure.
  • Existing resolver test suites (ResolverSuite, HybridAnalyzerSuite, ResolverGuardSuite, etc.) continue to compile and are unaffected by these changes.

Was this patch authored or co-authored using generative AI tooling?

…tabricks Runtime

Port additional single-pass resolver components from Databricks Runtime to OSS Spark, expanding the resolver package with new operator and expression resolvers. This includes support for pivot/unpivot, higher-order functions, lambda functions, table-valued functions, extract values, grouping analytics, repartition-by-expression, name-parameterized queries, and logical plan diffing infrastructure.

Co-authored-by: Isaac
The test expected IllegalArgumentException for a negative config value, but the
config key doesn't have that validation in OSS (it was a DatabricksSQLConf check).

Co-authored-by: Isaac
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.

1 participant