BryanCutler commented on issue #20280: [SPARK-22232][PYTHON][SQL] Fixed Row pickling to include __from_dict__ flag URL: https://github.com/apache/spark/pull/20280#issuecomment-546443457 Yes, that is kind of what I was thinking @zero323 , but still allow kwargs for python >= 3.6, where they will be ordered. To prevent a breaking change, we could offer a conf that would fall back to creating a `LegacyRow` that sorts the fields. For example: ```python class Row(tuple): def __new__(self, *args, **kwargs): if args and kwargs: raise ValueError("Can not use both args " "and kwargs to create Row") if py_version < "3.6": if len(args) != 1 and not isinstance(args[0], OrderedDict): if conf.get("python.useLegacyRow"): return LegacyRow(args, kwargs) else: raise ValueError(...) else: kwargs = args[0].to_dict() if kwargs: # create row objects names = kwargs.keys() row = tuple.__new__(self, [kwargs[n] for n in names]) row.__fields__ = names # row.__from_dict__ = True ## Don't need anymore, I think return row else: # create row class or objects return tuple.__new__(self, args) class LegacyRow(Row): ... names = sorted(kwargs.keys()) ... row.__from_dict__ = True ``` @HyukjinKwon and @zero323 does this look like a possibility?
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
