-
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
Add map_zip_with Presto lambda function #2711
Conversation
✅ Deploy Preview for meta-velox canceled.
|
4722436
to
4208dda
Compare
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: facebookincubator#2711 Differential Revision: D40010436 Pulled By: mbasmanova fbshipit-source-id: 48de1a2ce59b1869d08e847bd68a889b69a78d82
const auto numLeft = leftSorted.size(); | ||
const auto numRight = rightSorted.size(); | ||
|
||
if (numLeft == 0) { |
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 like these 2 if
blocks can be omitted, if one side is empty, it will skip the while
and jump to one of the for
loops later.
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.
Good point. Let me change that.
|
||
// Make sure already populated entries in newElements do not get | ||
// overwritten. | ||
VarSetter finalSelection( |
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.
VarSetter
is renamed in #2399. We need to rebase to newest main.
Summary: Pull Request resolved: facebookincubator#2711 Differential Revision: D40010436 Pulled By: mbasmanova fbshipit-source-id: 5e0529ddb31655308245f170d9f8eeaed29a69b1
Summary: Pull Request resolved: facebookincubator#2711 Reviewed By: Yuhta Differential Revision: D40010436 Pulled By: Yuhta fbshipit-source-id: 054de3325c0104c9307146c78776df9d31c75d2c
4208dda
to
618edd1
Compare
This pull request was exported from Phabricator. Differential Revision: D40010436 |
Summary: Pull Request resolved: facebookincubator#2711 Differential Revision: D40010436 Pulled By: mbasmanova fbshipit-source-id: 7c963fea21427e2c50296b1754a9b8776bd88a04
Summary: Pull Request resolved: facebookincubator#2711 Differential Revision: D40010436 Pulled By: mbasmanova fbshipit-source-id: c4f578d5de3c4261b533d607a7a4fe5d08cd6022
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, just one small question
(k, v1, v2) -> (v1, v2)); | ||
SELECT map_zip_with(MAP(ARRAY['a', 'b', 'c'], ARRAY[1, 8, 27]), -- {a -> a1, b -> b4, c -> c9} | ||
MAP(ARRAY['a', 'b', 'c'], ARRAY[1, 2, 3]), | ||
(k, v1, v2) -> k || CAST(v1/v2 AS VARCHAR)); |
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.
is the '||' valid syntax for concatenation ?
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.
Yes, this is valid SQL.
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.
ah ok, I only ask because I tried using it in a unit test and our expression parser threw an error: "Function:resolveScalarFunctionType, Expression: Scalar function doesn't exist: ||", should we add support for it?
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.
@bikramSingh91 Sure. That would be handy.
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.
Filed #2747
Summary: Pull Request resolved: facebookincubator#2711 Differential Revision: D40010436 Pulled By: mbasmanova fbshipit-source-id: 857a5cfbe17c0f6206f3be2c98612a368dd66350
No description provided.