nchammas commented on code in PR #44920: URL: https://github.com/apache/spark/pull/44920#discussion_r1584104489
########## python/pyspark/errors/exceptions/__init__.py: ########## @@ -18,39 +18,15 @@ def _write_self() -> None: import json + from pathlib import Path from pyspark.errors import error_classes - with open("python/pyspark/errors/error_classes.py", "w") as f: - error_class_py_file = """# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# NOTE: Automatically sort this file via -# - cd $SPARK_HOME -# - bin/pyspark -# - from pyspark.errors.exceptions import _write_self; _write_self() -import json - - -ERROR_CLASSES_JSON = ''' -%s -''' + ERRORS_DIR = Path(__file__).parents[1] -ERROR_CLASSES_MAP = json.loads(ERROR_CLASSES_JSON) -""" % json.dumps( - error_classes.ERROR_CLASSES_MAP, sort_keys=True, indent=2 + with open(ERRORS_DIR / "error-conditions.json", "w") as f: Review Comment: Hmm, I don't understand the concern. This method here is `_write_self()`. It's for development only. No user will run this when they install Spark, regardless of the installation method. That's what I was saying in my [earlier comment on this method][1]. The real code path we care about is [in `error_classes.py`][2], not `__init__.py`. And this is the code path that I tested in various ways and documented in the PR description. I tested the zip installation method you were particularly concerned about in point 5: <img width="400" alt="Screenshot 2024-04-30 at 12 12 25 AM" src="https://github.com/apache/spark/assets/1039369/07884c50-8cd6-4caf-8bb9-b0269f40eb54"> Is there something about that test you think is inadequate? [1]: https://github.com/apache/spark/pull/44920/files/010714d00b84d7e9edb61170cf35d176cacfb67d#r1470557657 [2]: https://github.com/apache/spark/pull/44920/files/010714d00b84d7e9edb61170cf35d176cacfb67d#diff-2823e146fc0e6bddff3505b5bee6e2b855782d9f71e900e6f9099fc97d1fffa6 -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org