-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JCBC-1171 Allow to add hints for hash and nested loop joins in Query dsl
Change-Id: Ib651726f38514adcc2fef150e41265ad81255299 Reviewed-on: http://review.couchbase.org/102501 Reviewed-by: David Nault <david.nault@couchbase.com> Tested-by: Subhashni Balakrishnan <b.subhashni@gmail.com>
- Loading branch information
1 parent
db9b353
commit 37dbcb9
Showing
6 changed files
with
184 additions
and
2 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/com/couchbase/client/java/query/dsl/element/NestedLoopJoinHintElement.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,34 @@ | ||
/* | ||
* Copyright (c) 2018 Couchbase, Inc. | ||
* | ||
* Licensed 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 com.couchbase.client.java.query.dsl.element; | ||
|
||
import com.couchbase.client.core.annotations.InterfaceAudience; | ||
import com.couchbase.client.core.annotations.InterfaceStability; | ||
|
||
/** | ||
* Hint to use Nested loop join | ||
* | ||
* @author Subhashni Balakrishnan | ||
*/ | ||
@InterfaceStability.Experimental | ||
@InterfaceAudience.Private | ||
public class NestedLoopJoinHintElement implements Element { | ||
|
||
@Override | ||
public String export() { | ||
return "USE NL"; | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
src/main/java/com/couchbase/client/java/query/dsl/path/HashJoinHintElement.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,45 @@ | ||
/* | ||
* Copyright (c) 2018 Couchbase, Inc. | ||
* | ||
* Licensed 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 com.couchbase.client.java.query.dsl.path; | ||
|
||
import java.util.Objects; | ||
|
||
import com.couchbase.client.core.annotations.InterfaceAudience; | ||
import com.couchbase.client.core.annotations.InterfaceStability; | ||
import com.couchbase.client.java.query.dsl.element.Element; | ||
|
||
/** | ||
* Hash Join hint for hash based join | ||
* | ||
* @author Subhashni Balakrishnan | ||
*/ | ||
@InterfaceStability.Experimental | ||
@InterfaceAudience.Private | ||
public class HashJoinHintElement implements Element { | ||
|
||
private final HashSide side; | ||
|
||
public HashJoinHintElement(HashSide side) { | ||
Objects.requireNonNull(side); | ||
this.side = side; | ||
} | ||
|
||
@Override | ||
public String export() { | ||
return "USE HASH(" + this.side + ")"; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/couchbase/client/java/query/dsl/path/HashSide.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,51 @@ | ||
/* | ||
* Copyright (c) 2018 Couchbase, Inc. | ||
* | ||
* Licensed 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 com.couchbase.client.java.query.dsl.path; | ||
|
||
import com.couchbase.client.core.annotations.InterfaceAudience; | ||
import com.couchbase.client.core.annotations.InterfaceStability; | ||
|
||
/** | ||
* Hash side for hash based join | ||
* | ||
* @author Subhashni Balakrishnan | ||
*/ | ||
@InterfaceStability.Experimental | ||
@InterfaceAudience.Public | ||
public enum HashSide { | ||
|
||
/** | ||
* The PROBE side will use that table to find matches and perform the join | ||
* */ | ||
PROBE("PROBE"), | ||
|
||
/** | ||
* The BUILD side of the join will be used to create an in-memory hash table | ||
* */ | ||
BUILD("BUILD"); | ||
|
||
private final String value; | ||
|
||
HashSide(String value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.value; | ||
} | ||
} |
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