Fokko commented on code in PR #118: URL: https://github.com/apache/iceberg-go/pull/118#discussion_r1728944144
########## table/scanner_test.go: ########## @@ -0,0 +1,124 @@ +// 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. + +//go:build integration + +package table_test + +import ( + "context" + "testing" + + "github.com/apache/iceberg-go" + "github.com/apache/iceberg-go/catalog" + "github.com/apache/iceberg-go/io" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestScanner(t *testing.T) { + cat, err := catalog.NewRestCatalog("rest", "http://localhost:8181") + require.NoError(t, err) + + props := iceberg.Properties{ + io.S3Region: "us-east-1", + io.S3AccessKeyID: "admin", io.S3SecretAccessKey: "password"} + + tests := []struct { + table string + expr iceberg.BooleanExpression + expectedNumTasks int + }{ + {"test_all_types", iceberg.AlwaysTrue{}, 5}, + {"test_all_types", iceberg.LessThan(iceberg.Reference("intCol"), int32(3)), 3}, + {"test_all_types", iceberg.GreaterThanEqual(iceberg.Reference("intCol"), int32(3)), 2}, + {"test_partitioned_by_identity", + iceberg.GreaterThanEqual(iceberg.Reference("ts"), "2023-03-05T00:00:00+00:00"), 8}, + {"test_partitioned_by_identity", + iceberg.LessThan(iceberg.Reference("ts"), "2023-03-05T00:00:00+00:00"), 4}, + {"test_partitioned_by_years", iceberg.AlwaysTrue{}, 2}, + {"test_partitioned_by_years", iceberg.LessThan(iceberg.Reference("dt"), "2023-03-05"), 1}, + {"test_partitioned_by_years", iceberg.GreaterThanEqual(iceberg.Reference("dt"), "2023-03-05"), 1}, + {"test_partitioned_by_months", iceberg.GreaterThanEqual(iceberg.Reference("dt"), "2023-03-05"), 1}, + {"test_partitioned_by_days", iceberg.GreaterThanEqual(iceberg.Reference("ts"), "2023-03-05T00:00:00+00:00"), 8}, + {"test_partitioned_by_hours", iceberg.GreaterThanEqual(iceberg.Reference("ts"), "2023-03-05T00:00:00+00:00"), 8}, + {"test_partitioned_by_truncate", iceberg.GreaterThanEqual(iceberg.Reference("letter"), "e"), 8}, + {"test_partitioned_by_bucket", iceberg.GreaterThanEqual(iceberg.Reference("number"), int32(5)), 6}, + // for some reason when I run the provisioning locally i get 5 data files + // but GHA CI running spark provisioning ends up with only 4 files? + // anyone know why? + {"test_uuid_and_fixed_unpartitioned", iceberg.AlwaysTrue{}, 4}, Review Comment: I think the default max parallelism of Spark is capped by the number of CPUs, so probably one of the data files contains two rows. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org