Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions spark/spark_dialect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,22 @@ supported_scalar_functions:
- "str"
- "vchar"
- "fchar"
- source: "string"
name: "lpad"
system_metadata:
name: "lpad"
notation: "FUNCTION"
supported_impls:
- "vchar_i32_vchar"
- "str_i32_str"
- source: "string"
name: "rpad"
system_metadata:
name: "rpad"
notation: "FUNCTION"
supported_impls:
- "vchar_i32_vchar"
- "str_i32_str"
- source: "arithmetic"
name: "shift_left"
system_metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class FunctionMappings {
s[Substring]("substring"),
s[Upper]("upper"),
s[Lower]("lower"),
s[StringLPad]("lpad"),
s[StringRPad]("rpad"),
s[Concat]("concat"),
s[Coalesce]("coalesce"),
s[ShiftLeft]("shift_left"),
Expand Down
10 changes: 10 additions & 0 deletions spark/src/test/scala/io/substrait/spark/TPCHPlan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ class TPCHPlan extends TPCHBase with SubstraitPlanTestBase {
)
}

test("pad") {
assertSqlSubstraitRelRoundTrip(
"select lpad(o_comment, 5), rpad(o_comment, 2) from orders"
)

assertSqlSubstraitRelRoundTrip(
"select lpad(o_comment, 5, '-'), rpad(o_comment, 2, '*') from orders"
)
}

test("tpch_q1_variant") {
// difference from tpch_q1 : 1) remove order by clause; 2) remove interval date literal
assertSqlSubstraitRelRoundTrip(
Expand Down