tanmayrauth commented on code in PR #969:
URL: https://github.com/apache/iceberg-go/pull/969#discussion_r3183791682
##########
catalog/hadoop/hadoop.go:
##########
@@ -235,8 +237,104 @@ func (c *Catalog) findVersion(ident table.Identifier)
(int, error) {
return c.scanForward(ident, maxVer), nil
}
-func (c *Catalog) CreateTable(_ context.Context, _ table.Identifier, _
*iceberg.Schema, _ ...catalog.CreateTableOpt) (*table.Table, error) {
- return nil, errors.New("hadoop catalog: CreateTable not yet
implemented")
+func (c *Catalog) CreateTable(ctx context.Context, ident table.Identifier, sc
*iceberg.Schema, opts ...catalog.CreateTableOpt) (*table.Table, error) {
+ var cfg catalog.CreateTableCfg
+ for _, opt := range opts {
+ opt(&cfg)
+ }
+
+ if len(ident) < 2 {
+ return nil, errors.New("hadoop catalog: table identifier must
have at least a namespace and table name")
+ }
+
+ ns := catalog.NamespaceFromIdent(ident)
+ nsPath := c.namespaceToPath(ns)
+
+ info, err := os.Stat(nsPath)
+ if os.IsNotExist(err) || (err == nil && !info.IsDir()) {
+ return nil, fmt.Errorf("%w: %s", catalog.ErrNoSuchNamespace,
strings.Join(ns, "."))
+ }
Review Comment:
This is intentionally local-only for now to match the scoped plan (local
parity with Spark's Java HadoopCatalog first). The io.IO interface doesn't
currently have Stat or MkdirAll equivalents needed for directory-based
namespace operations, so switching to it would require extending the interface.
I'll open a follow-up issue to add something like StatableIO and refactor to
use icebergio.IO throughout for HDFS/cloud support.
--
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]