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

Update to Airbase 134 #16420

Merged
merged 2 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,8 @@ protected List<Object> visitIrKeyValueMethod(IrKeyValueMethod node, PathEvaluati
ImmutableMap.of(
"name", TextNode.valueOf(field.getKey()),
"value", field.getValue(),
"id", IntNode.valueOf(objectId++)))));
"id", IntNode.valueOf(objectId)))));
objectId++;
}

return outputSequence.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,55 @@ public void testKeyValueMethod()
"value", NullNode.instance,
"id", IntNode.valueOf(1)))));

// nested methods
assertThat(pathResult(
new ArrayNode(
JsonNodeFactory.instance,
ImmutableList.of(
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of("key1", TextNode.valueOf("first"), "key2", BooleanNode.TRUE)),
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of("key3", IntNode.valueOf(42))))),
path(true, keyValue(keyValue(wildcardArrayAccessor(contextVariable()))))))
.isEqualTo(sequence(
// key1
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("name"),
"value", TextNode.valueOf("key1"),
"id", IntNode.valueOf(2))),
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("value"),
"value", TextNode.valueOf("first"),
"id", IntNode.valueOf(2))),
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("id"),
"value", IntNode.valueOf(0),
"id", IntNode.valueOf(2))),
// key2
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("name"),
"value", TextNode.valueOf("key2"),
"id", IntNode.valueOf(3))),
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("value"),
"value", BooleanNode.TRUE,
"id", IntNode.valueOf(3))),
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("id"),
"value", IntNode.valueOf(0),
"id", IntNode.valueOf(3))),
// key3
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("name"),
"value", TextNode.valueOf("key3"),
"id", IntNode.valueOf(4))),
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("value"),
"value", IntNode.valueOf(42),
"id", IntNode.valueOf(4))),
new ObjectNode(JsonNodeFactory.instance, ImmutableMap.of(
"name", TextNode.valueOf("id"),
"value", IntNode.valueOf(1),
"id", IntNode.valueOf(4)))));

