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

   ### What changes were proposed in this pull request?
   
   Fixes `createDataFrame` to autogenerate missing column names.
   
   ### Why are the changes needed?
   
   Currently the number of the column names specified to `createDataFrame` does 
not match the actual number of columns, it raises an error:
   
   ```py
   >>> spark.createDataFrame([["a", "b"]], ["col1"])
   Traceback (most recent call last):
   ...
   ValueError: Length mismatch: Expected axis has 1 elements, new values have 2 
elements
   ```
   
   but it should auto-generate the missing column names.
   
   ### Does this PR introduce _any_ user-facing change?
   
   It will auto-generate the missing columns:
   
   ```py
   >>> spark.createDataFrame([["a", "b"]], ["col1"])
   DataFrame[col1: string, _2: string]
   ```
   
   ### How was this patch tested?
   
   Enabled the related test.


-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to