alexandre-normand commented on code in PR #718:
URL: https://github.com/apache/iceberg-go/pull/718#discussion_r2777095216
##########
table/transaction_test.go:
##########
@@ -469,32 +428,111 @@ func (s *SparkIntegrationTestSuite)
TestOverwriteWithFilter() {
filter := iceberg.EqualTo(iceberg.Reference("foo"), true)
tx = tbl.NewTransaction()
- err = tx.OverwriteTable(s.ctx, overwriteTable, 1, filter, true, 0, nil)
+ err = tx.OverwriteTable(s.ctx, overwriteTable, 1, nil,
table.WithOverwriteFilter(filter))
s.Require().NoError(err)
_, err = tx.Commit(s.ctx)
s.Require().NoError(err)
- expectedOutput := `
-+--------+
-|count(1)|
-+--------+
-|2 |
-+--------+
-
-+-----+---------------+---+
+ output, err := recipe.ExecuteSpark(s.T(), "./validation.py", "--sql",
"SELECT * FROM default.go_test_overwrite_filter ORDER BY baz")
+ s.Require().NoError(err)
+ s.Require().Contains(output, `+-----+---------------+---+
|foo |bar |baz|
+-----+---------------+---+
|false|should_remain |200|
|true |new_replacement|999|
-+-----+---------------+---+
-`
++-----+---------------+---+`)
+}
+
+func (s *SparkIntegrationTestSuite) TestDelete() {
+ icebergSchema := iceberg.NewSchema(0,
+ iceberg.NestedField{ID: 1, Name: "first_name", Type:
iceberg.PrimitiveTypes.String},
+ iceberg.NestedField{ID: 2, Name: "last_name", Type:
iceberg.PrimitiveTypes.String},
+ iceberg.NestedField{ID: 3, Name: "age", Type:
iceberg.PrimitiveTypes.Int32},
+ )
- output, err := recipe.ExecuteSpark(s.T(), "./validation.py", "--test",
"TestOverwriteWithFilter")
+ tbl, err := s.cat.CreateTable(s.ctx, catalog.ToIdentifier("default",
"go_test_delete"), icebergSchema)
s.Require().NoError(err)
- s.Require().True(
- strings.HasSuffix(strings.TrimSpace(output),
strings.TrimSpace(expectedOutput)),
- "result does not contain expected output: %s", expectedOutput,
+
+ arrowSchema, err := table.SchemaToArrowSchema(icebergSchema, nil, true,
false)
+ s.Require().NoError(err)
+
+ initialTable, err := array.TableFromJSON(memory.DefaultAllocator,
arrowSchema, []string{
+ `[
+ {"first_name": "alan", "last_name": "gopher", "age": 7},
+ {"first_name": "steve", "last_name": "gopher", "age":
5},
Review Comment:
In case anyone was wondering why I had that gif in the PR description,
that's why. For some reason when typing up test data, this [fun
video](https://www.youtube.com/watch?v=XgvR3y5JCXg) came to mind.
--
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]