Error while converting Presto SQL to Hive SQL containing subquery

I am trying to convert the following Presto SQL to Hive SQL. The sub query in WHERE clause isn’t working in Hive and is throwing an error. select distinct id from account where load_date = (select max(load_date) from account) and account_status=’current’ and account_type=’crnt’ Please advise how I can fix this and make it work in… Read More Error while converting Presto SQL to Hive SQL containing subquery

How to extract string between "+" and "@" from column in Presto?

I have table in Presto like below: Input data: PHONE_NUMBER ——– ppa:+77845678021@abc.gbc443.gbc356.7kffooopppp.deu tel:+77695002395 dadsadas+884415002996xx2 …. Requirements: And I need to take all values from column "PHONE_NUMBER" between "+" and "@" (if exists). Desire output: So, as a result I need something like below: PHONE_NUMBER ——– 77845678021 77695002395 884415002996 …. How can I do that in… Read More How to extract string between "+" and "@" from column in Presto?

Get one row per unique column value combination (`DISTINCT ON` operation without using it)

I have a table with 5 columns, For each unique combination of the first three columns, I want a single sample row. I don’t care which values are considered for columns 4 and 5, as long as they come from the same row (they should be aligned). I realise I can do a DISTINCT to… Read More Get one row per unique column value combination (`DISTINCT ON` operation without using it)

AWS Athena (Presto) '+' cannot be applied to varchar, varchar error

I’m having a bit of trouble with some Presto SQL that I have written in Athena. I get the following error which I’m a bit confused about: SYNTAX_ERROR: line 46:39: ‘+’ cannot be applied to varchar, varchar Here is my script: SELECT Duplicate.AircraftTypeCode, Duplicate.LineNumber, Serial.SerialNumber FROM (SELECT * FROM (SELECT DISTINCT TypeCode AS AircraftTypeCode, LineNumber… Read More AWS Athena (Presto) '+' cannot be applied to varchar, varchar error

Presto – How to convert a field with map<string,string> to rows

I’m new to Presto SQL and I am stuck to a issue and I really need your help. I have a table with a field "Info": Date Info 2021-01-01 {"user_id":"12345", "order_id": "[333222, 444555, 777888]"} 2021-01-02 {"user_id":"67891", "order_id": "[948263]"} 2021-01-03 {"user_id":"93846", "order_id": "[937846, 889213, 886534, 991827]"} 2021-01-04 {"user_id":"63792", "order_id": "[]"} 2021-01-05 {"user_id":"04937", "order_id": "[837462, 837213]"} I… Read More Presto – How to convert a field with map<string,string> to rows