Skip to content
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

SPARKNLP 643 detecting spark version in a safer way #13035

Conversation

maziyarpanahi
Copy link
Member

@maziyarpanahi maziyarpanahi commented Nov 4, 2022

Some environments will have an alphanumeric version of Spark. This PR will make a safer comparison when it comes to whether or not we are in Spark 3.3.0 environment (needed for some operations).

We could use

cleaned_version = re.findall(r'(?:(\d+\.(?:\d+\.)*\d+))', self.sc.version)

or LooseVersion from distutils.version

LooseVersion(self.spark_version()) >= LooseVersion("3.3.0")

Tested on EMR:

>>> from sparknlp.training import CoNLL
>>> trainingData = CoNLL().readDataset(spark, "file:///home/hadoop/en.test.lemma.conllu")
>>>

image

@maziyarpanahi maziyarpanahi self-assigned this Nov 4, 2022
@maziyarpanahi maziyarpanahi linked an issue Nov 4, 2022 that may be closed by this pull request
@maziyarpanahi
Copy link
Member Author

@danilojsl I have 2 commits representing both approaches, they both work even in EMR. Please let me know which one you are more comfortable with

@maziyarpanahi maziyarpanahi changed the base branch from master to release/423-release-candidate November 4, 2022 11:10
@maziyarpanahi maziyarpanahi merged commit 375339c into release/423-release-candidate Nov 4, 2022
@danilojsl
Copy link
Contributor

@maziyarpanahi the one with LooseVersion LGFM

@KshitizGIT KshitizGIT deleted the SPARKNLP-643-detecting-spark-version-inside-extended-java-wrapper-py-is-not-safe branch March 2, 2023 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reading CoNLL dataset on AWS EMR 6.5 fails
2 participants