You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
If you have an expression that is an array, it would be convenient to do something like df.select(col("a")[0]) to get the first item in that array.
Describe the solution you'd like
This could be done with a simple check of the argument to __getitem__. If it is a string or expression, continue to do what we do now. If it is a number then we call functions.array_element.
Describe alternatives you've considered
Current work around is to use functions.array_element.
Additional context
The text was updated successfully, but these errors were encountered:
Something to consider: If we do this then the natural python view would be that col("a")[0] would give me the first element but the SQL approach would be col("a")[1] as the first element. It's a potential source of confusion.
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
If you have an expression that is an array, it would be convenient to do something like
df.select(col("a")[0])
to get the first item in that array.Describe the solution you'd like
This could be done with a simple check of the argument to
__getitem__
. If it is a string or expression, continue to do what we do now. If it is a number then we callfunctions.array_element
.Describe alternatives you've considered
Current work around is to use
functions.array_element
.Additional context
The text was updated successfully, but these errors were encountered: