laskoviymishka commented on code in PR #1505:
URL: https://github.com/apache/iceberg-go/pull/1505#discussion_r3833956218


##########
Makefile:
##########
@@ -58,7 +58,7 @@ integration-env:
        @echo "export SPARK_CONTAINER_ID=$$(docker ps -qf 'name=spark-iceberg')"
        @echo "export DOCKER_API_VERSION=$$(docker version -f 
'{{.Server.APIVersion}}')"
 
-integration-test: integration-scanner integration-io integration-rest 
integration-spark integration-hive integration-hadoop
+integration-test: integration-scanner integration-io integration-rest 
integration-rest-scan-planning integration-spark integration-hive 
integration-hadoop

Review Comment:
   The isolation is exactly what I wanted. One thing I'd tidy in a follow-up, 
not blocking: pulling `integration-rest-scan-planning` into the 
`integration-test` deps means a plain `make integration-test` pulls and runs 
the pre-release image again, since the target sets `RUN_INTEGRATION_TESTS=1` 
itself. I'd keep it opt-in (out of the umbrella deps, run explicitly), or note 
in a comment that the inclusion is deliberate. Fine to leave for later.



##########
internal/recipe/docker-compose.yml:
##########
@@ -59,6 +59,28 @@ services:
       - CATALOG_WAREHOUSE=s3://warehouse/
       - CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
       - CATALOG_S3_ENDPOINT=http://minio:9000
+  rest-scan-planning:
+    # 1.10.1 predates the fixture's scan-planning implementation. Pin the
+    # multi-platform image built from apache/iceberg@b0df3ca so the Java wire
+    # compatibility tests are reproducible even though the released tag is not
+    # available yet.
+    image: 
apache/iceberg-rest-fixture:latest@sha256:db8de90b5b7693d4ac334c336f91d9bbe320d7b19f4f514d26de84cdfbcbfe8d

Review Comment:
   The digest pin itself is right. For a follow-up: `latest@sha256` means once 
1.11.0 ships and `:latest` moves, nothing keeps this digest alive and DockerHub 
can GC it, at which point CI pulls 404. A `# TODO` to move to 
`apache/iceberg-rest-fixture:1.11.0` once it's released, plus a tracking issue, 
would close out the last of the pre-release thread. Not a blocker.



##########
internal/recipe/docker-compose.yml:
##########
@@ -59,6 +59,28 @@ services:
       - CATALOG_WAREHOUSE=s3://warehouse/
       - CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
       - CATALOG_S3_ENDPOINT=http://minio:9000
+  rest-scan-planning:

Review Comment:
   Non-blocking follow-up: this service has no healthcheck, so `docker compose 
up --wait` calls it ready as soon as the container starts rather than when the 
fixture is actually serving. It gets probed immediately by the first test body, 
so a `curl -f http://localhost:8181/v1/config` check with a `start_period` 
would head off a connection-refused flake on slow CI.



