Github user viirya commented on the pull request:
https://github.com/apache/spark/pull/9283#issuecomment-151750455
When the exception is thrown from JVM, we see a simplified description:
>>> df.select(sha2(df.a, 1024)).collect()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hduser/repos/spark/python/pyspark/sql/functions.py", line
943, in sha2
jc = sc._jvm.functions.sha2(_to_java_column(col), numBits)
File
"/home/hduser/repos/spark/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py",
line 813, in __call__
File "/home/hduser/repos/spark/python/pyspark/sql/utils.py", line 52,
in deco
raise IllegalArgumentException(s.split(': ', 1)[1], stackTrace)
pyspark.sql.utils.IllegalArgumentException: u'requirement failed:
numBits 1024 is not in the permitted values (0, 224, 256, 384, 512)'
If we catch the exception, we can print its full stack trace:
>>> from pyspark.sql.utils import AnalysisException,
IllegalArgumentException
>>> try:
... df.select(sha2(df.a, 1024)).collect()
... except IllegalArgumentException as e:
... print e.stackTrace
...
scala.Predef$.require(Predef.scala:233)
org.apache.spark.sql.functions$.sha2(functions.scala:1596)
org.apache.spark.sql.functions.sha2(functions.scala)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:483)
py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381)
py4j.Gateway.invoke(Gateway.java:259)
py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
py4j.commands.CallCommand.execute(CallCommand.java:79)
py4j.GatewayConnection.run(GatewayConnection.java:209)
java.lang.Thread.run(Thread.java:745)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]