Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I query Athena for columns containing a control character?

I need to find rows in which a control character appears in a particular column, but the CHAR function is not available in Athena.

How do I query akin to this?

SELECT * 
FROM table_name 
WHERE column_identifier like '%'||char(31)||'%' 
LIMIT 10;
like image 303
John Thow Avatar asked Oct 21 '25 02:10

John Thow


1 Answers

Wrap the zero-padded decimal representation of the character you want to query for with the chr function, e.g.:

SELECT * 
FROM table_name 
WHERE column_identifier LIKE '%'||chr(0031)||'%' 
LIMIT 10;
like image 187
John Thow Avatar answered Oct 24 '25 09:10

John Thow