-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: fix GenericRow encapsulation (#4414)
* refactor: fix GenericRow encapsulation The `GenericRow` that is so pervasive through the code has always been a bit of a mess: * it's untyped: just a list of objects. * it has verbose `toString` implementation. * it has a weird `equals`, which is also out of whack with its `hashCode`. * it leaks its internal state like crazy: i.e. it breaks encapsulation. It was basically a very leaky wrapper around a `List<Object>`. Following on from #4412, which added some new functionality to `GenericRow`, I couldn't resist spending some time fixing some of these issues. This change fixes all but the first issue. It: * simplifies `toString` impl, removing array type handling, (which prod code doesn't use). Note: `toString` is not called in prod code that I can tell, it's just for debugging. * removes funkiness from `equals`. Looks like `equals` is also only called from tests. * it fixes encapsulations: it no longer leaks mutable internal state via `getColumns` or constructors not taking defensive copies. Mutating the state now requires explicit invocation of `GenericRow` methods. It's use of `List<Object>` internally is now an implementation detail, as it should be. This change does not fix the fact that `GenericRow` is untyped. To facilitate this change `KudafAggregator` has also been updated to accept the number of non-aggregate columns, rather than a list of non-aggregate column indexes. This is possible as the list of indexes was always sequential and zero-based, e.g. [0, 1, 2].
- Loading branch information
1 parent
29b7ef7
commit c03c9b7
Showing
60 changed files
with
588 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.