zeroshade commented on code in PR #387:
URL: https://github.com/apache/iceberg-go/pull/387#discussion_r2039953367


##########
catalog/rest/rest_integration_test.go:
##########
@@ -181,6 +182,39 @@ func (s *RestIntegrationSuite) TestCreateTable() {
        s.Require().NoError(s.cat.DropTable(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent, "test-table")))
 }
 
+func (s *RestIntegrationSuite) TestCreateView() {
+       s.ensureNamespace()
+
+       const location = "s3://warehouse/iceberg"
+       // create a table first
+       tbl, err := s.cat.CreateTable(s.ctx,
+               catalog.ToIdentifier(TestNamespaceIdent, "test-table"),
+               tableSchemaSimple, 
catalog.WithProperties(iceberg.Properties{"foobar": "baz"}),
+               catalog.WithLocation(location))
+       s.Require().NoError(err)
+       s.Require().NotNil(tbl)
+
+       s.Equal(location, tbl.Location())
+       s.Equal("baz", tbl.Properties()["foobar"])
+
+       exists, err := s.cat.CheckTableExists(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent, "test-table"))
+       s.Require().NoError(err)
+       s.True(exists)
+
+       // Create a view
+       viewSQL := fmt.Sprintf("SELECT * FROM  %s.%s", TestNamespaceIdent, 
"test-table")
+
+       err = s.cat.CreateView(s.ctx, catalog.ToIdentifier(TestNamespaceIdent, 
"test-view"), tableSchemaSimple, viewSQL, iceberg.Properties{"foobar": "baz"})
+       s.Require().NoError(err)
+
+       exists, err = s.cat.CheckViewExists(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent, "test-view"))
+       s.Require().NoError(err)
+       s.True(exists)
+
+       s.Require().NoError(s.cat.DropTable(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent, "test-table")))
+       s.Require().NoError(s.cat.DropView(s.ctx, 
catalog.ToIdentifier(TestNamespaceIdent, "test-view")))

Review Comment:
   I'm surprised you can drop the table that the view references before you 
drop the view



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