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.
Merge from apache/spark #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Merge from apache/spark #1
Changes from 1 commit
86db9b2ea2642ef6084a8aeb45df1219d7a0bf1a74fba031333ae24312d20ddbe03d3a0e68330eb386beff48b1b9348e6891d1b306674acdb8bfce5774715d753793b568398432ec269171f6ddded6d2776e8a1d1eebfbe755f2f528778175536f318f6d5739c21ece613b71acfcd746ffe6fd7c745730796e48c67ea11ed4f0b1d224375ccc30ef8fcf66a3dbd492b11a849b8b497044e9e6aeafc364166a7d6bccda75b30fcdc081696302ea17aff2b352514c4a62234d943fd7d141ea0a5eeee3af15cfbe11e3d8837e028ee405955a2d994065df5b77147a702d8c284c4e1c9f95ce734a4be0c090fa6fc300247a0891a87a16a66fe369a2b65ab2970297d045c5df95a909fa703ed5861ab5aadbc96f6831693f92c0d2cddc895f9659e288fc80428368df7fc3e52fc5c1cf0aa656cff7d151c33bdc0b7424930b90aea95683e8af7e8bf65cd3f2dd8b9be9a8047b78041993f2159a7048b18e9414File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
## What changes were proposed in this pull request? ```Python import random from pyspark.sql.functions import udf from pyspark.sql.types import IntegerType, StringType random_udf = udf(lambda: int(random.random() * 100), IntegerType()).asNondeterministic() spark.catalog.registerFunction("random_udf", random_udf, StringType()) spark.sql("SELECT random_udf()").collect() ``` We will get the following error. ``` Py4JError: An error occurred while calling o29.__getnewargs__. Trace: py4j.Py4JException: Method __getnewargs__([]) does not exist at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318) at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326) at py4j.Gateway.invoke(Gateway.java:274) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:214) at java.lang.Thread.run(Thread.java:745) ``` This PR is to support it. ## How was this patch tested? WIP Author: gatorsmile <[email protected]> Closes apache#20137 from gatorsmile/registerFunction.Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing