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

2019-08-15 Thread GitBox
hsyuan commented on a change in pull request #1354: [CALCITE-482] Implement sql 
and planner hints
URL: https://github.com/apache/calcite/pull/1354#discussion_r311818673
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/rel/hint/HintStrategy.java
 ##
 @@ -0,0 +1,74 @@
+/*
+ * 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.rel.RelNode;
+import org.apache.calcite.rel.core.Join;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.core.TableScan;
+
+/**
+ * A {@code HintStrategy} indicates which kind of {@link 
org.apache.calcite.rel.RelNode} the
+ * hint can apply to.
+ *
+ * Typically, every supported hints should register a {@code HintStrategy}
+ * in the {@link HintStrategies}. For example, {@link HintStrategy#JOIN} 
implies that this hint
+ * would be propagated and applied to the {@link 
org.apache.calcite.rel.core.Join}
+ * relational expressions.
+ *
+ * In {@link HintStrategies} this enumeration is applied to
+ * hints registration. Only one kind of {@code HintStrategy} is supported for 
each hint
+ * right now.
+ *
+ * @see HintStrategies
+ */
+public enum HintStrategy {
+  /**
+   * The hint is used for the whole query, kind of like a query config.
+   * This kind of hints would never be propagated.
+   */
+  QUERY(RelNode.class),
 
 Review comment:
   It is more like `SET_VAR`.


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2019-08-15 Thread GitBox
hsyuan commented on a change in pull request #1354: [CALCITE-482] Implement sql 
and planner hints
URL: https://github.com/apache/calcite/pull/1354#discussion_r311816950
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/rel/hint/HintStrategy.java
 ##
 @@ -0,0 +1,74 @@
+/*
+ * 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.rel.RelNode;
+import org.apache.calcite.rel.core.Join;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.core.TableScan;
+
+/**
+ * A {@code HintStrategy} indicates which kind of {@link 
org.apache.calcite.rel.RelNode} the
+ * hint can apply to.
+ *
+ * Typically, every supported hints should register a {@code HintStrategy}
+ * in the {@link HintStrategies}. For example, {@link HintStrategy#JOIN} 
implies that this hint
+ * would be propagated and applied to the {@link 
org.apache.calcite.rel.core.Join}
+ * relational expressions.
+ *
+ * In {@link HintStrategies} this enumeration is applied to
+ * hints registration. Only one kind of {@code HintStrategy} is supported for 
each hint
+ * right now.
+ *
+ * @see HintStrategies
+ */
+public enum HintStrategy {
+  /**
+   * The hint is used for the whole query, kind of like a query config.
+   * This kind of hints would never be propagated.
+   */
+  QUERY(RelNode.class),
+  /**
+   * The hint would be propagated to the Join nodes.
+   */
+  JOIN(Join.class),
+  /**
+   * The hint would be propagated to the TableScan nodes.
+   */
+  TABLE_SCAN(TableScan.class),
+  /**
+   * The hint would be propagated to the Project nodes.
+   */
+  PROJECT(Project.class);
 
 Review comment:
   What is this for? Any example?


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:
us...@infra.apache.org


With regards,
Apache Git Services


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

2019-08-15 Thread GitBox
hsyuan commented on a change in pull request #1354: [CALCITE-482] Implement sql 
and planner hints
URL: https://github.com/apache/calcite/pull/1354#discussion_r311817703
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/rel/hint/HintStrategy.java
 ##
 @@ -0,0 +1,74 @@
+/*
+ * 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.rel.RelNode;
+import org.apache.calcite.rel.core.Join;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.core.TableScan;
+
+/**
+ * A {@code HintStrategy} indicates which kind of {@link 
org.apache.calcite.rel.RelNode} the
+ * hint can apply to.
+ *
+ * Typically, every supported hints should register a {@code HintStrategy}
+ * in the {@link HintStrategies}. For example, {@link HintStrategy#JOIN} 
implies that this hint
+ * would be propagated and applied to the {@link 
org.apache.calcite.rel.core.Join}
+ * relational expressions.
+ *
+ * In {@link HintStrategies} this enumeration is applied to
+ * hints registration. Only one kind of {@code HintStrategy} is supported for 
each hint
+ * right now.
+ *
+ * @see HintStrategies
+ */
+public enum HintStrategy {
+  /**
+   * The hint is used for the whole query, kind of like a query config.
+   * This kind of hints would never be propagated.
+   */
+  QUERY(RelNode.class),
+  /**
+   * The hint would be propagated to the Join nodes.
+   */
+  JOIN(Join.class),
+  /**
+   * The hint would be propagated to the TableScan nodes.
+   */
+  TABLE_SCAN(TableScan.class),
+  /**
+   * The hint would be propagated to the Project nodes.
+   */
+  PROJECT(Project.class);
+
+  private Class relClass;
+
+  HintStrategy(Class relClass) {
 
 Review comment:
   `HintStrategy` is confusing, `HintType` is more appropriate.


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:
us...@infra.apache.org


With regards,
Apache Git Services