-
Notifications
You must be signed in to change notification settings - Fork 328
Implement VectorUdf and use it in Queries 1 and 8 of TPCH benchmarks. #127
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
77416d5
Implement VectorUdf and use it in Queries 1 and 8 of TPCH benchmarks.
eerhardt dd2cf25
Unvectorize the vectorized functions.
eerhardt aa8f7c3
Respond to PR feedback
eerhardt 036e94f
Implement Vector UDF Registration.
eerhardt fdbe406
Merge remote-tracking branch 'upstream/master' into VectorUdf
eerhardt 0718b83
Fix code causing a test failure.
eerhardt 46749ee
Respond to PR feedback.
eerhardt a32ccd3
Merge branch 'master' into VectorUdf
rapoth 979ba93
Fix generic type names to match System.Func's naming pattern.
eerhardt 633b600
Merge branch 'master' into VectorUdf
imback82 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using Apache.Arrow; | ||
|
||
namespace Tpch | ||
{ | ||
internal static class VectorFunctions | ||
{ | ||
internal static DoubleArray ComputeTotal(DoubleArray price, DoubleArray discount, DoubleArray tax) | ||
{ | ||
if ((price.Length != discount.Length) || (price.Length != tax.Length)) | ||
{ | ||
throw new ArgumentException("Arrays need to be the same length"); | ||
} | ||
|
||
int length = price.Length; | ||
var builder = new ArrowBuffer.Builder<double>(length); | ||
ReadOnlySpan<double> prices = price.Values; | ||
ReadOnlySpan<double> discounts = discount.Values; | ||
ReadOnlySpan<double> taxes = tax.Values; | ||
for (int i = 0; i < length; ++i) | ||
{ | ||
builder.Append(prices[i] * (1 - discounts[i]) * (1 + taxes[i])); | ||
} | ||
|
||
return new DoubleArray( | ||
builder.Build(), | ||
nullBitmapBuffer: ArrowBuffer.Empty, | ||
length: length, | ||
nullCount: 0, | ||
offset: 0); | ||
} | ||
|
||
internal static DoubleArray ComputeDiscountPrice(DoubleArray price, DoubleArray discount) | ||
{ | ||
if (price.Length != discount.Length) | ||
{ | ||
throw new ArgumentException("Arrays need to be the same length"); | ||
} | ||
|
||
int length = price.Length; | ||
var builder = new ArrowBuffer.Builder<double>(length); | ||
ReadOnlySpan<double> prices = price.Values; | ||
ReadOnlySpan<double> discounts = discount.Values; | ||
for (int i = 0; i < length; ++i) | ||
{ | ||
builder.Append(prices[i] * (1 - discounts[i])); | ||
} | ||
|
||
return new DoubleArray( | ||
builder.Build(), | ||
nullBitmapBuffer: ArrowBuffer.Empty, | ||
length: length, | ||
nullCount: 0, | ||
offset: 0); | ||
} | ||
} | ||
} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.