{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Products","product_name":"Data Workbench","type":"markdown"},"seo":{"title":"Presto 0 205 to 317 Migration 2020","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"presto-0-205-to-317-migration-2020","__idx":0},"children":["Presto 0 205 to 317 Migration 2020"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Data’s Presto release is based on the Presto 317 open source release. Our previous release was based on Presto 0.205. This article includes:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h1_1921683457"},"children":["New Magic Comment Features"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__584086195"},"children":["parse_decimal_literals_as_double"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__1974809204"},"children":["Distributed_Sort"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__1734486412"},"children":["time_partitioning_range"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h1__1821394898"},"children":["Deprecated Features"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2_2028709490"},"children":["Migrate Your Distributed Joins"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h1__1516417081"},"children":["Updating Presto"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__1521992254"},"children":["About Side-by-Side Environments"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__1437983654"},"children":["Running Code in Presto 317 vs. Presto 0.205"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h1__87043302"},"children":["Query Syntax Fixes"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2_1448312120"},"children":["Having too many OR predicate. Maximum 500 OR allowed"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2_756987314"},"children":["Key not present in map: XXX"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__599545120"},"children":["Array subscript out of bounds"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2_1644950305"},"children":["Column alias list has 1 entry but 't' has N columns available'"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__285762603"},"children":["Window does not support distinct"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__1682355132"},"children":["ARRAY comparison not supported for arrays with null elements"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2_2060302521"},"children":["'XXX' must be an aggregate expression or appear in a GROUP BY clause"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__852805306"},"children":["Zero-length delimited identifier not allowed"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2__190112671"},"children":["Unexpected parameters (char(1)) for function codepoint. Expected: codepoint(varchar(1))"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020#h2_1996712627"},"children":["Invalid format: \"XXX\" is malformed / Invalid timezone: \"XXX\" is malformed"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We have done internal testing to identify compatibility and performance regression issues."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"new-magic-comment-features","__idx":1},"children":["New Magic Comment Features"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"parse_decimal_literals_as_double","__idx":2},"children":["parse_decimal_literals_as_double"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["parse_decimal_literals_as_double"]}," session property is supported as a magic comment."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Decimal literals without an explicit type specifier (e.g. 1.2) are treated as the values of the DOUBLE type by default."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This magic comment can disable the behavior and use decimal literals as the values of the DECIMAL type. For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"-- set session parse_decimal_literals_as_double = 'false'\n    SELECT typeof(1.1);  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"distributed_sort","__idx":3},"children":["Distributed_Sort"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["distributed_sort"]}," session property is supported as a magic comment."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Distributed sort allows sorting of data, which exceeds ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query.max-memory-per-node"]},". Distributed sort is enabled through the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["distributed_sort"]}," session property, or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["distributed-sort"]}," configuration property set in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["etc/config.properties"]}," of the coordinator. Distributed sort is enabled by default."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When distributed sort is enabled, the sort operator executes in parallel on multiple nodes in the cluster. Partially sorted data from each worker node is then streamed to a single worker node for a final merge. This technique allows to utilization of memory of multiple worker nodes for sorting. The primary purpose of the distributed sort is to allow for the sorting of data sets that don’t normally fit into single node memory. Performance improvement can be expected, but it won’t scale linearly with the number of nodes, since the data needs to be merged by a single node."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"-- set session distributed_sort = 'true'\n    SELECT * FROM large_table, small_table\n    WHERE small_table.id = large_table.id  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"time_partitioning_range","__idx":4},"children":["time_partitioning_range"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The time_partitioning_range session property is supported as a magic comment."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"-- set session time_partitioning_range = 'value`  \n  \nThe value can be\n\n  * none\n\n    * no time partitioning\n\n  * number with unit\n\n    * allowed units are `h, d, mo, q, y` (hour, day, month, quarter, year)\n\n    * ex) 12h, 2d, 1mo, 1q, 1y\n\n# Deprecated Features\n\n## Migrate Your Distributed Joins\n\nThe **distributed_join** session property has been removed.\n\nUse **join_distribution_type** session property instead. The **join_distribution_type** system property accepts the following values:\n\n  * PARTITIONED\n\n  * BROADCAST\n\nDeprecated code:\n\n```sql\n-- set session distributed_join = 'true'\n    SELECT * FROM large_table, small_table\n    WHERE small_table.id = large_table.id  \n  \nUpdated code:\n\n```sql\n-- set session join_distribution_type = 'PARTITIONED'\n    SELECT * \n    FROM large_table, small_table\n    WHERE small_table.id = large_table.id  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"updating-presto","__idx":5},"children":["Updating Presto"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"about-side-by-side-environments","__idx":6},"children":["About Side-by-Side Environments"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For your testing, Presto 0.205 and Presto 317 are available side-by-side to allow testing of the code before the upgrade."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"running-code-in-presto-317-vs-presto-0205","__idx":7},"children":["Running Code in Presto 317 vs. Presto 0.205"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["During the transition from Presto 317 and Presto 0.205 the two releases will be available side-by-side."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can control which Presto release runs your code by using the following query hint:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Version"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Query Hint"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Presto 317"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-- @TD engine_version: 317"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Presto 0.205"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-- @TD engine_version: 0.205"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"query-syntax-fixes","__idx":8},"children":["Query Syntax Fixes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Running queries that worked in the previous version might cause error messages. For each case, we show the message, a query that causes the error, and an example of how to rewrite the query."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"having-too-many-or-predicate-maximum-500-or-allowed","__idx":9},"children":["Having too many OR predicate. Maximum 500 OR allowed"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT path FROM  ( \n     SELECT * FROM sample_datasets.www_access ) WHERE \n    path = 'foo1' OR path = 'foo2' OR path = 'foo3'\n    -- Query having a lot of \"OR\" clauses\n    OR path = 'foo559';  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT path FROM ( \n     SELECT * FROM sample_datasets.www_access ) WHERE\n    path IN (\n     'foo1', 'foo2', 'foo3' ,\n    -- Query having a lot of conditions\n    'foo559');  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Typically, using an ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["IN"]}," clause to rewrite your queries solves the issue."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"_","__idx":10},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Key not present in map: XXX"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT MAP(ARRAY [1, 3], ARRAY [2, 4])[5];  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT element_at(MAP(ARRAY [1, 3], ARRAY [2, 4]), 5);  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use the function ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://trino.io/docs/423/functions/map.html"},"children":["element_at"]}," to rewrite your queries. The function ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://trino.io/docs/423/functions/map.html"},"children":["element_at"]}," is supported by both cluster versions, v0.205, and v317. The preceding query runs on both clusters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"_-1","__idx":11},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Array subscript out of bounds"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT\n     numbers[99] -- key isn't exist\n    FROM\n     (VALUES (ARRAY[1,2,3]) ) AS t(numbers);  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT\n      element_at(numbers, 99) -- key isn't exist\n    FROM\n      (VALUES (ARRAY[1,2,3]) ) AS t(numbers);  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The function ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://trino.io/docs/423/functions/array.html"},"children":["element_at"]}," is supported by both cluster versions, v0.205, and v317."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The preceding query runs on both clusters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"_-2","__idx":12},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Column alias list has 1 entry but 't' has N columns available'"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"WITH\n    dataset AS (\n     SELECT ARRAY[\n     CAST(ROW('Amy', 'devops') AS ROW(name VARCHAR, department VARCHAR))\n     ] AS users\n    ),\n    u AS (\n     SELECT person\n     FROM\n     dataset,\n     UNNEST(dataset.users) AS t(person)\n     )\n    SELECT\n     person.name,\n     person.department\n    FROM u;  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"WITH\n    dataset AS (\n     SELECT ARRAY[\n     CAST(ROW('Amy', 'devops') AS ROW(name VARCHAR, department VARCHAR))\n     ] AS users\n    ),\n    u AS (\n     SELECT\n     name, department\n     FROM\n     dataset,\n     UNNEST(dataset.users) AS person(name, department)\n     )\n    SELECT\n     name,\n     department\n    FROM u;  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"_-3","__idx":13},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Window does not support distinct"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT \n      UPPER(DISTINCT(id)) AS user_id \n    FROM (VALUES ('foo'), ('bar')) AS t(id);  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT \n      UPPER(id) AS user_id \n    FROM (\n      SELECT DISTINCT id FROM (VALUES ('foo'), ('bar')\n    ) AS t (id));  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"array-comparison-not-supported-for-arrays-with-null-elements","__idx":14},"children":["ARRAY comparison not supported for arrays with null elements"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT id, array_agg(value)\n    FROM (\n     VALUES\n     (1, 3), (1, 4), (1, 5), (2, 6), (2, 7), (3, null)\n    ) AS t(id, value)\n    GROUP BY 1 ORDER BY 2;  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT id, array_agg(value) FILTER (where value is not null)\n    FROM (\n     VALUES\n     (1, 3), (1, 4), (1, 5), (2, 6), (2, 7), (3, null)\n    ) AS t(id, value)\n    GROUP BY 1 ORDER BY 2;  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The function ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://trino.io/docs/423/functions/map.html"},"children":["element_at"]}," is supported by both cluster versions, v0.205, and v317. The preceding query runs on both clusters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"details-of-this-error-behavior-change-of-array_agg-function","__idx":15},"children":["Details of this error: Behavior change of array_agg function"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For Presto 0.205, the array_agg function ignores NULL values."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"presto> SELECT id, array_agg(value) FROM ( VALUES (1, null), (1, 0) ) AS t(id, value) GROUP BY 1;\n     id | _col1\n    ----+-------\n     1 | [0]\n    (1 row)\n    \n    presto> SELECT id, array_agg(value) FROM ( VALUES (1, null) ) AS t(id, value) GROUP BY 1;\n     id | _col1\n    ----+-------\n     1 | NULL\n    (1 row)  \n  \nIn Presto 0.205, _deprecated_._legacyagg_ property, true is enabled in order to keep this legacy behavior of the array_agg function.\n\nThis property was removed in Presto 317 and there is no ability to roll back the legacy behavior.\n\nFor Presto 317, the array_agg function doesn't ignore NULL values and returns an array including NULL values.\n\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["presto> SELECT id, array_agg(value) FROM ( VALUES (1, null), (1, 0) ) AS t(id, value) GROUP BY 1;"," ","id | _col1"," ","----+-----------"," ","1 | [null, 0]"," ","(1 row)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["presto> SELECT id, array_agg(value) FROM ( VALUES (1, null) ) AS t(id, value) GROUP BY 1;"," ","id | _col1"," ","----+--------"," ","1 | [null]"," ","(1 row)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["As a result, when Presto compares with a column that has arrays with NULL values, Presto returns the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ARRAY comparison not supported for arrays with null elements"]}," message."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"xxx-must-be-an-aggregate-expression-or-appear-in-a-group-by-clause","__idx":16},"children":["'XXX' must be an aggregate expression or appear in a GROUP BY clause"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT code FROM sample_datasets.www_access \n    HAVING code IS NOT NULL;  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT code FROM sample_datasets.www_access \n    WHERE code IS NOT NULL;  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you use a HAVING clause as a WHERE clause, this error appears."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"_-4","__idx":17},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Zero-length delimited identifier not allowed"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT 1 AS \"\";  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT 1 AS \"A\";  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"unexpected-parameters-char1-for-function-codepoint-expected-codepointvarchar1","__idx":18},"children":["Unexpected parameters (char(1)) for function codepoint. Expected: codepoint(varchar(1))"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT codepoint(CAST('a' AS CHAR));  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT codepoint(CAST('a' AS VARCHAR(1)));  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"invalid-format-xxx-is-malformed--invalid-timezone-xxx-is-malformed","__idx":19},"children":["Invalid format: \"XXX\" is malformed / Invalid timezone: \"XXX\" is malformed"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Error handling has been improved in v317. When an invalid argument gets passed, the current Presto returns NULL, but the new Presto returns the error."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Original code that causes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT td_time_range(1567890000, 'yyyy-MM-dd','JST', NULL);  \n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modified code that fixes the error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT td_time_range(1567890000, '2019-09-08', 'JST', NULL);  \n  \n  \n\n","lang":"sql"},"children":[]}]},"headings":[{"value":"Presto 0 205 to 317 Migration 2020","id":"presto-0-205-to-317-migration-2020","depth":1},{"value":"New Magic Comment Features","id":"new-magic-comment-features","depth":1},{"value":"parse_decimal_literals_as_double","id":"parse_decimal_literals_as_double","depth":2},{"value":"Distributed_Sort","id":"distributed_sort","depth":2},{"value":"time_partitioning_range","id":"time_partitioning_range","depth":2},{"value":"Updating Presto","id":"updating-presto","depth":1},{"value":"About Side-by-Side Environments","id":"about-side-by-side-environments","depth":2},{"value":"Running Code in Presto 317 vs. Presto 0.205","id":"running-code-in-presto-317-vs-presto-0205","depth":2},{"value":"Query Syntax Fixes","id":"query-syntax-fixes","depth":1},{"value":"Having too many OR predicate. Maximum 500 OR allowed","id":"having-too-many-or-predicate-maximum-500-or-allowed","depth":2},{"value":"","id":"_","depth":2},{"value":"","id":"_-1","depth":2},{"value":"","id":"_-2","depth":2},{"value":"","id":"_-3","depth":2},{"value":"ARRAY comparison not supported for arrays with null elements","id":"array-comparison-not-supported-for-arrays-with-null-elements","depth":2},{"value":"Details of this error: Behavior change of array_agg function","id":"details-of-this-error-behavior-change-of-array_agg-function","depth":3},{"value":"'XXX' must be an aggregate expression or appear in a GROUP BY clause","id":"xxx-must-be-an-aggregate-expression-or-appear-in-a-group-by-clause","depth":2},{"value":"","id":"_-4","depth":2},{"value":"Unexpected parameters (char(1)) for function codepoint. Expected: codepoint(varchar(1))","id":"unexpected-parameters-char1-for-function-codepoint-expected-codepointvarchar1","depth":2},{"value":"Invalid format: \"XXX\" is malformed / Invalid timezone: \"XXX\" is malformed","id":"invalid-format-xxx-is-malformed--invalid-timezone-xxx-is-malformed","depth":2}],"frontmatter":{"seo":{"title":"Presto 0 205 to 317 Migration 2020"}},"lastModified":"2026-03-09T02:59:36.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/data-workbench/queries/archives/presto-0-205-to-317-migration-2020","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}