-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-50963][ML][PYTHON][CONNECT] Support Tokenizers, SQLTransform and StopWordsRemover on Connect #49624
Conversation
python/pyspark/ml/feature.py
Outdated
@@ -5072,7 +5073,7 @@ def __init__( | |||
self._setDefault( | |||
stopWords=StopWordsRemover.loadDefaultStopWords("english"), | |||
caseSensitive=False, | |||
locale=self._java_obj.getLocale(), | |||
locale="en_US" if isinstance(self._java_obj, str) else self._java_obj.getLocale(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PySpark Classic calls the jvm side to get the default value
spark/mllib/src/main/scala/org/apache/spark/ml/feature/StopWordsRemover.scala
Lines 129 to 138 in e7e0826
private val getDefaultOrUS: Locale = { | |
if (Locale.getAvailableLocales.contains(Locale.getDefault)) { | |
Locale.getDefault | |
} else { | |
logWarning(log"Default locale set was [${MDC(LogKeys.LOCALE, Locale.getDefault)}]; " + | |
log"however, it was not found in available locales in JVM, falling back to en_US locale. " + | |
log"Set param `locale` in order to respect another locale.") | |
Locale.US | |
} | |
} |
which is not available in Connect Mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me rethink here, if we skip _setDefault locale, then remover.getLocale()
fails if user does not explicitly set it, but it will reuse the default value in the jvm side.
…nd StopWordsRemover on Connect ### What changes were proposed in this pull request? Support a group of text processing algorithms: - Tokenizer - RegexTokenizer - SQLTransform - StopWordsRemover ### Why are the changes needed? for feature parity ### Does this PR introduce _any_ user-facing change? yes ### How was this patch tested? added tests ### Was this patch authored or co-authored using generative AI tooling? no Closes #49624 from zhengruifeng/ml_connect_tokenizer. Authored-by: Ruifeng Zheng <ruifengz@apache.org> Signed-off-by: Ruifeng Zheng <ruifengz@apache.org> (cherry picked from commit 42b15c9) Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
thanks. merged to master/4.0 |
What changes were proposed in this pull request?
Support a group of text processing algorithms:
Why are the changes needed?
for feature parity
Does this PR introduce any user-facing change?
yes
How was this patch tested?
added tests
Was this patch authored or co-authored using generative AI tooling?
no