diff --git a/catalog/catalog.go b/catalog/catalog.go index e68fcdd..966a4d6 100644 --- a/catalog/catalog.go +++ b/catalog/catalog.go @@ -59,7 +59,7 @@ type Catalog interface { // identifiers containing the information required to load the table via that catalog. ListTables(ctx context.Context, namespace table.Identifier) ([]table.Identifier, error) // LoadTable loads a table from the catalog and returns a Table with the metadata. - LoadTable(ctx context.Context, identifier table.Identifier) (*table.Table, error) + LoadTable(ctx context.Context, identifier table.Identifier, props map[string]string) (*table.Table, error) // CatalogType returns the type of the catalog. CatalogType() CatalogType } diff --git a/catalog/glue.go b/catalog/glue.go index 1e78839..30f776a 100644 --- a/catalog/glue.go +++ b/catalog/glue.go @@ -90,19 +90,23 @@ func (c *GlueCatalog) ListTables(ctx context.Context, namespace table.Identifier // LoadTable loads a table from the catalog table details. // // The identifier should contain the Glue database name, then glue table name. -func (c *GlueCatalog) LoadTable(ctx context.Context, identifier table.Identifier) (*table.Table, error) { +func (c *GlueCatalog) LoadTable(ctx context.Context, identifier table.Identifier, props map[string]string) (*table.Table, error) { database, tableName, err := identifierToGlueTable(identifier) if err != nil { return nil, err } + if props == nil { + props = map[string]string{} + } + location, err := c.getTable(ctx, database, tableName) if err != nil { return nil, err } // TODO: consider providing a way to directly access the S3 iofs to enable testing of the catalog. - iofs, err := io.LoadFS(map[string]string{}, location) + iofs, err := io.LoadFS(props, location) if err != nil { return nil, fmt.Errorf("failed to load table %s.%s: %w", database, tableName, err) } diff --git a/catalog/glue_test.go b/catalog/glue_test.go index f19fb25..ebe2eb3 100644 --- a/catalog/glue_test.go +++ b/catalog/glue_test.go @@ -135,7 +135,7 @@ func TestGlueLoadTableIntegration(t *testing.T) { catalog := NewGlueCatalog(WithAwsConfig(awscfg)) - table, err := catalog.LoadTable(context.TODO(), []string{os.Getenv("TEST_DATABASE_NAME"), os.Getenv("TEST_TABLE_NAME")}) + table, err := catalog.LoadTable(context.TODO(), []string{os.Getenv("TEST_DATABASE_NAME"), os.Getenv("TEST_TABLE_NAME")}, nil) assert.NoError(err) assert.Equal([]string{os.Getenv("TEST_TABLE_NAME")}, table.Identifier()) }