-
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
[Minor] Reduce code duplication creating ScalarValue::List #3197
Conversation
value, | ||
Box::new(Field::new("item", nested_type.data_type().clone(), true)), | ||
) | ||
ScalarValue::new_list(value, nested_type.data_type().clone()) |
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.
The whole PR is just doing this transformation over and over again
@@ -648,6 +648,11 @@ impl ScalarValue { | |||
ScalarValue::IntervalMonthDayNano(Some(val)) | |||
} | |||
|
|||
/// Create a new nullable ScalarValue::List with the specified child_type | |||
pub fn new_list(scalars: Option<Vec<Self>>, child_type: DataType) -> Self { |
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.
Here is the new function
Codecov Report
@@ Coverage Diff @@
## master #3197 +/- ##
==========================================
- Coverage 85.87% 85.86% -0.02%
==========================================
Files 291 291
Lines 52885 52846 -39
==========================================
- Hits 45415 45375 -40
- Misses 7470 7471 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Great simplify 💯
Thanks for the review @xudong963 |
Benchmark runs are scheduled for baseline = 3df9f80 and contender = e0a9fa3. e0a9fa3 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
N/A
Rationale for this change
While working on #3122 I found it quite painful to make
ScalarValue::List
s and noticed that all over the code the same code got copy/pasted aroundWhat changes are included in this PR?
ScalarValue::new_list
Are there any user-facing changes?
No