anoopj commented on code in PR #17511: URL: https://github.com/apache/iceberg/pull/17511#discussion_r3716223616
########## api/src/main/java/org/apache/iceberg/expressions/StrictEvalVisitor.java: ########## @@ -0,0 +1,492 @@ +/* + * 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. + */ +package org.apache.iceberg.expressions; + +import java.util.Collection; +import java.util.Comparator; +import java.util.Set; +import java.util.stream.Collectors; +import org.apache.iceberg.types.Comparators; +import org.apache.iceberg.types.Types.StructType; +import org.apache.iceberg.util.NaNUtil; + +abstract class StrictEvalVisitor extends ExpressionVisitors.BoundExpressionVisitor<Boolean> { + protected static final boolean ROWS_MUST_MATCH = true; + protected static final boolean ROWS_MIGHT_NOT_MATCH = false; + + private final StructType struct; + + StrictEvalVisitor(StructType struct) { + this.struct = struct; + } + + /** Return true if null count is non-zero or is unknown, false if null count is 0. */ + protected abstract boolean mayContainNull(int id); + + /** Return true if null count is known and equal to value count, false otherwise. */ + protected abstract boolean containsNullsOnly(int id); + + /** + * Return true if null counts are unavailable or if the null count is non-zero, false otherwise. + * + * <p>Unlike {@link #mayContainNull(int)}, this returns false when a null count is unavailable for + * the field but is available for other fields. + */ + protected abstract boolean canContainNulls(int id); + + /** Return true if NaN count is non-zero or is unknown, false if NaN count is 0. */ + protected abstract boolean mayContainNaN(int id); + + /** Return true if NaN count is known and equal to value count, false otherwise. */ + protected abstract boolean containsNaNsOnly(int id); + + /** + * Return true if the NaN count is known and non-zero, false otherwise. + * + * <p>Unlike {@link #mayContainNaN(int)}, this returns false when the NaN count is unavailable. + * NaN counts are not tracked for non-floating point fields or by early writers. Review Comment: Nit: we can just remove this line, as it's describing the format behavior. I know we are going to remove it anyway, per the other comment thread. -- 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]
