Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Revision metadata and Snapshot #29

Merged
merged 14 commits into from
Oct 27, 2021
Merged

Conversation

osopardo1
Copy link
Member

@osopardo1 osopardo1 commented Oct 18, 2021

This PR solves #27 and moves the old concept of SpaceRevision into a new Revision case class. This Revision contains more configurable parameters like the desired cube size or the columns used for index:

case class Revision(
    id: RevisionID,
    timestamp: Long,
    desiredCubeSize: Int,
    indexedColumns: Seq[String],
    transformations: IndexedSeq[LinearTransformation]) 

Disclaimer: ID and timestamp are the same right now.

In order to provide Revision isolation on Analyze, Optimize and Write operations, RevisionData contains only the necessary information about a single revision, such as:

  • Revision information: timestamp, desiredCubeSize, indexedColumns and space transformations
  • Replicated Set: Set of cubes in a replicated state for the single Revision
  • CubeWeights: Map of cubes and the maximum Weight values for the single Revision

For Read operation, we still have to query all available RevisionData provided by QbeastSnapshot.

Accordingly, some information is changed in Metadata:

 "configuration": {
      "qbeast.lastRevisionID": "1635320405236",
      "qbeast.revision.1635320405236": "{\"id\":1635320405236,\"timestamp\":1635320405236,\"desiredCubeSize\":3000000,\"indexedColumns\":[\"user_id\",\"product_id\"],\"transformations\":[{\"min\":1.89823355E8,\"max\":6.91766695E8,\"scale\":1.9922567355909134E-9},{\"min\":-2.8748538E7,\"max\":9.0249526E7,\"scale\":8.403498060270964E-9}],\"dimensionCount\":2}"
    }

In order to isolate Revision processes, a new type of snapshot for the Qbeast structures is created.
QbeastSnapshot would be only in charge of grouping the different RevisionSnapshots that can be found in the proper delta Snapshot.
Analyze, Optimize and Write operations would affect only one RevisionSnapshot,
and Read operation needs to query all available RevisionSnapshots.
@eavilaes eavilaes linked an issue Oct 19, 2021 that may be closed by this pull request
@osopardo1 osopardo1 self-assigned this Oct 19, 2021
Copy link
Member

@cugni cugni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have different revisionID from revisionTimestamp, and make it clear in the API when we refer to a specific revision and when we want all revision happened before of a specific point in time.

# Conflicts:
#	src/main/scala/io/qbeast/spark/index/OTreeAlgorithm.scala
#	src/main/scala/io/qbeast/spark/sql/files/OTreeIndex.scala
#	src/main/scala/io/qbeast/spark/sql/qbeast/BlockWriter.scala
#	src/main/scala/io/qbeast/spark/sql/qbeast/QbeastOptimizer.scala
#	src/main/scala/io/qbeast/spark/sql/qbeast/QbeastSnapshot.scala
#	src/main/scala/io/qbeast/spark/sql/qbeast/QbeastWriter.scala
#	src/main/scala/io/qbeast/spark/table/AnalyzeTableCommand.scala
#	src/main/scala/io/qbeast/spark/table/IndexedTable.scala
#	src/main/scala/io/qbeast/spark/table/OptimizeTableCommand.scala
#	src/main/scala/io/qbeast/spark/table/QbeastTable.scala
#	src/test/scala/io/qbeast/spark/index/NewRevisionTest.scala
#	src/test/scala/io/qbeast/spark/utils/BlockWriterTest.scala
#	src/test/scala/io/qbeast/spark/utils/QbeastSnapshotTest.scala
@osopardo1 osopardo1 marked this pull request as ready for review October 26, 2021 16:15
Remove duplicated metadata (indexedColumns and desiredCubeSize)

and remove noise from method parameters
@osopardo1 osopardo1 merged commit b721684 into Qbeast-io:main Oct 27, 2021
@osopardo1 osopardo1 deleted the 27-revision branch October 27, 2021 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide unified structure for Revision
4 participants