alamb commented on code in PR #18412:
URL: https://github.com/apache/datafusion/pull/18412#discussion_r2676855568


##########
datafusion/sqllogictest/test_files/metadata.slt:
##########
@@ -235,7 +251,28 @@ order by 1 asc nulls last;
 3 1
 NULL 1
 
-# Regression test: first_value should preserve metadata
+# Reproducer for https://github.com/apache/datafusion/issues/18337
+# this query should not get an internal error
+query TI
+SELECT
+  'foo' AS name,
+  COUNT(
+    CASE
+      WHEN prev_value = 'no_bar' AND value = 'no_baz' THEN 1
+      ELSE NULL
+      END
+     ) AS count_rises
+FROM
+  (
+    SELECT
+      nonnull_name as value,
+      LAG(nonnull_name) OVER (ORDER BY ts) AS prev_value
+    FROM
+      table_with_metadata
+);
+----
+foo 1
+
 query IT

Review Comment:
   ```suggestion
   # Regression test: first_value should preserve metadata
   query IT
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to