79214782

Date: 2024-11-22 11:23:06
Score: 1
Natty:
Report link

It would have been helpful if you had shared sample data and the expected output for debugging purpose.

However I created this sample data set in Snowflake based on what you described in the question.

enter image description here

Below query gives me expected output as 9 as this is the number of JSON objects in variant column.

SELECT 
    COUNT(*) AS total_variant_objects
FROM 
    my_table,
    LATERAL FLATTEN(input => my_table.variants) AS flattened_variants;

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: samhita