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

refactor: Break PrestoSerializer.cpp into components #11922

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kevinwilfong
Copy link
Contributor

@kevinwilfong kevinwilfong commented Dec 20, 2024

Summary:
PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:

  • PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
  • PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
  • PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
    during deserialization
  • VectorStream: contains the VectorStream class which is an appendable container for serialized values used
    during serialization
  • PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex
    serialized PrestoPages for the benefit of compression libraries like Zstrong.
  • PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the
    function readTopColumns which serves as the entry to deserialization
  • PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this
    logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used
    with PrestoIterativeVectorSerializer)
  • PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
    function serializeColumn which serves as the entry point to serialization and the function flushStreams used
    to write the final output to an OutputStream. This logic is shared by PrestoBatchVectorSerializer,
    PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 20, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67543330

Copy link

netlify bot commented Dec 20, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 8807030
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6781ba4f4c091e000813efb2

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Dec 20, 2024
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Dec 20, 2024
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67543330

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67543330

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Jan 2, 2025
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67543330

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Jan 2, 2025
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67543330

Copy link
Collaborator

@assignUser assignUser left a comment

Choose a reason for hiding this comment

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

Nice, this will also help with improving incremental compile when working on these!

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Jan 10, 2025
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Jan 10, 2025
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Jan 10, 2025
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67543330

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Jan 11, 2025
…or#11922)

Summary:

PrestoSerializer.cpp has grown into a roughly 5000 line behemoth. It makes navigating the file a challenge.

This change is a pure refactor and does not introduce any changes besides moving things between files and renaming functions. It breaks the file up the code into 8 new files based on function:
* PrestoIterativeVectorSerializer: contains the PrestoIterativeVectorSerializer class
* PrestoBatchVectorSerializer: contains the PrestoBatchVectorSerializer class
* PrestoHeader: contains the PrestoHeader class which is used for reading/parsing the header of a PrestoPage
during deserialization
* VectorStream: contains the VectorStream class which is an appendable container for serialized values used
during serialization
* PrestoVectorLexer: contains the PrestoVectorLexer class along with Token and TokenType, this is used to lex 
serialized PrestoPages for the benefit of compression libraries like Zstrong.
* PrestoSerializerDeserializationUtils: contains the logic needed to deserialize a PrestoPage, notably the 
function readTopColumns which serves as the entry to deserialization
* PrestoSerializerEstimationUtils: contains the logic needed to estimate the size of a serialized PrestoPage, this 
logic is shared by PrestoBatchVectorSerializer and PrestoVectorSerde's estimateSerializedSize function (used 
with PrestoIterativeVectorSerializer)
* PrestoSerializerSerializationUtils: contains the generic logic needed to serialize a PrestoPage, notably the
function serializeColumn which serves as the entry point to serialization and the function flushStreams used 
write the final output to an OutputStream.  This logic is shared by PrestoBatchVectorSerializer, 
PrestoIterativeVectorSerializer, and PrestoVectorSerde's deserializeSingleColumn function.

These are all internal details of the PrestoSerializer (which is why they were in the cpp file) so I've placed all the
moved logic in a "detail" namespace (with the exception of Token and TokenType in PrestoVectorLexer).

I've verified that all tests pass and run the benchmark to verify I didn't introduce any regressions.

Differential Revision: D67543330
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants