DataFrame::aggregate returns the same instance of dataframe with updated pipeline
Changed
Removed
Deprecated
Security
Description
As much as I hate using reflections I even more hate the idea of exposing Pipelines outside the dataframe. Pipelines are considered to be internal and should not be exposed as it's not something we want to provide BC promise.
I couldn't find a better compromise between keeping the data frame mutable (it's just a big builder for the pipeline) and allowing it to expose partial builders like in this case GroupBy. Since we are just building a pipeline, returning a new instance of its builder is highly problematic since it's already a different object so it can't be referenced anymore.
<?php
$df = df();
$df->read(...);
$df->withEntry(...);
$df->aggregate(...)
// without reflection this would not work anymore
$df->rename(...)
$rows = $df->fetch();
The goal of GroupedDataFrame is to not let users do something like for example DataFrame::groupBy()->run(). That would be highly problematic since it would be a source of memory leaks as grouping without aggregation is just collecting all rows. InnerBuilders for more advanced transformations are also improving DX since IDE will guide developers through all possible methods.
Change Log
Added
Fixed
Changed
Removed
Deprecated
Security
Description
As much as I hate using reflections I even more hate the idea of exposing Pipelines outside the dataframe. Pipelines are considered to be internal and should not be exposed as it's not something we want to provide BC promise.
I couldn't find a better compromise between keeping the data frame mutable (it's just a big builder for the pipeline) and allowing it to expose partial builders like in this case GroupBy. Since we are just building a pipeline, returning a new instance of its builder is highly problematic since it's already a different object so it can't be referenced anymore.
The goal of GroupedDataFrame is to not let users do something like for example
DataFrame::groupBy()->run()
. That would be highly problematic since it would be a source of memory leaks as grouping without aggregation is just collecting all rows. InnerBuilders for more advanced transformations are also improving DX since IDE will guide developers through all possible methods.