// type mismatch
assertThatThrownBy(() -> evaluate(
IntNode.valueOf(-5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public void testHideDeltaLakeTables()
assertThatThrownBy(super::testHideDeltaLakeTables)
.hasMessageMatching("(?s)\n" +
"Expecting\n" +
" <\\[.*\\b(\\w+.tmp_trino_test_trino_delta_lake_table_\\w+)\\b.*]>\n" +
" \\[.*\\b(\\w+.tmp_trino_test_trino_delta_lake_table_\\w+)\\b.*]\n" +
"not to contain\n" +
" <\\[\\1]>\n" +
" \\[\\1]\n" +
"but found.*");

throw new SkipException("not supported");
Expand Down
14 changes: 9 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.airlift</groupId>
<artifactId>airbase</artifactId>
<version>133</version>
<version>134</version>
</parent>

<groupId>io.trino</groupId>
Expand Down Expand Up @@ -46,17 +46,14 @@

<air.release.preparation-goals>clean verify -DskipTests</air.release.preparation-goals>

<dep.slice.version>0.45</dep.slice.version>
<dep.accumulo.version>1.10.2</dep.accumulo.version>
<dep.accumulo-hadoop.version>2.7.7-1</dep.accumulo-hadoop.version>
<dep.antlr.version>4.11.1</dep.antlr.version>
<!-- TODO remove after updating Airbase -->
<dep.airlift.version>225</dep.airlift.version>
<dep.arrow.version>9.0.0</dep.arrow.version>
<dep.packaging.version>${dep.airlift.version}</dep.packaging.version>
<dep.aws-sdk.version>1.12.261</dep.aws-sdk.version>
<dep.okhttp.version>3.14.9</dep.okhttp.version>
<dep.joda.version>2.12.2</dep.joda.version>
<dep.jsonwebtoken.version>0.11.2</dep.jsonwebtoken.version>
<dep.oracle.version>19.3.0.0</dep.oracle.version>
<dep.drift.version>1.14</dep.drift.version>
Expand Down Expand Up @@ -1584,6 +1581,13 @@
<version>8.0.29</version>
</dependency>

<!-- force newer version to be used for dependencies -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.1</version>
</dependency>

<dependency>
<!-- org.testcontainers:testcontainer's dependencies pull two different versions of this artifact and this is to negotiate the version -->
<groupId>net.java.dev.jna</groupId>
Expand Down Expand Up @@ -1808,7 +1812,7 @@
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.22.0-GA</version>
<version>3.29.2-GA</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ public void testReturnsEmptyResult()

QueryAssert queryAssert = assertThat(query("VALUES 'foobar'"));
assertThatThrownBy(queryAssert::returnsEmptyResult)
.hasMessage("[Rows for query [VALUES 'foobar']] \nExpecting empty but was:<[[foobar]]>");
.hasMessageContaining("[Rows for query [VALUES 'foobar']] \nExpecting empty but was: [[foobar]]");

queryAssert = assertThat(query("VALUES 'foo', 'bar'"));
assertThatThrownBy(queryAssert::returnsEmptyResult)
.hasMessage("[Rows for query [VALUES 'foo', 'bar']] \nExpecting empty but was:<[[foo], [bar]]>");
.hasMessageContaining("[Rows for query [VALUES 'foo', 'bar']] \nExpecting empty but was: [[foo], [bar]]");
}

@Test
Expand All @@ -125,24 +125,31 @@ public void testVarbinaryResult()

QueryAssert queryAssert = assertThat(query("SELECT X'001234'"));
assertThatThrownBy(() -> queryAssert.matches("VALUES X'001299'"))
.hasMessageMatching("" +
.hasMessageMatching(
// TODO the representation and thus messages should be the same regardless of query runner in use
// when using local query runner
"(?s).*" +
"(\\Q" +
"Expecting:\n" +
" <(00 12 34)>\n" +
"to contain exactly in any order:\n" +
" <[(00 12 99)]>\n" +
"elements not found:\n" +
" <(00 12 99)>" +
"\\E|\\Q" +
// when using distributed query runner
"Expecting:\n" +
" <([0, 18, 52])>\n" +
"to contain exactly in any order:\n" +
" <[([0, 18, -103])]>" +
"\\E).*");
getQueryRunner() instanceof LocalQueryRunner
? "(?s).*" +
"\\Q" +
"Expecting actual:\n" +
" (00 12 34)\n" +
"to contain exactly in any order:\n" +
" [(00 12 99)]\n" +
"elements not found:\n" +
" (00 12 99)\n" +
"and elements not expected:\n" +
" (00 12 34)" +
"\\E.*"
: "(?s).*" +
"\\Q" +
"Expecting actual:\n" +
" ([0, 18, 52])\n" +
"to contain exactly in any order:\n" +
" [([0, 18, -103])]\n" +
"elements not found:\n" +
" ([0, 18, -103])\n" +
"and elements not expected:\n" +
" ([0, 18, 52])" +
"\\E.*");
}

@Test
Expand All @@ -158,25 +165,25 @@ public void testNestedVarbinaryResult()
getQueryRunner() instanceof LocalQueryRunner
? "(?s).*" +
"\\Q" +
"Expecting:\n" +
" <([00 12 34])>\n" +
"Expecting actual:\n" +
" ([00 12 34])\n" +
"to contain exactly in any order:\n" +
" <[([00 12 99])]>\n" +
" [([00 12 99])]\n" +
"elements not found:\n" +
" <([00 12 99])>\n" +
" ([00 12 99])\n" +
"and elements not expected:\n" +
" <([00 12 34])>" +
" ([00 12 34])" +
"\\E.*"
: "(?s).*" +
"\\Q" +
"Expecting:\n" +
" <([X'00 12 34'])>\n" +
"Expecting actual:\n" +
" ([X'00 12 34'])\n" +
"to contain exactly in any order:\n" +
" <[([X'00 12 99'])]>\n" +
" [([X'00 12 99'])]\n" +
"elements not found:\n" +
" <([X'00 12 99'])>\n" +
" ([X'00 12 99'])\n" +
"and elements not expected:\n" +
" <([X'00 12 34'])>" +
" ([X'00 12 34'])" +
"\\E.*");
}

Expand All @@ -193,10 +200,10 @@ public void testTimeQueryResult()

QueryAssert queryAssert = assertThat(query("SELECT TIME '01:23:45.123456789012'"));
assertThatThrownBy(() -> queryAssert.matches("SELECT TIME '01:23:45.123456789013'"))
.hasMessageContaining("Expecting:\n" +
" <(01:23:45.123456789012)>\n" +
.hasMessageContaining("Expecting actual:\n" +
" (01:23:45.123456789012)\n" +
"to contain exactly in any order:\n" +
" <[(01:23:45.123456789013)]>");
" [(01:23:45.123456789013)]");
}

/**
Expand All @@ -213,16 +220,16 @@ public void testTimeWithTimeZoneQueryResult()
QueryAssert queryAssert = assertThat(query("SELECT TIME '01:23:45.123456789012 +05:07'"));
// different second fraction
assertThatThrownBy(() -> queryAssert.matches("SELECT TIME '01:23:45.123456789013 +05:07'"))
.hasMessageContaining("Expecting:\n" +
" <(01:23:45.123456789012+05:07)>\n" +
.hasMessageContaining("Expecting actual:\n" +
" (01:23:45.123456789012+05:07)\n" +
"to contain exactly in any order:\n" +
" <[(01:23:45.123456789013+05:07)]>");
" [(01:23:45.123456789013+05:07)]");
// different zone
assertThatThrownBy(() -> queryAssert.matches("SELECT TIME '01:23:45.123456789012 +05:42'"))
.hasMessageContaining("Expecting:\n" +
" <(01:23:45.123456789012+05:07)>\n" +
.hasMessageContaining("Expecting actual:\n" +
" (01:23:45.123456789012+05:07)\n" +
"to contain exactly in any order:\n" +
" <[(01:23:45.123456789012+05:42)]>");
" [(01:23:45.123456789012+05:42)]");
}

/**
Expand All @@ -238,10 +245,10 @@ public void testTimestampQueryResult()

QueryAssert queryAssert = assertThat(query("SELECT TIMESTAMP '2017-01-02 09:12:34.123456789012'"));
assertThatThrownBy(() -> queryAssert.matches("SELECT TIMESTAMP '2017-01-02 09:12:34.123456789013'"))
.hasMessageContaining("Expecting:\n" +
" <(2017-01-02 09:12:34.123456789012)>\n" +
.hasMessageContaining("Expecting actual:\n" +
" (2017-01-02 09:12:34.123456789012)\n" +
"to contain exactly in any order:\n" +
" <[(2017-01-02 09:12:34.123456789013)]>");
" [(2017-01-02 09:12:34.123456789013)]");
}

/**
Expand All @@ -258,16 +265,16 @@ public void testTimestampWithTimeZoneQueryResult()
QueryAssert queryAssert = assertThat(query("SELECT TIMESTAMP '2017-01-02 09:12:34.123456789012 Europe/Warsaw'"));
// different second fraction
assertThatThrownBy(() -> queryAssert.matches("SELECT TIMESTAMP '2017-01-02 09:12:34.123456789013 Europe/Warsaw'"))
.hasMessageContaining("Expecting:\n" +
" <(2017-01-02 09:12:34.123456789012 Europe/Warsaw)>\n" +
.hasMessageContaining("Expecting actual:\n" +
" (2017-01-02 09:12:34.123456789012 Europe/Warsaw)\n" +
"to contain exactly in any order:\n" +
" <[(2017-01-02 09:12:34.123456789013 Europe/Warsaw)]>");
" [(2017-01-02 09:12:34.123456789013 Europe/Warsaw)]");
// different zone
assertThatThrownBy(() -> queryAssert.matches("SELECT TIMESTAMP '2017-01-02 09:12:34.123456789012 Europe/Paris'"))
.hasMessageContaining("Expecting:\n" +
" <(2017-01-02 09:12:34.123456789012 Europe/Warsaw)>\n" +
.hasMessageContaining("Expecting actual:\n" +
" (2017-01-02 09:12:34.123456789012 Europe/Warsaw)\n" +
"to contain exactly in any order:\n" +
" <[(2017-01-02 09:12:34.123456789012 Europe/Paris)]>");
" [(2017-01-02 09:12:34.123456789012 Europe/Paris)]");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ public void testIsFullyPushedDownWithSession()
public void testNullInErrorMessage()
{
assertThatThrownBy(() -> assertThat(query("SELECT CAST(null AS integer)")).matches("SELECT 1"))
.hasMessage("[Rows for query [SELECT CAST(null AS integer)]] \n" +
"Expecting:\n" +
" <(null)>\n" +
.hasMessageContaining("[Rows for query [SELECT CAST(null AS integer)]] \n" +
"Expecting actual:\n" +
" (null)\n" +
"to contain exactly in any order:\n" +
" <[(1)]>\n" +
" [(1)]\n" +
"elements not found:\n" +
" <(1)>\n" +
" (1)\n" +
"and elements not expected:\n" +
" <(null)>\n");
" (null)\n");

assertThatThrownBy(() -> assertThat(query("SELECT 1")).matches("SELECT CAST(null AS integer)"))
.hasMessage("[Rows for query [SELECT 1]] \n" +
"Expecting:\n" +
" <(1)>\n" +
.hasMessageContaining("[Rows for query [SELECT 1]] \n" +
"Expecting actual:\n" +
" (1)\n" +
"to contain exactly in any order:\n" +
" <[(null)]>\n" +
" [(null)]\n" +
"elements not found:\n" +
" <(null)>\n" +
" (null)\n" +
"and elements not expected:\n" +
" <(1)>\n");
" (1)\n");
}
}