lliangyu-lin commented on code in PR #414:
URL: https://github.com/apache/iceberg-go/pull/414#discussion_r2098807582


##########
catalog/sql/sql.go:
##########
@@ -809,3 +821,369 @@ func (c *Catalog) UpdateNamespaceProperties(ctx 
context.Context, namespace table
 func (c *Catalog) CheckNamespaceExists(ctx context.Context, namespace 
table.Identifier) (bool, error) {
        return c.namespaceExists(ctx, strings.Join(namespace, "."))
 }
+
+// CreateView creates a new view in the catalog.
+func (c *Catalog) CreateView(ctx context.Context, identifier table.Identifier, 
schema *iceberg.Schema, viewSQL string, props iceberg.Properties) error {
+       nsIdent := catalog.NamespaceFromIdent(identifier)
+       viewIdent := catalog.TableNameFromIdent(identifier)
+       ns := strings.Join(nsIdent, ".")
+
+       exists, err := c.namespaceExists(ctx, ns)
+       if err != nil {
+               return err
+       }
+       if !exists {
+               return fmt.Errorf("%w: %s", catalog.ErrNoSuchNamespace, ns)
+       }
+
+       exists, err = c.CheckViewExists(ctx, identifier)
+       if err != nil {
+               return err
+       }
+       if exists {
+               return fmt.Errorf("%w: %s", catalog.ErrViewAlreadyExists, 
identifier)
+       }
+
+       loc, err := internal.ResolveTableLocation(ctx, "", ns, viewIdent, 
c.props, c.LoadNamespaceProperties)
+       if err != nil {
+               return err
+       }
+
+       timestampMs := time.Now().UnixMilli()
+       versionId := int64(1)
+
+       viewVersion := struct {

Review Comment:
   I see there is `operation` field in iceberg java 
https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/view/ViewVersion.java#L67.
   Should we include in this PR?



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