Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/6532#issuecomment-107231326
  
    @davies, I agree that the test you added here acts as a proper regression 
test.  My comment was more to suggest that we could have prevented this 
regression in the first place with a relatively simple test that just tries to 
instantiate each data type with all of its constructor arguments.  The fact 
that this bug evaded unit tests implies that our existing unit tests didn't 
create DecimalTypes with any constructor arguments, implying that our test 
coverage of decimal-related code might be insufficient.  I think that this 
patch is fine, but for 1.5 we should make a dedicated effort to improve 
Python's test coverage.
    
    @airhorns, do you mean that the single metaclass would act as a no-op when 
applied to Types that take constructor arguments or that it would throw an 
exception if applied to those types?  This is purely academic at this point, 
but I can imagine some contrived scenarios where the no-op behavior might be 
confusing: what if I had a class which accepted constructor parameters, then 
created a subclass which called its superclass constructor with constant values 
for those parameters?  In this case, the subclass can be a singleton but the 
superclass can't.  To avoid having to reason about these corner-cases, maybe 
it's better to just accept a bit of verbosity and use decorators instead.  We 
shouldn't do that for this patch, though; we can leave it as a followup for 1.5.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to