Questions tagged [presto]

Presto is an open source distributed SQL query engine for running analytic queries against data sources of all sizes ranging from gigabytes to petabytes. The community version of Presto is now called Trino. Amazon serverless query service called Athena is using Presto under the hood.

What is Presto?

Presto is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes.

Presto was designed and written from the ground up for interactive analytics and approaches the speed of commercial data warehouses while scaling to the size of organizations like Facebook.

What can it do?

Presto allows querying data where it lives, including Hive, HBase, relational databases or even proprietary data stores. A single Presto query can combine data from multiple sources, allowing for analytics across your entire organization.

Presto is targeted at analysts who expect response times ranging from sub-second to minutes. Presto breaks the false choice between having fast analytics using an expensive commercial solution or using a slow "free" solution that requires excessive hardware.

References

3114 questions
13
votes
2 answers

How to configure Presto searches to be case-insensitive?

In my case, Presto connects to a MySQL database which has been configured to be case-insensitive. But any search through Presto seems to be case-sensitive. Questions: 1) Is there a way to configure Presto searches to be case-insensitive? If not, can…
felarof99
  • 185
  • 1
  • 1
  • 9
12
votes
2 answers

Athena unable to parse date using OpenCSVSerde

I have a very simple csv file on S3 "i","d","f","s" "1","2018-01-01","1.001","something great!" "2","2018-01-02","2.002","something terrible!" "3","2018-01-03","3.003","I'm an oil man" I'm trying to create a table across this using the following…
Kirk Broadhurst
  • 27,836
  • 16
  • 104
  • 169
12
votes
3 answers

How to concatenate arrays grouped by another column in Presto?

Is this possible in SQL (preferably Presto): I want to reshape this table: id, array 1, ['something'] 1, ['something else'] 2, ['something'] To this table: id, array 1, ['something', 'something else'] 2, ['something']
bry888
  • 263
  • 1
  • 4
  • 13
12
votes
3 answers

Athena date_parse for date with optional millisecond field

I have date in S3 using which I created an Athena table. I have some date entries in S3 in json format which Athena is not accepting as either Date or timestamp when am running the queries. Using AWS Athena which uses Prestodb as query…
Scorpion
  • 633
  • 3
  • 11
  • 24
12
votes
5 answers

AWS Athena (Presto) OFFSET support

I would like to know if there is support for OFFSET in AWS Athena. For mysql the following query is running but in athena it is giving me error. Any example would be helpful. select * from employee where empSal >3000 LIMIT 300 OFFSET 20
NinjaDev
  • 301
  • 1
  • 7
  • 19
12
votes
2 answers

How to convert timestamp to date in Presto?

I like to convert my timestamp columns to date and time format. How should I write the query from presto? my timestamp is UTC time. Thank you very much Timestamp format"1506929478589" After query convert it looks like "2016-10-25 21:04:08.436"
user8818601
  • 123
  • 1
  • 1
  • 6
12
votes
5 answers

Presto create table with 'with' queries

typically to create a table in Presto (from existing db tables), I do: create table abc as ( select... ) But to make my code simple, I've broken out subqueries like this: with sub1 as ( select... ), sub2 as ( select... ), sub3 as…
Moosa
  • 3,126
  • 5
  • 25
  • 45
11
votes
1 answer

Error Query failed: Cannot unnest type: row

I'm running a query with a select bar_tbl.thing1 from foo cross join unnest(bar) as t(bar_tbl) And got the error Error Query failed: Cannot unnest type: row Why? The bar column looks like this {thing1=abc, thing2=def}
sshevlyagin
  • 1,310
  • 2
  • 16
  • 26
11
votes
1 answer

Converting Unix epoch time to extended ISO8601

I have 3 tables I would like to work on using the date, however one of the tables includes the date in unix epoch format. Here is an example of the 3 fields: Table1: 2017-02-01T07:58:40.756031Z Table2: 2017-02-07T10:16:46Z Table3: 1489236559 I…
Kelly Norton
  • 487
  • 2
  • 4
  • 19
11
votes
2 answers

Time diff in Amazon Athena / Presto (seconds and minutes )

I have a list of creation time stamps and ending time stamps , i would like to get the amount of seconds last from creation to ending . could not find any way to do that without using UNIX time stamp (which i dont have at the moment) . something…
Latent
  • 556
  • 1
  • 9
  • 23
11
votes
2 answers

Nested Query Alternatives in AWS Athena

I am running a query that gives a non-overlapping set of first_party_id's - ids that are associated with one third party but not another. This query does not run in Athena, however, giving the error: Correlated queries not yet supported. Was…
pauld
  • 401
  • 1
  • 5
  • 20
10
votes
1 answer

Multiple strings in LIKE condition - Presto SQL

I want to query a column in my table using a LIKE condition and this works fine- select * from my_table where my_column LIKE '%hello%'; But, how do I query this column with multiple strings in my LIKE condition? Looking for something like- select *…
kev
  • 2,741
  • 5
  • 22
  • 48
10
votes
2 answers

Data Grip - how do I perform a simple SQL formatting (the same way ctrl+shift+F does in DBeaver)?

I'm using Data Grip and writing queries for use with Presto. How can I get Data Grip to format my queries so they will be neat and easy to read?
GiladZa789
  • 111
  • 1
  • 7
10
votes
2 answers

How to take max between two values in presto?

I have the following query: select id, table1.date1, table2.date2, table1.name from table1 join table2 using (id) I want also to have another column with MAX(table1.date1, table2.date2) but I don't find the proper syntax for that. I don't want MAX…
HaloKu
  • 405
  • 2
  • 7
  • 17
10
votes
1 answer

How to convert varchar to array in Presto Athena

My data is in VARCHAR format. I want to split both the elements of this array so that I can then extract a key value from the JSON. Data format [ { "skuId": "5bc87ae20d298a283c297ca1", "unitPrice": 0, "id": "5bc87ae20d298a283c297ca1", …
dhankhar
  • 101
  • 1
  • 1
  • 5