viirya commented on a change in pull request #26496: [WIP][SPARK-29748][PYTHON][SQL] Remove Row field sorting in PySpark URL: https://github.com/apache/spark/pull/26496#discussion_r353474462
########## File path: python/pyspark/sql/types.py ########## @@ -1474,21 +1486,40 @@ class Row(tuple): True """ - def __new__(self, *args, **kwargs): + # Remove after Python < 3.6 dropped, see SPARK-29748 + _row_field_sorting_enabled = \ + os.environ.get('PYSPARK_ROW_FIELD_SORTING_ENABLED', 'false').lower() == 'true' + + if _row_field_sorting_enabled: + warnings.warn("The environment variable 'PYSPARK_ROW_FIELD_SORTING_ENABLED' " + "is deprecated and will be removed in future versions of Spark") + + def __new__(cls, *args, **kwargs): if args and kwargs: raise ValueError("Can not use both args " "and kwargs to create Row") if kwargs: + if not Row._row_field_sorting_enabled and sys.version_info[:2] < (3, 6): + warnings.warn("To use named arguments for Python version < 3.6, Row " + "field sorting must be enabled by setting the environment " + "variable 'PYSPARK_ROW_FIELD_SORTING_ENABLED' to 'true'.") Review comment: it would be better to say we enable it automatically now. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org