gortiz opened a new pull request, #12475:
URL: https://github.com/apache/pinot/pull/12475

   This PR adds a check that fails if there is an implicit or explicit cast 
from to Bytes.
   
   I still need to add some automatic tests, but I've tested manually. In a 
query like:
   ```sql
   select * from starbucksStores where location_st_point = 
   '80c062bc98021f94f1404e9bda0f6b0202'
   limit 10
   ```
   
   The message shown is: ` From line 0, column 0 to line 2, column 36: Cannot 
cast '80c062bc98021f94f1404e9bda0f6b0202' as VARBINARY. Try to use binary 
literal instead (like x'80c062bc98021f94f1404e9bda0f6b0202')`
   
   In a query like:
   ```sql
   select * from starbucksStores 
   where OCTET_LENGTH(
     substring('80c062bc98021f94f1404e9bda0f6b0202', 2)
   ) > 0 limit 10
   ```
   
   The message shown is: `From line 0, column 0 to line 3, column 52: Cannot 
cast SUBSTRING('80c062bc98021f94f1404e9bda0f6b0202' FROM 2) as VARBINARY. Try 
to wrap the expression in hexToBytes (like 
hexToBytes(SUBSTRING('80c062bc98021f94f1404e9bda0f6b0202' FROM 2)))`
   
   Two things that we can try to improve (although priority doesn't seem high):
   - Given in this cases the cast expression was implicit, start position seem 
to be line 0 column 0. It would be great to find a way to show a more precise 
start position
   - As shown in the second case, the suggested expression is not exactly like 
the original one.
   
   Related to https://github.com/apache/pinot/issues/12457


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to