Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Oct 21, 2024
1 parent a5bf992 commit d099332
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,11 @@ private Statistics computeCatalogRelation(CatalogRelation catalogRelation) {
// rows newly updated after last analyze
long deltaRowCount = computeDeltaRowCount(catalogRelation);
double rowCount = getTableRowCount(catalogRelation);
if (FeConstants.runningUnitTest || !FeConstants.enableInternalSchemaDb) {
rowCount = Math.max(1, rowCount);
} else {
rowCount = Math.max(0, rowCount);
}
boolean hasUnknownCol = false;
long idxId = -1;
if (catalogRelation instanceof OlapScan) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.PrimitiveType;
import org.apache.doris.common.FeConstants;
import org.apache.doris.mysql.privilege.MockedAuth;
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.jobs.JobContext;
Expand Down Expand Up @@ -62,6 +63,7 @@ public class DeriveStatsJobTest {

@Test
public void testExecute() throws Exception {
FeConstants.runningUnitTest = true;
MockedAuth.mockedConnectContext(context, "root", "192.168.1.1");

LogicalOlapScan olapScan = constructOlapSCan();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.doris.nereids.memo;

import org.apache.doris.common.FeConstants;
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.Plan;
Expand All @@ -38,6 +39,7 @@ class RankTest extends TestWithFeService {

@Test
void test() throws Exception {
FeConstants.runningUnitTest = true;
createDatabase("test");
HyperGraphBuilder hyperGraphBuilder = new HyperGraphBuilder(Sets.newHashSet(JoinType.INNER_JOIN));
hyperGraphBuilder.init(0, 1, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public void testGlobalColocateGroup() throws Exception {
+ "db1.test_global_colocate1 group by k1, k2) a , db2.test_global_colocate2 b "
+ "where a.k1=b.k1 and a.k2=b.k2";
String plan1 = getSQLPlanOrErrorMsg(sql);
System.out.println(plan1);
Assert.assertEquals(1, StringUtils.countMatches(plan1, "AGGREGATE"));
Assert.assertTrue(plan1.contains(COLOCATE_ENABLE));
ColocateTableIndex colocateTableIndex = Env.getCurrentColocateIndex();
Expand Down

0 comments on commit d099332

Please sign in to comment.