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

[Colocate plan][Step1] Colocate join covers more situations #5521

Merged
merged 6 commits into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix ut
  • Loading branch information
EmmyMiao87 committed Apr 8, 2021
commit 44a8e1477baa959f34614103ac091d42e4f8f26a
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@

import org.apache.commons.lang.StringUtils;

import java.io.File;
import java.util.UUID;

import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class ColocatePlanTest {
private static final String COLOCATE_ENABLE = "colocate: true";
private static String runningDir = "fe/mocked/DemoTest/" + UUID.randomUUID().toString() + "/";
private static ConnectContext ctx;

@Before
public void setUp() throws Exception {
@BeforeClass
public static void setUp() throws Exception {
FeConstants.runningUnitTest = true;
UtFrameUtils.createMinDorisCluster(runningDir, 2);
ctx = UtFrameUtils.createDefaultCtx();
Expand All @@ -54,6 +56,13 @@ public void setUp() throws Exception {
Catalog.getCurrentCatalog().createTable(createTableStmt);
}


@AfterClass
public static void tearDown() {
File file = new File(runningDir);
file.delete();
}

// without
// 1. agg: group by column < distributed columns
// 2. join: src data has been redistributed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,54 +82,12 @@ public class AnotherDemoTest {
public static void beforeClass() throws EnvVarNotSetException, IOException,
FeStartException, NotInitException, DdlException, InterruptedException {
FeConstants.default_scheduler_interval_millisecond = 10;
// get DORIS_HOME
String dorisHome = System.getenv("DORIS_HOME");
if (Strings.isNullOrEmpty(dorisHome)) {
dorisHome = Files.createTempDirectory("DORIS_HOME").toAbsolutePath().toString();
}

getPorts();

// start fe in "DORIS_HOME/fe/mocked/"
MockedFrontend frontend = MockedFrontend.getInstance();
Map<String, String> feConfMap = Maps.newHashMap();
// set additional fe config
feConfMap.put("http_port", String.valueOf(fe_http_port));
feConfMap.put("rpc_port", String.valueOf(fe_rpc_port));
feConfMap.put("query_port", String.valueOf(fe_query_port));
feConfMap.put("edit_log_port", String.valueOf(fe_edit_log_port));
feConfMap.put("tablet_create_timeout_second", "10");
frontend.init(dorisHome + "/" + runningDir, feConfMap);
frontend.start(new String[0]);

// start be
MockedBackend backend = MockedBackendFactory.createBackend("127.0.0.1",
be_heartbeat_port, be_thrift_port, be_brpc_port, be_http_port,
new DefaultHeartbeatServiceImpl(be_thrift_port, be_http_port, be_brpc_port),
new DefaultBeThriftServiceImpl(), new DefaultPBackendServiceImpl());
backend.setFeAddress(new TNetworkAddress("127.0.0.1", frontend.getRpcPort()));
backend.start();

// add be
Backend be = new Backend(10001, backend.getHost(), backend.getHeartbeatPort());
Map<String, DiskInfo> disks = Maps.newHashMap();
DiskInfo diskInfo1 = new DiskInfo("/path1");
diskInfo1.setTotalCapacityB(1000000);
diskInfo1.setAvailableCapacityB(500000);
diskInfo1.setDataUsedCapacityB(480000);
disks.put(diskInfo1.getRootPath(), diskInfo1);
be.setDisks(ImmutableMap.copyOf(disks));
be.setAlive(true);
be.setOwnerClusterName(SystemInfoService.DEFAULT_CLUSTER);
Catalog.getCurrentSystemInfo().addBackend(be);

// sleep to wait first heartbeat
Thread.sleep(6000);
UtFrameUtils.createMinDorisCluster(runningDir, 1);
}

@AfterClass
public static void TearDown() {
UtFrameUtils.cleanDorisFeDir(runningDirBase);
UtFrameUtils.cleanDorisFeDir(runningDir);
}

// generate all port from valid ports
Expand Down