-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-29664][PYTHON][SQL] Column.getItem behavior is not consistent with Scala #26351
Conversation
cc: @HyukjinKwon |
Test build #113051 has finished for PR 26351 at commit
|
Test build #113053 has finished for PR 26351 at commit
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent sounds ok. A concern is about this is a behavior change could break user code.
Yeah, true. Workaround is pretty easy here ( |
@@ -23,6 +23,8 @@ | |||
from pyspark.sql.utils import AnalysisException | |||
from pyspark.testing.sqlutils import ReusedSQLTestCase | |||
|
|||
from py4j.protocol import Py4JJavaError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move py4j
over pyspark
per pep8 (https://www.python.org/dev/peps/pep-0008/#imports)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise.
Test build #113062 has finished for PR 26351 at commit
|
Merged to master. |
What changes were proposed in this pull request?
This PR changes the behavior of
Column.getItem
to callColumn.getItem
on Scala side instead ofColumn.apply
.Why are the changes needed?
The current behavior is not consistent with that of Scala.
In PySpark:
In Scala:
Does this PR introduce any user-facing change?
Yes. If the use wants to pass
Column
object togetItem
, he/she now needs to use the indexing operator to achieve the previous behavior.How was this patch tested?
Existing tests.