##########
catalog/rest/scan_planning_integration_test.go:
##########
@@ -0,0 +1,354 @@
+// 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 rest_test
+
+import (
+       "bytes"
+       "context"
+       "encoding/json"
+       "fmt"
+       stdio "io"
+       "net/http"
+       "net/url"
+       "os"
+       "strings"
+       "sync"
+       "time"
+
+       "github.com/apache/arrow-go/v18/arrow/array"
+       "github.com/apache/arrow-go/v18/arrow/memory"
+       "github.com/apache/arrow-go/v18/parquet/pqarrow"
+       "github.com/apache/iceberg-go"
+       "github.com/apache/iceberg-go/catalog"
+       "github.com/apache/iceberg-go/catalog/rest"
+       iceio "github.com/apache/iceberg-go/io"
+       "github.com/apache/iceberg-go/table"
+)
+
+const (
+       runIntegrationTestsEnv            = "RUN_INTEGRATION_TESTS"
+       scanPlanningIntegrationURI        = "http://localhost:8182";
+       integrationAccessDelegation       = "vended-credentials"
+       integrationAccessDelegationHeader = "X-Iceberg-Access-Delegation"
+       integrationGCSToken               = "scan-planning-integration-token"
+       integrationGCSTokenKey            = "gcs.oauth2.token"
+)
+
+func (s *RestIntegrationSuite) 
TestScanPlanningJavaSynchronousInteroperability() {
+       s.requireScanPlanningIntegration()
+
+       transport := newScanPlanningCaptureTransport()
+       s.T().Cleanup(transport.CloseIdleConnections)
+       planningCatalog, err := loadScanPlanningCatalog(s.ctx, 
rest.WithCustomTransport(transport))
+       s.Require().NoError(err)
+       s.T().Cleanup(func() { s.Require().NoError(planningCatalog.Close()) })
+       s.requireJavaScanPlanningCapabilities(planningCatalog)
+
+       ident := catalog.ToIdentifier(TestNamespaceIdent, 
"scan-planning-java-wire")
+       tbl, dataPath := s.createScanPlanningTable(planningCatalog, ident)
+
+       filter, err := json.Marshal(iceberg.EqualTo(iceberg.Reference("foo"), 
"hello"))
+       s.Require().NoError(err)
+       snapshotID := tbl.CurrentSnapshot().SnapshotID
+       caseSensitive := true
+       useSnapshotSchema := false
+       minRowsRequested := int64(1)
+
+       response, err := planningCatalog.PlanTableScan(s.ctx, ident, 
rest.PlanTableScanRequest{
+               AccessDelegation:  stringPointer(integrationAccessDelegation),
+               SnapshotID:        &snapshotID,
+               Select:            []string{"foo", "bar"},
+               Filter:            filter,
+               MinRowsRequested:  &minRowsRequested,
+               CaseSensitive:     &caseSensitive,
+               UseSnapshotSchema: &useSnapshotSchema,
+               StatsFields:       []string{"foo", "bar"},
+       })
+       s.Require().NoError(err)
+       s.Require().Equal(rest.PlanStatusCompleted, response.Status)
+       s.Require().NotNil(response.PlanID)
+       s.Require().NotEmpty(*response.PlanID)
+       planID := *response.PlanID
+       planCancelled := false
+       s.T().Cleanup(func() {
+               if planCancelled {
+                       return
+               }
+
+               _ = cancelPlanningWithTimeout(planningCatalog, ident, planID)
+       })
+       s.Empty(response.PlanTasks)
+       s.Require().Len(response.FileScanTasks, 1)
+       s.Empty(response.DeleteFiles)
+       s.assertJavaPlanningCredentials(response.StorageCredentials)
+
+       rawResponses := transport.PlanResponses()
+       s.Require().Len(rawResponses, 1)
+       requestHeaders := transport.PlanRequestHeaders()
+       s.Require().Len(requestHeaders, 1)
+       s.Equal(integrationAccessDelegation, 
requestHeaders[0].Get(integrationAccessDelegationHeader))
+       raw := parseRawPlanningFixture(s.T(), string(rawResponses[0]))
+       s.Equal("completed", raw.Status)
+       s.Equal(*response.PlanID, raw.PlanID)
+       s.Empty(raw.PlanTasks)
+       s.Require().Len(raw.FileScanTasks, 1)
+       s.Empty(raw.DeleteFiles)
+
+       task := raw.FileScanTasks[0]
+       s.Equal("data", task.DataFile.Content)
+       s.Equal(dataPath, task.DataFile.FilePath)
+       s.Require().Len(task.DataFile.Partition, 1)
+       s.Equal("17", string(task.DataFile.Partition[0]),
+               "Java partitions must remain typed JSON values, not 
binary-bound strings")
+       s.JSONEq(`{"type":"eq","term":"foo","value":"hello"}`, 
string(task.ResidualFilter))
+       s.Empty(task.DeleteFileReferences)
+
+       lowerBounds := s.valueMapByFieldID(task.DataFile.LowerBounds)
+       upperBounds := s.valueMapByFieldID(task.DataFile.UpperBounds)
+       s.Require().ElementsMatch([]int{1, 2}, task.DataFile.LowerBounds.Keys)
+       s.Require().ElementsMatch([]int{1, 2}, task.DataFile.UpperBounds.Keys)
+       s.Equal("68656C6C6F", lowerBounds[1], "Java string lower bounds must be 
uppercase hexadecimal")
+       s.Equal("68656C6C6F", upperBounds[1], "Java string upper bounds must be 
uppercase hexadecimal")
+       s.Equal("11000000", lowerBounds[2], "Java int lower bounds must use 
Iceberg little-endian binary")
+       s.Equal("11000000", upperBounds[2], "Java int upper bounds must use 
Iceberg little-endian binary")
+
+       s.Require().Len(raw.StorageCredentials, 1)
+       // The fixture vends these credentials under prefix "gcp", but 
GCSFileIO (Java
+       // and Go alike) only matches prefixes starting with "gs", so they 
would not
+       // actually resolve for a real gs:// path today. That's a known fixture 
quirk,
+       // not something this suite introduces; pinning "gcp" here is a canary 
that
+       // will trip once the fixture is fixed to vend "gs" instead.
+       s.Equal("gcp", raw.StorageCredentials[0].Prefix)
+       s.Equal(integrationGCSToken, 
raw.StorageCredentials[0].Config[integrationGCSTokenKey])
+
+       // The reference fixture retains its synchronous plan state until the 
client
+       // releases it, so this also verifies the advertised DELETE route end 
to end.
+       s.Require().NoError(cancelPlanningWithTimeout(planningCatalog, ident, 
planID))
+       planCancelled = true
+}
+
+func (s *RestIntegrationSuite) TestScanPlanningJavaErrorTypes() {
+       s.requireScanPlanningIntegration()
+       planningCatalog, err := loadScanPlanningCatalog(s.ctx)
+       s.Require().NoError(err)
+       s.T().Cleanup(func() { s.Require().NoError(planningCatalog.Close()) })
+       s.requireJavaScanPlanningCapabilities(planningCatalog)
+       s.ensureNamespaceIn(planningCatalog)
+       // The published fixture defaults to synchronous inline planning and 
exposes
+       // no container setting for async planning or a smaller plan-task page 
size.
+       // The not-found cases still exercise the live GET and POST routes and 
their
+       // Java error models; deterministic successful polling/fanout remains 
covered
+       // by planfake until the reference image exposes those controls.
+
+       missingTable := catalog.ToIdentifier(TestNamespaceIdent, 
"missing-scan-planning-table")
+       _, err = planningCatalog.PlanTableScan(s.ctx, missingTable, 
rest.PlanTableScanRequest{})
+       s.ErrorIs(err, catalog.ErrNoSuchTable)
+
+       ident := catalog.ToIdentifier(TestNamespaceIdent, 
"scan-planning-java-errors")
+       tbl, err := planningCatalog.CreateTable(s.ctx, ident, tableSchemaSimple)
+       s.Require().NoError(err)
+       s.Require().NotNil(tbl)
+       s.T().Cleanup(func() { 
s.Require().NoError(planningCatalog.DropTable(s.ctx, ident)) })
+
+       _, err = planningCatalog.FetchPlanningResult(s.ctx, ident, 
"missing-plan-id", rest.FetchPlanningResultOptions{})
+       s.ErrorIs(err, rest.ErrPlanExpired)
+
+       _, err = planningCatalog.FetchScanTasks(s.ctx, ident, 
rest.FetchScanTasksRequest{PlanTask: "missing-plan-task"})
+       s.ErrorIs(err, rest.ErrNoSuchPlanTask)
+}
+
+func (s *RestIntegrationSuite) requireScanPlanningIntegration() {
+       s.T().Helper()
+       if os.Getenv(runIntegrationTestsEnv) != "1" {
+               s.T().Skipf("set %s=1 to run Java REST scan-planning 
integration tests", runIntegrationTestsEnv)
+       }
+}
+
+func (s *RestIntegrationSuite) requireJavaScanPlanningCapabilities(cat 
*rest.Catalog) {
+       s.T().Helper()
+       if !cat.SupportsPlanTableScan() || 
!cat.SupportsFullRemoteScanPlanning() {
+               s.T().Skip("Java fixture does not advertise 
planTableScan/poll/cancel/task-fetch endpoints; " +
+                       "is the scan-planning-capable image running?")
+       }
+}
+
+func cancelPlanningWithTimeout(cat *rest.Catalog, ident table.Identifier, 
planID string) error {
+       ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+       defer cancel()
+
+       return cat.CancelPlanning(ctx, ident, planID)
+}
+
+func loadScanPlanningCatalog(ctx context.Context, opts ...rest.Option) 
(*rest.Catalog, error) {
+       opts = append(opts, rest.WithAdditionalProps(iceberg.Properties{
+               iceio.S3Region:          "us-east-1",
+               iceio.S3AccessKeyID:     "admin",
+               iceio.S3SecretAccessKey: "password",
+       }))
+
+       return rest.NewCatalog(ctx, "scan-planning-java-wire", 
scanPlanningIntegrationURI, opts...)
+}
+
+func (s *RestIntegrationSuite) ensureNamespaceIn(cat *rest.Catalog) {
+       s.T().Helper()
+       exists, err := cat.CheckNamespaceExists(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent))
+       s.Require().NoError(err)
+       if exists {
+               s.Require().NoError(cat.DropNamespace(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent)))
+       }
+
+       s.NoError(cat.CreateNamespace(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent),

Review Comment:
   Small robustness nit for a follow-up: `s.NoError` here is non-fatal, so if 
`CreateNamespace` fails the run keeps going into `createScanPlanningTable` and 
dies on a namespace-not-found from `CreateTable`, pointing at the wrong line. 
`s.Require().NoError` would report the setup failure directly.



##########
catalog/rest/scan_planning_integration_test.go:
##########
@@ -0,0 +1,354 @@
+// 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 rest_test
+
+import (
+       "bytes"
+       "context"
+       "encoding/json"
+       "fmt"
+       stdio "io"
+       "net/http"
+       "net/url"
+       "os"
+       "strings"
+       "sync"
+       "time"
+
+       "github.com/apache/arrow-go/v18/arrow/array"
+       "github.com/apache/arrow-go/v18/arrow/memory"
+       "github.com/apache/arrow-go/v18/parquet/pqarrow"
+       "github.com/apache/iceberg-go"
+       "github.com/apache/iceberg-go/catalog"
+       "github.com/apache/iceberg-go/catalog/rest"
+       iceio "github.com/apache/iceberg-go/io"
+       "github.com/apache/iceberg-go/table"
+)
+
+const (
+       runIntegrationTestsEnv            = "RUN_INTEGRATION_TESTS"
+       scanPlanningIntegrationURI        = "http://localhost:8182";
+       integrationAccessDelegation       = "vended-credentials"
+       integrationAccessDelegationHeader = "X-Iceberg-Access-Delegation"
+       integrationGCSToken               = "scan-planning-integration-token"
+       integrationGCSTokenKey            = "gcs.oauth2.token"
+)
+
+func (s *RestIntegrationSuite) 
TestScanPlanningJavaSynchronousInteroperability() {
+       s.requireScanPlanningIntegration()
+
+       transport := newScanPlanningCaptureTransport()
+       s.T().Cleanup(transport.CloseIdleConnections)
+       planningCatalog, err := loadScanPlanningCatalog(s.ctx, 
rest.WithCustomTransport(transport))
+       s.Require().NoError(err)
+       s.T().Cleanup(func() { s.Require().NoError(planningCatalog.Close()) })
+       s.requireJavaScanPlanningCapabilities(planningCatalog)
+
+       ident := catalog.ToIdentifier(TestNamespaceIdent, 
"scan-planning-java-wire")
+       tbl, dataPath := s.createScanPlanningTable(planningCatalog, ident)
+
+       filter, err := json.Marshal(iceberg.EqualTo(iceberg.Reference("foo"), 
"hello"))
+       s.Require().NoError(err)
+       snapshotID := tbl.CurrentSnapshot().SnapshotID
+       caseSensitive := true
+       useSnapshotSchema := false
+       minRowsRequested := int64(1)
+
+       response, err := planningCatalog.PlanTableScan(s.ctx, ident, 
rest.PlanTableScanRequest{
+               AccessDelegation:  stringPointer(integrationAccessDelegation),
+               SnapshotID:        &snapshotID,
+               Select:            []string{"foo", "bar"},
+               Filter:            filter,
+               MinRowsRequested:  &minRowsRequested,
+               CaseSensitive:     &caseSensitive,
+               UseSnapshotSchema: &useSnapshotSchema,
+               StatsFields:       []string{"foo", "bar"},
+       })
+       s.Require().NoError(err)
+       s.Require().Equal(rest.PlanStatusCompleted, response.Status)
+       s.Require().NotNil(response.PlanID)
+       s.Require().NotEmpty(*response.PlanID)
+       planID := *response.PlanID
+       planCancelled := false
+       s.T().Cleanup(func() {
+               if planCancelled {
+                       return
+               }
+
+               _ = cancelPlanningWithTimeout(planningCatalog, ident, planID)
+       })
+       s.Empty(response.PlanTasks)
+       s.Require().Len(response.FileScanTasks, 1)
+       s.Empty(response.DeleteFiles)
+       s.assertJavaPlanningCredentials(response.StorageCredentials)
+
+       rawResponses := transport.PlanResponses()
+       s.Require().Len(rawResponses, 1)
+       requestHeaders := transport.PlanRequestHeaders()
+       s.Require().Len(requestHeaders, 1)
+       s.Equal(integrationAccessDelegation, 
requestHeaders[0].Get(integrationAccessDelegationHeader))
+       raw := parseRawPlanningFixture(s.T(), string(rawResponses[0]))
+       s.Equal("completed", raw.Status)
+       s.Equal(*response.PlanID, raw.PlanID)
+       s.Empty(raw.PlanTasks)
+       s.Require().Len(raw.FileScanTasks, 1)
+       s.Empty(raw.DeleteFiles)
+
+       task := raw.FileScanTasks[0]
+       s.Equal("data", task.DataFile.Content)
+       s.Equal(dataPath, task.DataFile.FilePath)
+       s.Require().Len(task.DataFile.Partition, 1)
+       s.Equal("17", string(task.DataFile.Partition[0]),
+               "Java partitions must remain typed JSON values, not 
binary-bound strings")
+       s.JSONEq(`{"type":"eq","term":"foo","value":"hello"}`, 
string(task.ResidualFilter))
+       s.Empty(task.DeleteFileReferences)
+
+       lowerBounds := s.valueMapByFieldID(task.DataFile.LowerBounds)
+       upperBounds := s.valueMapByFieldID(task.DataFile.UpperBounds)
+       s.Require().ElementsMatch([]int{1, 2}, task.DataFile.LowerBounds.Keys)
+       s.Require().ElementsMatch([]int{1, 2}, task.DataFile.UpperBounds.Keys)
+       s.Equal("68656C6C6F", lowerBounds[1], "Java string lower bounds must be 
uppercase hexadecimal")
+       s.Equal("68656C6C6F", upperBounds[1], "Java string upper bounds must be 
uppercase hexadecimal")
+       s.Equal("11000000", lowerBounds[2], "Java int lower bounds must use 
Iceberg little-endian binary")
+       s.Equal("11000000", upperBounds[2], "Java int upper bounds must use 
Iceberg little-endian binary")
+
+       s.Require().Len(raw.StorageCredentials, 1)
+       // The fixture vends these credentials under prefix "gcp", but 
GCSFileIO (Java
+       // and Go alike) only matches prefixes starting with "gs", so they 
would not
+       // actually resolve for a real gs:// path today. That's a known fixture 
quirk,
+       // not something this suite introduces; pinning "gcp" here is a canary 
that
+       // will trip once the fixture is fixed to vend "gs" instead.
+       s.Equal("gcp", raw.StorageCredentials[0].Prefix)
+       s.Equal(integrationGCSToken, 
raw.StorageCredentials[0].Config[integrationGCSTokenKey])
+
+       // The reference fixture retains its synchronous plan state until the 
client
+       // releases it, so this also verifies the advertised DELETE route end 
to end.
+       s.Require().NoError(cancelPlanningWithTimeout(planningCatalog, ident, 
planID))
+       planCancelled = true
+}
+
+func (s *RestIntegrationSuite) TestScanPlanningJavaErrorTypes() {
+       s.requireScanPlanningIntegration()
+       planningCatalog, err := loadScanPlanningCatalog(s.ctx)
+       s.Require().NoError(err)
+       s.T().Cleanup(func() { s.Require().NoError(planningCatalog.Close()) })
+       s.requireJavaScanPlanningCapabilities(planningCatalog)
+       s.ensureNamespaceIn(planningCatalog)
+       // The published fixture defaults to synchronous inline planning and 
exposes
+       // no container setting for async planning or a smaller plan-task page 
size.
+       // The not-found cases still exercise the live GET and POST routes and 
their
+       // Java error models; deterministic successful polling/fanout remains 
covered
+       // by planfake until the reference image exposes those controls.
+
+       missingTable := catalog.ToIdentifier(TestNamespaceIdent, 
"missing-scan-planning-table")
+       _, err = planningCatalog.PlanTableScan(s.ctx, missingTable, 
rest.PlanTableScanRequest{})
+       s.ErrorIs(err, catalog.ErrNoSuchTable)
+
+       ident := catalog.ToIdentifier(TestNamespaceIdent, 
"scan-planning-java-errors")
+       tbl, err := planningCatalog.CreateTable(s.ctx, ident, tableSchemaSimple)
+       s.Require().NoError(err)
+       s.Require().NotNil(tbl)
+       s.T().Cleanup(func() { 
s.Require().NoError(planningCatalog.DropTable(s.ctx, ident)) })
+
+       _, err = planningCatalog.FetchPlanningResult(s.ctx, ident, 
"missing-plan-id", rest.FetchPlanningResultOptions{})
+       s.ErrorIs(err, rest.ErrPlanExpired)
+
+       _, err = planningCatalog.FetchScanTasks(s.ctx, ident, 
rest.FetchScanTasksRequest{PlanTask: "missing-plan-task"})
+       s.ErrorIs(err, rest.ErrNoSuchPlanTask)
+}
+
+func (s *RestIntegrationSuite) requireScanPlanningIntegration() {
+       s.T().Helper()
+       if os.Getenv(runIntegrationTestsEnv) != "1" {
+               s.T().Skipf("set %s=1 to run Java REST scan-planning 
integration tests", runIntegrationTestsEnv)
+       }
+}
+
+func (s *RestIntegrationSuite) requireJavaScanPlanningCapabilities(cat 
*rest.Catalog) {
+       s.T().Helper()
+       if !cat.SupportsPlanTableScan() || 
!cat.SupportsFullRemoteScanPlanning() {
+               s.T().Skip("Java fixture does not advertise 
planTableScan/poll/cancel/task-fetch endpoints; " +
+                       "is the scan-planning-capable image running?")
+       }
+}
+
+func cancelPlanningWithTimeout(cat *rest.Catalog, ident table.Identifier, 
planID string) error {
+       ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+       defer cancel()
+
+       return cat.CancelPlanning(ctx, ident, planID)
+}
+
+func loadScanPlanningCatalog(ctx context.Context, opts ...rest.Option) 
(*rest.Catalog, error) {
+       opts = append(opts, rest.WithAdditionalProps(iceberg.Properties{
+               iceio.S3Region:          "us-east-1",
+               iceio.S3AccessKeyID:     "admin",
+               iceio.S3SecretAccessKey: "password",
+       }))
+
+       return rest.NewCatalog(ctx, "scan-planning-java-wire", 
scanPlanningIntegrationURI, opts...)
+}
+
+func (s *RestIntegrationSuite) ensureNamespaceIn(cat *rest.Catalog) {
+       s.T().Helper()
+       exists, err := cat.CheckNamespaceExists(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent))
+       s.Require().NoError(err)
+       if exists {
+               s.Require().NoError(cat.DropNamespace(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent)))
+       }
+
+       s.NoError(cat.CreateNamespace(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent),
+               iceberg.Properties{"foo": "bar", "prop": "yes"}))
+}
+
+func (s *RestIntegrationSuite) createScanPlanningTable(cat *rest.Catalog, 
ident table.Identifier) (*table.Table, string) {
+       s.T().Helper()
+       s.ensureNamespaceIn(cat)
+
+       spec := iceberg.NewPartitionSpec(iceberg.PartitionField{
+               SourceIDs: []int{2},
+               FieldID:   1000,
+               Name:      "bar",
+               Transform: iceberg.IdentityTransform{},
+       })
+       tbl, err := cat.CreateTable(s.ctx, ident, tableSchemaSimple, 
catalog.WithPartitionSpec(&spec))
+       s.Require().NoError(err)
+       s.Require().NotNil(tbl)
+       s.T().Cleanup(func() { s.Require().NoError(cat.DropTable(s.ctx, ident)) 
})
+
+       arrowSchema, err := table.SchemaToArrowSchema(tableSchemaSimple, nil, 
false, false)
+       s.Require().NoError(err)
+       arrowTable, err := array.TableFromJSON(memory.DefaultAllocator, 
arrowSchema,
+               []string{`[{"foo":"hello","bar":17,"baz":true}]`})
+       s.Require().NoError(err)
+       defer arrowTable.Release()
+
+       dataPath, err := url.JoinPath(tbl.Location(), "data", "bar=17", 
"data.parquet")
+       s.Require().NoError(err)
+       file, err := mustFS(s.T(), tbl).(iceio.WriteFileIO).Create(dataPath)

Review Comment:
   Same class, also fine as a follow-up: the bare `.(iceio.WriteFileIO)` panics 
the whole test binary with an interface-conversion error if the FS doesn't 
implement it, and against a live Docker FileIO a misconfigured endpoint can 
hand back a read-only impl. Comma-ok with `s.Require().True(ok, "table 
filesystem must implement WriteFileIO")` fails it as a test instead.



-- 
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]

Reply via email to