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

   ### What changes were proposed in this pull request?
   
   Adds two tests to `SparkConnectDataFrameCreationTests` in 
`python/pyspark/sql/tests/connect/test_connect_dataframe_creation.py`:
   
   - `test_ignored_options`: `createDataFrame(..., samplingRatio=0.5)` and 
`createDataFrame(..., verifySchema=False)` emit the "is ignored" `UserWarning` 
and still build the expected rows.
   - `test_with_mismatched_column_names`: for a 3-column pandas DataFrame and 
the equivalent `pyarrow.Table`, `createDataFrame(data, ["x"])` names the extra 
columns `_2` and `_3` and keeps the data. A 1-dim ndarray given two column 
names raises `AXIS_LENGTH_MISMATCH`.
   
   ### Why are the changes needed?
   
   9 lines of `SparkSession.createDataFrame` in 
`python/pyspark/sql/connect/session.py` were not covered by any test; this adds 
coverage for the Spark Connect warnings for the ignored `samplingRatio` and 
`verifySchema` arguments, the default names for extra columns when a pandas 
DataFrame or pyarrow Table gets a shorter name list, and the 
`AXIS_LENGTH_MISMATCH` error for a 1-dim ndarray. The existing Connect tests 
always pass a full-length name list or a schema, and only check the mismatch 
error for 2-dim input.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test-only change.
   
   ### How was this patch tested?
   
   ```
   python/run-tests --testnames 
'pyspark.sql.tests.connect.test_connect_dataframe_creation 
SparkConnectDataFrameCreationTests.test_ignored_options 
SparkConnectDataFrameCreationTests.test_with_mismatched_column_names'
   python/run-tests --testnames 
'pyspark.sql.tests.connect.test_connect_dataframe_creation 
SparkConnectDataFrameCreationTests'
   ```
   
   Both pass. The whole class (28 tests) passes, and the new tests add about 
0.15 s.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (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