You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/10/15 18:45:55 UTC

[GitHub] [calcite] xndai commented on a change in pull request #1354: [CALCITE-482] Implement sql and planner hints

xndai commented on a change in pull request #1354: [CALCITE-482] Implement sql and planner hints
URL: https://github.com/apache/calcite/pull/1354#discussion_r335108367
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/hint/ExplicitHintMatcher.java
 ##########
 @@ -0,0 +1,41 @@
+/*
+ * 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.calcite.rel.hint;
+
+import org.apache.calcite.linq4j.function.Function2;
+import org.apache.calcite.rel.RelNode;
+
+/**
+ * A function to customize whether a relational expression should match a hint.
+ *
+ * <p>Usually you may not need to implement this function, a {@link NodeTypeHintStrategy} is enough
+ * for most of the {@link RelHint}s.
+ *
+ * <p>Some of the hints can only be matched to the relational
+ * expression with special match conditions(not only the relational expression type).
+ * i.e. "hash_join(r, st)", this hint can only be applied to JOIN expression that
+ * has "r" and "st" as the input table names. To implement this, you may need to customize an
+ * {@link ExplicitHintStrategy} with an {@link ExplicitHintMatcher}.
 
 Review comment:
   For example like hash_join(r, st), I think a better solution will be attaching this hint to the particular join node during parsing phase. With current design, it's still too much burden on the user to build a custom matcher for handling cases like this. 

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


With regards,
Apache Git Services