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] Add support for percent_rank #4004

Closed
viadea opened this issue Nov 2, 2021 · 1 comment · Fixed by #4924
Closed

[FEA] Add support for percent_rank #4004

viadea opened this issue Nov 2, 2021 · 1 comment · Fixed by #4924
Assignees
Labels
cudf_dependency An issue or PR with this label depends on a new feature in cudf feature request New feature or request P1 Nice to have for release

Comments

@viadea
Copy link
Collaborator

viadea commented Nov 2, 2021

Is your feature request related to a problem? Please describe.
This is a feature quest to add support for percent_rank in windowing.

Here is a mini example:

val querytext="""SELECT gender,percent_rank(salary) OVER (PARTITION BY gender ORDER BY salary) from df2"""
sql(querytext).collect
@viadea viadea added feature request New feature or request ? - Needs Triage Need team to review and classify labels Nov 2, 2021
@Salonijain27 Salonijain27 added P1 Nice to have for release 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 Nov 2, 2021
@res-life res-life self-assigned this Nov 3, 2021
@viadea
Copy link
Collaborator Author

viadea commented Nov 4, 2021

Full script to reproduce:

import org.apache.spark.sql.Row
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._

val data = Seq(
    Row(Row("Adam ","","Green"),"1","M",1000.1, "2019-01-01",List("Java","Scala")),
    Row(Row("Bob ","Middle","Green"),"2","M",2000.2, "2019-01-02",List("Java","Python")),
    Row(Row("Cathy ","","Green"),"3","F",3000.3, "2019-01-03",List())
)

val schema = (new StructType()
  .add("name",new StructType()
    .add("firstname",StringType)
    .add("middlename",StringType)
    .add("lastname",StringType)) 
  .add("id",StringType)
  .add("gender",StringType)
  .add("salary",DoubleType)
  .add("birthdayStr",StringType)
  .add("language",ArrayType(StringType))
             )

val df = spark.createDataFrame(spark.sparkContext.parallelize(data),schema)
df.withColumn("birthday", to_date(col("birthdayStr"))).write.format("parquet").mode("overwrite").save("/tmp/testparquet")
val df2 = spark.read.parquet("/tmp/testparquet")
df2.createOrReplaceTempView("df2")
df2.printSchema
val querytext="""SELECT gender,percent_rank(salary) OVER (PARTITION BY gender ORDER BY salary) from df2"""
sql(querytext).collect

Spark Driver log snippet:

        !NOT_FOUND <PercentRank> percent_rank(salary#90) cannot run on GPU because no GPU enabled version of expression class org.apache.spark.sql.catalyst.expressions.PercentRank could be found

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 P1 Nice to have for release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants