You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by dz...@apache.org on 2022/07/08 06:50:18 UTC
[drill] 01/06: DRILL-8237: Limit is not pushed down to scan for MSSQL (#2564)
This is an automated email from the ASF dual-hosted git repository.
dzamo pushed a commit to branch 1.20
in repository https://gitbox.apache.org/repos/asf/drill.git
commit 7c77850ac12fbaa0d8c832efe61241891d343593
Author: Volodymyr Vysotskyi <vv...@gmail.com>
AuthorDate: Fri May 27 03:16:33 2022 +0300
DRILL-8237: Limit is not pushed down to scan for MSSQL (#2564)
---
.../org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMSSQL.java | 5 +----
.../org/apache/drill/exec/store/enumerable/plan/DrillJdbcSort.java | 3 ++-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMSSQL.java b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMSSQL.java
index 68c6871261..a1299f67a0 100644
--- a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMSSQL.java
+++ b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMSSQL.java
@@ -31,7 +31,6 @@ import org.apache.drill.test.ClusterTest;
import org.apache.drill.test.rowSet.RowSetUtilities;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.testcontainers.containers.MSSQLServerContainer;
@@ -48,7 +47,7 @@ import static org.junit.Assert.assertEquals;
@Category(JdbcStorageTest.class)
public class TestJdbcPluginWithMSSQL extends ClusterTest {
- private static MSSQLServerContainer jdbcContainer;
+ private static MSSQLServerContainer<?> jdbcContainer;
@BeforeClass
public static void initMSSQL() throws Exception {
@@ -313,8 +312,6 @@ public class TestJdbcPluginWithMSSQL extends ClusterTest {
}
@Test
- @Ignore
- // TODO: Enable once the push down logic has been clarified.
public void testLimitPushDownWithOffset() throws Exception {
String query = "select person_id, first_name from mssql.dbo.person limit 100 offset 10";
queryBuilder()
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/enumerable/plan/DrillJdbcSort.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/enumerable/plan/DrillJdbcSort.java
index 1f15ce3388..a1ab014f89 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/enumerable/plan/DrillJdbcSort.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/enumerable/plan/DrillJdbcSort.java
@@ -42,7 +42,8 @@ public class DrillJdbcSort extends JdbcRules.JdbcSort {
double numRows = mq.getRowCount(this);
double cpuCost = DrillCostBase.COMPARE_CPU_COST * numRows;
DrillCostBase.DrillCostFactory costFactory = (DrillCostBase.DrillCostFactory) planner.getCostFactory();
- return costFactory.makeCost(numRows, cpuCost, 0, 0);
+ // adjust cost to handle the case when the original limit was split
+ return costFactory.makeCost(numRows, cpuCost, 0, 0).multiplyBy(0.1);
}
return super.computeSelfCost(planner, mq);
}