Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
952 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
core/src/main/java/org/apache/calcite/rel/hint/ExplicitHintMatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}. | ||
* | ||
* @see ExplicitHintStrategy | ||
* @see HintStrategyTable | ||
*/ | ||
public interface ExplicitHintMatcher extends Function2<RelHint, RelNode, Boolean> { | ||
} | ||
|
||
// End ExplicitHintMatcher.java |
49 changes: 49 additions & 0 deletions
49
core/src/main/java/org/apache/calcite/rel/hint/ExplicitHintStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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; | ||
|
||
/** | ||
* A hint strategy whose rules are totally customized. | ||
* | ||
* @see ExplicitHintMatcher | ||
*/ | ||
public class ExplicitHintStrategy implements HintStrategy { | ||
//~ Instance fields -------------------------------------------------------- | ||
|
||
private final ExplicitHintMatcher matcher; | ||
|
||
/** | ||
* Creates a ExplicitHintStrategy with specified {@code matcher}. | ||
* | ||
* @param matcher ExplicitHintMatcher instance to test | ||
* if a hint can be applied to a rel. | ||
*/ | ||
ExplicitHintStrategy(ExplicitHintMatcher matcher) { | ||
this.matcher = matcher; | ||
} | ||
|
||
//~ Methods ---------------------------------------------------------------- | ||
|
||
@Override public boolean supportsRel(RelHint hint, RelNode rel) { | ||
return this.matcher.apply(hint, rel); | ||
} | ||
} | ||
|
||
// End ExplicitHintStrategy.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.