HyukjinKwon opened a new pull request, #614:
URL: https://github.com/apache/spark-connect-rust/pull/614

   ### What changes were proposed in this pull request?
   
   From the same review as #608 (SPARK-61613): four differences from PySpark 
4.3.0's Connect client in the catalog and writer methods of the Python client, 
which predate it.
   - **`DataFrame.registerTempTable`** created the view, so a name of an 
existing view raised `TEMP_TABLE_OR_VIEW_ALREADY_EXISTS`, and it gave no 
warning. PySpark's warns `FutureWarning("Deprecated in 2.0, use 
createOrReplaceTempView instead.")` and calls `createOrReplaceTempView`. It now 
does both, in that order, so a warning filter of `error` raises before the name 
is converted.
   - **Bool arguments** took only a bool.
     - `dropTable(ifExists, purge)`, `dropView(ifExists)`, 
`createDatabase(ifNotExists)` and `dropDatabase(ifExists, cascade)`: PySpark 
passes these to the constructor of a proto message, so they now take what upb's 
bool conversion takes (an int by its truth, a NumPy bool; its errors 
otherwise), with `None` as false.
     - `getCreateTableString(asSerde)` and `analyzeTable(noScan)`: PySpark sets 
these on the plan, so an omitted value is false and an explicit `None` raises 
upb's `TypeError`.
     - `insertInto(overwrite)` tests the truth of a value that is not `None`, 
as PySpark's `if overwrite:`.
     - `DataFrame.unpersist(blocking)` takes upb's conversion.
   - **`createDatabase(properties=[])`** raised a `TypeError`, where PySpark's 
`properties or {}` takes a false value as no properties. It now takes any 
mapping, and a true non-mapping raises PySpark's `AttributeError` of `.items()`.
   - **`createExternalTable`** took a fifth positional `description`. PySpark's 
signature is `(tableName, path=None, source=None, schema=None, **options)`, so 
a fifth positional argument raises Python's `TypeError`, and a `description=` 
keyword goes through `**options` to `createTable`, as in PySpark. `createTable` 
gives Python's counts of positional arguments too.
   
   ### Why are the changes needed?
   
   To match PySpark 4.3.0. A probe of these four items (147 lines: errors, 
warnings, the effects sent, row counts and signatures) now gives the same 
output on official pyspark-client 4.3.0 and on this client. Before the change, 
102 of its lines differed.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, in the Python client:
   - `registerTempTable` warns and replaces a view, as PySpark's does;
   - these methods take PySpark's bool and properties values;
   - `createExternalTable` has PySpark's signature.
   
   ### How was this patch tested?
   
   - 4 new offline tests, after those of #608. They fail without the change.
   - The whole `test_dropin_offline.py` (1971 passed, 8 skipped), and the 
related e2e tests against a Spark 4.3.0 server.
   - `cargo fmt --all --check` and ruff 0.14.0.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


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