divyanshus2404 commented on code in PR #71711:
URL: https://github.com/apache/airflow/pull/71711#discussion_r3946653825


##########
providers/apache/spark/src/airflow/providers/apache/spark/hooks/spark_submit.py:
##########
@@ -55,6 +55,26 @@
 
 _K8S_WAIT_APP_COMPLETION_CONF = "spark.kubernetes.submission.waitAppCompletion"
 
+# Values to mask are anchored at a token boundary so the scan stays linear: 
without

Review Comment:
   Agreed — dropped the linear-time claim.
   
   Reproduced your payload: with `"secret" * n` as a single token the timing 
quadruples as the input doubles (39ms → 149ms → 598ms → 2,424ms across 6k → 48k 
chars), so the worst case is still O(n²). The anchor removes the 
retry-at-every-offset factor, but a token packing many keyword occurrences 
still makes the inner `\S*?` rescan from each one.
   
   Changed in 5d58a97:
   - Title is now "Reduce `_mask_cmd` backtracking on large inputs"
   - The comment above the pattern states it is not strictly O(n), and why
   - `test_masks_passwords_is_linear_on_large_input` renamed to 
`..._stays_fast_on_large_input`
   - Added `test_masks_passwords_stays_fast_on_repeated_keywords` using your 
input shape
   
   Also corrected the PR description, which still described the pattern as 
scanning linearly.
   
   ---
   Drafted-by: Claude Code; reviewed by @divyanshus2404 before posting



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

Reply via email to