ankitsultana commented on code in PR #12437:
URL: https://github.com/apache/pinot/pull/12437#discussion_r1501197064


##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/StringFunctions.java:
##########
@@ -597,6 +596,41 @@ public static String splitPart(String input, String 
delimiter, int index) {
     }
   }
 
+  /**
+   * TODO: Revisit if index should be one-based (both Presto and Postgres use 
one-based index, which starts with 1)

Review Comment:
   nit: we can remove this TODO. I see it's still there in `splitPart`, but 
once we ship this we anyways can't change this without making the function b/w 
incompatible. Same for the next function



##########
pinot-common/src/test/java/org/apache/pinot/common/function/scalar/StringFunctionsTest.java:
##########
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.common.function.scalar;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+
+public class StringFunctionsTest {
+
+  @DataProvider(name = "splitPartTestCases")
+  public static Object[][] splitPartTestCases() {
+    return new Object[][]{
+        {"org.apache.pinot.common.function", ".", 0, 100, "org", "org", 
"function"},
+        {"org.apache.pinot.common.function", ".", 10, 100, "null", "null", 
"null"},
+        {"org.apache.pinot.common.function", ".", 1, 0, "apache", "apache", 
"common"},
+        {"org.apache.pinot.common.function", ".", 1, 1, "apache", "null", 
"common"},
+        {"org.apache.pinot.common.function", ".", 0, 1, "org", 
"org.apache.pinot.common.function", "function"},
+        {"org.apache.pinot.common.function", ".", 1, 2, "apache", 
"apache.pinot.common.function", "common"},
+        {"org.apache.pinot.common.function", ".", 2, 3, "pinot", 
"pinot.common.function", "pinot"},
+        {"org.apache.pinot.common.function", ".", 3, 4, "common", 
"common.function", "apache"},
+        {"org.apache.pinot.common.function", ".", 4, 5, "function", 
"function", "org"},
+        {"org.apache.pinot.common.function", ".", 5, 6, "null", "null", 
"null"},
+        {"org.apache.pinot.common.function", ".", 3, 3, "common", "null", 
"apache"},
+        {"+++++", "+", 0, 100, "", "", ""},
+        {"+++++", "+", 1, 100, "null", "null", "null"},
+    };
+  }
+
+  @Test(dataProvider = "splitPartTestCases")
+  public void testSplitPark(String input, String delimiter, int index, int 
max, String expectedToken,

Review Comment:
   typo: `testSplitPart`



-- 
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: commits-unsubscr...@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to