Skip to content

Commit

Permalink
Updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
norberttech committed Apr 25, 2024
1 parent 656bcc3 commit 0efd397
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 120 deletions.
6 changes: 3 additions & 3 deletions examples/topics/aggregations/group_by/code.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use function Flow\ETL\DSL\{data_frame, from_array, ref, to_stream};
use function Flow\ETL\DSL\{count, data_frame, from_array, ref, to_stream};

require __DIR__ . '/../../../autoload.php';

Expand All @@ -19,7 +19,7 @@
['id' => 9, 'group' => 'A'],
['id' => 10, 'group' => 'B'],
]))
->groupBy(ref('group')) // GroupedDataFrame
->toDF() // DataFrame
->groupBy(ref('group'))
->aggregate(count(ref('group')))
->write(to_stream(__DIR__ . '/output.txt', truncate: false))
->run();
12 changes: 6 additions & 6 deletions examples/topics/aggregations/group_by/output.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+-------+
| group |
+-------+
| A |
| B |
+-------+
+-------+-------------+
| group | group_count |
+-------+-------------+
| A | 5 |
| B | 5 |
+-------+-------------+
2 rows
2 changes: 1 addition & 1 deletion examples/topics/data_source/http_dynamic/output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+----------+----------+---------------------+--------------+-----------+-----------------------------+----------------------+
| login | name | blog | public_repos | followers | html_url | created_at |
+----------+----------+---------------------+--------------+-----------+-----------------------------+----------------------+
| flow-php | Flow PHP | http://flow-php.com | 30 | 89 | https://github.com/flow-php | 2020-10-26T18:40:27Z |
| flow-php | Flow PHP | http://flow-php.com | 30 | 91 | https://github.com/flow-php | 2020-10-26T18:40:27Z |
+----------+----------+---------------------+--------------+-----------+-----------------------------+----------------------+
1 rows
2 changes: 1 addition & 1 deletion examples/topics/data_source/sequence_date/code.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'date',
new DateTimeImmutable('2024-01-01 00:00:00 UTC'),
new DateInterval('P1D'),
new DateTimeImmutable('now + 60 days'),
new DateTimeImmutable('2024-01-01 00:00:00 +60 days'),
))
->collect()
->write(to_stream(__DIR__ . '/output.txt', truncate: false))
Expand Down
92 changes: 1 addition & 91 deletions examples/topics/data_source/sequence_date/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,95 +61,5 @@
| 2024-02-27T00:00:00+00:00 |
| 2024-02-28T00:00:00+00:00 |
| 2024-02-29T00:00:00+00:00 |
| 2024-03-01T00:00:00+00:00 |
| 2024-03-02T00:00:00+00:00 |
| 2024-03-03T00:00:00+00:00 |
| 2024-03-04T00:00:00+00:00 |
| 2024-03-05T00:00:00+00:00 |
| 2024-03-06T00:00:00+00:00 |
| 2024-03-07T00:00:00+00:00 |
| 2024-03-08T00:00:00+00:00 |
| 2024-03-09T00:00:00+00:00 |
| 2024-03-10T00:00:00+00:00 |
| 2024-03-11T00:00:00+00:00 |
| 2024-03-12T00:00:00+00:00 |
| 2024-03-13T00:00:00+00:00 |
| 2024-03-14T00:00:00+00:00 |
| 2024-03-15T00:00:00+00:00 |
| 2024-03-16T00:00:00+00:00 |
| 2024-03-17T00:00:00+00:00 |
| 2024-03-18T00:00:00+00:00 |
| 2024-03-19T00:00:00+00:00 |
| 2024-03-20T00:00:00+00:00 |
| 2024-03-21T00:00:00+00:00 |
| 2024-03-22T00:00:00+00:00 |
| 2024-03-23T00:00:00+00:00 |
| 2024-03-24T00:00:00+00:00 |
| 2024-03-25T00:00:00+00:00 |
| 2024-03-26T00:00:00+00:00 |
| 2024-03-27T00:00:00+00:00 |
| 2024-03-28T00:00:00+00:00 |
| 2024-03-29T00:00:00+00:00 |
| 2024-03-30T00:00:00+00:00 |
| 2024-03-31T00:00:00+00:00 |
| 2024-04-01T00:00:00+00:00 |
| 2024-04-02T00:00:00+00:00 |
| 2024-04-03T00:00:00+00:00 |
| 2024-04-04T00:00:00+00:00 |
| 2024-04-05T00:00:00+00:00 |
| 2024-04-06T00:00:00+00:00 |
| 2024-04-07T00:00:00+00:00 |
| 2024-04-08T00:00:00+00:00 |
| 2024-04-09T00:00:00+00:00 |
| 2024-04-10T00:00:00+00:00 |
| 2024-04-11T00:00:00+00:00 |
| 2024-04-12T00:00:00+00:00 |
| 2024-04-13T00:00:00+00:00 |
| 2024-04-14T00:00:00+00:00 |
| 2024-04-15T00:00:00+00:00 |
| 2024-04-16T00:00:00+00:00 |
| 2024-04-17T00:00:00+00:00 |
| 2024-04-18T00:00:00+00:00 |
| 2024-04-19T00:00:00+00:00 |
| 2024-04-20T00:00:00+00:00 |
| 2024-04-21T00:00:00+00:00 |
| 2024-04-22T00:00:00+00:00 |
| 2024-04-23T00:00:00+00:00 |
| 2024-04-24T00:00:00+00:00 |
| 2024-04-25T00:00:00+00:00 |
| 2024-04-26T00:00:00+00:00 |
| 2024-04-27T00:00:00+00:00 |
| 2024-04-28T00:00:00+00:00 |
| 2024-04-29T00:00:00+00:00 |
| 2024-04-30T00:00:00+00:00 |
| 2024-05-01T00:00:00+00:00 |
| 2024-05-02T00:00:00+00:00 |
| 2024-05-03T00:00:00+00:00 |
| 2024-05-04T00:00:00+00:00 |
| 2024-05-05T00:00:00+00:00 |
| 2024-05-06T00:00:00+00:00 |
| 2024-05-07T00:00:00+00:00 |
| 2024-05-08T00:00:00+00:00 |
| 2024-05-09T00:00:00+00:00 |
| 2024-05-10T00:00:00+00:00 |
| 2024-05-11T00:00:00+00:00 |
| 2024-05-12T00:00:00+00:00 |
| 2024-05-13T00:00:00+00:00 |
| 2024-05-14T00:00:00+00:00 |
| 2024-05-15T00:00:00+00:00 |
| 2024-05-16T00:00:00+00:00 |
| 2024-05-17T00:00:00+00:00 |
| 2024-05-18T00:00:00+00:00 |
| 2024-05-19T00:00:00+00:00 |
| 2024-05-20T00:00:00+00:00 |
| 2024-05-21T00:00:00+00:00 |
| 2024-05-22T00:00:00+00:00 |
| 2024-05-23T00:00:00+00:00 |
| 2024-05-24T00:00:00+00:00 |
| 2024-05-25T00:00:00+00:00 |
| 2024-05-26T00:00:00+00:00 |
| 2024-05-27T00:00:00+00:00 |
| 2024-05-28T00:00:00+00:00 |
| 2024-05-29T00:00:00+00:00 |
+---------------------------+
150 rows
60 rows
6 changes: 3 additions & 3 deletions examples/topics/partitioning/partition_pruning/output.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
+----+-------+-----------+
| id | color | sku |
+----+-------+-----------+
| 7 | blue | PRODUCT01 |
| 8 | blue | PRODUCT02 |
| 1 | red | PRODUCT01 |
| 2 | red | PRODUCT02 |
| 3 | red | PRODUCT03 |
| 1 | red | PRODUCT01 |
| 8 | blue | PRODUCT02 |
| 7 | blue | PRODUCT01 |
+----+-------+-----------+
5 rows
30 changes: 15 additions & 15 deletions examples/topics/partitioning/reading/output.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
+----+-------+-----------+
| id | color | sku |
+----+-------+-----------+
| 5 | green | PRODUCT02 |
| 7 | blue | PRODUCT01 |
+----+-------+-----------+
Partitions:
- color=green
- sku=PRODUCT02
- color=blue
- sku=PRODUCT01
1 rows
+----+-------+-----------+
| id | color | sku |
+----+-------+-----------+
| 6 | green | PRODUCT03 |
| 8 | blue | PRODUCT02 |
+----+-------+-----------+
Partitions:
- color=green
- sku=PRODUCT03
- color=blue
- sku=PRODUCT02
1 rows
+----+-------+-----------+
| id | color | sku |
Expand All @@ -28,19 +28,19 @@ Partitions:
+----+-------+-----------+
| id | color | sku |
+----+-------+-----------+
| 2 | red | PRODUCT02 |
| 5 | green | PRODUCT02 |
+----+-------+-----------+
Partitions:
- color=red
- color=green
- sku=PRODUCT02
1 rows
+----+-------+-----------+
| id | color | sku |
+----+-------+-----------+
| 3 | red | PRODUCT03 |
| 6 | green | PRODUCT03 |
+----+-------+-----------+
Partitions:
- color=red
- color=green
- sku=PRODUCT03
1 rows
+----+-------+-----------+
Expand All @@ -55,18 +55,18 @@ Partitions:
+----+-------+-----------+
| id | color | sku |
+----+-------+-----------+
| 8 | blue | PRODUCT02 |
| 2 | red | PRODUCT02 |
+----+-------+-----------+
Partitions:
- color=blue
- color=red
- sku=PRODUCT02
1 rows
+----+-------+-----------+
| id | color | sku |
+----+-------+-----------+
| 7 | blue | PRODUCT01 |
| 3 | red | PRODUCT03 |
+----+-------+-----------+
Partitions:
- color=blue
- sku=PRODUCT01
- color=red
- sku=PRODUCT03
1 rows

0 comments on commit 0efd397

Please sign in to comment.