My Sigma query with map lookup has stopped working

Error Message: “INVALID_FUNCTION_ARGUMENT: Key not present in map”

Resolution: Use ELEMENT_AT() instead of [] for map lookup

For example, if your query looks like:

SELECT charge_id, metadata[‘customer’] FROM (
  SELECT charge_id, map_agg(key, value) AS metadata FROM charges_metadata
)

Change it to:

SELECT charge_id, ELEMENT_AT(metadata, 'customer') FROM (
  SELECT charge_id, map_agg(key, value) AS metadata FROM charges_metadata
)

Additional Information

As of September 3rd 2020, Sigma supports queries using Prestosql v334 SQL syntax. As a part of this change, map lookup with [] will fail if the key is not present in the map. ELEMENT_AT() resumes the previous behavior of returning NULL for key absence.

Your scheduled and saved queries have been updated accordingly.