-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix Expr::evalWithMemo #48
Conversation
@mbasmanova has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Fix BaseVector::ensureWritable(*uncached,... &dictionaryCache_); call. dictionaryCache_ is valid only for some rows (cachedDictionaryIndices_), hence, a safe call to BaseVector::ensureWritable must include all the rows not covered by cachedDictionaryIndices_. If BaseVector::ensureWritable is called only for a subset of rows not covered by cachedDictionaryIndices_, it will attempt to copy rows that are not valid leading to a crash. Also, set EvalCtx::isFinalSelection to false when evaluating "uncached" rows to ensure that values in rows copies from the dictionaryCache_ don't get lost. These fixes are band-aids. They are workarounds for the fact that BaseVector::ensureWritable primitive is not safe. It takes a set of rows to make writable and copies all other rows. Since it has no way of knowing which of the other rows are uninitialized it may cause a crash. A proper fix could be to (1) introduce a way to specify that a particular row in a vector is uninitilized and use this information when copying the rows to skip uninitialized rows or (2) change BaseVector::ensureWritable to take a set of rows to preserve and change all the call sites accordingly.
be480a4
to
3f7bcb8
Compare
@mbasmanova has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -618,6 +636,16 @@ class ExprTest : public testing::Test { | |||
return vectorMaker_->arrayVector(size, sizeAt, valueAt, isNullAt); | |||
} | |||
|
|||
template <typename T> | |||
ArrayVectorPtr makeArrayVector( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure I have seen an equivalent function in ExprTest.cpp..
@mbasmanova merged this pull request in f7601bf. |
relative pr: Check a fallback case in validation: using literal partition key in window function facebookincubator#148 Fix might_contain validate fallback and support struct literal facebookincubator#137 Implement datetime functions in velox/sparksql. facebookincubator#81 Parse options in SingularOrList correctly facebookincubator#48 Add SingularOrList support facebookincubator#45 Support if then in filter facebookincubator#74 Fix semi join output type and support existence join facebookincubator#67 Support decimal as partition column facebookincubator#167 Add the window support facebookincubator#61 Add expand operator facebookincubator#65 Support more cases of filter and its pushdown facebookincubator#14
relative pr: Check a fallback case in validation: using literal partition key in window function facebookincubator#148 Fix might_contain validate fallback and support struct literal facebookincubator#137 Implement datetime functions in velox/sparksql. facebookincubator#81 Parse options in SingularOrList correctly facebookincubator#48 Add SingularOrList support facebookincubator#45 Support if then in filter facebookincubator#74 Fix semi join output type and support existence join facebookincubator#67 Support decimal as partition column facebookincubator#167 Add the window support facebookincubator#61 Add expand operator facebookincubator#65 Support more cases of filter and its pushdown facebookincubator#14
relative pr: Check a fallback case in validation: using literal partition key in window function facebookincubator#148 Fix might_contain validate fallback and support struct literal facebookincubator#137 Implement datetime functions in velox/sparksql. facebookincubator#81 Parse options in SingularOrList correctly facebookincubator#48 Add SingularOrList support facebookincubator#45 Support if then in filter facebookincubator#74 Fix semi join output type and support existence join facebookincubator#67 Support decimal as partition column facebookincubator#167 Add the window support facebookincubator#61 Add expand operator facebookincubator#65 Support more cases of filter and its pushdown facebookincubator#14
relative pr: Check a fallback case in validation: using literal partition key in window function facebookincubator#148 Fix might_contain validate fallback and support struct literal facebookincubator#137 Implement datetime functions in velox/sparksql. facebookincubator#81 Parse options in SingularOrList correctly facebookincubator#48 Add SingularOrList support facebookincubator#45 Support if then in filter facebookincubator#74 Fix semi join output type and support existence join facebookincubator#67 Support decimal as partition column facebookincubator#167 Add the window support facebookincubator#61 Add expand operator facebookincubator#65 Support more cases of filter and its pushdown facebookincubator#14
relative pr: Check a fallback case in validation: using literal partition key in window function facebookincubator#148 Fix might_contain validate fallback and support struct literal facebookincubator#137 Implement datetime functions in velox/sparksql. facebookincubator#81 Parse options in SingularOrList correctly facebookincubator#48 Add SingularOrList support facebookincubator#45 Support if then in filter facebookincubator#74 Fix semi join output type and support existence join facebookincubator#67 Support decimal as partition column facebookincubator#167 Add the window support facebookincubator#61 Add expand operator facebookincubator#65 Support more cases of filter and its pushdown facebookincubator#14
relative pr: Check a fallback case in validation: using literal partition key in window function facebookincubator#148 Fix might_contain validate fallback and support struct literal facebookincubator#137 Implement datetime functions in velox/sparksql. facebookincubator#81 Parse options in SingularOrList correctly facebookincubator#48 Add SingularOrList support facebookincubator#45 Support if then in filter facebookincubator#74 Fix semi join output type and support existence join facebookincubator#67 Support decimal as partition column facebookincubator#167 Add the window support facebookincubator#61 Add expand operator facebookincubator#65 Support more cases of filter and its pushdown facebookincubator#14
Fix BaseVector::ensureWritable(*uncached,... &dictionaryCache_); call.
dictionaryCache_ is valid only for some rows
(cachedDictionaryIndices_), hence, a safe call to BaseVector::ensureWritable
must include all the rows not covered by cachedDictionaryIndices_. If
BaseVector::ensureWritable is called only for a subset of rows not covered by
cachedDictionaryIndices_, it will attempt to copy rows that are not valid
leading to a crash.
Also, set EvalCtx::isFinalSelection to false when evaluating "uncached" rows
to ensure that values in rows copies from the dictionaryCache_ don't get
lost.
These fixes are band-aids. They are workarounds for the fact that
BaseVector::ensureWritable primitive is not safe. It takes a set of rows to
make writable and copies all other rows. Since it has no way of knowing which
of the other rows are uninitialized it may cause a crash. A proper fix could
be to (1) introduce a way to specify that a particular row in a vector is
uninitilized and use this information when copying the rows to skip
uninitialized rows or (2) change BaseVector::ensureWritable to take a set of
rows to preserve and change all the call sites accordingly.