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 unit test
  • Loading branch information
EmmyMiao87 committed Apr 8, 2021
commit f251b38bcb3bee1bee25fb0326ad1f6b3006798c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ public SlotRef getSrcSlotRef() {
}
List<Expr> sourceExpr = slotDescriptor.getSourceExprs();
if (sourceExpr == null || sourceExpr.isEmpty()) {
return (SlotRef) this;
return unwrapSloRef;
}
if (sourceExpr.size() > 1) {
return null;
Expand Down
28 changes: 23 additions & 5 deletions fe/fe-core/src/test/java/org/apache/doris/analysis/ExprTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@

import com.google.common.collect.Maps;

import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.ArrayList;

import mockit.Expectations;
import mockit.Injectable;
import mockit.Mocked;
import org.junit.Assert;
import org.junit.Test;

public class ExprTest {

Expand Down Expand Up @@ -184,4 +183,23 @@ public void testEqualSets() {
list2.add(r4);
Assert.assertFalse(Expr.equalSets(list1, list2));
}

@Test
public void testSrcSlotRef(@Injectable SlotDescriptor slotDescriptor) {
TableName tableName = new TableName("db1", "table1");
SlotRef slotRef = new SlotRef(tableName, "c1");
slotRef.setDesc(slotDescriptor);
Deencapsulation.setField(slotRef, "isAnalyzed", true);
Expr castExpr = new CastExpr(new TypeDef(Type.INT), slotRef);
new Expectations() {
{
slotDescriptor.getSourceExprs();
result = null;
}
};

SlotRef srcSlotRef = castExpr.getSrcSlotRef();
Assert.assertTrue(srcSlotRef != null);
Assert.assertTrue(srcSlotRef == slotRef);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ public void testCreateOneTable() throws Exception {

GroupId groupId = index.getGroup(tableId);
List<Long> backendIds = index.getBackendsPerBucketSeq(groupId).get(0);
System.out.println(backendIds);
Assert.assertEquals(Collections.singletonList(10001L), backendIds);
Assert.assertEquals(1, backendIds.size());

String fullGroupName = dbId + "_" + groupName;
Assert.assertEquals(tableId, index.getTableIdByGroup(fullGroupName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ public void testOdbcSink() throws Exception {
@Test
public void testPreferBroadcastJoin() throws Exception {
connectContext.setDatabase("default_cluster:test");
String queryStr = "explain select * from (select k1 from jointest group by k1)t2, jointest t1 where t1.k1 = t2.k1";
String queryStr = "explain select * from (select k2 from jointest group by k2)t2, jointest t1 where t1.k1 = t2.k2";

// default set PreferBroadcastJoin true
String explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, queryStr);
Expand Down