korlov42 commented on a change in pull request #9276:
URL: https://github.com/apache/ignite/pull/9276#discussion_r694865270



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdSelectivity.java
##########
@@ -17,83 +17,94 @@
 
 package org.apache.ignite.internal.processors.query.calcite.metadata;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.math.MathContext;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.volcano.RelSubset;
+import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider;
+import org.apache.calcite.rel.metadata.RelColumnOrigin;
 import org.apache.calcite.rel.metadata.RelMdSelectivity;
 import org.apache.calcite.rel.metadata.RelMdUtil;
 import org.apache.calcite.rel.metadata.RelMetadataProvider;
 import org.apache.calcite.rel.metadata.RelMetadataQuery;
+import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexLocalRef;
 import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexUtil;
+import org.apache.calcite.rex.RexSlot;
+import org.apache.calcite.schema.Statistic;
 import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.type.BasicSqlType;
+import org.apache.calcite.sql.type.SqlTypeFamily;
 import org.apache.calcite.util.BuiltInMethod;
-import 
org.apache.ignite.internal.processors.query.calcite.rel.AbstractIndexScan;
+import org.apache.calcite.util.DateString;
+import org.apache.calcite.util.TimeString;
+import org.apache.calcite.util.TimestampString;
+import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.internal.processors.query.calcite.rel.IgniteExchange;
 import 
org.apache.ignite.internal.processors.query.calcite.rel.IgniteHashIndexSpool;
 import 
org.apache.ignite.internal.processors.query.calcite.rel.IgniteSortedIndexSpool;
+import 
org.apache.ignite.internal.processors.query.calcite.rel.IgniteTableSpool;
 import 
org.apache.ignite.internal.processors.query.calcite.rel.ProjectableFilterableTableScan;
+import 
org.apache.ignite.internal.processors.query.calcite.schema.IgniteStatisticsImpl;
+import org.apache.ignite.internal.processors.query.calcite.schema.IgniteTable;
+import 
org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
+import org.apache.ignite.internal.processors.query.calcite.util.Commons;
 import org.apache.ignite.internal.processors.query.calcite.util.RexUtils;
-import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.processors.query.stat.ColumnStatistics;
+import org.h2.value.Value;
 
 /** */
 public class IgniteMdSelectivity extends RelMdSelectivity {
-    /** */
-    public static final RelMetadataProvider SOURCE =
-        ReflectiveRelMetadataProvider.reflectiveSource(
-            BuiltInMethod.SELECTIVITY.method, new IgniteMdSelectivity());
-
-    /** */
-    public Double getSelectivity(AbstractIndexScan rel, RelMetadataQuery mq, 
RexNode predicate) {
-        if (predicate != null)
-            return getSelectivity((ProjectableFilterableTableScan)rel, mq, 
predicate);
+    /** Default selectivity for is null conditions. */
+    private static final double IS_NULL_SELECTIVITY = 0.1;
 
-        List<RexNode> lowerCond = rel.lowerCondition();
-        List<RexNode> upperCond = rel.upperCondition();
+    /** Default selectivity for is not null confitions. */

Review comment:
       ```suggestion
       /** Default selectivity for IS NOT NULL conditions. */
   ```

##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdSelectivity.java
##########
@@ -17,83 +17,94 @@
 
 package org.apache.ignite.internal.processors.query.calcite.metadata;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.math.MathContext;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.volcano.RelSubset;
+import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider;
+import org.apache.calcite.rel.metadata.RelColumnOrigin;
 import org.apache.calcite.rel.metadata.RelMdSelectivity;
 import org.apache.calcite.rel.metadata.RelMdUtil;
 import org.apache.calcite.rel.metadata.RelMetadataProvider;
 import org.apache.calcite.rel.metadata.RelMetadataQuery;
+import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexLocalRef;
 import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexUtil;
+import org.apache.calcite.rex.RexSlot;
+import org.apache.calcite.schema.Statistic;
 import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.type.BasicSqlType;
+import org.apache.calcite.sql.type.SqlTypeFamily;
 import org.apache.calcite.util.BuiltInMethod;
-import 
org.apache.ignite.internal.processors.query.calcite.rel.AbstractIndexScan;
+import org.apache.calcite.util.DateString;
+import org.apache.calcite.util.TimeString;
+import org.apache.calcite.util.TimestampString;
+import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.internal.processors.query.calcite.rel.IgniteExchange;
 import 
org.apache.ignite.internal.processors.query.calcite.rel.IgniteHashIndexSpool;
 import 
org.apache.ignite.internal.processors.query.calcite.rel.IgniteSortedIndexSpool;
+import 
org.apache.ignite.internal.processors.query.calcite.rel.IgniteTableSpool;
 import 
org.apache.ignite.internal.processors.query.calcite.rel.ProjectableFilterableTableScan;
+import 
org.apache.ignite.internal.processors.query.calcite.schema.IgniteStatisticsImpl;
+import org.apache.ignite.internal.processors.query.calcite.schema.IgniteTable;
+import 
org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
+import org.apache.ignite.internal.processors.query.calcite.util.Commons;
 import org.apache.ignite.internal.processors.query.calcite.util.RexUtils;
-import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.processors.query.stat.ColumnStatistics;
+import org.h2.value.Value;
 
 /** */
 public class IgniteMdSelectivity extends RelMdSelectivity {
-    /** */
-    public static final RelMetadataProvider SOURCE =
-        ReflectiveRelMetadataProvider.reflectiveSource(
-            BuiltInMethod.SELECTIVITY.method, new IgniteMdSelectivity());
-
-    /** */
-    public Double getSelectivity(AbstractIndexScan rel, RelMetadataQuery mq, 
RexNode predicate) {
-        if (predicate != null)
-            return getSelectivity((ProjectableFilterableTableScan)rel, mq, 
predicate);
+    /** Default selectivity for is null conditions. */

Review comment:
       ```suggestion
       /** Default selectivity for IS NULL conditions. */
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to