Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration data type test for new table format #850

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sfc-gh-alhuang
Copy link
Contributor

Created data type IT for Iceberg table and verified through local VM. This test should be disabled until the sever side change is release.

"create or replace iceberg table %s (%s string, %s %s) "
+ "catalog = 'SNOWFLAKE' "
+ "external_volume = 'streaming_ingest' "
+ "base_location = 'all_type_col';",
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. lets use a different base_location for each table.
  2. Create a JIRA for how to cleanup all of the data that ITs upload, from the external volume.

import org.junit.Ignore;
import org.junit.Test;

@Ignore("This test can be enabled after server side Iceberg EP support is released")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a backlog JIRA to track adding a different github merge gate for iceberg ITs, we'll then have one merge gate for FDN ITs and another for iceberg ITs.

Comment on lines +39 to +40
testIcebergIngestion("boolean", 1, true, new BooleanProvider());
testIcebergIngestion("boolean", "false", false, new BooleanProvider());
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets also add 0, "true", "1", "0"


@Test
public void testBoolean() throws Exception {
testIcebergIngestion("boolean", true, new BooleanProvider());
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: whenever you have time in the next few weeks, lets introduce a class called ITTestcaseBuilder that has methods withDataType, withInputValue, withExpectedValue, withVerificationQuery.

THe provider business is funky as it only supports doing exact value verification with a where value = {expectedValue}. I'd much rather write the sql filter directly in the testcase instead of have code generate it, for flexibility.

testIcebergIngestion("boolean", "false", false, new BooleanProvider());

SFException ex =
Assert.assertThrows(
Copy link
Collaborator

Choose a reason for hiding this comment

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

pl use fluent assertions (assertj) as they (a) have test code that reads like a story, and (b) generate very well formatted error messages. Assert.assert*() has the most useless error messages when things fail unless every single call to the method has an associated string message that details the current state of whatever was being asserted on.

For instance:
assertThat(ex).isNotNull();
assertThat(ex.getVendorCode).isEqualTo(ErrorCode.INVALID_FORMAT_ROW.getMessageCode());
assertThatCode(() -> lambda).doesNotThrow();
assertThatThrownBy(() -> lambda).hasCause();

For this you'll have to add the assertj library (I added it once and it failed in one of the mergegates, did not have the time to find and fix what happened!). Feel free to remove the org.hamcrest import from this project.

return tableName;
}

protected String createIcebergTable(String dataType) throws SQLException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

also add an argument for boolean nullable and we can make sure the sdk does proper nullability checking for columns marked non-nullable.

Assert.assertThrows(
SFException.class,
() -> testIcebergIngestion("boolean", new Object(), true, new BooleanProvider()));
Assert.assertEquals(ErrorCode.INVALID_FORMAT_ROW.getMessageCode(), ex.getVendorCode());
Copy link
Collaborator

Choose a reason for hiding this comment

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

(dupe) lets add nullability tests too - sending in null should work for every column, but when its a non-null column then the sdk should throw.

SFException ex =
Assert.assertThrows(
SFException.class,
() -> testIcebergIngestion("int", Long.MAX_VALUE, new LongProvider()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: (Long)Integer.MAX_VALUE + 1 instead of long.maxvalue?

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.

2 participants