zhangfengcdt commented on code in PR #7316: URL: https://github.com/apache/datafusion-comet/pull/7316#discussion_r4515712422
########## native/core/src/execution/planner/scalar_expansion.rs: ########## @@ -0,0 +1,344 @@ +// 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. + +//! Bounds the rows per batch under an operator that expands a large string scalar. +//! +//! An aggregate, a hash partitioner and most string kernels expand a scalar argument to the +//! batch's length: a 256 KiB string over the default 8192-row batch needs 2 GiB of value bytes, +//! past the 32-bit offsets of Arrow's `Utf8` and `Binary` arrays. Spark evaluates such scalars +//! row by row and never materializes the column. See +//! <https://github.com/apache/datafusion-comet/issues/7247>. +//! +//! The bound is enforced right under the operator that evaluates the expressions, with a Review Comment: Yes, I updated the sort to get the same bound as a projection - should cover the topk case now. Also, i would like to take the case of plain sort without a limit as a follow-up issue. In such case, the external sorter concatenates its in-memory input into one MiB runs before evaluating the keys. -- 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]
