Repository navigation
Replace SinkStorageReader and SinkStorageWriter with VirtualDocument[Tuple] - #3024
Merged
Merged
Conversation
Yicong-Huang
requested changes
Nov 13, 2024
bobbai00
force-pushed
the
jiadong-unify-storage-api
branch
from
November 14, 2024 01:42
97dd92c to
04368f4
Compare
bobbai00
force-pushed
the
jiadong-unify-storage-api
branch
2 times, most recently
from
November 29, 2024 04:54
7c05491 to
764e1b0
Compare
bobbai00
force-pushed
the
jiadong-unify-storage-api
branch
from
December 6, 2024 06:11
764e1b0 to
bee72bf
Compare
Yicong-Huang
requested changes
Dec 7, 2024
Yicong-Huang
left a comment
Contributor
There was a problem hiding this comment.
I am mainly against of setting the storage schema during propagation function. you could do it in the compiler, add a stage after propagate schemas, to assign schema to corresponding storages.
bobbai00
force-pushed
the
jiadong-unify-storage-api
branch
from
December 8, 2024 22:51
5d06eec to
d446cda
Compare
Yicong-Huang
approved these changes
Dec 8, 2024
Yicong-Huang
left a comment
Contributor
There was a problem hiding this comment.
LGTM! please fix the tests
bobbai00
force-pushed
the
jiadong-unify-storage-api
branch
from
December 9, 2024 18:21
2ffa93c to
bbc0ecd
Compare
Yicong-Huang
pushed a commit
that referenced
this pull request
Dec 16, 2024
…Tuple] (#3024) This PR removes the `SinkStorageReader` and `SinkStorageWriter`, and substitute it with `VirtualDocument[Tuple]` ### 1. Recap on `SinkStorage` and `VirtualDocument` `SinkStorage` is one kinds of storage specialized for Tuple storage. It relies on the `setSchema` function to know how to serialize/deserialize the tuples, and has `getSchema` function to return out the stored schema. In other words, `SinkStorage` stores both the tuples AND schema. `VirtualDocument` is an abstraction layer for all the storage-related apis. It currently has `MongoDocument[T]`. `MemoryDocument[T]`, `FileDocument[T]` implemented. These implementations are designed to store the actual data(a sequence of `T` objects), and `T`'s serializer/deserializer if any. Compared to storing tuples like `SinkStorage`, implementations will ONLY store tuples, NO schema, because schema is very specialized for `TupleLike` object and should not be part of the Document. ### 2. Changes in the `OpResultStorage` `OpResultStorage` manages all the opened `SinkStorageReader`. So to persist this part, the `OpResultStorage` extends from `ConcurrentHashMap[OperatorIdentity, SinkStorageReader]` to `ConcurrentHashMap[OperatorIdentity, (VirtualDocument[Tuple], Option[Schema])]`. This extension is due to the fact that `VirtualDocument[T]` doesn't have interfaces to acquire the `Schema`. `Option` is used because in some cases the schema is not generated yet when the `VirtualDocument` is initialized ### 3. New method `setSerde` in the `MongoDocument` A new function is added: ``` /** * set the serializer & deserializer. * * @PARAM toDocument: the serializer, convert T to MongoDB's Document. * @PARAM fromDocument: the deserializer, convert MongoDB's Document to T. */ def setSerde(toDocument: T => Document, fromDocument: Document => T): Unit = { this.toDocument = Some(toDocument) this.fromDocument = Some(fromDocument) } ``` this is used to reset the document's the serializer/deserializer . This is needed because in some cases, the document needs to be created, but the serializer and deserializer are not ready yet. ### 4. New trait, `TupleResultStatistics`, is added Since when MongoDB is used for result storage, the statistics of columns will be shown in the result panel. A new trait is added: ``` package edu.uci.ics.amber.engine.common.storage trait TupleResultStatistics { // a map from numerical fields to stats def getNumericColStats: Map[String, Map[String, Any]] // a map from date fields to stats def getDateColStats: Map[String, Map[String, Any]] // a map from categorical fields to stats def getCategoricalStats: Map[String, Map[String, Any]] } ``` And MongoDocument implements this trait: ``` override def getNumericColStats: Map[String, Map[String, Any]] = collectionMgr.calculateNumericStats() override def getDateColStats: Map[String, Map[String, Any]] = collectionMgr.calculateDateStats() override def getCategoricalStats: Map[String, Map[String, Any]] = collectionMgr.calculateCategoricalStats() ```
Yicong-Huang
pushed a commit
that referenced
this pull request
Dec 16, 2024
…Tuple] (#3024) This PR removes the `SinkStorageReader` and `SinkStorageWriter`, and substitute it with `VirtualDocument[Tuple]` ### 1. Recap on `SinkStorage` and `VirtualDocument` `SinkStorage` is one kinds of storage specialized for Tuple storage. It relies on the `setSchema` function to know how to serialize/deserialize the tuples, and has `getSchema` function to return out the stored schema. In other words, `SinkStorage` stores both the tuples AND schema. `VirtualDocument` is an abstraction layer for all the storage-related apis. It currently has `MongoDocument[T]`. `MemoryDocument[T]`, `FileDocument[T]` implemented. These implementations are designed to store the actual data(a sequence of `T` objects), and `T`'s serializer/deserializer if any. Compared to storing tuples like `SinkStorage`, implementations will ONLY store tuples, NO schema, because schema is very specialized for `TupleLike` object and should not be part of the Document. ### 2. Changes in the `OpResultStorage` `OpResultStorage` manages all the opened `SinkStorageReader`. So to persist this part, the `OpResultStorage` extends from `ConcurrentHashMap[OperatorIdentity, SinkStorageReader]` to `ConcurrentHashMap[OperatorIdentity, (VirtualDocument[Tuple], Option[Schema])]`. This extension is due to the fact that `VirtualDocument[T]` doesn't have interfaces to acquire the `Schema`. `Option` is used because in some cases the schema is not generated yet when the `VirtualDocument` is initialized ### 3. New method `setSerde` in the `MongoDocument` A new function is added: ``` /** * set the serializer & deserializer. * * @PARAM toDocument: the serializer, convert T to MongoDB's Document. * @PARAM fromDocument: the deserializer, convert MongoDB's Document to T. */ def setSerde(toDocument: T => Document, fromDocument: Document => T): Unit = { this.toDocument = Some(toDocument) this.fromDocument = Some(fromDocument) } ``` this is used to reset the document's the serializer/deserializer . This is needed because in some cases, the document needs to be created, but the serializer and deserializer are not ready yet. ### 4. New trait, `TupleResultStatistics`, is added Since when MongoDB is used for result storage, the statistics of columns will be shown in the result panel. A new trait is added: ``` package edu.uci.ics.amber.engine.common.storage trait TupleResultStatistics { // a map from numerical fields to stats def getNumericColStats: Map[String, Map[String, Any]] // a map from date fields to stats def getDateColStats: Map[String, Map[String, Any]] // a map from categorical fields to stats def getCategoricalStats: Map[String, Map[String, Any]] } ``` And MongoDocument implements this trait: ``` override def getNumericColStats: Map[String, Map[String, Any]] = collectionMgr.calculateNumericStats() override def getDateColStats: Map[String, Map[String, Any]] = collectionMgr.calculateDateStats() override def getCategoricalStats: Map[String, Map[String, Any]] = collectionMgr.calculateCategoricalStats() ```
Yicong-Huang
pushed a commit
that referenced
this pull request
Dec 30, 2024
…Tuple] (#3024) This PR removes the `SinkStorageReader` and `SinkStorageWriter`, and substitute it with `VirtualDocument[Tuple]` ### 1. Recap on `SinkStorage` and `VirtualDocument` `SinkStorage` is one kinds of storage specialized for Tuple storage. It relies on the `setSchema` function to know how to serialize/deserialize the tuples, and has `getSchema` function to return out the stored schema. In other words, `SinkStorage` stores both the tuples AND schema. `VirtualDocument` is an abstraction layer for all the storage-related apis. It currently has `MongoDocument[T]`. `MemoryDocument[T]`, `FileDocument[T]` implemented. These implementations are designed to store the actual data(a sequence of `T` objects), and `T`'s serializer/deserializer if any. Compared to storing tuples like `SinkStorage`, implementations will ONLY store tuples, NO schema, because schema is very specialized for `TupleLike` object and should not be part of the Document. ### 2. Changes in the `OpResultStorage` `OpResultStorage` manages all the opened `SinkStorageReader`. So to persist this part, the `OpResultStorage` extends from `ConcurrentHashMap[OperatorIdentity, SinkStorageReader]` to `ConcurrentHashMap[OperatorIdentity, (VirtualDocument[Tuple], Option[Schema])]`. This extension is due to the fact that `VirtualDocument[T]` doesn't have interfaces to acquire the `Schema`. `Option` is used because in some cases the schema is not generated yet when the `VirtualDocument` is initialized ### 3. New method `setSerde` in the `MongoDocument` A new function is added: ``` /** * set the serializer & deserializer. * * @PARAM toDocument: the serializer, convert T to MongoDB's Document. * @PARAM fromDocument: the deserializer, convert MongoDB's Document to T. */ def setSerde(toDocument: T => Document, fromDocument: Document => T): Unit = { this.toDocument = Some(toDocument) this.fromDocument = Some(fromDocument) } ``` this is used to reset the document's the serializer/deserializer . This is needed because in some cases, the document needs to be created, but the serializer and deserializer are not ready yet. ### 4. New trait, `TupleResultStatistics`, is added Since when MongoDB is used for result storage, the statistics of columns will be shown in the result panel. A new trait is added: ``` package edu.uci.ics.amber.engine.common.storage trait TupleResultStatistics { // a map from numerical fields to stats def getNumericColStats: Map[String, Map[String, Any]] // a map from date fields to stats def getDateColStats: Map[String, Map[String, Any]] // a map from categorical fields to stats def getCategoricalStats: Map[String, Map[String, Any]] } ``` And MongoDocument implements this trait: ``` override def getNumericColStats: Map[String, Map[String, Any]] = collectionMgr.calculateNumericStats() override def getDateColStats: Map[String, Map[String, Any]] = collectionMgr.calculateDateStats() override def getCategoricalStats: Map[String, Map[String, Any]] = collectionMgr.calculateCategoricalStats() ```
Yicong-Huang
pushed a commit
that referenced
this pull request
Dec 30, 2024
…Tuple] (#3024) This PR removes the `SinkStorageReader` and `SinkStorageWriter`, and substitute it with `VirtualDocument[Tuple]` ### 1. Recap on `SinkStorage` and `VirtualDocument` `SinkStorage` is one kinds of storage specialized for Tuple storage. It relies on the `setSchema` function to know how to serialize/deserialize the tuples, and has `getSchema` function to return out the stored schema. In other words, `SinkStorage` stores both the tuples AND schema. `VirtualDocument` is an abstraction layer for all the storage-related apis. It currently has `MongoDocument[T]`. `MemoryDocument[T]`, `FileDocument[T]` implemented. These implementations are designed to store the actual data(a sequence of `T` objects), and `T`'s serializer/deserializer if any. Compared to storing tuples like `SinkStorage`, implementations will ONLY store tuples, NO schema, because schema is very specialized for `TupleLike` object and should not be part of the Document. ### 2. Changes in the `OpResultStorage` `OpResultStorage` manages all the opened `SinkStorageReader`. So to persist this part, the `OpResultStorage` extends from `ConcurrentHashMap[OperatorIdentity, SinkStorageReader]` to `ConcurrentHashMap[OperatorIdentity, (VirtualDocument[Tuple], Option[Schema])]`. This extension is due to the fact that `VirtualDocument[T]` doesn't have interfaces to acquire the `Schema`. `Option` is used because in some cases the schema is not generated yet when the `VirtualDocument` is initialized ### 3. New method `setSerde` in the `MongoDocument` A new function is added: ``` /** * set the serializer & deserializer. * * @PARAM toDocument: the serializer, convert T to MongoDB's Document. * @PARAM fromDocument: the deserializer, convert MongoDB's Document to T. */ def setSerde(toDocument: T => Document, fromDocument: Document => T): Unit = { this.toDocument = Some(toDocument) this.fromDocument = Some(fromDocument) } ``` this is used to reset the document's the serializer/deserializer . This is needed because in some cases, the document needs to be created, but the serializer and deserializer are not ready yet. ### 4. New trait, `TupleResultStatistics`, is added Since when MongoDB is used for result storage, the statistics of columns will be shown in the result panel. A new trait is added: ``` package edu.uci.ics.amber.engine.common.storage trait TupleResultStatistics { // a map from numerical fields to stats def getNumericColStats: Map[String, Map[String, Any]] // a map from date fields to stats def getDateColStats: Map[String, Map[String, Any]] // a map from categorical fields to stats def getCategoricalStats: Map[String, Map[String, Any]] } ``` And MongoDocument implements this trait: ``` override def getNumericColStats: Map[String, Map[String, Any]] = collectionMgr.calculateNumericStats() override def getDateColStats: Map[String, Map[String, Any]] = collectionMgr.calculateDateStats() override def getCategoricalStats: Map[String, Map[String, Any]] = collectionMgr.calculateCategoricalStats() ```
SarahAsad23
pushed a commit
to madisonmlin/texera
that referenced
this pull request
May 20, 2026
…Tuple] (apache#3024) This PR removes the `SinkStorageReader` and `SinkStorageWriter`, and substitute it with `VirtualDocument[Tuple]` ### 1. Recap on `SinkStorage` and `VirtualDocument` `SinkStorage` is one kinds of storage specialized for Tuple storage. It relies on the `setSchema` function to know how to serialize/deserialize the tuples, and has `getSchema` function to return out the stored schema. In other words, `SinkStorage` stores both the tuples AND schema. `VirtualDocument` is an abstraction layer for all the storage-related apis. It currently has `MongoDocument[T]`. `MemoryDocument[T]`, `FileDocument[T]` implemented. These implementations are designed to store the actual data(a sequence of `T` objects), and `T`'s serializer/deserializer if any. Compared to storing tuples like `SinkStorage`, implementations will ONLY store tuples, NO schema, because schema is very specialized for `TupleLike` object and should not be part of the Document. ### 2. Changes in the `OpResultStorage` `OpResultStorage` manages all the opened `SinkStorageReader`. So to persist this part, the `OpResultStorage` extends from `ConcurrentHashMap[OperatorIdentity, SinkStorageReader]` to `ConcurrentHashMap[OperatorIdentity, (VirtualDocument[Tuple], Option[Schema])]`. This extension is due to the fact that `VirtualDocument[T]` doesn't have interfaces to acquire the `Schema`. `Option` is used because in some cases the schema is not generated yet when the `VirtualDocument` is initialized ### 3. New method `setSerde` in the `MongoDocument` A new function is added: ``` /** * set the serializer & deserializer. * * @PARAM toDocument: the serializer, convert T to MongoDB's Document. * @PARAM fromDocument: the deserializer, convert MongoDB's Document to T. */ def setSerde(toDocument: T => Document, fromDocument: Document => T): Unit = { this.toDocument = Some(toDocument) this.fromDocument = Some(fromDocument) } ``` this is used to reset the document's the serializer/deserializer . This is needed because in some cases, the document needs to be created, but the serializer and deserializer are not ready yet. ### 4. New trait, `TupleResultStatistics`, is added Since when MongoDB is used for result storage, the statistics of columns will be shown in the result panel. A new trait is added: ``` package edu.uci.ics.amber.engine.common.storage trait TupleResultStatistics { // a map from numerical fields to stats def getNumericColStats: Map[String, Map[String, Any]] // a map from date fields to stats def getDateColStats: Map[String, Map[String, Any]] // a map from categorical fields to stats def getCategoricalStats: Map[String, Map[String, Any]] } ``` And MongoDocument implements this trait: ``` override def getNumericColStats: Map[String, Map[String, Any]] = collectionMgr.calculateNumericStats() override def getDateColStats: Map[String, Map[String, Any]] = collectionMgr.calculateDateStats() override def getCategoricalStats: Map[String, Map[String, Any]] = collectionMgr.calculateCategoricalStats() ```
yangzhang75
pushed a commit
to yangzhang75/texera
that referenced
this pull request
Jun 22, 2026
…Tuple] (apache#3024) This PR removes the `SinkStorageReader` and `SinkStorageWriter`, and substitute it with `VirtualDocument[Tuple]` ### 1. Recap on `SinkStorage` and `VirtualDocument` `SinkStorage` is one kinds of storage specialized for Tuple storage. It relies on the `setSchema` function to know how to serialize/deserialize the tuples, and has `getSchema` function to return out the stored schema. In other words, `SinkStorage` stores both the tuples AND schema. `VirtualDocument` is an abstraction layer for all the storage-related apis. It currently has `MongoDocument[T]`. `MemoryDocument[T]`, `FileDocument[T]` implemented. These implementations are designed to store the actual data(a sequence of `T` objects), and `T`'s serializer/deserializer if any. Compared to storing tuples like `SinkStorage`, implementations will ONLY store tuples, NO schema, because schema is very specialized for `TupleLike` object and should not be part of the Document. ### 2. Changes in the `OpResultStorage` `OpResultStorage` manages all the opened `SinkStorageReader`. So to persist this part, the `OpResultStorage` extends from `ConcurrentHashMap[OperatorIdentity, SinkStorageReader]` to `ConcurrentHashMap[OperatorIdentity, (VirtualDocument[Tuple], Option[Schema])]`. This extension is due to the fact that `VirtualDocument[T]` doesn't have interfaces to acquire the `Schema`. `Option` is used because in some cases the schema is not generated yet when the `VirtualDocument` is initialized ### 3. New method `setSerde` in the `MongoDocument` A new function is added: ``` /** * set the serializer & deserializer. * * @PARAM toDocument: the serializer, convert T to MongoDB's Document. * @PARAM fromDocument: the deserializer, convert MongoDB's Document to T. */ def setSerde(toDocument: T => Document, fromDocument: Document => T): Unit = { this.toDocument = Some(toDocument) this.fromDocument = Some(fromDocument) } ``` this is used to reset the document's the serializer/deserializer . This is needed because in some cases, the document needs to be created, but the serializer and deserializer are not ready yet. ### 4. New trait, `TupleResultStatistics`, is added Since when MongoDB is used for result storage, the statistics of columns will be shown in the result panel. A new trait is added: ``` package edu.uci.ics.amber.engine.common.storage trait TupleResultStatistics { // a map from numerical fields to stats def getNumericColStats: Map[String, Map[String, Any]] // a map from date fields to stats def getDateColStats: Map[String, Map[String, Any]] // a map from categorical fields to stats def getCategoricalStats: Map[String, Map[String, Any]] } ``` And MongoDocument implements this trait: ``` override def getNumericColStats: Map[String, Map[String, Any]] = collectionMgr.calculateNumericStats() override def getDateColStats: Map[String, Map[String, Any]] = collectionMgr.calculateDateStats() override def getCategoricalStats: Map[String, Map[String, Any]] = collectionMgr.calculateCategoricalStats() ```
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the
SinkStorageReaderandSinkStorageWriter, and substitute it withVirtualDocument[Tuple]1. Recap on
SinkStorageandVirtualDocumentSinkStorageis one kinds of storage specialized for Tuple storage. It relies on thesetSchemafunction to know how to serialize/deserialize the tuples, and hasgetSchemafunction to return out the stored schema. In other words,SinkStoragestores both the tuples AND schema.VirtualDocumentis an abstraction layer for all the storage-related apis. It currently hasMongoDocument[T].MemoryDocument[T],FileDocument[T]implemented. These implementations are designed to store the actual data(a sequence ofTobjects), andT's serializer/deserializer if any. Compared to storing tuples likeSinkStorage, implementations will ONLY store tuples, NO schema, because schema is very specialized forTupleLikeobject and should not be part of the Document.2. Changes in the
OpResultStorageOpResultStoragemanages all the openedSinkStorageReader. So to persist this part, theOpResultStorageextends fromConcurrentHashMap[OperatorIdentity, SinkStorageReader]toConcurrentHashMap[OperatorIdentity, (VirtualDocument[Tuple], Option[Schema])]. This extension is due to the fact thatVirtualDocument[T]doesn't have interfaces to acquire theSchema.Optionis used because in some cases the schema is not generated yet when theVirtualDocumentis initialized3. New method
setSerdein theMongoDocumentA new function is added:
this is used to reset the document's the serializer/deserializer . This is needed because in some cases, the document needs to be created, but the serializer and deserializer are not ready yet.
4. New trait,
TupleResultStatistics, is addedSince when MongoDB is used for result storage, the statistics of columns will be shown in the result panel. A new trait is added:
And MongoDocument implements this trait: