-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conjunction check for skipping and covering index
Signed-off-by: Chen Dai <[email protected]>
- Loading branch information
Showing
6 changed files
with
88 additions
and
10 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkIndexUtils.scala
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 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.flint.spark | ||
|
||
import org.apache.spark.sql.catalyst.expressions.{Expression, Or} | ||
import org.apache.spark.sql.functions.expr | ||
|
||
/** | ||
* Flint Spark index utility methods. | ||
*/ | ||
object FlintSparkIndexUtils { | ||
|
||
/** | ||
* Is the given Spark predicate string a conjunction | ||
* | ||
* @param condition | ||
* predicate condition string | ||
* @return | ||
* true if yes, otherwise false | ||
*/ | ||
def isConjunction(condition: String): Boolean = { | ||
isConjunction(expr(condition).expr) | ||
} | ||
|
||
/** | ||
* Is the given Spark predicate a conjunction | ||
* | ||
* @param condition | ||
* predicate condition | ||
* @return | ||
* true if yes, otherwise false | ||
*/ | ||
def isConjunction(condition: Expression): Boolean = { | ||
condition.collectFirst { case Or(_, _) => | ||
true | ||
}.isEmpty | ||
} | ||
} |
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