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:
- Review the SQL syntax requirements for Trino at Migrating from Hive.
- Determine which of your queries might need to have syntax updates.
- 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.
- On the Query page of the Treasure Console for your query, make sure that the Type is set to Trino.
