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

feat(core): enhance the manifest serizlization and deserialization #847

Merged
merged 8 commits into from
Oct 24, 2024

Conversation

goldmedal
Copy link
Contributor

@goldmedal goldmedal commented Oct 24, 2024

Description

This PR enhances some issues about the MDLserizlization and deserialization.

Optional Field

Some fields are optional and can be absent in the MDL. For example, in the model definition, the user only needs to provide one of tableReference, refSql, or baseObject.

{
    "name": "orders",
    "tableReference": {
        "table": "orders"
    },
    "refSql": null  // optional
}

Empty expression

In the expression field of the Column, it could be an empty string. We should read it as a null value.

{
    "name": "o_orderkey",
    "type": "int",
    "expression": ""
}

Read Bool from integer

In the MDL provided by Wren AI, the boolean value could be 0 or 1. This PR also backward supports it.

{
    "name": "o_orderkey",
    "isCalculated": 0
}

Fix the name of NotNull

Fix no_null -> not_null.

@github-actions github-actions bot added core dependencies Pull requests that update a dependency file rust Pull requests that update Rust code python Pull requests that update Python code labels Oct 24, 2024
@goldmedal goldmedal marked this pull request as ready for review October 24, 2024 07:25
@goldmedal goldmedal requested a review from grieve54706 October 24, 2024 07:25
Copy link
Contributor

@grieve54706 grieve54706 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @goldmedal.

@grieve54706 grieve54706 merged commit 094745c into Canner:main Oct 24, 2024
13 checks passed
grieve54706 pushed a commit that referenced this pull request Dec 13, 2024
)

* handle optional field in mdl

* handle empty exprsssion and integer as bool

* add comment for backward compatibility

* cargo update

* fix cargo check

* fix clippy

* fix clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core dependencies Pull requests that update a dependency file python Pull requests that update Python code rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants