-
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.
Implement index refresh options validation
Signed-off-by: Chen Dai <[email protected]>
- Loading branch information
Showing
10 changed files
with
133 additions
and
54 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
32 changes: 32 additions & 0 deletions
32
flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkException.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,32 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.flint.spark | ||
|
||
/** | ||
* Flint Spark exception. | ||
*/ | ||
abstract class FlintSparkException(message: String, cause: Option[Throwable]) | ||
extends Throwable(message) {} | ||
|
||
object FlintSparkException { | ||
|
||
def requireValidation(requirement: Boolean, message: => Any): Unit = { | ||
if (!requirement) { | ||
throw new FlintSparkValidationException(message.toString) | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Flint Spark validation exception. | ||
* | ||
* @param message | ||
* error message | ||
* @param cause | ||
* exception causing the error | ||
*/ | ||
class FlintSparkValidationException(message: String, cause: Option[Throwable] = None) | ||
extends FlintSparkException(message, cause) |
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
18 changes: 18 additions & 0 deletions
18
flint-spark-integration/src/test/scala/org/apache/spark/sql/FlintTestSparkSession.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,18 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.apache.spark.sql | ||
|
||
import org.apache.spark.SparkConf | ||
import org.apache.spark.sql.hive.HiveSessionStateBuilder | ||
import org.apache.spark.sql.internal.SessionState | ||
import org.apache.spark.sql.test.TestSparkSession | ||
|
||
class FlintTestSparkSession(sparkConf: SparkConf) extends TestSparkSession(sparkConf) { | ||
|
||
override lazy val sessionState: SessionState = { | ||
new HiveSessionStateBuilder(this, None).build() | ||
} | ||
} |
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