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

Support unparsing implicit lateral UNNEST plan to SQL text #13793

Open
goldmedal opened this issue Dec 16, 2024 · 0 comments · May be fixed by #13824
Open

Support unparsing implicit lateral UNNEST plan to SQL text #13793

goldmedal opened this issue Dec 16, 2024 · 0 comments · May be fixed by #13824
Assignees
Labels
enhancement New feature or request

Comments

@goldmedal
Copy link
Contributor

Is your feature request related to a problem or challenge?

After #13695, we can plan the implicit lateral unnest plan now. However, the generated logical plan can't be unparsed back to the SQL text.

If we tried to unparse the plan:

#[tokio::main]
pub async fn main() -> Result<()> {
    let ctx = SessionContext::new();
    ctx.sql("CREATE TABLE t (c1 array<int>)").await?.show().await?;
    ctx.sql("INSERT INTO t VALUES (ARRAY[1, 2, 3])").await?.show().await?;
    let sql = r#"select * from t, unnest(t.c1)"#;
    println!("SQL: {}", sql);
    let df = ctx.sql(sql).await?;
    let planned = df.into_optimized_plan()?;
    println!("Plan: {}", planned);
    let sql = plan_to_sql(&planned)?;
    println!("Plan to SQL: {}", sql);
    Ok(())
}

We will get the unsupported error

Error: This feature is not implemented: Unsupported operator: Subquery(<subquery>)

Describe the solution you'd like

Implement the unparsing behavior in Unparser::select_to_sql_recursively

Describe alternatives you've considered

No response

Additional context

No response

@goldmedal goldmedal added the enhancement New feature or request label Dec 16, 2024
@goldmedal goldmedal self-assigned this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant