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

sqlsmith: generate IMPLICIT CAST in function arguments #6945

Closed
1 task
Tracked by #3896
kwannoel opened this issue Dec 19, 2022 · 2 comments · Fixed by #7629
Closed
1 task
Tracked by #3896

sqlsmith: generate IMPLICIT CAST in function arguments #6945

kwannoel opened this issue Dec 19, 2022 · 2 comments · Fixed by #7629
Assignees

Comments

@kwannoel
Copy link
Contributor

kwannoel commented Dec 19, 2022

Enable implicit cast conservatively to avoid wrong type inference.

Examples

  1. Generated in explicit cast:
    Suppose we generate implicit cast from smallint -> int, where int is the expected type of the expression.
    We can end up with:
     CAST(1::smallint AS BOOLEAN)
    
  2. Generated in function / Agg Call:
    We attempt to generate an argument to min of type int, and end up with 1::smallint, since that can be implicit cast to int.
    We end up with:
    min(1::smallint)
    
    The type of the expression is wrong.
  3. Generated in SELECT CTE:
    Column type can be wrong.

Background

see this for context: #6939

Solution

Just generate for functions with fixed return type. For instance, CONCAT, CONCAT_WS.

  • Generate for all locations with enforce_bool_clause.

Feel free to suggest other alternatives.

@github-actions github-actions bot added this to the release-0.1.15 milestone Dec 19, 2022
@kwannoel kwannoel changed the title Generate cast implicit. feat(sqlsmith): generate IMPLICIT CAST in function arguments Dec 19, 2022
@kwannoel kwannoel changed the title feat(sqlsmith): generate IMPLICIT CAST in function arguments sqlsmith: generate IMPLICIT CAST in function arguments Dec 19, 2022
@fuyufjh
Copy link
Member

fuyufjh commented Jan 30, 2023

Hi, any progress?

@kwannoel
Copy link
Contributor Author

Hi, any progress?

Nope, but will probably work on it this week. Didn't prioritize it because previously it didn't really catch any bugs.

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 a pull request may close this issue.

2 participants