Fixes to Spark API show() and udf.register()#550
Open
Shooter23 wants to merge 2 commits into
Open
Conversation
Match Spark API show() signature to PySpark's. Convert (more or less) show() parameters to DuckDB show() parameters. - n -> max_rows - truncate -> max_col_width (not quite the same) - vertical -> render_mode='COLUMNS' (not quite the same) Call to create_function() under Spark API udf.register() fixes: - Pass None for third (function parameters) argument. - Assume udf.register() receives a PySpark return type. - Convert to DuckDB return type for create_function() call.
PySpark UDFs take nulls as valid input. Vis-a-vis other UDF options (exception handling and side effects) PySpark UDFs behave like the DuckDB defaults.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Match signature to Spark API's show() method to PySpark's and translate parameters to DuckDB's show().
Fix call to create_function() in Spark API's UDFRegistration.register(). It lacked the correct third argument (input parameters, set to None). It assumes a PySpark style return type parameter (eg T.StringType()) and translates it to the DuckDB SQL type for the create_function() call. Sets null_handling='special' to match PySpark UDF behavior.