s-maling-celonis opened a new pull request, #58383:
URL: https://github.com/apache/spark/pull/58383

   ### What changes were proposed in this pull request?
   
   **JIRA: SPARK-XXXX (placeholder).** An ASF JIRA account request is in 
progress; this PR will be retitled (and tests renamed) once the ticket exists.
   
   `HiveSessionStateBuilder` constructs its own `Analyzer` and does not 
override `hintResolutionRules`. The Catalyst default is `Nil`, so 
`SparkSessionExtensions.injectHintResolutionRule` is ignored when Hive support 
is enabled (`enableHiveSupport()`, Hive Thrift Server / `jdbc:hive2`).
   
   `BaseSessionStateBuilder` already wires:
   
   ```scala
   override val hintResolutionRules: Seq[Rule[LogicalPlan]] =
     customHintResolutionRules
   ```
   
   This PR copies that override onto the Hive analyzer.
   
   `injectResolutionRule` is not a substitute: Hive's `extendedResolutionRules` 
run `ResolveSQLOnFile` *before* `customResolutionRules`. This is the same class 
of miss as SPARK-56453 (Hive analyzer lists not updated when the in-memory 
builder was).
   
   ### Why are the changes needed?
   
   With `enableHiveSupport()`, extensions that inject analyzer rules into the 
Hints batch never run. That includes any early-analysis work that must happen 
before `ResolveSQLOnFile` (for example path SQL such as `SELECT * FROM 
parquet.\`s3://...\``). In-memory sessions and Spark Connect without Hive are 
unaffected.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. 
`SparkSession.builder.enableHiveSupport().withExtensions(_.injectHintResolutionRule(...))`
 now applies those rules, matching the non-Hive session builder. Previously 
they were silently dropped.
   
   ### How was this patch tested?
   
   Added `HiveSparkSessionExtensionSuite` (isolated Hive `SparkSession`, no 
`TestHiveSingleton`):
   
   - Mirrors `SparkSessionExtensionSuite` "inject custom hint rule" 
(`CONVERT_TO_EMPTY` -> `LocalRelation`).
   - Path SQL `SELECT * FROM parquet.\`...\``: a hint rule sees 
`UnresolvedRelation`; an `injectResolutionRule` does not (because Hive places 
`ResolveSQLOnFile` before `customResolutionRules`).
   
   Local `hive/testOnly` was not run in this environment: SBT failed to fetch 
Netty artifacts from an incomplete local Maven cache.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Cursor Grok 4.6
   
   
   Made with [Cursor](https://cursor.com)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to