cloud-fan commented on code in PR #56498:
URL: https://github.com/apache/spark/pull/56498#discussion_r3449131794


##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -5174,6 +5174,62 @@ object functions {
    */
   def instr(str: Column, substring: Column): Column = Column.fn("instr", str, 
substring)
 
+  /**
+   * Locate the position of the first occurrence of `substring` in `str`, 
starting the search from

Review Comment:
   Minor: the new overloads' Scaladoc doesn't mention that a negative `start` 
searches backward, or that `start = 0` returns 0 — both of which the SQL 
`ExpressionDescription` documents. Worth a one-line `@note` so the IDE-facing 
docs match the SQL docs.



##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -15180,7 +15180,12 @@ def format_string(format: str, *cols: "ColumnOrName") 
-> Column:
 
 
 @_try_remote_functions
-def instr(str: "ColumnOrName", substr: Union[Column, str]) -> Column:
+def instr(
+    str: "ColumnOrName",
+    substr: Union[Column, str],
+    start: Optional[Union[Column, int]] = None,
+    occurrence: Optional[Union[Column, int]] = None,
+) -> Column:
     """
     Locate the position of the first occurrence of substr column in the given 
string.

Review Comment:
   The lead line still says "first occurrence", but with the new `occurrence` 
parameter the function can locate the Nth match — the `Returns` line was 
generalized below, but this summary wasn't.
   ```suggestion
       Locate the position of the specified occurrence of substr column in the 
given string.
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to