sdf-jkl commented on code in PR #19722: URL: https://github.com/apache/datafusion/pull/19722#discussion_r2712783112
########## datafusion/expr/src/preimage.rs: ########## @@ -0,0 +1,28 @@ +// 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. + +use datafusion_expr_common::interval_arithmetic::Interval; + +use crate::Expr; + +pub enum PreimageResult { + /// No preimage exists for the specified value + None, + /// The expression always evaluates to the specified constant + /// given that `expr` is within the interval + Range { expr: Expr, interval: Box<Interval> }, Review Comment: Clippy suggested `Box`ing it because one enum variant is much bigger than the other. (threshold is 200bytes, None is 0, Range is 240bytes minimum) ```rust warning: large size difference between variants --> datafusion/expr/src/preimage.rs:22:1 | 22 | / pub enum PreimageResult { 23 | | /// No preimage exists for the specified value 24 | | None, | | ---- the second-largest variant carries no data at all 25 | | /// The expression always evaluates to the specified constant 26 | | /// given that `expr` is within the interval 27 | | Range { expr: Expr, interval: Interval }, | | ---------------------------------------- the largest variant contains at least 240 bytes 28 | | } | |_^ the entire enum is at least 240 bytes | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#large_enum_variant = note: `#[warn(clippy::large_enum_variant)]` on by default help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum | 27 - Range { expr: Expr, interval: Interval }, 27 + Range { expr: Expr, interval: Box<Interval> }, | ``` -- 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]
