Skip to content

Commit

Permalink
Test and documentation related to signum function.
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Soszynski <[email protected]>
  • Loading branch information
lukasz-soszynski-eliatra committed Sep 30, 2024
1 parent b67a40f commit be667b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ppl-spark-integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ Limitation: Overriding existing field is unsupported, following queries throw ex
- `source = table | eval a = 10 | fields a,b,c`
- `source = table | eval a = a * 2 | stats avg(a)`
- `source = table | eval a = abs(a) | where a > 0`
- `source = table | eval a = signum(a) | where a < 0`

**Aggregations**
- `source = table | stats avg(a) `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,18 @@ class PPLLogicalPlanMathFunctionsTranslatorTestSuite
val expectedPlan = Project(projectList, evalProject)
comparePlans(expectedPlan, logPlan, false)
}

test("test signum") {
val context = new CatalystPlanContext
val logPlan = planTransformer.visit(plan(pplParser, "source=t a = signum(b)", false), context)

val table = UnresolvedRelation(Seq("t"))
val filterExpr = EqualTo(
UnresolvedAttribute("a"),
UnresolvedFunction("signum", seq(UnresolvedAttribute("b")), isDistinct = false))
val filterPlan = Filter(filterExpr, table)
val projectList = Seq(UnresolvedStar(None))
val expectedPlan = Project(projectList, filterPlan)
comparePlans(expectedPlan, logPlan, false)
}
}

0 comments on commit be667b4

Please sign in to comment.