Skip to content

Conversation

@Elbehery
Copy link

This PR adds test suite for write operations.

Inspired by TestRewriteFiles

cc @laskoviymishka

Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>

// Second should succeed since conflict detection may not be fully implemented yet
// In a full implementation, this would fail due to conflict
_, err2 = tx2.Commit(s.ctx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better s.T().Skip("not yet implemented")?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if i skip, i would skip the whole test, i think currently the comments and logs explain, wdyt ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only change between log and skip is that skip test is not GREEN in CI (it's yellow), so it's more honest.

s.writeParquet(fs, consolidatedPath, replacementData)

// For this test, we'll demonstrate overwrite by creating a new file
// and replacing specific known files rather than discovering them dynamically
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need an assertion of this row

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you kindly suggest a change ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think what you can check that lists of files in snapshot differ before and after writes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added 3500678

// manifests to include the delete files, which is a more complex operation
// that would need transaction-level support for delete file management

s.T().Log("Position delete file structure verified - integration with table scanning requires manifest updates")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.T().Skip()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iiuc this is the end of the test .. u mean to skip this test

s.Run("ApplyPositionDeletes", func() {

?

Copy link
Author

@Elbehery Elbehery Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted 👍🏽

// 3. The current scanner has error handling for equality deletes but
// returns "not yet supported" for actual application

s.T().Log("Equality delete file structure verified - scanner integration shows 'not yet supported'")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto ? skip whole test ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm think so, all other aspect in this tests already covered in tests above, and this skip would be vocal here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted 👍🏽

Elbehery added 2 commits July 25, 2025 14:30
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
@zeroshade
Copy link
Member

Many of these types of tests already exist in table/table_test.go, can we move these tests there instead?

Go doesn't really have a convention of a "tests" directory like this, the tests should be in the same package as the code being tested.

Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
@Elbehery
Copy link
Author

Many of these types of tests already exist in table/table_test.go, can we move these tests there instead?

Go doesn't really have a convention of a "tests" directory like this, the tests should be in the same package as the code being tested.

check now 👍🏽

@Elbehery Elbehery force-pushed the 20250725_add_write_operations_test branch from e833d44 to 1bdc32e Compare July 25, 2025 16:34
@Elbehery
Copy link
Author

i fixed the linter issues, can u re-run plz

cc @zeroshade

@Elbehery
Copy link
Author

i ran golanglint run ./... but no error locally

func TestRewriteFiles(t *testing.T) {
suite.Run(t, &WriteOperationsTestSuite{})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, this is identical to TestWriteOptions, you don't need both of them

}

func (s *WriteOperationsTestSuite) TestRewriteFiles() {
s.Run("RewriteDataFiles", func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need this, the function itself does this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cant get it, this is a sub-test,

which function u mean ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you use the test suite pattern, having a function TestRewriteDataFiles will create the subtest for you. You don't need to manually add s.Run here. Since there's no commonality between the subtests it would be better for them to be separate functions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍🏽

s.T().Log("EXPECTED: In full implementation, should only contain consolidated file")
})

s.Run("RewriteWithConflictDetection", func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a separate function named TestRewriteWithConflictDetection instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍🏽

}

func (s *WriteOperationsTestSuite) TestOverwriteFiles() {
s.Run("OverwriteByPartition", func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make a function TestOverwriteByPartition instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍🏽

s.T().Log("EXPECTED: In partition overwrite, should only contain new partition data")
})

s.Run("OverwriteWithFilter", func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing, make this a separate function

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍🏽

}

func (s *WriteOperationsTestSuite) TestPositionDeletes() {
s.Run("WritePositionDeleteFiles", func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you get the idea, not going to repeat this comment over and over 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍🏽


require.NoError(t, cat.CreateNamespace(t.Context(), table.Identifier{"testing"}, nil))
tbl, err := cat.CreateTable(t.Context(), table.Identifier{"testing", "nullable_struct_required_field"}, sc,
require.NoError(t, cat.CreateNamespace(context.Background(), table.Identifier{"testing"}, nil))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make a variable ctx := context.Background() and just reuse that instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍🏽

@Elbehery Elbehery force-pushed the 20250725_add_write_operations_test branch from 1bdc32e to b25c5a1 Compare July 25, 2025 16:56
@Elbehery
Copy link
Author

@zeroshade ptal :)

@zeroshade
Copy link
Member

@Elbehery see my comments :)

Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
@Elbehery Elbehery force-pushed the 20250725_add_write_operations_test branch from b25c5a1 to a05303c Compare July 25, 2025 17:25
@Elbehery Elbehery changed the title test: add write operations test suite feat(test): add write operations test suite Jul 26, 2025
@Elbehery Elbehery changed the title feat(test): add write operations test suite test: add write operations test suite Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants