troubleshooting

Is it possible to extract the max of an array of doubles per row?

Yannick Koechlin is asking if it's possible to extract the maximum value from an array of doubles per row in a database table. Kexiang provides a SQL query to achieve this and mentions the availability of the array_max function in version 1.2.0 of the tool. Yannick Koechlin expresses that their current version is 1.1.2 and Kexiang informs that array_max will be available in version 1.3.0.

Ya

Yannick Koechlin

Asked on Sep 20, 2023

  • To extract the max of an array of doubles per row, you can use the array_max function available in version 1.2.0 or later.

  • If you are using version 1.1.2, you can achieve this by using a SQL query like:

SELECT id, MAX(value) AS max_value FROM your_table_name, unnest(your_array_column) AS value GROUP BY id;
  • The array_max function can be used as follows in version 1.2.0 or later:
select array_max(array_column_name) from {table_name};
Sep 21, 2023Edited by