zeroshade commented on code in PR #1505: URL: https://github.com/apache/iceberg-go/pull/1505#discussion_r3647332226
########## catalog/rest/scan_planning_integration_test.go: ########## @@ -0,0 +1,321 @@ +// 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" + integrationAccessDelegation = "vended-credentials" + integrationAccessDelegationHeader = "X-Iceberg-Access-Delegation" + integrationGCSToken = "scan-planning-integration-token" + integrationGCSTokenKey = "gcs.oauth2.token" +) + +func (s *RestIntegrationSuite) TestScanPlanningJavaInteroperability() { + s.requireScanPlanningIntegration() + + transport := newScanPlanningCaptureTransport() + s.T().Cleanup(transport.CloseIdleConnections) + planningCatalog, err := rest.NewCatalog(s.ctx, "scan-planning-java-wire", "http://localhost:8181", + 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(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) Review Comment: Non-blocking: the Go-decoded task payload isn't asserted beyond length. Once #1492's decoder is in the base, add decoded-field assertions so a decoder regression can't pass while the raw-JSON checks succeed. ########## catalog/rest/scan_planning_integration_test.go: ########## @@ -0,0 +1,321 @@ +// 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" + integrationAccessDelegation = "vended-credentials" + integrationAccessDelegationHeader = "X-Iceberg-Access-Delegation" + integrationGCSToken = "scan-planning-integration-token" + integrationGCSTokenKey = "gcs.oauth2.token" +) + +func (s *RestIntegrationSuite) TestScanPlanningJavaInteroperability() { + s.requireScanPlanningIntegration() + + transport := newScanPlanningCaptureTransport() + s.T().Cleanup(transport.CloseIdleConnections) + planningCatalog, err := rest.NewCatalog(s.ctx, "scan-planning-java-wire", "http://localhost:8181", + 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(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) Review Comment: Non-blocking: this asserts `PlanTasks` is empty and only `Len(FileScanTasks, 1)`, so successful Java `plan-tasks` fanout / `FetchScanTasks` traversal isn't exercised against the real server. Consider scoping the name/description to “synchronous” or adding a fanout case if the fixture can produce it. -- 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]
