You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/12/17 19:59:12 UTC

[GitHub] [ignite] korlov42 opened a new pull request #8590: IGNITE-12819 Calcite integration. Cost system

korlov42 opened a new pull request #8590:
URL: https://github.com/apache/ignite/pull/8590


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548841614



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteExchange.java
##########
@@ -72,9 +74,19 @@ public IgniteExchange(RelInput input) {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rowCount = mq.getRowCount(this);
-        double bytesPerRow = getRowType().getFieldCount() * 4 * (TraitUtils.distribution(this) == IgniteDistributions.broadcast() ? 10 : 1);
-        return planner.getCostFactory().makeCost(rowCount * bytesPerRow, rowCount, 0);
+        double rowCount = mq.getRowCount(getInput());
+        double bytesPerRow = getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE;
+        double totalBytes = rowCount * bytesPerRow;
+
+        IgniteCostFactory costFactory = (IgniteCostFactory)planner.getCostFactory();
+
+        if (RelDistributions.BROADCAST_DISTRIBUTED.equals(distribution))
+            // With broadcast distribution each row will be sent to the each distination node,
+            // thus the total bytes amount will be multiplies of the destination nodes count.
+            // We have no such information, so let's just multiply it by 5.
+            totalBytes *= 5;

Review comment:
       probably we need to replace 5 with IgniteCost.BROADCAST_FACTOR?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548847125



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/AbstractIndexScan.java
##########
@@ -148,6 +152,39 @@ public String indexName() {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        return super.computeSelfCost(planner, mq).plus(planner.getCostFactory().makeTinyCost());
+        double rows = table.getRowCount();
+
+        double cost = rows * IgniteCost.ROW_PASS_THROUGH_COST;

Review comment:
       yep, but I would prefer to left this as is, If you don't mind




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548836015



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorTest.java
##########
@@ -99,26 +99,28 @@ public void testCountWithJoin() throws Exception {
         Map<Integer, RISK> mRisk = new HashMap<>(65000);
 
         for (int i = 0; i < 65000; i++)
-            mRisk.put(1, new RISK(i));
+            mRisk.put(i, new RISK(i));
 
         RISK.putAll(mRisk);
 
         Map<Integer, TRADE> mTrade = new HashMap<>(200);
 
         for (int i = 0; i < 200; i++)
-            mTrade.put(1, new TRADE(i));
+            mTrade.put(i, new TRADE(i));
 
         TRADE.putAll(mTrade);
 
         for (int i = 0; i < 80; i++)
-            BATCH.put(1, new BATCH(i));
+            BATCH.put(i, new BATCH(i));
 
         awaitPartitionMapExchange(true, true, null);
 
-        QueryEngine engine = Commons.lookupComponent(grid(1).context(), QueryEngine.class);
+        QueryEngine engine = Commons.lookupComponent(ignite.context(), QueryEngine.class);

Review comment:
       hope we need to extend this and lower tests, append additional call from server nodes and check results for equality.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] dspavlov commented on pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
dspavlov commented on pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#issuecomment-894333882


   This PR is associated with a resolved ticket. Closing the PR, please reopen it if you still need it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548842096



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/AbstractIndexScan.java
##########
@@ -148,6 +152,39 @@ public String indexName() {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        return super.computeSelfCost(planner, mq).plus(planner.getCostFactory().makeTinyCost());
+        double rows = table.getRowCount();
+
+        double cost = rows * IgniteCost.ROW_PASS_THROUGH_COST;

Review comment:
       u can place this cost computation under "else" scope.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548840957



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorTest.java
##########
@@ -99,26 +99,28 @@ public void testCountWithJoin() throws Exception {
         Map<Integer, RISK> mRisk = new HashMap<>(65000);
 
         for (int i = 0; i < 65000; i++)
-            mRisk.put(1, new RISK(i));
+            mRisk.put(i, new RISK(i));
 
         RISK.putAll(mRisk);
 
         Map<Integer, TRADE> mTrade = new HashMap<>(200);
 
         for (int i = 0; i < 200; i++)
-            mTrade.put(1, new TRADE(i));
+            mTrade.put(i, new TRADE(i));
 
         TRADE.putAll(mTrade);
 
         for (int i = 0; i < 80; i++)
-            BATCH.put(1, new BATCH(i));
+            BATCH.put(i, new BATCH(i));
 
         awaitPartitionMapExchange(true, true, null);
 
-        QueryEngine engine = Commons.lookupComponent(grid(1).context(), QueryEngine.class);
+        QueryEngine engine = Commons.lookupComponent(ignite.context(), QueryEngine.class);

Review comment:
       think it should be done under separate ticket




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548838646



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteTrimExchange.java
##########
@@ -87,8 +94,10 @@ public IgniteTrimExchange(RelInput input) {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rowCount = mq.getRowCount(this);
-        return planner.getCostFactory().makeCost(rowCount, rowCount, 0);
+        double rowCount = mq.getRowCount(getInput());
+
+        return planner.getCostFactory().makeCost(rowCount,
+            rowCount * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0);

Review comment:
       not obvious here, can u explain plz ? why : IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] dspavlov closed pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
dspavlov closed pull request #8590:
URL: https://github.com/apache/ignite/pull/8590


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548844416



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteTrimExchange.java
##########
@@ -87,8 +94,10 @@ public IgniteTrimExchange(RelInput input) {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rowCount = mq.getRowCount(this);
-        return planner.getCostFactory().makeCost(rowCount, rowCount, 0);
+        double rowCount = mq.getRowCount(getInput());
+
+        return planner.getCostFactory().makeCost(rowCount,
+            rowCount * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0);

Review comment:
       TrimExchange just filter out rows which don't met the distribution function's. So the cost function is the same as for IgniteFilter




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548868952



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteLimit.java
##########
@@ -99,44 +101,45 @@ public IgniteLimit(
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rows = estimateRowCount(mq);
+        double inputRowCount = mq.getRowCount(getInput());
+
+        int lim = intFromRex(fetch);
+        int off = intFromRex(offset);
+
+        double rows = Math.min(lim + off, inputRowCount);
 
-        return planner.getCostFactory().makeCost(rows, 0, 0);
+        return planner.getCostFactory().makeCost(rows, rows * IgniteCost.ROW_PASS_THROUGH_COST, 0);
     }
 
     /** {@inheritDoc} */
     @Override public double estimateRowCount(RelMetadataQuery mq) {
-        Integer lim = intFromRex(fetch);
-        Integer off = intFromRex(offset);
+        double inputRowCount = mq.getRowCount(getInput());
 
-        if (lim == null) {
-            // If estimated rowcount is less than offset return 0
-            if (off == null)
-                return getInput().estimateRowCount(mq) * 0.01;

Review comment:
       ok, I've return this back




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548845775



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteExchange.java
##########
@@ -72,9 +74,19 @@ public IgniteExchange(RelInput input) {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rowCount = mq.getRowCount(this);
-        double bytesPerRow = getRowType().getFieldCount() * 4 * (TraitUtils.distribution(this) == IgniteDistributions.broadcast() ? 10 : 1);
-        return planner.getCostFactory().makeCost(rowCount * bytesPerRow, rowCount, 0);
+        double rowCount = mq.getRowCount(getInput());
+        double bytesPerRow = getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE;
+        double totalBytes = rowCount * bytesPerRow;
+
+        IgniteCostFactory costFactory = (IgniteCostFactory)planner.getCostFactory();
+
+        if (RelDistributions.BROADCAST_DISTRIBUTED.equals(distribution))
+            // With broadcast distribution each row will be sent to the each distination node,
+            // thus the total bytes amount will be multiplies of the destination nodes count.
+            // We have no such information, so let's just multiply it by 5.
+            totalBytes *= 5;
+
+        return costFactory.makeCost(rowCount, rowCount * IgniteCost.ROW_PASS_THROUGH_COST, 0D, 0D, totalBytes);

Review comment:
       fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548840935



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteExchange.java
##########
@@ -72,9 +74,19 @@ public IgniteExchange(RelInput input) {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rowCount = mq.getRowCount(this);
-        double bytesPerRow = getRowType().getFieldCount() * 4 * (TraitUtils.distribution(this) == IgniteDistributions.broadcast() ? 10 : 1);
-        return planner.getCostFactory().makeCost(rowCount * bytesPerRow, rowCount, 0);
+        double rowCount = mq.getRowCount(getInput());
+        double bytesPerRow = getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE;
+        double totalBytes = rowCount * bytesPerRow;
+
+        IgniteCostFactory costFactory = (IgniteCostFactory)planner.getCostFactory();
+
+        if (RelDistributions.BROADCAST_DISTRIBUTED.equals(distribution))
+            // With broadcast distribution each row will be sent to the each distination node,
+            // thus the total bytes amount will be multiplies of the destination nodes count.
+            // We have no such information, so let's just multiply it by 5.
+            totalBytes *= 5;
+
+        return costFactory.makeCost(rowCount, rowCount * IgniteCost.ROW_PASS_THROUGH_COST, 0D, 0D, totalBytes);

Review comment:
       lower case notation more frequent 0d, but it`s up to u of course.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548869041



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteExchange.java
##########
@@ -72,9 +74,19 @@ public IgniteExchange(RelInput input) {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rowCount = mq.getRowCount(this);
-        double bytesPerRow = getRowType().getFieldCount() * 4 * (TraitUtils.distribution(this) == IgniteDistributions.broadcast() ? 10 : 1);
-        return planner.getCostFactory().makeCost(rowCount * bytesPerRow, rowCount, 0);
+        double rowCount = mq.getRowCount(getInput());
+        double bytesPerRow = getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE;
+        double totalBytes = rowCount * bytesPerRow;
+
+        IgniteCostFactory costFactory = (IgniteCostFactory)planner.getCostFactory();
+
+        if (RelDistributions.BROADCAST_DISTRIBUTED.equals(distribution))
+            // With broadcast distribution each row will be sent to the each distination node,
+            // thus the total bytes amount will be multiplies of the destination nodes count.
+            // We have no such information, so let's just multiply it by 5.
+            totalBytes *= 5;

Review comment:
       fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548836680



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteBasicSecondaryIndexIntegrationTest.java
##########
@@ -647,7 +650,7 @@ public void testOrderByNameCityDesc() {
     @Test
     public void testOrderByNoIndexedColumn() {
         assertQuery("SELECT * FROM Developer ORDER BY age DESC")
-            .matches(containsTableScan("PUBLIC", "DEVELOPER"))

Review comment:
       possibly we need to append additional check for IndexScan usage here and all appropriate tests? If it`s beyond the scope of this ticket may be we need additional one?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548841625



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteBasicSecondaryIndexIntegrationTest.java
##########
@@ -120,10 +121,11 @@ public void testIndexLoopJoin() {
             .check();
     }
 
+    /** */
     @Test
     public void testMergeJoin() {
         assertQuery("" +
-            "SELECT d1.name, d2.name FROM Developer d1, Developer d2 WHERE d1.depId = d2.depId")
+            "SELECT /*+ DISABLE_RULE('CorrelatedNestedLoopJoin') */ d1.name, d2.name FROM Developer d1, Developer d2 WHERE d1.depId = d2.depId")

Review comment:
       because in the middle of the task progress this test was failing several times because of changed plan. Since this test should verify only correctness of MergeJoin execution, I think it's OK to disable other algorithms explicitly




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548841625



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteBasicSecondaryIndexIntegrationTest.java
##########
@@ -120,10 +121,11 @@ public void testIndexLoopJoin() {
             .check();
     }
 
+    /** */
     @Test
     public void testMergeJoin() {
         assertQuery("" +
-            "SELECT d1.name, d2.name FROM Developer d1, Developer d2 WHERE d1.depId = d2.depId")
+            "SELECT /*+ DISABLE_RULE('CorrelatedNestedLoopJoin') */ d1.name, d2.name FROM Developer d1, Developer d2 WHERE d1.depId = d2.depId")

Review comment:
       because in the middle of the task progress this test fails several times because of changed plan. Since this test should verify only correctness of MergeJoin execution, I think it's OK to disable other algorithms explicitly




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548836840



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteBasicSecondaryIndexIntegrationTest.java
##########
@@ -120,10 +121,11 @@ public void testIndexLoopJoin() {
             .check();
     }
 
+    /** */
     @Test
     public void testMergeJoin() {
         assertQuery("" +
-            "SELECT d1.name, d2.name FROM Developer d1, Developer d2 WHERE d1.depId = d2.depId")
+            "SELECT /*+ DISABLE_RULE('CorrelatedNestedLoopJoin') */ d1.name, d2.name FROM Developer d1, Developer d2 WHERE d1.depId = d2.depId")

Review comment:
       why do we need it here? test passed without this change too.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548828108



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteLimit.java
##########
@@ -99,44 +101,45 @@ public IgniteLimit(
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-        double rows = estimateRowCount(mq);
+        double inputRowCount = mq.getRowCount(getInput());
+
+        int lim = intFromRex(fetch);
+        int off = intFromRex(offset);
+
+        double rows = Math.min(lim + off, inputRowCount);
 
-        return planner.getCostFactory().makeCost(rows, 0, 0);
+        return planner.getCostFactory().makeCost(rows, rows * IgniteCost.ROW_PASS_THROUGH_COST, 0);
     }
 
     /** {@inheritDoc} */
     @Override public double estimateRowCount(RelMetadataQuery mq) {
-        Integer lim = intFromRex(fetch);
-        Integer off = intFromRex(offset);
+        double inputRowCount = mq.getRowCount(getInput());
 
-        if (lim == null) {
-            // If estimated rowcount is less than offset return 0
-            if (off == null)
-                return getInput().estimateRowCount(mq) * 0.01;

Review comment:
       0.01 here is due to we can`t (probably it`s possible but not implemented yet) calculate if we have DYNAMIC_PARAM or CALCULATED here, i think we need to preserve it here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] korlov42 commented on a change in pull request #8590: IGNITE-12819 Calcite integration. Cost system

Posted by GitBox <gi...@apache.org>.
korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548845062



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteBasicSecondaryIndexIntegrationTest.java
##########
@@ -647,7 +650,7 @@ public void testOrderByNameCityDesc() {
     @Test
     public void testOrderByNoIndexedColumn() {
         assertQuery("SELECT * FROM Developer ORDER BY age DESC")
-            .matches(containsTableScan("PUBLIC", "DEVELOPER"))

Review comment:
       We don't. Every test should have only those checks which verifies a state the current test is suppose to verify.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org