Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kbendick committed Jul 31, 2022
1 parent 5a92b19 commit bdce642
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public String name() {
return "iceberg_version";
}

// class must be at least package private to be resolvable
// Implementing class cannot be private, otherwise Spark is unable to access the static invoke
// function during code-gen and calling the function fails
static class IcebergVersionFunctionImpl implements ScalarFunction<UTF8String> {
private static final UTF8String VERSION = UTF8String.fromString(IcebergBuild.version());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public void dropDefaultNamespace() {
@Test
public void testListFunctionsViaCatalog() throws NoSuchNamespaceException {
Assertions.assertThat(asFunctionCatalog.listFunctions(EMPTY_NAMESPACE))
.anyMatch(func -> "iceberg_version".equalsIgnoreCase(func.name()));
.anyMatch(func -> "iceberg_version".equals(func.name()));

Assertions.assertThat(asFunctionCatalog.listFunctions(SYSTEM_NAMESPACE))
.anyMatch(func -> "iceberg_version".equalsIgnoreCase(func.name()));
.anyMatch(func -> "iceberg_version".equals(func.name()));

Assert.assertArrayEquals(
"Listing functions in an existing namespace that's not system should not throw",
Expand Down Expand Up @@ -108,15 +108,9 @@ public void testLoadFunctions() throws NoSuchFunctionException {
}

@Test
public void testIcebergVersionFunctionReturnsCorrectResult() {
public void testUsingFunctionFromFunctionCatalogInSQL() {
String buildVersion = IcebergBuild.version();

// Check that value correctly loads from file, even in codegen etc
Assert.assertNotEquals(
"iceberg_version should not return undefined",
"undefined",
scalarSql("SELECT %s.system.iceberg_version()", catalogName));

Assert.assertEquals(
"Should be able to use the Iceberg version function from the fully qualified system namespace",
buildVersion,
Expand Down

0 comments on commit bdce642

Please sign in to comment.