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 2021/01/20 08:54:47 UTC

[GitHub] [ignite] zstan opened a new pull request #8678: IGNITE-13566

zstan opened a new pull request #8678:
URL: https://github.com/apache/ignite/pull/8678


   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 #8678: IGNITE-13566

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



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/AbstractIndexScan.java
##########
@@ -132,15 +132,15 @@ public String indexName() {
             cost = 0;
 
             if (lowerCondition() != null) {
-                double selectivity0 = mq.getSelectivity(this, RexUtil.composeDisjunction(builder, lowerCondition()));
+                double selectivity0 = mq.getSelectivity(this, RexUtil.composeConjunction(builder, lowerCondition()));
 
                 selectivity -= 1 - selectivity0;
 
                 cost += Math.log(rows);
             }
 
-            if (upperCondition() != null) {
-                double selectivity0 = mq.getSelectivity(this, RexUtil.composeDisjunction(builder, upperCondition()));
+            if (upperCondition() != null && lowerCondition() != null && !lowerCondition().equals(upperCondition())) {

Review comment:
       discussed in private, i don`t touch this place.




----------------------------------------------------------------
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] Berkof commented on a change in pull request #8678: IGNITE-13566

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



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/OrToUnionRuleTest.java
##########
@@ -224,7 +238,7 @@ public void testNonIndexedOrToUnionAllRewrite() throws Exception {
      * @throws Exception If failed.
      */
     @Test
-    @Ignore("https://issues.apache.org/jira/browse/IGNITE-12819")
+    //@Ignore("https://issues.apache.org/jira/browse/IGNITE-12819")

Review comment:
       Commented code




----------------------------------------------------------------
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 #8678: IGNITE-13566

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



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/TableDescriptorImpl.java
##########
@@ -678,4 +678,11 @@ private FieldDescriptor(GridQueryProperty desc, int fieldIdx) {
             desc.setValue(key0, val0, val);
         }
     }
+
+    /**
+     * @return Type description.
+     */
+    @Override public GridQueryTypeDescriptor typeDescription() {

Review comment:
       ```suggestion
       /** {@inheritDoc} */
       @Override public GridQueryTypeDescriptor typeDescription() {
   ```

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
##########
@@ -2871,6 +2871,10 @@ private void checkxEnabled() throws IgniteException {
         });
     }
 
+    public boolean useExperimentalEngine() {
+        return experimentalQueryEngine != null/* && useExperimentalSqlEngine*/;

Review comment:
       commented code

##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/SqlFieldsQueryUsageTest.java
##########
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query.calcite;
+
+import java.util.List;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.AfterClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static java.util.Collections.singletonList;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_EXPERIMENTAL_SQL_ENGINE;
+
+/** */
+@WithSystemProperty(key = IGNITE_EXPERIMENTAL_SQL_ENGINE, value = "true")
+public class SqlFieldsQueryUsageTest extends GridCommonAbstractTest {
+    /** */
+    private static IgniteEx client;
+
+    /** */
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrids(1);
+
+        client = startClientGrid();
+    }
+
+    /** */
+    @AfterClass
+    public static void tearDown() {
+        G.stopAll(false);
+    }
+
+    /**
+     * Temporary redirects create|drop|alter commands into h2 engine.
+     */
+    @Test
+    public void testUseH2Functionality() {
+        execute(grid(0), "CREATE TABLE IF NOT EXISTS Person(\"id\" INT, PRIMARY KEY(\"id\"), \"name\" VARCHAR)");
+
+        execute(grid(0), "alter table Person add column age int");
+        execute(grid(0),"drop table Person");

Review comment:
       ```suggestion
           execute(grid(0), "drop table Person");
   ```

##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/SqlFieldsQueryUsageTest.java
##########
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query.calcite;
+
+import java.util.List;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.AfterClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static java.util.Collections.singletonList;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_EXPERIMENTAL_SQL_ENGINE;
+
+/** */
+@WithSystemProperty(key = IGNITE_EXPERIMENTAL_SQL_ENGINE, value = "true")
+public class SqlFieldsQueryUsageTest extends GridCommonAbstractTest {
+    /** */
+    private static IgniteEx client;
+
+    /** */
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrids(1);
+
+        client = startClientGrid();
+    }
+
+    /** */
+    @AfterClass
+    public static void tearDown() {
+        G.stopAll(false);
+    }
+
+    /**
+     * Temporary redirects create|drop|alter commands into h2 engine.
+     */
+    @Test
+    public void testUseH2Functionality() {
+        execute(grid(0), "CREATE TABLE IF NOT EXISTS Person(\"id\" INT, PRIMARY KEY(\"id\"), \"name\" VARCHAR)");
+
+        execute(grid(0), "alter table Person add column age int");
+        execute(grid(0),"drop table Person");
+    }
+
+    /** */
+    @Ignore("https://issues.apache.org/jira/browse/IGNITE-14019")
+    @Test
+    public void createCacheOnSrvCallOnCli() {
+        QueryEntity projEntity = new QueryEntity();
+        projEntity.setKeyType(Integer.class.getName());
+        projEntity.setKeyFieldName("id");
+        projEntity.setValueType(Integer.class.getName());
+        projEntity.addQueryField("id", Integer.class.getName(), null);
+        projEntity.addQueryField("depId", Integer.class.getName(), null);
+
+        projEntity.setTableName("Developer");
+
+        CacheConfiguration<Integer, Integer> projCfg =
+            new CacheConfiguration<Integer, Integer>(projEntity.getTableName())
+                .setQueryEntities(singletonList(projEntity))
+                .setSqlSchema("PUBLIC");
+
+        IgniteCache<Integer, Integer> devCache = grid(0).createCache(projCfg);
+
+        assertFalse(grid(0).configuration().isClientMode());
+
+        devCache.put(1, 2);
+
+        assertEquals(1, execute(client,"SELECT * FROM Developer").size());;

Review comment:
       ```suggestion
           assertEquals(1, execute(client, "SELECT * FROM Developer").size());;
   ```

##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/AbstractIndexScan.java
##########
@@ -132,15 +132,15 @@ public String indexName() {
             cost = 0;
 
             if (lowerCondition() != null) {
-                double selectivity0 = mq.getSelectivity(this, RexUtil.composeDisjunction(builder, lowerCondition()));
+                double selectivity0 = mq.getSelectivity(this, RexUtil.composeConjunction(builder, lowerCondition()));
 
                 selectivity -= 1 - selectivity0;
 
                 cost += Math.log(rows);
             }
 
-            if (upperCondition() != null) {
-                double selectivity0 = mq.getSelectivity(this, RexUtil.composeDisjunction(builder, upperCondition()));
+            if (upperCondition() != null && lowerCondition() != null && !lowerCondition().equals(upperCondition())) {

Review comment:
       > !lowerCondition().equals(upperCondition())
   this doesn't work with condition, only with bounds. I think it's be better to leave it as is for now and fix it under https://issues.apache.org/jira/browse/IGNITE-14034




----------------------------------------------------------------
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 #8678: IGNITE-13566

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


   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] Berkof commented on a change in pull request #8678: IGNITE-13566

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
##########
@@ -2871,6 +2871,10 @@ private void checkxEnabled() throws IgniteException {
         });
     }
 
+    public boolean useExperimentalEngine() {

Review comment:
       javadoc




----------------------------------------------------------------
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 #8678: IGNITE-13566

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


   


-- 
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