zhangfengcdt commented on code in PR #7316:
URL: https://github.com/apache/datafusion-comet/pull/7316#discussion_r4445994140


##########
spark/src/test/resources/sql-tests/operators/large_scalar_string.sql:
##########
@@ -0,0 +1,72 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- A string scalar, from a scalar subquery or a literal, is expanded to the 
batch length by the
+-- aggregate, the hash partitioner and string kernels. A 256 KiB string over 
the default 8192-row
+-- batch needs 2 GiB of value bytes, past Arrow's 32-bit offsets. Spark 
evaluates row by row.
+-- The ids are written in one task so they arrive in one batch. Constant 
folding is on so that
+-- `repeat('x', 262144)` reaches Comet as the literal it is in a Spark session.
+-- See https://github.com/apache/datafusion-comet/issues/7247.
+-- Config: spark.sql.adaptive.enabled=false
+-- Config: spark.comet.exec.range.enabled=true
+-- ConstantFolding: enabled
+
+statement
+CREATE TABLE test_large_scalar_wide(s string) USING parquet
+
+statement
+INSERT INTO test_large_scalar_wide SELECT repeat('x', 262144)
+
+statement
+CREATE TABLE test_large_scalar_ids(k int) USING parquet
+
+statement
+INSERT INTO test_large_scalar_ids SELECT /*+ COALESCE(1) */ CAST(id % 2 AS 
INT) FROM range(8192)
+
+-- count of the scalar in a grouped aggregate, which expands it to the batch 
length. A literal
+-- rather than the subquery: the harness's missingInput check trips on a 
grouped count of a
+-- scalar subquery whatever the string's size, which is a separate plan issue.
+query
+SELECT k, count(repeat('x', 262144)) FROM test_large_scalar_ids GROUP BY k 
ORDER BY k

Review Comment:
   Yes, the fixture is changed to excludes NullPropagation so 
`count(repeat('x', 262144))` keeps its argument now.



-- 
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