Skip to content

Provide API for SQL Dry-Run and Dry-Plan #527

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

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

goldmedal
Copy link
Contributor

@goldmedal goldmedal commented Apr 16, 2024

Description

Provide a API to get the result metadata or inner SQL without executing.

Dry Run

Get the result metadata without executing SQL

GET /v1/mdl/dry-run

Sample Body

{
    "manifest" : {
        "catalog": "canner-cml",
        "schema": "tpch_tiny",
        "models": [
            {
                "name": "Orders",
                "refSql": "select * from \"memory\".\"tpch\".\"orders\"",
                "columns": [
                    {
                        "name": "o_orderkey",
                        "type": "integer"
                    },
                    {
                        "name": "o_orderdate",
                        "type": "date"
                    
                    }
                ]
            }
        ]
    },
    "sql": "select \"o_orderkey\", \"o_orderdate\" from \"Orders\" wehre \"o_orderdate\" > ?",
}
  • manifest: It's optional. If we don't carry it, use deployed MDL in default.
  • sql: It's required. The sql will be dry-run.

Dry Plan

Get the dry-planned SQL which is a SQL can be executed in the data source side.

GET /v1/mdl/dry-plan

Sample Body

{
    "manifest" : {
        "catalog": "canner-cml",
        "schema": "tpch_tiny",
        "models": [
            {
                "name": "Orders",
                "refSql": "select * from \"memory\".\"tpch\".\"orders\"",
                "columns": [
                    {
                        "name": "o_orderkey",
                        "type": "integer"
                    },
                    {
                        "name": "o_orderdate",
                        "type": "date"
                    
                    }
                ]
            }
        ]
    },
    "sql": "select \"o_orderkey\", \"o_orderdate\" from \"Orders\" wehre \"o_orderdate\" > ?",
    "modelingOnly": false
}
  • manifest: It's optional. If we don't carry it, use deployed MDL in default.
  • sql: It's required. The sql will be planned.
  • modelingOnly: It's optional. Enable it to get the SQL without translating by SqlDialect.

@goldmedal goldmedal marked this pull request as ready for review April 16, 2024 03:58
@goldmedal goldmedal requested a review from grieve54706 April 16, 2024 03:58
@grieve54706 grieve54706 merged commit 029f4e7 into main Apr 16, 2024
3 checks passed
@grieve54706 grieve54706 deleted the feature/provide-dry-run-plan branch April 16, 2024 09:09
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.

2 participants