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
Replace coalesce function with a special form #1430
Replace coalesce function with a special form #1430
Conversation
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
438daab
to
3ac8654
Compare
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
3ac8654
to
c95406f
Compare
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
c95406f
to
f1e3c0c
Compare
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. Pull Request resolved: facebookincubator#1430 Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 1b430c3e863a8aaf14ed9cfd96a6118d6c11bb06
f1e3c0c
to
daf7624
Compare
This pull request was exported from Phabricator. Differential Revision: D35674128 |
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.
Looks good.
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.
@mbasmanova Changes look good to me.
This pull request was exported from Phabricator. Differential Revision: D35674128 |
Summary: Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. Pull Request resolved: facebookincubator#1430 Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 85fec3a9569d56a1917824897162f61028b8ea82
daf7624
to
dfc4165
Compare
Summary: Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 07650ac8a519e566a96abdc27871c4f131478619
Summary: X-link: pytorch/torcharrow#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. Pull Request resolved: facebookincubator#1430 Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 7cf3fac8650f6227beb4f6721935fa73de428397
dfc4165
to
9ac37cc
Compare
This pull request was exported from Phabricator. Differential Revision: D35674128 |
Summary: Pull Request resolved: pytorch#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: d1fe74c00ac355661ea90bf0d7837b7418ebb7e1
Summary: X-link: pytorch/torcharrow#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. Pull Request resolved: facebookincubator#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: bb9b73fb1c4160aee7111bf4dc08dcd3d68ebe57
This pull request was exported from Phabricator. Differential Revision: D35674128 |
9ac37cc
to
67ea7e6
Compare
Summary: Pull Request resolved: pytorch#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 6ec63b4f5ecf99247232fb0f006209461a2b7662
Summary: Pull Request resolved: pytorch#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 83b6c13e9ff8a89aee988bbd705dd5e1831c4799
Summary: Pull Request resolved: pytorch#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 4b8d6599e74238b4a20a58c41c72de567b8a4da5
Summary: Pull Request resolved: pytorch#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 6bba174f60a7b1334dbcf8b89a7f245393cf1342
Summary: Pull Request resolved: pytorch#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: e7583dcabfa419ba5afcb425e6c58c5d64c9284b
Summary: Pull Request resolved: #301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 2d16cb3404843322da67b699e7163d53757225bd
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.
Thanks for this change.
Another minor cleanup comment is that we could either move CoalesceExpr class to ControlExpr or promote SpecialForm to its own file since it now has implementations spread out from ControlExpr. Will do it some point.
@@ -202,7 +202,7 @@ class FlatVector final : public SimpleVector<T> { | |||
T* mutableRawValues() { | |||
if (!values_ || !values_->unique()) { | |||
BufferPtr newValues = | |||
AlignedBuffer::allocate<T>(BaseVector::length_, values_->pool()); | |||
AlignedBuffer::allocate<T>(BaseVector::length_, BaseVector::pool()); |
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.
QQ : Why is this needed for the current change ?
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.
This is needed to avoid a crash when values_ is a nullptr.
Summary: X-link: pytorch/torcharrow#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. Pull Request resolved: facebookincubator#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 2d16cb3404843322da67b699e7163d53757225bd
Summary: X-link: #301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. X-link: facebookincubator/velox#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 2d16cb3404843322da67b699e7163d53757225bd
Summary: X-link: pytorch/torcharrow#301 Coalesce needs to be a special form expression and cannot be a function because it is not supposed to evaluate remaining inputs once there are no nulls. For example, if column a has no nulls, the following expression should not try to evaluate `b / 0` and should not fail. ``` coalesce(a, b / 0) ``` This change introduces CoalesceExpr special form and deletes coalesce function. Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues. Pull Request resolved: facebookincubator#1430 Reviewed By: laithsakka Differential Revision: D35674128 Pulled By: mbasmanova fbshipit-source-id: 2d16cb3404843322da67b699e7163d53757225bd
Coalesce needs to be a special form expression and cannot be a function because
it is not supposed to evaluate remaining inputs once there are no nulls. For
example, if column a has no nulls, the following expression should not try to
evaluate
b / 0
and should not fail.This change introduces CoalesceExpr special form and deletes coalesce function.
Also, fix a crash due to null pointer dereference in FlatVector::mutableRawValues.