Skip to content

Commit

Permalink
Remove transaction information from explain plan
Browse files Browse the repository at this point in the history
Remove transaction handle from TableCommit part of the `explain <query>`
plan as it can have random elements such as UUID.

When comparing explain plans, they may change between calls
even if the query or environment has not changed. This fixes one
of the known causes since a new UUID is generated on each query.

See: #11444
  • Loading branch information
natewoodfb authored and mbasmanova committed Sep 19, 2018
1 parent d36a215 commit 5a32d82
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions presto-hive/pom.xml
Expand Up @@ -217,6 +217,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-parser</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-tests</artifactId>
Expand Down
Expand Up @@ -13,10 +13,15 @@
*/
package com.facebook.presto.hive;

import com.facebook.presto.testing.MaterializedResult;
import com.facebook.presto.tests.AbstractTestDistributedQueries;
import org.testng.annotations.Test;

import static com.facebook.presto.hive.HiveQueryRunner.createQueryRunner;
import static com.facebook.presto.sql.tree.ExplainType.Type.LOGICAL;
import static com.google.common.collect.Iterables.getOnlyElement;
import static io.airlift.tpch.TpchTable.getTables;
import static org.testng.Assert.assertEquals;

public class TestHiveDistributedQueries
extends AbstractTestDistributedQueries
Expand All @@ -32,5 +37,13 @@ public void testDelete()
// Hive connector currently does not support row-by-row delete
}

@Test
public void testExplainOfCreateTableAs()
{
String query = "CREATE TABLE copy_orders AS SELECT * FROM orders";
MaterializedResult result = computeActual("EXPLAIN " + query);
assertEquals(getOnlyElement(result.getOnlyColumnAsSet()), getExplainPlan(query, LOGICAL));
}

// Hive specific tests should normally go in TestHiveIntegrationSmokeTest
}
Expand Up @@ -82,6 +82,6 @@ public boolean equals(Object obj)
@Override
public String toString()
{
return connectorId + ":" + transactionHandle + ":" + connectorHandle;
return connectorId + ":" + connectorHandle;
}
}
Expand Up @@ -82,6 +82,6 @@ public boolean equals(Object obj)
@Override
public String toString()
{
return connectorId + ":" + transactionHandle + ":" + connectorHandle;
return connectorId + ":" + connectorHandle;
}
}

0 comments on commit 5a32d82

Please sign in to comment.