suhuruli opened a new pull request, #60580:
URL: https://github.com/apache/spark/pull/60580

   ### What changes were proposed in this pull request?
   
   The project template that `spark-pipelines init` writes now sets 
`spark.sql.catalogImplementation` to `hive` under `configuration` in 
`spark-pipeline.yml`. Spark then keeps table metadata in a local Hive 
metastore, a small database in a `metastore_db/` folder created in the 
directory the pipeline runs from, instead of only in memory.
   
   - `python/pyspark/pipelines/init_cli.py`: the spec template gets a 
`configuration` section and a comment that explains it.
   - `python/pyspark/pipelines/tests/test_init_cli.py`: `test_init` asserts the 
generated configuration.
   - `docs/declarative-pipelines-programming-guide.md`: the Auto CDC 
requirement on the catalog now says that the in-memory setting keeps metadata 
only for the session, and that projects from `spark-pipelines init` use the 
Hive setting.
   
   This change depends on a companion pull request opened alongside it, 
`[SPARK-61825][SDP] Skip pipeline configurations that cannot be modified at 
runtime when running flows` (apache/spark#60579), which lets a flow skip static 
and core Spark settings from the spec. Without that change, the setting is 
applied when the session starts and is then sent to every flow, and every flow 
fails with `CANNOT_MODIFY_STATIC_CONFIG`. Merge that change first, or with this 
one.
   
   ### Why are the changes needed?
   
   A project created by `spark-pipelines init` uses the in-memory session 
catalog. When the run ends, Spark forgets its tables, so they cannot be queried 
with `spark-sql` or `pyspark`. The table folders stay in `spark-warehouse/`, so 
the second `spark-pipelines run` fails with `LOCATION_ALREADY_EXISTS`.
   
   Setting the same key in the spec by hand is the obvious fix. On the current 
master it fails every flow with `CANNOT_MODIFY_STATIC_CONFIG`, which is why 
this change depends on the companion pull request above.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes.
   
   - A new project from `spark-pipelines init` writes 
`spark.sql.catalogImplementation: hive` to `spark-pipeline.yml`.
   - Runs of such a project create `metastore_db/` and `derby.log` in the 
directory the run starts from. Tables persist across runs, and `spark-sql` or 
`pyspark` started in that directory can query them.
   - A Spark build without Hive classes fails to start a session with this 
setting, with the error "Unable to instantiate SparkSession with Hive support 
because Hive classes are not found."
   - Projects created before this change are not modified.
   
   ### How was this patch tested?
   
   - `InitCLITests.test_init` now asserts that the generated spec's 
configuration is `{"spark.sql.catalogImplementation": "hive"}`. Run with 
`python/run-tests --testnames "pyspark.pipelines.tests.test_init_cli"`.
   - I reproduced the problem on the unmodified base: a spec that sets the Hive 
catalog by hand fails every flow with `CANNOT_MODIFY_STATIC_CONFIG`, and a 
project from the template loses its tables after the run.
   - I also ran the quick start from `[SPARK-61807][SDP][DOCS] Add a 
Declarative Pipelines quick start and hello world example` (apache/spark#60546) 
end to end, every `bash` block in order in a fresh virtual environment, on a 
build of master with the branches of apache/spark#60546, apache/spark#60579 and 
this change applied. That run did not exercise this change alone.
   - `ruff check` and `ruff format --check` pass on the changed Python files. I 
did not run the Jekyll docs build.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   


-- 
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