kbendick commented on a change in pull request #2062: URL: https://github.com/apache/iceberg/pull/2062#discussion_r571696892
########## File path: api/src/test/java/org/apache/iceberg/transforms/TestNotStartsWith.java ########## @@ -0,0 +1,191 @@ +/* + * 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.transforms; + +import org.apache.iceberg.DataFile; +import org.apache.iceberg.PartitionSpec; +import org.apache.iceberg.Schema; +import org.apache.iceberg.TestHelpers; +import org.apache.iceberg.TestHelpers.Row; +import org.apache.iceberg.TestHelpers.TestDataFile; +import org.apache.iceberg.expressions.Binder; +import org.apache.iceberg.expressions.BoundPredicate; +import org.apache.iceberg.expressions.Evaluator; +import org.apache.iceberg.expressions.Expression; +import org.apache.iceberg.expressions.False; +import org.apache.iceberg.expressions.InclusiveMetricsEvaluator; +import org.apache.iceberg.expressions.Literal; +import org.apache.iceberg.expressions.Projections; +import org.apache.iceberg.expressions.StrictMetricsEvaluator; +import org.apache.iceberg.expressions.UnboundPredicate; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; +import org.apache.iceberg.types.Types; +import org.apache.iceberg.types.Types.NestedField; +import org.apache.iceberg.types.Types.StringType; +import org.junit.Assert; +import org.junit.Test; + +import static org.apache.iceberg.TestHelpers.assertAndUnwrapUnbound; +import static org.apache.iceberg.expressions.Expressions.notStartsWith; +import static org.apache.iceberg.types.Conversions.toByteBuffer; +import static org.apache.iceberg.types.Types.NestedField.optional; + +public class TestNotStartsWith { + + private static final String COLUMN = "someStringCol"; + private static final NestedField FIELD = optional(1, COLUMN, Types.StringType.get()); + private static final Schema SCHEMA = new Schema(FIELD); + + // All 50 rows have someStringCol = 'bbb', none are null (despite being optional). + private static final DataFile FILE_1 = new TestDataFile("file_1.avro", Row.of(), 50, + // any value counts, including nulls + ImmutableMap.of(1, 50L), + // null value counts + ImmutableMap.of(1, 0L), + // nan value counts + null, + // lower bounds + ImmutableMap.of(1, toByteBuffer(StringType.get(), "bbb")), + // upper bounds + ImmutableMap.of(1, toByteBuffer(StringType.get(), "bbb"))); + + @Test + public void testTruncateProjections() { Review comment: You are correct. I am pushing a fix now that updates all of the projection tests, as well as adds assertions that the truncation transform is being respected. 👍 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
