zeroshade commented on code in PR #291:
URL: https://github.com/apache/arrow-go/pull/291#discussion_r1963967441


##########
arrow/array/compare.go:
##########
@@ -644,6 +645,46 @@ func validityBitmapEqual(left, right arrow.Array) bool {
        return true
 }
 
+func arrayApproxEqualString(left, right *String) bool {
+       for i := 0; i < left.Len(); i++ {
+               if left.IsNull(i) {
+                       continue
+               }
+               if stripNulls(left.Value(i)) != stripNulls(right.Value(i)) {
+                       return false
+               }
+       }
+       return true
+}
+
+func arrayApproxEqualLargeString(left, right *LargeString) bool {
+       for i := 0; i < left.Len(); i++ {
+               if left.IsNull(i) {
+                       continue
+               }
+               if stripNulls(left.Value(i)) != stripNulls(right.Value(i)) {
+                       return false
+               }
+       }
+       return true
+}
+
+func arrayApproxEqualStringView(left, right *StringView) bool {
+       for i := 0; i < left.Len(); i++ {
+               if left.IsNull(i) {
+                       continue
+               }
+               if stripNulls(left.Value(i)) != stripNulls(right.Value(i)) {
+                       return false
+               }
+       }
+       return true
+}
+
+func stripNulls(s string) string {
+       return strings.TrimRight(s, "\x00")
+}
+

Review Comment:
   sure, i'm not opposed to that



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to