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

Eliminate unnecessary cross joins #6395

Closed
wants to merge 12 commits into
base: master
from
Next

Add reorder-joins config and session parameter

  • Loading branch information...
pnowojski committed Oct 14, 2016
commit 94e04226e076a3331a196228ad55977fe79e57a1
@@ -57,6 +57,7 @@
public static final String DICTIONARY_AGGREGATION = "dictionary_aggregation";
public static final String PLAN_WITH_TABLE_NODE_PARTITIONING = "plan_with_table_node_partitioning";
public static final String COLOCATED_JOIN = "colocated_join";
public static final String REORDER_JOINS = "reorder_joins";
public static final String INITIAL_SPLITS_PER_NODE = "initial_splits_per_node";
public static final String SPLIT_CONCURRENCY_ADJUSTMENT_INTERVAL = "split_concurrency_adjustment_interval";
public static final String OPTIMIZE_METADATA_QUERIES = "optimize_metadata_queries";
@@ -230,6 +231,11 @@ public SystemSessionProperties(
"Experimental: Adapt plan to pre-partitioned tables",
true,
false),
booleanSessionProperty(
REORDER_JOINS,
"Experimental: Reorder joins to optimize plan",
featuresConfig.isJoinReorderingEnabled(),
false),
booleanSessionProperty(
COLOCATED_JOIN,
"Experimental: Use a colocated join when possible",
@@ -351,6 +357,11 @@ public static boolean planWithTableNodePartitioning(Session session)
return session.getSystemProperty(PLAN_WITH_TABLE_NODE_PARTITIONING, Boolean.class);
}
public static boolean isJoinReorderingEnabled(Session session)
{
return session.getSystemProperty(REORDER_JOINS, Boolean.class);
}
public static boolean isColocatedJoinEnabled(Session session)
{
return session.getSystemProperty(COLOCATED_JOIN, Boolean.class);
@@ -46,6 +46,7 @@
private boolean distributedIndexJoinsEnabled;
private boolean distributedJoinsEnabled = true;
private boolean colocatedJoinsEnabled;
private boolean reorderJoins;
private boolean redistributeWrites = true;
private boolean optimizeMetadataQueries;
private boolean optimizeHashGeneration = true;
@@ -127,6 +128,19 @@ public FeaturesConfig setColocatedJoinsEnabled(boolean colocatedJoinsEnabled)
return this;
}
public boolean isJoinReorderingEnabled()
{
return reorderJoins;
}
@Config("reorder-joins")
@ConfigDescription("Experimental: Reorder joins to optimize plan")
public FeaturesConfig setJoinReorderingEnabled(boolean reorderJoins)
{
this.reorderJoins = reorderJoins;
return this;
}
public boolean isRedistributeWrites()
{
return redistributeWrites;
@@ -39,6 +39,7 @@ public void testDefaults()
.setDistributedIndexJoinsEnabled(false)
.setDistributedJoinsEnabled(true)
.setColocatedJoinsEnabled(false)
.setJoinReorderingEnabled(false)
.setRedistributeWrites(true)
.setOptimizeMetadataQueries(false)
.setOptimizeHashGeneration(true)
@@ -66,6 +67,7 @@ public void testExplicitPropertyMappings()
.put("distributed-index-joins-enabled", "true")
.put("distributed-joins-enabled", "false")
.put("colocated-joins-enabled", "true")
.put("reorder-joins", "true")
.put("redistribute-writes", "false")
.put("optimizer.optimize-metadata-queries", "true")
.put("optimizer.optimize-hash-generation", "false")
@@ -88,6 +90,7 @@ public void testExplicitPropertyMappings()
.put("distributed-index-joins-enabled", "true")
.put("distributed-joins-enabled", "false")
.put("colocated-joins-enabled", "true")
.put("reorder-joins", "true")
.put("redistribute-writes", "false")
.put("optimizer.optimize-metadata-queries", "true")
.put("optimizer.optimize-hash-generation", "false")
@@ -110,6 +113,7 @@ public void testExplicitPropertyMappings()
.setDistributedIndexJoinsEnabled(true)
.setDistributedJoinsEnabled(false)
.setColocatedJoinsEnabled(true)
.setJoinReorderingEnabled(true)
.setRedistributeWrites(false)
.setOptimizeMetadataQueries(true)
.setOptimizeHashGeneration(false)
ProTip! Use n and p to navigate between commits in a pull request.