# SQL

**URL:** https://www.starburst.io/community/forum/c/sql/16.md

[Latest](https://www.starburst.io/community/forum/latest.md) · [Categories](https://www.starburst.io/community/forum/categories.md) · [Tags](https://www.starburst.io/community/forum/tags.md)

---

## [About the SQL category](https://www.starburst.io/community/forum/t/about-the-sql-category/44)

<div class="topic-metadata">

**Author:** [@bitsondatadev](https://www.starburst.io/community/forum/u/bitsondatadev)\
**Replies:** 0

</div>

Questions and answers about SQL statements, functions and more as supported by Starburst Galaxy, Starburst Enterprise and Trino.

---

## [Unnesting Supers in Starburst](https://www.starburst.io/community/forum/t/unnesting-supers-in-starburst/1378)

<div class="topic-metadata">

**Author:** [@Aarthi](https://www.starburst.io/community/forum/u/Aarthi)\
**Replies:** 5\
**Last updated:** [March 13, 2026, 9:13pm UTC](https://www.starburst.io/community/forum/t/unnesting-supers-in-starburst/1378 "2026-03-13T21:13:23Z")

</div>

How many levels of nested SUPERS can Starburst support? Is there a maximum limit?

---

## [Querying a Struct](https://www.starburst.io/community/forum/t/querying-a-struct/1379)

<div class="topic-metadata">

**Author:** [@Aarthi](https://www.starburst.io/community/forum/u/Aarthi)\
**Replies:** 1\
**Last updated:** [March 13, 2026, 8:43pm UTC](https://www.starburst.io/community/forum/t/querying-a-struct/1379 "2026-03-13T20:43:44Z")

</div>

Starburst queries against a Glue table fail when nested STRUCT field names contain special characters such as hyphens, colons, spaces, or other non-standard identifier characters. The root cause appears to be the Hive ty…

---

## [Df = (session.sql(sql\_query).to\_pandas()) returns all columns as string](https://www.starburst.io/community/forum/t/df-session-sql-sql-query-to-pandas-returns-all-columns-as-string/1358)

<div class="topic-metadata">

**Author:** [@gathe](https://www.starburst.io/community/forum/u/gathe)\
**Replies:** 1\
**Last updated:** [December 19, 2025, 10:50pm UTC](https://www.starburst.io/community/forum/t/df-session-sql-sql-query-to-pandas-returns-all-columns-as-string/1358 "2025-12-19T22:50:43Z")

</div>

I’m converting pystarburst dataframes into pandas so that my colleagues can interact using familiar techniques. However, the conversion returns all columns as object (string/varchar) instead of the original data types f…

---

## [Forum to Knowledge Base](https://www.starburst.io/community/forum/t/forum-to-knowledge-base/1281)

<div class="topic-metadata">

**Author:** [@Thara](https://www.starburst.io/community/forum/u/Thara)\
**Replies:** 2\
**Last updated:** [August 23, 2025, 12:11pm UTC](https://www.starburst.io/community/forum/t/forum-to-knowledge-base/1281 "2025-08-23T12:11:02Z")

</div>

I’m just asking out of curiosity in case I’ve missed your any of the KB section in resources center page (Resources | Starburst). Please correct me if I’m wrong and you already have something in place. I see a lot of us…

---

## [Error opening Hive split](https://www.starburst.io/community/forum/t/error-opening-hive-split/1282)

<div class="topic-metadata">

**Author:** [@Thara](https://www.starburst.io/community/forum/u/Thara)\
**Replies:** 3\
**Last updated:** [August 22, 2025, 1:58am UTC](https://www.starburst.io/community/forum/t/error-opening-hive-split/1282 "2025-08-22T01:58:31Z")

</div>

We are consuming data in Power BI from Starburst and noticed the following error: Encountered user gateway exception ODBC: Error \[HY000\] \[Starburst\] \[Trino\] (1060) Trino query error: Error opening Hive split…

---

## [Sargable Queries in Galaxy](https://www.starburst.io/community/forum/t/sargable-queries-in-galaxy/556)

<div class="topic-metadata">

**Author:** [@mcbenzing](https://www.starburst.io/community/forum/u/mcbenzing)\
**Replies:** 4\
**Last updated:** [August 20, 2025, 7:14pm UTC](https://www.starburst.io/community/forum/t/sargable-queries-in-galaxy/556 "2025-08-20T19:14:42Z")

</div>

A few weeks ago I was working with indexes. I found out that a query must be sargable in order to use an index. I created a table with 100 entries of mock data. then i queried it with some sargable and some non-sargable …

---

## [Alter table execute optimize](https://www.starburst.io/community/forum/t/alter-table-execute-optimize/558)

<div class="topic-metadata">

**Author:** [@mcbenzing](https://www.starburst.io/community/forum/u/mcbenzing)\
**Replies:** 4\
**Last updated:** [July 10, 2024, 5:41pm UTC](https://www.starburst.io/community/forum/t/alter-table-execute-optimize/558 "2024-07-10T17:41:26Z")

</div>

I create partitioned Iceberg tables and try to use compaction via the optimize command. However, I can’t really understand how the optimization works yet. Does it only change the way the data is stored if I have changed …

---

## [How to collect Oracle table statistics?](https://www.starburst.io/community/forum/t/how-to-collect-oracle-table-statistics/548)

<div class="topic-metadata">

**Author:** [@mcbenzing](https://www.starburst.io/community/forum/u/mcbenzing)\
**Replies:** 4\
**Last updated:** [July 3, 2024, 3:27pm UTC](https://www.starburst.io/community/forum/t/how-to-collect-oracle-table-statistics/548 "2024-07-03T15:27:25Z")

</div>

The documentation of the Oracle connector says: To collect statistics for a table, add the following statement to your Oracle database: EXECUTE DBMS\_STATS.GATHER\_TABLE\_STATS(‘USER\_NAME’, ‘TABLE\_NAME’); Does that mea…

---

## [OPTIMIZE alledgedly not supported by Hive Table](https://www.starburst.io/community/forum/t/optimize-alledgedly-not-supported-by-hive-table/549)

<div class="topic-metadata">

**Author:** [@mcbenzing](https://www.starburst.io/community/forum/u/mcbenzing)\
**Replies:** 3\
**Last updated:** [July 3, 2024, 2:41pm UTC](https://www.starburst.io/community/forum/t/optimize-alledgedly-not-supported-by-hive-table/549 "2024-07-03T14:41:03Z")

</div>

I am struggeling with the optimize function of the hive connector. It keeps saying that executing OPTIMIZE is not supported by Hive tables. I created a table with the following statement: create table tmp\_cat\_hive.hive…

---

## [Freshness of materialized views unknown](https://www.starburst.io/community/forum/t/freshness-of-materialized-views-unknown/547)

<div class="topic-metadata">

**Author:** [@mcbenzing](https://www.starburst.io/community/forum/u/mcbenzing)\
**Replies:** 2\
**Last updated:** [July 3, 2024, 2:07pm UTC](https://www.starburst.io/community/forum/t/freshness-of-materialized-views-unknown/547 "2024-07-03T14:07:07Z")

</div>

When I run SELECT \* FROM system.metadata.materialized\_views; the freshness of all my materialized views is unknown, even though I just refreshed them. Why is that?

---

## [Can you pls provide more example of using Windows W Specfications](https://www.starburst.io/community/forum/t/can-you-pls-provide-more-example-of-using-windows-w-specfications/542)

<div class="topic-metadata">

**Author:** [@mgjagadish](https://www.starburst.io/community/forum/u/mgjagadish)\
**Replies:** 2\
**Last updated:** [June 28, 2024, 2:04am UTC](https://www.starburst.io/community/forum/t/can-you-pls-provide-more-example-of-using-windows-w-specfications/542 "2024-06-28T02:04:57Z")

</div>

Hey Folks, Am trying to replicate QUALIFY 1 windows ROW\_NUMBER OVER PARTITION Clause using Windows like the below example QUALIFY 1 =ROW\_NUMBER() OVER PARTITION BY MY COLUMN order by column I want to achieve this in …

---

## [How to use Bucketed\_by property in a Materialized View](https://www.starburst.io/community/forum/t/how-to-use-bucketed-by-property-in-a-materialized-view/524)

<div class="topic-metadata">

**Author:** [@mgjagadish](https://www.starburst.io/community/forum/u/mgjagadish)\
**Replies:** 3\
**Last updated:** [June 18, 2024, 5:16pm UTC](https://www.starburst.io/community/forum/t/how-to-use-bucketed-by-property-in-a-materialized-view/524 "2024-06-18T17:16:44Z")

</div>

How to use Bucketed\_by property in a Materialized View . I know there is an article on this. But with below SQL DDL Statement does not work CREATE MATERIALIZED VIEW “jagadishgaglani”.“discovered\_schema”.“myjagadishs3bu…

---

## [Percentages in Starburst Enterprise IDE](https://www.starburst.io/community/forum/t/percentages-in-starburst-enterprise-ide/514)

<div class="topic-metadata">

**Author:** [@sanoosha](https://www.starburst.io/community/forum/u/sanoosha)\
**Replies:** 2\
**Last updated:** [May 24, 2024, 3:37pm UTC](https://www.starburst.io/community/forum/t/percentages-in-starburst-enterprise-ide/514 "2024-05-24T15:37:27Z")

</div>

Whenever I do a division of integers on Starburst, the results are always rounded either to 0 or 1. I would like the casting to automatically to set to decimals when this division is done. Additionally I need the DIV0 fu…

---

## [Available window functions and Qualify statement](https://www.starburst.io/community/forum/t/available-window-functions-and-qualify-statement/515)

<div class="topic-metadata">

**Author:** [@sanoosha](https://www.starburst.io/community/forum/u/sanoosha)\
**Replies:** 1\
**Last updated:** [May 15, 2024, 6:02pm UTC](https://www.starburst.io/community/forum/t/available-window-functions-and-qualify-statement/515 "2024-05-15T18:02:41Z")

</div>

Hi, the window functions available on trino and starburst are too minimal and have intricacies that often fail. I would like to have a count(distinct \[ val \]) window function to check duplicate rows without adding a cte …

---

## [Pushdown operators](https://www.starburst.io/community/forum/t/pushdown-operators/376)

<div class="topic-metadata">

**Author:** [@TrinoSlackHighlights](https://www.starburst.io/community/forum/u/TrinoSlackHighlights)\
**Replies:** 1\
**Last updated:** [August 4, 2023, 7:18pm UTC](https://www.starburst.io/community/forum/t/pushdown-operators/376 "2023-08-04T19:18:42Z")

</div>

How do we know which operator/function is eligible for pushdown and which is not? For example, are the following operators/functions eligible for pushdown: CONCAT(col, '-', partitionCol) col || - || partitionCol ARRAY\_I…

---

## [How would I go about partitioning an Iceberg table on Month and Year From a Single Column](https://www.starburst.io/community/forum/t/how-would-i-go-about-partitioning-an-iceberg-table-on-month-and-year-from-a-single-column/346)

<div class="topic-metadata">

**Author:** [@ycat](https://www.starburst.io/community/forum/u/ycat)\
**Replies:** 2\
**Last updated:** [July 24, 2023, 4:55pm UTC](https://www.starburst.io/community/forum/t/how-would-i-go-about-partitioning-an-iceberg-table-on-month-and-year-from-a-single-column/346 "2023-07-24T16:55:40Z")

</div>

Is this possible within Starburst Galaxy?

---

## [Subqueries give strange results](https://www.starburst.io/community/forum/t/subqueries-give-strange-results/113)

<div class="topic-metadata">

**Author:** [@soxprox](https://www.starburst.io/community/forum/u/soxprox)\
**Replies:** 7\
**Last updated:** [July 19, 2023, 3:32am UTC](https://www.starburst.io/community/forum/t/subqueries-give-strange-results/113 "2023-07-19T03:32:51Z")

</div>

The following query SELECT Count(\*) AS po\_count, Date\_format(orderdate, '%b') AS ordermonth, Year(orderdate) AS orderyear FROM erp.purchase\_orders po GROUP BY Year(order…

---

## [Snowflake query in Staburst wont return recordsets \> 4000 rows](https://www.starburst.io/community/forum/t/snowflake-query-in-staburst-wont-return-recordsets-4000-rows/225)

<div class="topic-metadata">

**Author:** [@DENVER-LITTLE\_farmer](https://www.starburst.io/community/forum/u/DENVER-LITTLE_farmer)\
**Replies:** 1\
**Last updated:** [July 19, 2023, 3:30am UTC](https://www.starburst.io/community/forum/t/snowflake-query-in-staburst-wont-return-recordsets-4000-rows/225 "2023-07-19T03:30:40Z")

</div>

having this weird issue in Starburst. When i run a query form snowflake, if the recordset is \> 4k rows the query never returns. Oracle, SQL Server, RDS are all fine. just Snowflake. Query in Snowflake runs really fast,…

---

## [Count Zero Bytes and NonZero Bytes in a Bytestring (varbinary)](https://www.starburst.io/community/forum/t/count-zero-bytes-and-nonzero-bytes-in-a-bytestring-varbinary/261)

<div class="topic-metadata">

**Author:** [@msilb7](https://www.starburst.io/community/forum/u/msilb7)\
**Replies:** 3\
**Last updated:** [May 13, 2023, 6:34pm UTC](https://www.starburst.io/community/forum/t/count-zero-bytes-and-nonzero-bytes-in-a-bytestring-varbinary/261 "2023-05-13T18:34:02Z")

</div>

Hi all, I’ve been trying to track down a way to solve counting matching bytes in a bytestring, wondering if anyone has done this or has ideas: I have bytestrings (varbinary datatype) that look like this: 0x9120491c0000…

---

## [Forcing Push Down Join into connected Data source](https://www.starburst.io/community/forum/t/forcing-push-down-join-into-connected-data-source/177)

<div class="topic-metadata">

**Author:** [@johnz](https://www.starburst.io/community/forum/u/johnz)\
**Replies:** 7\
**Last updated:** [December 6, 2022, 5:04pm UTC](https://www.starburst.io/community/forum/t/forcing-push-down-join-into-connected-data-source/177 "2022-12-06T17:04:41Z")

</div>

The Trino Doc claims that Joins can be pushed down into a connected DB, such as postgres I have typical OLAP query that does a join, group by on a dimension, and a aggregation of a metric all on the same connected DB. T…

---

## [How to unnest multiple columns in Trino, outputting into corresponding rows](https://www.starburst.io/community/forum/t/how-to-unnest-multiple-columns-in-trino-outputting-into-corresponding-rows/47)

<div class="topic-metadata">

**Author:** [@system](https://www.starburst.io/community/forum/u/system)\
**Replies:** 1\
**Last updated:** [October 12, 2021, 10:12pm UTC](https://www.starburst.io/community/forum/t/how-to-unnest-multiple-columns-in-trino-outputting-into-corresponding-rows/47 "2021-10-12T22:12:41Z")

</div>

Originally posted on Stack Overflow I’m trying to unnest some code I have a a couple of columns that have arrays, both columns using | as a deliminator The data would be stored looking like this, with extra values to …

---

## [How to cast VARCHAR to MAP(VARCHAR,VARCHAR) in Trino](https://www.starburst.io/community/forum/t/how-to-cast-varchar-to-map-varchar-varchar-in-trino/45)

<div class="topic-metadata">

**Author:** [@system](https://www.starburst.io/community/forum/u/system)\
**Replies:** 1\
**Last updated:** [October 12, 2021, 9:47pm UTC](https://www.starburst.io/community/forum/t/how-to-cast-varchar-to-map-varchar-varchar-in-trino/45 "2021-10-12T21:47:59Z")

</div>

This question was originally asked on Stack Overflow. I have table in Trino, one column named (“mappings”) have key-value pair as string select mappings from hello; Ex: {"foo": "baar", "foo1": "bar1" } I want to cast…

---

## [How do I search nested objects in Elasticsearch from Trino?](https://www.starburst.io/community/forum/t/how-do-i-search-nested-objects-in-elasticsearch-from-trino/27)

<div class="topic-metadata">

**Author:** [@system](https://www.starburst.io/community/forum/u/system)\
**Replies:** 1\
**Last updated:** [October 12, 2021, 2:05am UTC](https://www.starburst.io/community/forum/t/how-do-i-search-nested-objects-in-elasticsearch-from-trino/27 "2021-10-12T02:05:07Z")

</div>

This question was originally posted on Stack Overflow. I’m new to trino and I’m trying to use it to query nested objects in elastic search. This is my mapping in elasticsearch: { "product\_index": { "mappings": { …
