Github user zsxwing commented on the pull request:
https://github.com/apache/spark/pull/4006#issuecomment-71419194
> (1) make StreamingListenerEvent extend SparkListenerEvent
I don't like it because if so, we will get many meaningless "match may not
be exhaustive." warnings from the compiler when we use pattern matching.
My original idea was that creating a parent trait for
StreamingListenerEvent and SparkListenerEvent and also a parent trait for
SparkListener and StreamingListener. However, it still needs `ListenerHelper` ,
an event process template, to remove duplicate codes.
When I was writing `ListenerHelper`, I found I need the type parameters to
check the type at the compile time. If not using type parameters, E.g., assume
`Listener` is the parent trait of SparkListener and StreamingListener, then the
method signature of `addListener` will be `def addListener(listener:
Listener)`. The subclasses cannot change it to accept a more specific
`Listener`, so they need to do the type check at the runtime to reject a wrong
Listener.
Therefore, I added the type parameters and found I could remove the parent
traits of StreamingListenerEvent/SparkListenerEvent and
SparkListener/StreamingListener. I prefer less classes, so I removed them.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]