Skip to content
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

[FEA] Support Window functions(lead & lag) for ArrayType #2012

Closed
Dooyoung-Hwang opened this issue Mar 24, 2021 · 3 comments
Closed

[FEA] Support Window functions(lead & lag) for ArrayType #2012

Dooyoung-Hwang opened this issue Mar 24, 2021 · 3 comments
Assignees
Labels
cudf_dependency An issue or PR with this label depends on a new feature in cudf feature request New feature or request

Comments

@Dooyoung-Hwang
Copy link
Contributor

I request a feature to run lead & lag functions with ArrayType[AtomicType], ArrayType[ArrayType[AtomicType]] on GPU.

  • Test code
from pyspark.sql import Window
data = [(1,0.1, 0.4, 1), (2, 0.2, 0.5,2), (3, -1.0, 2.2,3)]
schema = StructType([ \
    StructField("a",IntegerType(),True), \
    StructField("b",FloatType(),True), \
    StructField("c",FloatType(),True), \
    StructField("d",IntegerType(),True)
  ])
  
win_spec = Window().partitionBy(col("a")).orderBy(desc("d"))
df1 = spark.createDataFrame(data=data,schema=schema).withColumn("arr1", array("b", "c")) \
        .withColumn("arr2", lead(col("arr1"), 1).over(win_spec))
df2 = spark.createDataFrame(data=data,schema=schema).withColumn("arr1", array("b", "c")) \
        .withColumn("arr2", lag(col("arr1"), 1).over(win_spec)) \

print(df1._jdf.queryExecution())
print(df2._jdf.queryExecution())
  • Output message in driver log
!Expression lead(arr1#6082, 1, null) cannot run on GPU because expression Lead lead(arr1#6082, 1, null) produces an unsupported type ArrayType(FloatType,true); expression AttributeReference arr1#6082 produces an unsupported type ArrayType(FloatType,true)
!Expression lag(arr1#6187, 1, null) cannot run on GPU because expression Lag lag(arr1#6187, 1, null) produces an unsupported type ArrayType(FloatType,true); expression AttributeReference arr1#6187 produces an unsupported type ArrayType(FloatType,true)
@Dooyoung-Hwang Dooyoung-Hwang added ? - Needs Triage Need team to review and classify feature request New feature or request labels Mar 24, 2021
@sameerz sameerz added cudf_dependency An issue or PR with this label depends on a new feature in cudf and removed ? - Needs Triage Need team to review and classify labels Mar 24, 2021
@wbo4958
Copy link
Collaborator

wbo4958 commented May 7, 2021

@mythrocks Do you have any idea if cudf has supported this ?

@GaryShen2008
Copy link
Collaborator

@mythrocks Do you have any idea if cudf has supported this ?

Mithun has merged the PR rapidsai/cudf#8062

rapids-bot bot pushed a commit to rapidsai/cudf that referenced this issue May 19, 2021
This PR just added the unit tests for the lead/lag on List/Struct type for both Row-window and Range-window, Since libcudf has already supported the functionality. See the plugin feature request  NVIDIA/spark-rapids#2012

But there is an issue when setting the default values for lead/lag on List/Struct. I just commented the corresponding assertation out. I will re-enable it after libcudf fixes it.

Authors:
  - Bobby Wang (https://github.com/wbo4958)

Approvers:
  - MithunR (https://github.com/mythrocks)

URL: #8259
@wbo4958
Copy link
Collaborator

wbo4958 commented May 19, 2021

close this issue, Since the PRs have been merged.

@wbo4958 wbo4958 closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cudf_dependency An issue or PR with this label depends on a new feature in cudf feature request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants