Skip to content
Last updated

Migrating Hive Queries into Trino

Trino follows the ANSI SQL syntax and semantics, while Hive uses a different SQL syntax dialect. Differences include:

  • Quotation — In Trino, use double quotations for column and table names (e.g., "column1"), single quotations for strings (for example, ‘hello presto’).
  • Implicit type conversion — In Trino, SELECT CAST(5 AS DOUBLE) / 2 gives 2.5, but SELECT 5 / 2 gives 2. In Hive, both return 2.5.

To migrate Hive queries into Trino:

  1. Review the SQL syntax requirements for Trino at Migrating from Hive.
  2. Determine which of your queries might need to have syntax updates.
  3. Make and test the changes to your queries. Or, create copies of the queries you want to migrate to Trino and make changes in the new queries.
  4. On the Query page of the Treasure Console for your query, make sure that the Type is set to Trino.

image