trino Questions

2

I'm extracting data from a json column in presto and getting the output in a array like this [AL,null,NEW].The problem is i need to remove the null since the array has to be mapped another array.I ...
Desolation asked 11/2, 2021 at 21:1

4

Solved

I have a table Name pets -------------- Andy {dog:2, cat:1, bird:4} John {tiger:3, elephant:1, fish:2} Mary {dog:2, pig:2} I want the find the pet type with maximum count for each person. In the e...
Hadrian asked 2/8, 2020 at 0:1

3

Solved

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', 'somethin...
Truthfunction asked 25/9, 2018 at 14:59

3

Solved

I have a column with JSON arrays like below: {data=[{"name":"col1","min":0,"max":32,"avg":29}, {"name":"col2","min":1...
Ferino asked 2/2, 2021 at 18:42

0

I'm trying to achieve performant record writes from pandas (or ideally Polars if possible) in a Python environment to our Apache Iceberg deployment (with hive metastore) directly, or via Trino quer...
Plutonian asked 6/7, 2023 at 14:34

3

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 ...
Methanol asked 6/7, 2020 at 20:0

1

I want to get result in JSON format, below is the structure of object obj UUID string MobileCountryCode string UserState []struct { Mobile int64 IsNewUser bool } when i do simple select of ...
Mariellemariellen asked 17/2, 2023 at 5:56

1

Solved

The query below does not work. CREATE TABLE test_table (date varchar, id varchar, PRIMARY KEY (date,id)) I can't seem to find any docs on primary keys in Trino.
Midget asked 11/11, 2022 at 0:3

4

For example, one column in my table is an array, I want to check if that column contains an element that contains substring "denied" (so elements like "denied at 12:00 pm", "denied by admin" will a...
Suez asked 8/6, 2018 at 19:0

2

Solved

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
Lengthwise asked 2/8, 2022 at 18:8

1

Solved

Say I have some data in a table, t. id, arr --, --- 1, [1,2,3] 2, [4,5,6] SQL SELECT AVG(n) FROM UNNEST( SELECT arr FROM t AS n) AS avg_arr This returns the error, 'Mismatched input 'SELECT'. E...
Leningrad asked 4/3, 2022 at 22:22

2

I want to write a recursive query using CTE in Presto to find Employee Hierarchy. Do Presto support recursive query? When I write simple recursion as with cte as(select 1 n union all select cte...
Carrion asked 30/3, 2019 at 4:59

2

Solved

I am new to Presto, and can't quite figure out how to check if a key is present in a map. When I run a SELECT query, this error message is returned: Key not present in map: element SELECT value_m...
Herstein asked 29/3, 2019 at 22:4

1

Solved

I'm attempting to generate a series of dates in Presto SQL (Athena) using unnest and sequence something similair to generate_series in postgres. my table looks like job_name | run_date A | '2021-0...
Springtail asked 26/8, 2021 at 14:18

2

Solved

why does AWS Athena needs 'spill-bucket' when it dumps results in target S3 location WITH ( format = 'Parquet', parquet_compression = 'SNAPPY', external_location = '**s3://target_bucket_name/my_d...
Dikmen asked 24/2, 2021 at 8:54

2

I have a json table which was created by CREATE TABLE `normaldata_source`( `column1` int, `column2` string, `column3` struct<column4:string>) A sample data is: { "column1": 9...
Neumark asked 27/12, 2020 at 9:33

1

Solved

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(col...
Eating asked 17/3, 2021 at 20:50

1

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.av...
Bueno asked 10/5, 2018 at 22:5

1

Solved

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 t...
Mraz asked 26/1, 2021 at 18:2

1

Solved

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 ...
Ecclesiastical asked 22/9, 2020 at 17:33

1

Solved

This question is primarily about older versions of PrestoSQL, which have been resolved in the (now renamed) Trino project as of versions 346. However, Amazon's Athena project is based off of Presto...
Turnpike asked 19/2, 2020 at 14:17

1

Solved

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: co...
Boscage asked 20/5, 2020 at 22:39

1

Can some experts give some succinct answers to the differences between Presto and Impala from these perspectives? Fundamental architecture design SQL compliance Real-world latency Any SPOF or f...
Burning asked 7/11, 2013 at 16:16

2

Solved

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 configu...
Tyner asked 17/3, 2017 at 6:5

2

Solved

In Presto SQL, SELECT 1 / 3 returns 0, because / performs integer division. But SELECT 1.0 / 3 returns 0.3... How can I get 0.3333333333? (i.e., more specifically, 32- or 64-bits precision instead...
Photosphere asked 13/11, 2019 at 10:58

© 2022 - 2024 — McMap. All rights reserved.