-
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.
refactor statement lifecycle [WIP] Fix tests fix some tests
- Loading branch information
Showing
17 changed files
with
1,033 additions
and
819 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
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,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.apache.spark.sql | ||
|
||
import org.opensearch.flint.data.FlintStatement | ||
|
||
trait QueryResultWriter { | ||
def reformatQueryResult( | ||
dataFrame: DataFrame, | ||
flintStatement: FlintStatement, | ||
queryExecutionContext: StatementExecutionContext): DataFrame | ||
def persistQueryResult(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.data.{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 getSessionManagerMetadata: 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 | ||
} |
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
29 changes: 29 additions & 0 deletions
29
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,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.apache.spark.sql | ||
|
||
import org.opensearch.flint.data.FlintStatement | ||
|
||
/** | ||
* Trait defining the interface for managing the lifecycle of statements. | ||
*/ | ||
trait StatementLifecycleManager { | ||
|
||
/** | ||
* Prepares the statement lifecycle. | ||
*/ | ||
def prepareStatementLifecycle(): Either[String, Unit] | ||
|
||
/** | ||
* 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.