surawut-jirasaktavee commented on code in PR #59422:
URL: https://github.com/apache/spark/pull/59422#discussion_r4280158619


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -4411,6 +4411,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_REGEXP_INSTR_IGNORE_GROUP_INDEX =
+    buildConf("spark.sql.legacy.regexpInstrIgnoreGroupIndex")
+      .internal()
+      .doc("When true, `regexp_instr(str, regexp, idx)` ignores `idx` and 
returns the " +
+        "position of the entire match, as in Spark 4.3 and earlier. When 
false, it returns the " +
+        "position of the regex group `idx`, and fails if `idx` is negative or 
greater than " +
+        "the number of groups.")
+      .version("4.4.0")

Review Comment:
   Thanks for the re-review! You're right about the binding policy. I 
reproduced the view issue locally: I added a test that creates a persisted view 
calling regexp_instr(..., 1) and sets 
spark.sql.legacy.regexpInstrIgnoreGroupIndex=true in the session. Without a 
binding policy, it failed (expected [1], got [2]), so the legacy flag had no 
effect inside the view, as you described.
   
   I'm adding .withBindingPolicy(ConfigBindingPolicy.SESSION) to the config, 
together with this view test, and will update the PR description to describe 
the flag and the new tests. I'll push the fix shortly.



-- 
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