asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [1/2] asterixdb git commit: [ASTERIXDB-1664][FUN][DOC] Fix position/regexp_postion to be 1-based
Date Fri, 21 Jul 2017 21:05:05 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 9884ff1c2 -> 5689665e3


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5689665e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
index 523207c..6f4d116 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
@@ -54,7 +54,8 @@ public class StringPositionDescriptor extends AbstractScalarFunctionDynamicDescr
 
                     @Override
                     protected int compute(UTF8StringPointable left, UTF8StringPointable right)
throws IOException {
-                        return UTF8StringPointable.find(left, right, false);
+                        int pos = UTF8StringPointable.find(left, right, false);
+                        return pos < 0 ? pos : pos + 1;
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5689665e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
index a41fb56..1bb0fdc 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
@@ -58,7 +58,8 @@ public class StringRegExpPositionDescriptor extends AbstractScalarFunctionDynami
                     protected int compute(UTF8StringPointable srcPtr, UTF8StringPointable
patternPtr)
                             throws IOException {
                         matcher.build(srcPtr, patternPtr);
-                        return matcher.postion();
+                        int pos = matcher.postion();
+                        return pos < 0 ? pos : pos + 1;
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5689665e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
index ea04896..35eb3b1 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
@@ -58,7 +58,8 @@ public class StringRegExpPositionWithFlagDescriptor extends AbstractScalarFuncti
                     protected int compute(UTF8StringPointable srcPtr, UTF8StringPointable
patternPtr,
                             UTF8StringPointable flagPtr) throws IOException {
                         matcher.build(srcPtr, patternPtr, flagPtr);
-                        return matcher.postion();
+                        int pos = matcher.postion();
+                        return pos < 0 ? pos : pos + 1;
                     }
                 };
             }


Mime
View raw message