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

Snowpark backend #1133

Merged
merged 48 commits into from
Jan 23, 2024
Merged

Snowpark backend #1133

merged 48 commits into from
Jan 23, 2024

Conversation

sfc-gh-lfallasavendano
Copy link
Contributor

Adds a new backend for generating Scala code that uses Snowpark .

Terms

THIS SOFTWARE IS CONTRIBUTED SUBJECT TO THE TERMS OF THE TERMS OF THE CCLA DATED 2017-11-07 WITH FINOS/LINUX FOUNDATION (FORMERLY THE SYMPHONY SOFTWARE FOUNDATION CCLA).

THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED LICENSE TERMS.

Generate empty files for ELM modules in the IR
* Add initial implementation of a 'mapping' context

This context element has information about type definitions.

* Code review suggestions
Add support to the literals using the snowpark function lit for boolean, string, char, float and Int.
Add test for lit literals.
* Adds basic generation of record wrappers

* Fix missing `extends` generation
Considers expressions like:

a.b
a
AConstructor
Close finos#23 and close finos#24
Also adds local variables for records representing tables.

Related to finos#20
Support List.member function into Snowpark using the "in" function
…s#48)

* Add support for Snowpark generation of basic PatternMatch cases

The following cases are supported:

- Cases with literal values
- Cases with constructors of union types without parameters
* Add support for some list functions

Adds basic support for:
- `List.map` with lambda returning record
- `List.map` with lambda returning a single value
- `List.filter` with lambda predicate
- `List.sum` with `List.map` as its collection

* Fixes for Code review comments
Generate a basic support for the add, subtract, multiply and divide operators in Snowpark
Support the comparison operators for snowpark
===, =!=, <, >, <=, >=
* Add support for a couple of elements

- Adds basic support for case/of with Union types with params

```
  case x of
    First a b c -> a
    Second y -> y
```

- Adds support for Maybe case/of patterns

```
  case x of
    Just w -> w
    Nothing -> 19
```

- Adds basic support for conversion of `Maybe.Just` and `Maybe.Nothing`

- Adds a new Scala literal for `null`

* Code review changes
Add support for the and (&&) or (||) and not (!) operators in snowpark.
Add support for the floor and module functions in Snowpark
* Add support `let` and `Maybe` functions

Adds support for:

- Basic `let` without function definitions
- `Maybe.map`
- `Maybe.withDefault`

* Fix Nothing comparisons

Also fixes tagging of fields with aliases.
Add support to access field of a record in the way .field
- Fix creation of union type instance with parameters
- Fix generation of parameter names with Scala reserved words
- Fix calls to use curry-like syntax in scala
* Add generation of wrappers for keeping record references

Now we don't remove parameters representing records from functions .
This fixes problems where the a column may be lead to ambiguities.

* Code review suggestions
Changes to allow the conversion of must of the subset for Unsecured.elm.

Adds basic unpacking of JSON results.

Fixes finos#75
Adds support for converting tuple creation:

let
   t = (1,2,3)
And matching:

case t of
   (a,b,c) -> c
…inos#88)

* Add support for the groupBy and aggregate from Morphir.SDK

Add support to the pattern of groupBy and Aggregate from the Moprhir.SDK in Snowpark

* Support multiple variables in the lambda's call for the SDK Aggregate function

Support multiple variable in the lambda's call for the SDK aggregate function

* Support the alias function from the column in order to generate a custom column name

* Refactoring Aggregate mapping

* Fix alias generation and refactoring constants and map functions file
Fix alias name when is added in the aggregate function for the column
Fix passing lambda functions as arguments.
* Changes to improve compilation for `Calculations.elm`

Adds support for:

- Different set of function mappings when converting a function
  identified as Scala-only
- Convert empty DataFrame (still pending issue with session object)
- Adds several simple mappings for `Calculations.elm`: `List.maximum` ,
  `max`, `min`

* Code review fixes and fix List.sum with null values
* Add support for the Aggregate when returns a record

Support the return type as a record in the Aggregate function.

* Support records and handle error asign in the record field
* First commit for decorations

* Add support for `inlining`
First support for the join feature in elm. Mapping the innerJoin function from Elm
* Add issue generation report

- Generates `GenerationReport.elm`
- Adds propagation of issue list
- Changes uses of `Value` for `TypedValue`

* Code review suggestions
* In-progress documentation and fixes/coverage

* Add minor updates

* Add missing elements

* Add latest changes

* Split initial documents

* Code review comments
- Fixes some pattern matching scenarios
- Adds pattern matching test
- Adds function mapping tests
- Adds support for some function scenarios
Adds command line options for the `Snowpark` backend to the CLI2
project.
- Add Test for the join feature.
* Adding and fixing documentation for Snowpark backend
- Remove unused code
- Fix Boolean expression generation in pattern matching code
* Add documentation for the join feature

* Fixing documentation
Fixes:

- `List.filter` with a local function reference
- Binary operation generated as part of a projection
* Code review suggestion

Changes string literal to "throwing an exception" when processing
a not supported element.

* Code review suggestion

Add support for aggregate errors
@stephengoldbaum stephengoldbaum merged commit a697113 into finos:main Jan 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants