Skip to content

Unexpected evaluation of false part of if statement #62656

Answered by UnamedRus
njcstreet asked this question in Q&A
Discussion options

You must be logged in to vote
CREATE OR REPLACE FUNCTION add_or_concat AS (x, y) -> if((toTypeName(x) = 'String') OR (toTypeName(y) = 'String'), concat(x, y), toString(toUInt32OrZero(toString(x)) + toUInt32OrZero(toString(y))))

Query id: 1f849ee7-d9da-4698-93e5-3acdb8fbf53f

Ok.

0 rows in set. Elapsed: 0.009 sec.


SELECT add_or_concat(materialize('a'), materialize('b')) AS res

Query id: 16d6a323-09cc-41f5-b592-a8c6d30ad9f0

┌─res─┐
│ ab  │
└─────┘

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@njcstreet
Comment options

@UnamedRus
Comment options

@njcstreet
Comment options

Answer selected by njcstreet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants