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.

Filter by
Sorted by
Tagged with
0 votes
2 answers
24 views

group by/ aggregate in sql presto athena

I have a table which looks like so: id, author 1, {entries..} 1, {entries2..} 1, {entries3..} 2, {entry x} 2, {entry y} </snip> I would like to group by and produce another table which looks ...
AJW's user avatar
  • 5,659
0 votes
1 answer
15 views

How to set up Presto server on aws emr and allow data access to users through a connection string

I am new to Presto and Hive. I am working on a project where I have to use aws and set up an emr cluster that runs both presto and hive. I am able to do this and I can access hive from the cli, I can ...
jingo francis's user avatar
1 vote
1 answer
43 views

unnesting an array into two other array sql (athena/presto)

I have a nested array in athena which looks like this: [ {org=[..],auth={..}},{org=[..],auth={..}},{org=[..],auth={..}} ] both the array and its contents are optional. I would like to unnest the org ...
AJW's user avatar
  • 5,659
1 vote
2 answers
39 views

sql athena/presto check if value in array of nested json

I run a query in athena like so: SELECT element_at(col_name,1).entities FROM "db_name"."the_table" limit 10; and I get an array of nested jsons/dicts like so: [{country=US,content=...
AJW's user avatar
  • 5,659
0 votes
2 answers
51 views

large aggregation queries optimization

I have a table events with columns user_id, event_type, date. I need to create a table which aggregates it in the following way select user_id, event_type, count(*) group by user_id, event_type where ...
Adam's user avatar
  • 285
0 votes
0 answers
34 views

Trino/Athena: LEFT JOIN a table based on most recent date relative to another date column

Let's say that there is a table A (Charging Session Table) that keeps track of devices' charging sessions (device_id, charging_session_ids start_time, end_time, ....etc ), I joined this table with ...
SomeOne's user avatar
  • 33
0 votes
0 answers
21 views

Guice bindings on config changes

I am using cfg4j library for reflecting the changes in the beans on changes in the config files (auto-reload/refresh) public ConfigurationProvider getConfigurationProvider() { ...
Paul Schimmer's user avatar
1 vote
1 answer
21 views

Presto | Athena: Duplicated values in not key column

I have the following table: CD_CLIENTE DE_CLIENTE 12345 Jhon One 23456 Jhon Two 34567 Jhon Three 12345 Jhon ONEe Even using DISTINCT for CD_CLIENT I have it two times in my Result because the ...
Guilherme Corbini's user avatar
0 votes
1 answer
16 views

Athena equivalent for Presto's find_first_index on array column

find_first_index(array(E), function(T, boolean)) → BIGINT# Returns the index of the first element of array which returns true for function(T,boolean). Returns NULL if no such element exists. This ...
Roelant's user avatar
  • 4,684
0 votes
0 answers
16 views

Trino CLI fails to receive data from server

I have setup Trino 433 on an Ubuntu server and it appears to be running as expected, but when connected to it using the Trino CLI trino-cli-433-executable.jar from my workstation, the CLI tool never ...
Peter's user avatar
  • 5,585
0 votes
0 answers
39 views

Presto UI + convert presto UI details to logs or database

We have medium presto cluster with 12 presto workers , all presto workers are installed on Linux machines Presto have web interface running on port 8080 of the coordinator node: How we can store the ...
King David's user avatar
0 votes
0 answers
76 views

presto + Query exceeded distributed user memory limit of XXGB

we have presto cluster around 100 presto workers machines and of course one coordinator all presto are installed on Linux RHEL 7.9 version sometimes we get exceptions on presto UI , and exception is ...
King David's user avatar
0 votes
1 answer
52 views

Extract all values from JSON

I have some data that looks like this: Data From Other Columns JSON Data Data 1 JSON 1 Data 2 JSON 2 The JSON data looks like this: { "status": "x" ,"campaigns&...
Miguel Barrientos's user avatar
1 vote
1 answer
33 views

AWS Athena would like to join table once instead of 3 times

Could you please help to rewrite SQL on AWS Athena to use table with one join instead of 3 times I need to get result: with t1 as ( select 1 id, 1 id1, 2 id2, 3 id3 union all select 2 id, ...
Igor T's user avatar
  • 36
-2 votes
0 answers
45 views

Date format change between in mysql

I want to have a range based on a specific date, but I can't start with the period excluding the specific date. Help me plz , o.dt between to_char(contact_dt + interval '1' day , 'yyyymmdd') and ...
Ralph K Won Sik Kim's user avatar
0 votes
1 answer
63 views

How do I get the index (position) of an element from a json array in presto?

I'm using Presto, and have two columns. Column A is a json array which looks like ["apple", "banana", "cherry"] Column B is a string value "cherry" All I want ...
Vertika Sharma's user avatar
0 votes
0 answers
52 views

Presto: join two large tables directly or filter them first?

I need to join 2 or more large tables(> 100,000,000 rows) in Presto SQL. My environment limits resources by query time and resource allocation. It is my understanding that Presto loads the JOINED ...
ttcaltt's user avatar
  • 21
1 vote
1 answer
80 views

Create new columns from String Columns that looks like JSON

I got a table with 1 column which is a string type, but the inside looks like an json type. The value looks like this 'old_id' column with value [{"name":"Entitas Penugasan","...
KaraiKare's user avatar
  • 169
0 votes
0 answers
49 views

Athena SQL - Select JSON field from a string if it exists otherwise print NULL

I've a column called Validity with JSON strings as follows: {begin=2023-10-27T16:13:36.756Z, end=2026-10-27T16:13:36.756Z} {begin=2023-10-28T16:13:36.756Z} SELECT validity.begin, validity.end FROM ...
RMu's user avatar
  • 819
0 votes
1 answer
43 views

Athena SQL - Unable to UNNEST JSON string as desired

I've JSON string in Athena as follows: [{name=agreementUrl, value=agmt-id00001}, {name=sellerOfRecord, value=ABC Corporation}] [{name=agreementUrl, value=agmt-id00002}, {name=sellerOfRecord, value=XYZ ...
RMu's user avatar
  • 819
0 votes
0 answers
32 views

Can I print presto parser Expression in JSON format

(Sorry I can not find similar questions before). We want to print the presto parser's Expression in JSON format. https://github.com/slackhq/presto/blob/b147a2bc6614c4028ffb09cf668821a79c2af0fa/presto-...
user2988877's user avatar
1 vote
1 answer
40 views

Count function using two columns in sql table

PICTURE OF SQL TABLE PLEASE LOOK I'd like to count the number of uris that have xml in it for each request_ip, so id like the results table to look like this | Request ip | Number of hits | | 34.212....
H Hassan's user avatar
1 vote
1 answer
28 views

Extracting string value before bracket using regexp in Athena

I am trying to learn about regexp and I am trying to extract data that is before open bracket character using regexp_extract. String value: device iphone-ios-cx 12.45.0(2144) Expected output: ...
vvazza's user avatar
  • 383
1 vote
3 answers
69 views

How to select the last element of a JSON array in AWS Athena?

My database has a column that contains a JSON array like this: WITH dataset AS ( SELECT * FROM (VALUES ('1', JSON'[{ "name" : "foo" }, { "name" : "...
srk's user avatar
  • 1,692
2 votes
1 answer
27 views

Prestodb - Cast value from array(row("name" varchar,"value" varchar)) when name matches a string

in a prestodb table, I have a column with the following structure. array(row("name" varchar,"value" varchar)) Let's call the column complexcolumn. The data would look like this: ...
Donovan's user avatar
  • 21
0 votes
1 answer
19 views

Map type presto

I'm using presto for the sql and the code below is not working, I've tried json extract too, that's also not working with presto, could you guys please help me with this code so that it work on presto ...
Vikas Sharma's user avatar
0 votes
0 answers
38 views

presto select column names from another query

I'm trying to write a presto query that can assign column names dynamically based on the results of another query but doesn't work. This is what I tried: WITH x AS ( SELECT DATE_TRUNC('Week', ...
MTT's user avatar
  • 5,153
1 vote
1 answer
30 views

Perform Value Count with Specific Conditions inside subwindows SQL Presto

let's say I have a table with 3 columns: id, date_time, color. The data looks like this: id, date_time, color 1, 2023-10-01 12:15, green 1, 2023-10-01 12:16, yellow 1, 2023-10-01 12:17, yellow 1, 2023-...
Ekaterina Kochurova's user avatar
1 vote
1 answer
25 views

Presto function at_timezone results in incorrect UTC time for timezone 'Africa/Cairo'

I need to rely on the Presto function at_timezone to return the correct UTC time offset for a given timezone. The function currently returns an incorrect UTC time, and hence offset value, for the ...
DomThePom's user avatar
1 vote
0 answers
31 views

Athena Partition Projection Custom Date Format

I have partitions in S3 in hive-style format that look like s3://prefix/year=yyyy/month=MM/day=dd. I'm trying to create a partitioned projected table in Athena with one "date" partition. I'...
Josh Knize's user avatar
0 votes
2 answers
24 views

Querying Nested Type Map <string, timestamp>

I have a sample table, let's call it table: id events 1 {requested=1719-05-08 11:11:11.111, created=1820-05-08 11:11:11.699, completed=1869-69-69 15:11:13.111} 2 {created=6969-01-01 09:01:01.466} ...
Maggie Liu's user avatar
0 votes
1 answer
42 views

Access array in presto

We've a table named route_data and it has one of the main column named as start_hotspot_uuid , end_hotspot_uuid (INT) and another column we have is waypoints which has details for all the hotspot (it'...
Vikas Sharma's user avatar
0 votes
1 answer
40 views

Value_map array in sql

I'm new to sql and this was the task assigned to me, I need to count() all the sessions where the vehicleViewId 20054133, vehicleViewId 20054595,vehicleViewId 20055263)(which is present in the ...
Vikas Sharma's user avatar
0 votes
0 answers
44 views

Metrics on a weekly level, and then averaged across all weeks for the given period

My manager want all these metrics on a weekly level and then averaged across all the weeks. WITH RegisteredUsers AS ( SELECT e.organization_uuid, COUNT(DISTINCT e.user_uuid) AS ...
Vikas Sharma's user avatar
0 votes
0 answers
19 views

Fetch top samples & random samples from a Presto table whose data type is not known

I am building a UI tool that shows some data to the user. The user can select any Presto table & column from the tool. The tool queries that table & column_name & fetches a) 10 random ...
Piyush's user avatar
  • 606
0 votes
1 answer
31 views

Rolling Average based on n value in a column

I have a table with following structure - | date1 | grp | value | n | |:-----------:|:------:|:-----:|:-:| | 2023-10-01 | g1 | 10 | 30| | 2023-10-02 | g1 | 15 | 30| | 2023-10-...
Pratibha UR's user avatar
0 votes
0 answers
38 views

Error while Converting Presto SQL to Hive format

I have a presto query that I am trying to convert to Hive format. When I try to convert, am getting compilation error. Presto query: select id , json_extract_scalar(item, '$.ticker') as ticker , ...
vvazza's user avatar
  • 383
0 votes
1 answer
51 views

12M Rolling Active Customers

I have a order table with order_date and customer_id fields and for each date in 2022 and beyond I want to compute the 12 month rolling distinct active customers using SQL. I've tried SELECT ...
Danyal Imran's user avatar
  • 2,525
0 votes
0 answers
32 views

Find unique combinations of two columns optimizing for performance

Given a table like the one below, how can I write a SQL query to find the unique combinations of col1 and col2 without using array functions or LEAST()/GREATEST() as mentioned here. I was wondering if ...
starHopp3r's user avatar
1 vote
2 answers
102 views

Athena/Trino/Presto code to parse text file with custom line separator

I want to parse some log files in plain text file with records spanning across multiple lines using Trino/Presto code. My data looks like this: each record has multiple lines and each line has a ...
Jason's user avatar
  • 1,122
1 vote
1 answer
28 views

Create flattened array from array of JSON values Athena

Say I have the following array of json variables in my data: pets --- [{"type":"dog", "name":"fido"}, {"type":"cat", "name":"...
DavidWebb's user avatar
  • 121
0 votes
1 answer
25 views

Implementing java's `HashCode` in Presto/Trino

I am trying to find a method in SQL world (specifically Trino/Presto) where I can reproduce the following Input / Output combination. Input - s (type String) Output - o Int where o = hashCode(s) E.g. ...
Heisenberg's user avatar
  • 1,510
0 votes
2 answers
54 views

athena prepared statement how to pass multiple values in IN cluase

i have a prepared statement with IN clause SELECT locationId, location, FROM location_type where city in (?) and userId = ? i tried executing the above query with prepared statement query ...
triples13's user avatar
  • 206
2 votes
1 answer
68 views

Decode base64 to array of floats

I have a 768 length array of float values that have been tokenized and are stored in a string field in an Athena table. I want to extract from that string the 768 original float values. In python, ...
David's user avatar
  • 41
0 votes
0 answers
17 views

trino to quey data straight from operational databases

I´ve been doing some POCS with trino (aka presto). I am very happy with the performance even with small trino clusters. Mostly my pocs are against data lakes doing replication source data from ...
jacktrade's user avatar
  • 3,185
1 vote
0 answers
45 views

How to get the top level hierarchy as separate column

I have a requirement where data looks as shown below in the table where PL-135 is the top level with children 21-001, 210-002, PL-76. In turn, PL-76 is parent of 25-001 and 25-002 but child of PL-135. ...
user22435160's user avatar
-1 votes
1 answer
15 views

Preto installation /setup failed

I have configured presto on master and slave nodes . Ghe queries are running fine on both the master and slave seperately. But in UI it only shows 1 active worker Tried to set up presto on master and ...
tushar bhatia's user avatar
2 votes
2 answers
54 views

Get only the most recent records from a table

Trying to query a database in Athena; the info's recorded in big batches by snapshot date, so one 'node' will have multiple duplicate entries - e.g. node realm snapshot_date NODEA NA 02/21/2022 ...
subcorax's user avatar
0 votes
0 answers
50 views

Connect to AWS S3 From Presto

Connect to AWS S3 Using presto connector : I had followed the documentation provided by presto , but however I couldnt able to , I tried the below configuration : https://prestodb.io/docs/current/...
Rajesh m's user avatar
0 votes
1 answer
41 views

Conditional Row Numbering - PrestoDB

I need help with my PrestoDB Query. I need to only change the row number to the next if my column_1 like statement is true. Current I have set it to 0 but ive tried using "lag" "lead&...
Jeremiah Rodriguez's user avatar

1
2 3 4 5
63