-
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.
Signed-off-by: Louis Chu <[email protected]>
- Loading branch information
Showing
13 changed files
with
813 additions
and
524 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
flint-commons/src/main/scala/org/apache/spark/sql/QueryResultWriter.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,12 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.apache.spark.sql | ||
|
||
import org.opensearch.flint.common.model.FlintStatement | ||
|
||
trait QueryResultWriter { | ||
def writeDataFrame(dataFrame: DataFrame, flintStatement: FlintStatement): Unit | ||
} |
48 changes: 48 additions & 0 deletions
48
flint-commons/src/main/scala/org/apache/spark/sql/SessionManager.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,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.apache.spark.sql | ||
|
||
import org.opensearch.flint.common.model.{FlintStatement, InteractiveSession} | ||
|
||
import org.apache.spark.sql.SessionUpdateMode.SessionUpdateMode | ||
|
||
/** | ||
* Trait defining the interface for managing interactive sessions. | ||
*/ | ||
trait SessionManager { | ||
|
||
/** | ||
* Retrieves metadata about the session manager. | ||
*/ | ||
def getSessionContext: Map[String, Any] | ||
|
||
/** | ||
* Fetches the details of a specific session. | ||
*/ | ||
def getSessionDetails(sessionId: String): Option[InteractiveSession] | ||
|
||
/** | ||
* Updates the details of a specific session. | ||
*/ | ||
def updateSessionDetails( | ||
sessionDetails: InteractiveSession, | ||
updateMode: SessionUpdateMode): Unit | ||
|
||
/** | ||
* Retrieves the next statement to be executed in a specific session. | ||
*/ | ||
def getNextStatement(sessionId: String): Option[FlintStatement] | ||
|
||
/** | ||
* Records a heartbeat for a specific session to indicate it is still active. | ||
*/ | ||
def recordHeartbeat(sessionId: String): Unit | ||
} | ||
|
||
object SessionUpdateMode extends Enumeration { | ||
type SessionUpdateMode = Value | ||
val UPDATE, UPSERT, UPDATE_IF = Value | ||
} |
31 changes: 31 additions & 0 deletions
31
flint-commons/src/main/scala/org/apache/spark/sql/StatementLifecycleManager.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,31 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.apache.spark.sql | ||
|
||
import org.opensearch.flint.common.model.FlintStatement | ||
|
||
/** | ||
* Trait defining the interface for managing the lifecycle of executing a FlintStatement. | ||
*/ | ||
trait StatementLifecycleManager { | ||
|
||
/** | ||
* Prepares the statement lifecycle. | ||
*/ | ||
def prepareStatementLifecycle(): Either[String, Unit] | ||
|
||
// def executeStatement(statement: FlintStatement): DataFrame | ||
|
||
/** | ||
* Updates a specific statement. | ||
*/ | ||
def updateStatement(statement: FlintStatement): Unit | ||
|
||
/** | ||
* Terminates the statement lifecycle. | ||
*/ | ||
def terminateStatementLifecycle(): Unit | ||
} |
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
Oops, something went wrong.