This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 6dc272a  ARROW-13810: [C++][Compute] Predicate IsAsciiCharacter allows 
invalid types and values
6dc272a is described below

commit 6dc272aa4b4377d6c597efef675534507b48e853
Author: Eduardo Ponce <[email protected]>
AuthorDate: Tue Sep 7 12:19:15 2021 +0200

    ARROW-13810: [C++][Compute] Predicate IsAsciiCharacter allows invalid types 
and values
    
    Remove template from string predicate IsAsciiCharacter to prevent returning 
true for invalid types and values.
    
    Closes #11048 from 
edponce/ARROW-13810-Compute-Predicate-IsAsciiCharacter-allow
    
    Authored-by: Eduardo Ponce <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 cpp/src/arrow/compute/kernels/scalar_string.cc | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/cpp/src/arrow/compute/kernels/scalar_string.cc 
b/cpp/src/arrow/compute/kernels/scalar_string.cc
index aa95311..1f043ad 100644
--- a/cpp/src/arrow/compute/kernels/scalar_string.cc
+++ b/cpp/src/arrow/compute/kernels/scalar_string.cc
@@ -73,10 +73,7 @@ Status RegexStatus(const RE2& regex) {
 
 // IsAlpha/Digit etc
 
-template <typename T>
-static inline bool IsAsciiCharacter(T character) {
-  return character < 128;
-}
+static inline bool IsAsciiCharacter(uint8_t character) { return character < 
128; }
 
 static inline bool IsLowerCaseCharacterAscii(uint8_t ascii_character) {
   return (ascii_character >= 'a') && (ascii_character <= 'z');
@@ -1746,8 +1743,7 @@ struct IsNumericUnicode : 
CharacterPredicateUnicode<IsNumericUnicode> {
 struct IsAscii {
   static bool Call(KernelContext*, const uint8_t* input,
                    size_t input_string_nascii_characters, Status*) {
-    return std::all_of(input, input + input_string_nascii_characters,
-                       IsAsciiCharacter<uint8_t>);
+    return std::all_of(input, input + input_string_nascii_characters, 
IsAsciiCharacter);
   }
 };
 

Reply via email to