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/04/07 10:41:59 UTC

[GitHub] [ignite] tledkov-gridgain commented on a change in pull request #8959: IGNITE-13546 Calcite integration. Hash index spool

tledkov-gridgain commented on a change in pull request #8959:
URL: https://github.com/apache/ignite/pull/8959#discussion_r608540397



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteHashIndexSpool.java
##########
@@ -0,0 +1,142 @@
+/*
+ * 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.rel;
+
+import java.util.List;
+
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelOptCost;
+import org.apache.calcite.plan.RelOptPlanner;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelInput;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.RelWriter;
+import org.apache.calcite.rel.core.Spool;
+import org.apache.calcite.rel.metadata.RelMetadataQuery;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.util.ImmutableBitSet;
+import org.apache.ignite.internal.processors.query.calcite.metadata.cost.IgniteCost;
+import org.apache.ignite.internal.processors.query.calcite.metadata.cost.IgniteCostFactory;
+import org.apache.ignite.internal.processors.query.calcite.util.RexUtils;
+import org.apache.ignite.internal.util.typedef.F;
+
+/**
+ * Relational operator that returns the sorted contents of a table
+ * and allow to lookup rows by specified bounds.
+ */
+public class IgniteHashIndexSpool extends Spool implements IgniteRel {
+    /** Search row. */
+    private final List<RexNode> searchRow;
+
+    /** Search row. */
+    private final ImmutableBitSet keys;
+
+    /** Condition (used to calculate selectivity). */
+    private final RexNode cond;
+
+    /** */
+    public IgniteHashIndexSpool(
+        RelOptCluster cluster,
+        RelTraitSet traits,
+        RelNode input,
+        List<RexNode> searchRow,
+        RexNode cond
+    ) {
+        super(cluster, traits, input, Type.LAZY, Type.EAGER);
+
+        assert !F.isEmpty(searchRow);
+
+        this.searchRow = searchRow;
+        this.cond = cond;
+
+        keys = ImmutableBitSet.of(RexUtils.notNullKeys(searchRow));
+    }
+
+    /**
+     * Constructor used for deserialization.
+     *
+     * @param input Serialized representation.
+     */
+    public IgniteHashIndexSpool(RelInput input) {
+        this(input.getCluster(),
+            input.getTraitSet().replace(IgniteConvention.INSTANCE),
+            input.getInputs().get(0),
+            input.getExpressionList("searchRow"),
+            null

Review comment:
       I think yes. See he comment on `cond` field. Now this field and the conditions fields of the `IndexConditions` are used only on the optimize phase to calculate selectivity. Later we have to allow calculate selectivity by bounds and hash keys.




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