Add Sparse Vectors Decoding#97
Open
devsimiyu wants to merge 4 commits into
Open
Conversation
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.
Description
Adds initial support for Spark ML linalg vectors on the C++ client. Introduces
DenseVectorandSparseVectorclasses undersrc/ml/linalg/vectors/and instructsRow::get<T>()to decode Spark's vector UDT struct ({type, size, indices, values}) returned from the server into a typedSparseVector. Also extendsdataframe.cpp's value printer to handleINT8andSTRUCTArrow types so vector columns render inshow().Key Implementation Details
SparseVector/DenseVector(src/ml/linalg/vectors/sparse_vector.h,src/ml/linalg/vectors/dense_vector.h)src/types.h): Added aRow::get<SparseVector>()specialization.src/dataframe.cpp): AddedINT8andSTRUCTcases toarrayValueToString.API Changes
SparseVector,DenseVector.Row::get<SparseVector>(column_name)new template instantiation.Testing
SparkIntegrationTest.SparkVector(tests/spark/ml/linalg/vectors/sparse_vector.cpp) - verifies the decode + norm path with a unit test that constructs aRowmirroring Spark's vector UDT and asserts the norms.Why is this change necessary?
DataFrames containing ML feature columns (e.g. output of
HashingTFtransformer) can be consumed. Sparse vectors are the first piece;DenseVectordecoding and other linalg ops will follow.User-Facing Changes
Does this introduce a user-facing change? Yes.