Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Affichage
Vue
Divisé
Unifié
Éditeur live
Masquer les espaces
Cacher identiques
Sans retour à la ligne
Niveau de précision
Intelligent
Syntaxe
Aucun
Modifier l’apparence
Traitement
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 8 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
10 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
25 lignes
Copier tout
14 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
21 lignes
Copier tout
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();
Copier
Copié
Copier
Copié
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;
}
}
Copier
Copié
Copier
Copié
if all_nulls {
all_nulls = false;
}
Copier
Copié
Copier
Copié
let m = array.value(i);
let m = array.value(i);
n = n + m;
n = n + m;
}
}
Copier
Copié
Copier
Copié
if all_nulls {
None
} else {
Some(n)
Some(n)
}
}
}
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
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) } }
Texte modifié
Ouvrir un fichier
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) } }
Trouver la différence