Skip to content
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 @@ -1754,7 +1754,7 @@ public PhysicalOperation visitIndexJoin(IndexJoinNode node, LocalExecutionPlanCo
}

OperatorFactory lookupJoinOperatorFactory;
OptionalInt totalOperatorsCount = getJoinOperatorsCountForSpill(context, session);
OptionalInt totalOperatorsCount = OptionalInt.empty(); // spill not supported for index joins
switch (node.getType()) {
case INNER:
lookupJoinOperatorFactory = lookupJoinOperators.innerJoin(context.getNextOperatorId(), node.getId(), lookupSourceFactoryManager, probeSource.getTypes(), probeChannels, probeHashChannel, Optional.empty(), totalOperatorsCount, partitioningSpillerFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package com.facebook.presto.tests;

import com.facebook.presto.Session;
import com.facebook.presto.testing.MaterializedResult;
import com.facebook.presto.tests.tpch.TpchIndexSpec;
import com.facebook.presto.tests.tpch.TpchIndexSpec.Builder;
Expand Down Expand Up @@ -77,6 +78,26 @@ public void testBasicIndexJoin()
" ON l.orderkey = o.orderkey");
}

@Test
public void testBasicIndexJoinWithSpillEnabled()
{
// spill is not supported for index join, but it shares the lookup join operator
// with non-index join. Make sure no errors are thrown when running index joins
// when spill is enabled.
assertQuery(Session.builder(getSession())
.setSystemProperty("spill_enabled", "true")
.setSystemProperty("join_spill_enabled", "true")
.build(),
"" +
"SELECT *\n" +
"FROM (\n" +
" SELECT *\n" +
" FROM lineitem\n" +
" WHERE partkey % 8 = 0) l\n" +
"JOIN orders o\n" +
" ON l.orderkey = o.orderkey");
}

@Test
public void testBasicIndexJoinReverseCandidates()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import com.facebook.presto.Session;
import com.facebook.presto.tests.tpch.IndexedTpchPlugin;
import com.google.common.collect.ImmutableMap;

import java.nio.file.Paths;

import static com.facebook.presto.testing.TestingSession.testSessionBuilder;
import static com.facebook.presto.tpch.TpchMetadata.TINY_SCHEMA_NAME;
Expand All @@ -35,7 +38,14 @@ private static DistributedQueryRunner createQueryRunner()
.setSchema(TINY_SCHEMA_NAME)
.build();

DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 3);
// set spill path so we can enable spill by session property
ImmutableMap<String, String> extraProperties = ImmutableMap.of(
"experimental.spiller-spill-path",
Paths.get(System.getProperty("java.io.tmpdir"), "presto", "spills").toString());
DistributedQueryRunner queryRunner = new DistributedQueryRunner.Builder(session)
.setNodeCount(3)
.setExtraProperties(extraProperties)
.build();

queryRunner.installPlugin(new IndexedTpchPlugin(INDEX_SPEC));
queryRunner.createCatalog("tpch_indexed", "tpch_indexed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@
import com.facebook.presto.tests.AbstractTestIndexedQueries;
import com.google.common.collect.ImmutableMap;

import java.nio.file.Paths;

import static com.facebook.presto.connector.thrift.integration.ThriftQueryRunner.createThriftQueryRunner;

public class TestThriftDistributedQueriesIndexed
extends AbstractTestIndexedQueries
{
public TestThriftDistributedQueriesIndexed()
{
super(() -> createThriftQueryRunner(2, 2, true, ImmutableMap.of()));
super(() -> createThriftQueryRunner(
2,
2,
true,
// set spill path so we can enable spill by session property
ImmutableMap.of("experimental.spiller-spill-path", Paths.get(System.getProperty("java.io.tmpdir"), "presto", "spills").toString())));
}

@Override
Expand Down