Questions tagged [trino]

Trino is an open source distributed SQL query engine for running analytic queries against data sources of all sizes ranging from gigabytes to petabytes. Trino is the community version of Presto, and emerged from the rename of the PrestoSQL codebase.

What is Trino?

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

Trino, formerly 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 very large organizations.

What can it do?

Trino allows querying data where it lives, including HDFS/Hive, object storage systems like S3, Iceberg, Delta Lake, many relational databases, NoSQL/document databases, and even proprietary data stores. A single Trino query, written in standard SQL, can combine data from multiple sources, allowing for analytics across your entire organization.

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

The massively parallel processing design of Trino allows very high performance, and horizontal scaling to adjust to your needs.

References

680 questions
7
votes
3 answers

How to format a number as percentage with 2 decimal places in Presto?

I have a number want to format it as percentage in Presto. I want to format 0.18932 as 18.93%. I tried: format('%s%%', decimal_number*100) format('%s%%', round((a.decimal_number*100), 2)) Here is the result: none formatted: 0.019435618 first…
Jason LiLy
  • 634
  • 2
  • 9
  • 19
7
votes
1 answer

Insert into static hive partition using Presto

Suppose I want to INSERT INTO a static hive partition, can I do that with Presto? The PARTITION keyword is only for hive. INSERT INTO TABLE Employee PARTITION (department='HR') Caused by: com.facebook.presto.sql.parser.ParsingException: line…
Tiberiu
  • 990
  • 2
  • 18
  • 36
7
votes
2 answers

How to cast varchar to MAP(VARCHAR,VARCHAR) in presto

I have table in presto, one column named ("mappings") have key-value pair as string select mappings from hello; Ex: {"foo": "baar", "foo1": "bar1" } I want to cast "mappings" column into a MAP like select CAST("mappings" as MAP) from hello; This…
7
votes
1 answer

Cannot cast '' to bigint in presto

I tried to clear 'null' in my query, but there is still error when run it, keep telling me that 'cannot cast '' to bigint, is there any way to fix it? myquery select m.app, m.hour,m.user_id, m.avg_minutes_watched, n.userid, n.watched_mins,…
joey
  • 115
  • 1
  • 1
  • 10
6
votes
1 answer

Convert array(double) to varchar in Presto

I'm trying to convert Array(double) to varchar in Presto. A sample value: [99.0,98.0,99.0,95.0,99.0,88.0,90.0,79.0,90.0,56.0,90.0,90.0,92.0,90.0,93.0,99.0] I tried the cast function below: cast(colname as varchar) But got this error message: "Cannot…
ali60vip
  • 370
  • 1
  • 5
  • 13
6
votes
3 answers

Extract values from a JSON Array in Presto

I have a column with JSON arrays like below: {data=[{"name":"col1","min":0,"max":32,"avg":29}, {"name":"col2","min":1,"max":35,"avg":21}, {"name":"col3","min":4,"max":56,"avg":34}]} I'm trying to parse the array and extract specific values based on…
ali60vip
  • 370
  • 1
  • 5
  • 13
6
votes
1 answer

Removing exact duplicate rows from presto

With the following table (assuming it has many other rows and columns), how could I query it while removing duplicates? order_id customer_name amount bill_type 1 Chris 10 sale 1 Chris 1 tip 1 Chris 10 sale Note that while all 3 rows…
6
votes
2 answers

Getting day of week from date column in prestosql?

I have a date column called day such as 2019/07/22 if I want to create a custom field that translates that date to the actual day of week it is such as Sunday or Monday how is this possible? I cant seem to find a method that works for presto sql.…
Chris90
  • 1,868
  • 5
  • 20
  • 42
6
votes
2 answers

Presto with Kubernetes

We are trying to implement Presto with Kubernetes. We have a kubernetes cluster running on cloud as a service. I tried to google on this but could not find a conclusive result as to what may be the best practices to deploy Presto with Kubernetes.…
Anshul Verma
  • 1,065
  • 1
  • 9
  • 26
6
votes
1 answer

Presto SQL: TO_UNIXTIME

I want to convert a readable timestamp to UNIX time. For example: I want to convert 2018-08-24 18:42:16 to 1535136136000. Here is my syntax: TO_UNIXTIME('2018-08-24 06:42:16') new_year_ut My error is: SYNTAX_ERROR: line 1:77: Unexpected…
noobeerp
  • 417
  • 2
  • 6
  • 11
6
votes
1 answer

How to access a json field with "~" in the field name with Presto JSON functions

I have a "~" in my json fields, such as "~id". Using Presto 0.75, I am unable to access such fields. Following is what I have tried so far without success: SELECT json_extract_scalar('{"id":"1","table":"test"}', '$.table'); // This works SELECT…
l8Again
  • 263
  • 3
  • 9
5
votes
2 answers

Get JSON object keys as array in Presto/Trino

I have JSON data like this in one of my columns {"foo": 1, "bar": 2} {"foo": 1} and I would like to run a query that returns the keys as an array foo,bar foo
Boris Verkhovskiy
  • 14,854
  • 11
  • 100
  • 103
5
votes
1 answer

How can I hash a string to a bigint in presto?

I have a long string and I would like to semi-uniquely represent it as a bigint. Ideally I'd just take the hash, but presto hash functions seem to want to return "varbinary", and I can't find a function to convert a varbinary into a bigint. If I…
erbert
  • 153
  • 1
  • 4
5
votes
1 answer

Convert varbinary to varchar with encoding in presto sql and AWS athena

I'm using AWS Athena. I have a string field which holds base64 encoding of a DOMString by javascript's btoa (so, not utf-8 string but instead, 16-bit-encoded string). So, the string Fútbol España is stored as Rvp0Ym9sIEVzcGHxYQ== (and not…
Yossi Vainshtein
  • 3,845
  • 4
  • 23
  • 39
5
votes
1 answer

Are Amazon Athena views actually hive views, or are they a separate bolt-on?

Amazon Athena is based on Presto. Amazon Athena supports views. Presto does not support Hive views because it doesn't want to deal with Hive Query Language. Since a view is actually a Hive query, it would have to understand hive's entire language…
John Humphreys
  • 37,047
  • 37
  • 155
  • 255
1
2
3
45 46