StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.68k stars 1.76k forks source link

Implicit cast of string to boolean is broken #42234

Open mcgray opened 6 months ago

mcgray commented 6 months ago

We noticed that in case we are using string field in WHERE clause without expression it is always mistakenly cast to FALSE

Steps to reproduce the behavior (Required)

Use String value without expression (going to be used as cast(table.field as boolean)) .

Expected behavior (Required)

Non-empty non-null String cast to TRUE and SQL has results.

Real behavior (Required)

SQL has no results. String cast to false.

StarRocks version (Required)

3.2.1

murphyatwork commented 6 months ago
MySQL> select cast('123123' as boolean)
1

MySQL> select cast('100018588397' as boolean)
<null>
github-actions[bot] commented 1 week ago

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!