-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a384bb5
commit efbd61d
Showing
19 changed files
with
257 additions
and
134 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
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
80 changes: 80 additions & 0 deletions
80
src/main/scala/io/qbeast/core/model/StagingDataManager.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,80 @@ | ||
/* | ||
* Copyright 2021 Qbeast Analytics, S.L. | ||
* | ||
* 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 io.qbeast.core.model | ||
|
||
import org.apache.spark.sql.DataFrame | ||
|
||
/** | ||
* Metadata Manager template | ||
* | ||
* @tparam DataSchema | ||
* type of data schema | ||
* @tparam FileDescriptor | ||
* type of file descriptor | ||
* @tparam QbeastOptions | ||
* type of the Qbeast options | ||
*/ | ||
trait StagingDataManager[DATA, QbeastOptions] { | ||
|
||
/** | ||
* Resolve write policy according to the current staging size and its desired value. | ||
* | ||
* @param data | ||
* DataFrame to write. | ||
* @return | ||
* A StagingResolution instance containing the data to write, the staging RemoveFiles, and a | ||
* boolean denoting whether the data to write is to be staged or indexed. | ||
*/ | ||
def updateWithStagedData(data: DATA): StagingResolution | ||
|
||
/** | ||
* Stage the data without indexing by writing it in the desired format. | ||
* | ||
* @param data | ||
* The data to stage. | ||
* @param indexStatus | ||
* The index status. | ||
* @param options | ||
* The options for staging. | ||
* @param append | ||
* Whether the operation appends data or overwrites. | ||
*/ | ||
def stageData( | ||
data: DATA, | ||
indexStatus: IndexStatus, | ||
options: QbeastOptions, | ||
append: Boolean): Unit | ||
|
||
} | ||
|
||
trait StagingDataManagerFactory[DATA, QbeastOptions] { | ||
|
||
/** | ||
* Returns a IndexedTable for given SQLContext and path. It is not guaranteed that the returned | ||
* table physically exists, use IndexedTable#exists attribute to verify it. | ||
* | ||
* @param tableId | ||
* the table path | ||
* @return | ||
* the stagingmanager | ||
*/ | ||
def getManager(tableId: QTableID): StagingDataManager[DATA, QbeastOptions] | ||
} | ||
|
||
case class StagingResolution( | ||
dataToWrite: DataFrame, | ||
removeFiles: Seq[IndexFile], | ||
sendToStaging: Boolean) |
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.