Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Display
Layout
Split
Unified
Real-time editor
Hide whitespace changes
Hide unchanged lines
Disable line wrap
Diff precision
Smart
Syntax
None
Change appearance
Process
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
8 years ago
Diff never expires
Clear
Export
Share
Explain
10 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
25 lines
Copy
14 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
21 lines
Copy
pub fn sum<T>(array: &PrimitiveArray<T>) -> Option<T::Native>
pub fn sum<T>(array: &PrimitiveArray<T>) -> Option<T::Native>
where
where
T: ArrowNumericType,
T: ArrowNumericType,
T::Native: Add<Output = T::Native>,
T::Native: Add<Output = T::Native>,
{
{
let mut n: T::Native = T::default_value();
let mut n: T::Native = T::default_value();
Copy
Copied
Copy
Copied
let array_len = array.len();
// iteratively track whether all values are
null
(or
array
is empty)
if array.
null
_count() ==
array
_len {
let mut all_nulls = true;
None
} else {
let data = array.data();
let data = array.data();
for i in 0..data.len() {
for i in 0..data.len() {
if data.is_null(i) {
if data.is_null(i) {
continue;
continue;
}
}
Copy
Copied
Copy
Copied
if all_nulls {
all_nulls = false;
}
Copy
Copied
Copy
Copied
let m = array.value(i);
let m = array.value(i);
n = n + m;
n = n + m;
}
}
Copy
Copied
Copy
Copied
if all_nulls {
None
} else {
Some(n)
Some(n)
}
}
}
}
Saved diffs
Original text
Open file
pub fn sum<T>(array: &PrimitiveArray<T>) -> Option<T::Native> where T: ArrowNumericType, T::Native: Add<Output = T::Native>, { let mut n: T::Native = T::default_value(); // iteratively track whether all values are null (or array is empty) let mut all_nulls = true; let data = array.data(); for i in 0..data.len() { if data.is_null(i) { continue; } if all_nulls { all_nulls = false; } let m = array.value(i); n = n + m; } if all_nulls { None } else { Some(n) } }
Changed text
Open file
pub fn sum<T>(array: &PrimitiveArray<T>) -> Option<T::Native> where T: ArrowNumericType, T::Native: Add<Output = T::Native>, { let mut n: T::Native = T::default_value(); let array_len = array.len(); if array.null_count() == array_len { None } else { let data = array.data(); for i in 0..data.len() { if data.is_null(i) { continue; } let m = array.value(i); n = n + m; } Some(n) } }
Find difference