zeroshade commented on code in PR #2730:
URL: https://github.com/apache/iceberg-go/pull/2730#discussion_r4743727860
##########
catalog/catalogtest/catalogtest.go:
##########
@@ -107,6 +107,11 @@ type Config struct {
// flags it has no not-supported test: Hive and Glue reject nested
// namespaces with their own error, not iceberg.ErrNotImplemented.
SupportsNestedNamespaces bool
+
+ // SupportsCustomTableLocation reports whether the catalog honors a
table
Review Comment:
nit: unlike `SupportsNamespaceProperties` and `SupportsRenameTable`, there's
no not-supported test when this is false. Hadoop rejects a custom location
(`hadoop/tables.go`), but with a plain `errors.New`, so callers can't match it.
A `CreateTableWithLocationNotSupported` case would pin that the call fails and
no table is created. Wrapping `iceberg.ErrNotImplemented` in Hadoop, as its
rename path does, would let that test use `require.ErrorIs`. A follow-up is
fine.
Also, the comment could mention that the case checks the metadata file sits
under the location too. A REST server configured with `write.metadata.path`
would fail it.
##########
catalog/catalogtest/create_table_opts.go:
##########
@@ -116,3 +119,41 @@ func testCreateTableWithSortOrder(t *testing.T, cfg
Config) {
assert.Equal(t, sourceName(t, Schema, want.SourceIDs),
sourceName(t, tbl.Schema(), got.SourceIDs))
}
}
+
+// testCreateTableWithLocation asserts that a table created with an explicit
+// location reports it on a fresh load and writes its metadata under it. The
+// suite does not know the catalog's warehouse, so the location is a sibling
+// of a default table location, which the catalog's storage already accepts.
+func testCreateTableWithLocation(t *testing.T, cfg Config) {
+ ctx := context.Background()
+ cat := cfg.NewCatalog(t)
+
+ defaultIdent, defaultTbl := createTable(t, cat)
+ loc := strings.TrimSuffix(defaultTbl.Location(), "/") + "_custom_" +
strings.ReplaceAll(uuid.NewString(), "-", "_")
+
+ ident := table.Identifier{defaultIdent[0], "tbl_with_location"}
+ _, err := cat.CreateTable(ctx, ident, Schema, catalog.WithLocation(loc))
Review Comment:
nit: the table returned by `CreateTable` is discarded. Asserting its
`Location()` too (one line) would catch a catalog that returns a different
location from what it stores.
--
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]