Skip to content

fix(tyck): fix missing simple_cast #9671

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 15 commits into from
Jan 22, 2023
Merged

fix(tyck): fix missing simple_cast #9671

merged 15 commits into from
Jan 22, 2023

Conversation

andylokandy
Copy link
Contributor

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Summary about this PR

Closes #issue

@vercel
Copy link

vercel bot commented Jan 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
databend ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 22, 2023 at 2:46PM (UTC)

@mergify mergify bot added the pr-bugfix this PR patches a bug in codebase label Jan 18, 2023
@andylokandy andylokandy requested a review from sundy-li January 18, 2023 17:30
@andylokandy andylokandy marked this pull request as draft January 18, 2023 18:56
@RinChanNOWWW
Copy link
Contributor

RinChanNOWWW commented Jan 19, 2023

Here are some unit tests:

// src/query/functions/tests/it/scalars/cast.rs
fn test_cast_to_nested_type(file: &mut impl Write, is_try: bool) {
    let prefix = if is_try { "TRY_" } else { "" };

    run_ast(
        file,
        format!("{prefix}CAST(((1, TRUE), 1) AS Tuple(Tuple(INT, INT), INT))"),
        &[],
    );
    run_ast(
        file,
        format!("{prefix}CAST(((1, 'a'), 1) AS Tuple(Tuple(INT, INT NULL), INT))"),
        &[],
    );
    run_ast(
        file,
        format!("{prefix}CAST(((1, 'a'), 1) AS Tuple(Tuple(INT, INT), INT) NULL)"),
        &[],
    );
    run_ast(
        file,
        format!("{prefix}CAST([(1,TRUE),(2,FALSE)] AS Array(Tuple(INT, INT)))"),
        &[],
    );
    run_ast(
        file,
        format!("{prefix}CAST([(1,'a'),(2,'a')] AS Array(Tuple(INT, INT)) NULL)"),
        &[],
    );
    run_ast(
        file,
        format!("{prefix}CAST([(1,'a'),(2,'a')] AS Array(Tuple(INT, INT NULL)))"),
        &[],
    );
    run_ast(
        file,
        format!("{prefix}CAST([[TRUE], [FALSE, TRUE]] AS Array(Array(INT)))"),
        &[],
    );
    run_ast(
        file,
        format!("{prefix}CAST([['a'], ['b', 'c']] AS Array(Array(INT) NULL))"),
        &[],
    );
}

@andylokandy andylokandy marked this pull request as ready for review January 20, 2023 07:52

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mergify mergify bot merged commit bbd5939 into databendlabs:main Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix this PR patches a bug in codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants