Skip to content

Commit

Permalink
Fix AbstractTestQueries tests affected by TestNG bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturGajowy authored and lucesape committed Apr 16, 2017
1 parent e4dd247 commit 9770083
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import static com.facebook.presto.spi.type.TimestampType.TIMESTAMP;
import static com.facebook.presto.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.spi.type.VarcharType.createVarcharType;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.INVALID_PARAMETER_USAGE;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_SCHEMA;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MUST_BE_AGGREGATE_OR_GROUP_BY;
Expand All @@ -84,6 +85,7 @@
import static com.facebook.presto.tests.QueryAssertions.assertEqualsIgnoreOrder;
import static com.facebook.presto.tests.QueryTemplate.parameter;
import static com.facebook.presto.tests.QueryTemplate.queryTemplate;
import static com.facebook.presto.type.UnknownType.UNKNOWN;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.collect.Iterables.transform;
import static io.airlift.tpch.TpchTable.ORDERS;
Expand Down Expand Up @@ -3985,7 +3987,7 @@ public void testWindowFunctionsExpressions()
"FROM (SELECT * FROM orders ORDER BY orderkey LIMIT 10) x\n" +
"ORDER BY orderkey LIMIT 5");

MaterializedResult expected = resultBuilder(getSession(), BIGINT, VARCHAR, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), BIGINT, createVarcharType(1), BIGINT)
.row(1L, "O", (1L * 10) + 100)
.row(2L, "O", (2L * 9) + 100)
.row(3L, "F", (3L * 8) + 100)
Expand All @@ -4012,7 +4014,7 @@ public void testWindowFunctionsFromAggregate()
"WHERE rnk <= 2\n" +
"ORDER BY orderstatus, rnk");

MaterializedResult expected = resultBuilder(getSession(), VARCHAR, VARCHAR, DOUBLE, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), createVarcharType(1), createVarcharType(15), DOUBLE, BIGINT)
.row("F", "Clerk#000000090", 2784836.61, 1L)
.row("F", "Clerk#000000084", 2674447.15, 2L)
.row("O", "Clerk#000000500", 2569878.29, 1L)
Expand Down Expand Up @@ -4054,7 +4056,7 @@ public void testSameWindowFunctionsTwoCoerces()
"ORDER BY 2 DESC\n" +
"LIMIT 5");

MaterializedResult expected = resultBuilder(getSession(), BIGINT, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), DOUBLE, BIGINT)
.row(12.0, 10L)
.row(12.0, 9L)
.row(12.0, 8L)
Expand Down Expand Up @@ -4485,7 +4487,7 @@ public void testWindowFunctionWithGroupBy()
"FROM (SELECT 'foo' x)\n" +
"GROUP BY 1");

MaterializedResult expected = resultBuilder(getSession(), VARCHAR, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), createVarcharType(3), BIGINT)
.row("foo", 1L)
.build();

Expand Down Expand Up @@ -4576,7 +4578,7 @@ public void testFullyPartitionedAndPartiallySortedWindowFunction()
"FROM (SELECT * FROM orders ORDER BY orderkey, custkey LIMIT 10)\n" +
"ORDER BY orderkey LIMIT 5");

MaterializedResult expected = resultBuilder(getSession(), BIGINT, BIGINT, VARCHAR, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), BIGINT, BIGINT, createVarcharType(15), BIGINT)
.row(1L, 370L, "5-LOW", 1L)
.row(2L, 781L, "1-URGENT", 1L)
.row(3L, 1234L, "5-LOW", 1L)
Expand All @@ -4595,7 +4597,7 @@ public void testFullyPartitionedAndFullySortedWindowFunction()
"FROM (SELECT * FROM orders ORDER BY orderkey, custkey LIMIT 10)\n" +
"ORDER BY orderkey LIMIT 5");

MaterializedResult expected = resultBuilder(getSession(), BIGINT, BIGINT, VARCHAR, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), BIGINT, BIGINT, BIGINT)
.row(1L, 370L, 1L)
.row(2L, 781L, 1L)
.row(3L, 1234L, 1L)
Expand Down Expand Up @@ -4668,7 +4670,7 @@ public void testValueWindowFunctions()
" ) x\n" +
"ORDER BY orderkey LIMIT 5");

MaterializedResult expected = resultBuilder(getSession(), BIGINT, VARCHAR, BIGINT, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), BIGINT, createVarcharType(1), BIGINT, BIGINT)
.row(1L, "O", 1001L, 1002L)
.row(2L, "O", 1001L, 1002L)
.row(3L, "F", 1003L, 1005L)
Expand All @@ -4690,7 +4692,7 @@ public void testWindowFrames()
" ) x\n" +
"ORDER BY orderkey LIMIT 5");

MaterializedResult expected = resultBuilder(getSession(), BIGINT, VARCHAR, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), BIGINT, createVarcharType(1), BIGINT)
.row(1L, "O", 1001L)
.row(2L, "O", 3007L)
.row(3L, "F", 3014L)
Expand All @@ -4708,7 +4710,7 @@ public void testWindowNoChannels()
"FROM (SELECT * FROM orders LIMIT 10)\n" +
"LIMIT 3");

MaterializedResult expected = resultBuilder(getSession(), BIGINT, VARCHAR, BIGINT)
MaterializedResult expected = resultBuilder(getSession(), BIGINT)
.row(1L)
.row(1L)
.row(1L)
Expand Down Expand Up @@ -8087,7 +8089,7 @@ public void testDescribeInputNoParameters()
.addPreparedStatement("my_query", "select * from nation")
.build();
MaterializedResult actual = computeActual(session, "DESCRIBE INPUT my_query");
MaterializedResult expected = resultBuilder(session, BIGINT, VARCHAR).build();
MaterializedResult expected = resultBuilder(session, UNKNOWN, UNKNOWN).build();
assertEquals(actual, expected);
}

Expand Down

0 comments on commit 9770083

Please sign in to comment.