Uh oh!
There was an error while loading. Please reload this page.
[SPARK-24568] Code refactoring for DataType equalsXXX methods - #21787
[SPARK-24568] Code refactoring for DataType equalsXXX methods#21787swapnilushinde wants to merge 2 commits into
Conversation
AmplabJenkins
commented
Jul 17, 2018
Can one of the admins verify this patch? |
HyukjinKwon
left a comment
There was a problem hiding this comment.
How much does this deduplicate? Seems overkill and even more complicated and not reducing the codes much. Roughly guess 60ish line deletion and 70ish line addition.
Thanks @HyukjinKwon! I removed old commented code in new comment.
Please let me know if I need to change anything to make code changes more readable & less complex. |
HyukjinKwon
commented
Jul 18, 2018
But the current code looks less readable and adding more lines. I would rather leave this as was. |
true. Currently we have just 3 variations of comparing two datatypes for equality. Adding even one more equality function would easily cause writing same repetitive code which would negate observed increase in code lines. |
Constant variables and squashing the logic into one function look not worth enough and overkill. Less duplication is good of course but it doesn't look worth enough by the overkill. I would focus on more important stuff. -1 from me. |
Closesapache#17422Closesapache#17619Closesapache#18034Closesapache#18229Closesapache#18268Closesapache#17973Closesapache#18125Closesapache#18918Closesapache#19274Closesapache#19456Closesapache#19510Closesapache#19420Closesapache#20090Closesapache#20177Closesapache#20304Closesapache#20319Closesapache#20543Closesapache#20437Closesapache#21261Closesapache#21726Closesapache#14653Closesapache#13143Closesapache#17894Closesapache#19758Closesapache#12951Closesapache#17092Closesapache#21240Closesapache#16910Closesapache#12904Closesapache#21731Closesapache#21095 Added: Closesapache#19233Closesapache#20100Closesapache#21453Closesapache#21455Closesapache#18477 Added: Closesapache#21812Closesapache#21787 Author: hyukjinkwon <gurwls223@apache.org> Closesapache#21781 from HyukjinKwon/closing-prs.
What changes were proposed in this pull request?
Currently, DataType equals* methods has lot of code duplication. This PR adds -
Current functionality -
DataTypes are matched on three factors - (fieldName, dataType, nullability)
Current APIs
Same API contracts are maintained but just new helper functions equalsDataTypes, isSameFieldName, isSameNullability added to give more flexibility & code centralization.
Additional private vals are added to set behavior of helper functions.
Any combination of above variables can be generated in future to add new equals* APIs. For instance,
can easily be generated by calling -
New scalatests added to test missing API unit testing as well.
How was this patch tested?
Code was tested with existing scalatests. New scalatests added for more robust testing of this functionality.
All tests were ran locally to make sure it doesn't affect elsewhere.
Please review http://spark.apache.org/contributing.html before opening a pull request.