Skip to content

Commit

Permalink
Support the comparison operators for Snowpark (finos#59)
Browse files Browse the repository at this point in the history
Support the comparison operators for snowpark
===, =!=, <, >, <=, >=
  • Loading branch information
sfc-gh-aramirezfuentes authored and sfc-gh-lfallasavendano committed Dec 13, 2023
1 parent fa015ed commit 28877eb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Morphir/Snowpark/MapFunctionsMapping.elm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,33 @@ mapFunctionsMapping value mapValue ctx =
operatorname = mapOperator optname
in
Scala.BinOp leftValue operatorname rightValue
ValueIR.Apply
(TypeIR.Reference () ([["morphir"],["s","d","k"]],[["basics"]],["bool"]) [])
(ValueIR.Apply (TypeIR.Function
()
(TypeIR.Variable () ["t","0"])
(TypeIR.Reference () ([["morphir"],["s","d","k"]],[["basics"]],["bool"]) [])
)
(ValueIR.Reference (TypeIR.Function
()
(TypeIR.Variable () ["t","0"])
(TypeIR.Function
()
(TypeIR.Variable () ["t","0"])
(TypeIR.Reference () ([["morphir"],["s","d","k"]],[["basics"]],["bool"]) [])
)
)
([["morphir"],["s","d","k"]],[["basics"]], optname)
)
left
)
right ->
let
leftValue = mapValue left ctx
rightValue = mapValue right ctx
operatorname = mapOperator optname
in
Scala.BinOp leftValue operatorname rightValue
_ ->
Scala.Literal (Scala.StringLit "To Do")

Expand Down
12 changes: 12 additions & 0 deletions src/Morphir/Snowpark/Operatorsmaps.elm
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,17 @@ mapOperator name =
"/"
["float", "divide"] ->
"/"
["equal"] ->
"==="
["not", "equal"] ->
"=!="
["greater", "than"] ->
">"
["less", "than"] ->
"<"
["less", "than", "or", "equal"] ->
"<="
["greater", "than", "or", "equal"] ->
">="
_ ->
"Unsupported"

0 comments on commit 28877eb

Please sign in to comment.