Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/components/core/building-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ $rows = array_to_rows([

## Entry Types

- [Array](../../../src/core/etl/src/Flow/ETL/Row/Entry/ArrayEntry.php)
- [Boolean](../../../src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php)
- [Time](../../../src/core/etl/src/Flow/ETL/Row/Entry/TimeEntry.php)
- [Date](../../../src/core/etl/src/Flow/ETL/Row/Entry/DateEntry.php)
- [DateTime](../../../src/core/etl/src/Flow/ETL/Row/Entry/DateTimeEntry.php)
- [Enum](../../../src/core/etl/src/Flow/ETL/Row/Entry/EnumEntry.php)
- [Float](../../../src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php)
- [Integer](../../../src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php)
- [Json](../../../src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php)
- [List](../../../src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php)
- [Map](../../../src/core/etl/src/Flow/ETL/Row/Entry/MapEntry.php)
- [Object](../../../src/core/etl/src/Flow/ETL/Row/Entry/ObjectEntry.php)
- [String](../../../src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php)
- [Structure](../../../src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php)
- [Uuid](../../../src/core/etl/src/Flow/ETL/Row/Entry/UuidEntry.php)
Expand Down
10 changes: 5 additions & 5 deletions examples/topics/aggregations/first/output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+-----+
| a |
+-----+
| 100 |
+-----+
+---------+
| a_first |
+---------+
| 100 |
+---------+
1 rows
10 changes: 5 additions & 5 deletions examples/topics/aggregations/last/output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+-----+
| a |
+-----+
| 400 |
+-----+
+--------+
| a_last |
+--------+
| 400 |
+--------+
1 rows
13 changes: 11 additions & 2 deletions examples/topics/data_frame/data_frame/code.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@

declare(strict_types=1);

use function Flow\ETL\DSL\{array_entry, array_expand, data_frame, from_rows, int_entry, ref, row, rows, to_stream};
use function Flow\ETL\DSL\{
array_expand,
data_frame,
from_rows,
int_entry,
json_entry,
ref,
row,
rows,
to_stream};

data_frame()
->read(
from_rows(
rows(
row(int_entry('id', 1), array_entry('array', ['a' => 1, 'b' => 2, 'c' => 3])),
row(int_entry('id', 1), json_entry('array', ['a' => 1, 'b' => 2, 'c' => 3])),
)
)
)
Expand Down
6 changes: 3 additions & 3 deletions examples/topics/data_frame/rename_entries/code.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

data_frame()
->read(from_array([
['id' => 1, 'name' => 'Norbert', 'joined_id' => 1, 'joined_Status' => 'active'],
['id' => 2, 'name' => 'John', 'joined_id' => 2, 'joined_Status' => 'inactive'],
['id' => 3, 'name' => 'Jane', 'joined_id' => 3, 'joined_Status' => 'active'],
['id' => 1, 'name' => 'Norbert', 'joined_id' => 1, 'joined_status' => 'active'],
['id' => 2, 'name' => 'John', 'joined_id' => 2, 'joined_status' => 'inactive'],
['id' => 3, 'name' => 'Jane', 'joined_id' => 3, 'joined_status' => 'active'],
]))
->rename('id', 'user_id')
->renameAll('joined_', '')
Expand Down
14 changes: 7 additions & 7 deletions examples/topics/data_frame/rename_entries/output.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
+---------+----+----------+--------+
| name | id | status | userId |
+---------+----+----------+--------+
| Norbert | 1 | active | 1 |
| John | 2 | inactive | 2 |
| Jane | 3 | active | 3 |
+---------+----+----------+--------+
+---------+----+----------+---------+
| name | id | status | user_id |
+---------+----+----------+---------+
| Norbert | 1 | active | 1 |
| John | 2 | inactive | 2 |
| Jane | 3 | active | 3 |
+---------+----+----------+---------+
3 rows
11 changes: 1 addition & 10 deletions examples/topics/data_frame/reorder_entries/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\{array_entry,
use function Flow\ETL\DSL\{
bool_entry,
compare_entries_by_type_and_name,
data_frame,
Expand All @@ -13,7 +13,6 @@
json_entry,
list_entry,
map_entry,
object_entry,
row,
rows,
str_entry,
Expand Down Expand Up @@ -44,13 +43,6 @@
str_entry('string_b', 'string'),
uuid_entry('uuid', '06143adb-3009-45c8-a4f0-c7016f97cab7'),
json_entry('json', ['id' => 1, 'status' => 'NEW']),
array_entry(
'array',
[
['id' => 1, 'status' => 'NEW'],
['id' => 2, 'status' => 'PENDING'],
]
),
list_entry('list', [1, 2, 3], type_list(type_int())),
map_entry('map', [0 => 'zero', 1 => 'one', 2 => 'two'], type_map(type_int(), type_string())),
struct_entry(
Expand All @@ -76,7 +68,6 @@
),
]),
),
object_entry('object', new ArrayIterator([1, 2, 3])),
)
)))
->reorderEntries(compare_entries_by_type_and_name())
Expand Down
10 changes: 5 additions & 5 deletions examples/topics/data_frame/reorder_entries/output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+-------------------------------------------------------+---------+-------------------------+----------------------+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
| uuid | int_a | int_b | bool | bool_a | bool_c | float_a | float_b | datetime_d | datetime_z | string_a | string_b | array | list | json | map | object | struct |
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+-------------------------------------------------------+---------+-------------------------+----------------------+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
| 06143adb-3009-45c8-a4f0-c7016f97cab7 | 1 | 1 | false | false | false | 572.91 | 210.21 | 2024-04-01T00:00:00+00:00 | 2024-04-01T00:00:00+00:00 | string | string | [{"id":1,"status":"NEW"},{"id":2,"status":"PENDING"}] | [1,2,3] | {"id":1,"status":"NEW"} | ["zero","one","two"] | ArrayIterator Object( [storage:ArrayIterator:private] => Array ( [0] => 1 [1] => 2 [2] => 3 )) | {"street":"street","city":"city","zip":"zip","country":"country","location":{"lat":1.5,"lon":1.5}} |
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+-------------------------------------------------------+---------+-------------------------+----------------------+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+---------+-------------------------+----------------------+----------------------------------------------------------------------------------------------------+
| uuid | int_a | int_b | bool | bool_a | bool_c | float_a | float_b | datetime_d | datetime_z | string_a | string_b | list | json | map | struct |
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+---------+-------------------------+----------------------+----------------------------------------------------------------------------------------------------+
| 06143adb-3009-45c8-a4f0-c7016f97cab7 | 1 | 1 | false | false | false | 572.91 | 210.21 | 2024-04-01T00:00:00+00:00 | 2024-04-01T00:00:00+00:00 | string | string | [1,2,3] | {"id":1,"status":"NEW"} | ["zero","one","two"] | {"street":"street","city":"city","zip":"zip","country":"country","location":{"lat":1.5,"lon":1.5}} |
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+---------+-------------------------+----------------------+----------------------------------------------------------------------------------------------------+
1 rows
Binary file modified examples/topics/data_sink/parquet/output.parquet
Binary file not shown.
1 change: 0 additions & 1 deletion examples/topics/data_source/http_dynamic/code.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function create(?Message\ResponseInterface $previousResponse = null) : ?M
data_frame()
->read($from_github_api)
->withEntry('unpacked', ref('response_body')->jsonDecode())
->select('unpacked')
->withEntry('unpacked', ref('unpacked')->unpack())
->renameAll('unpacked.', '')
->drop('unpacked')
Expand Down
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 @@
+----------+-----------------------------+---------------------+----------+--------------+-----------+----------------------+
| name | html_url | blog | login | public_repos | followers | created_at |
+----------+-----------------------------+---------------------+----------+--------------+-----------+----------------------+
| Flow PHP | https://github.com/flow-php | http://flow-php.com | flow-php | 34 | 98 | 2020-10-26T18:40:27Z |
| Flow PHP | https://github.com/flow-php | http://flow-php.com | flow-php | 36 | 101 | 2020-10-26T18:40:27Z |
+----------+-----------------------------+---------------------+----------+--------------+-----------+----------------------+
1 rows
128 changes: 64 additions & 64 deletions examples/topics/data_source/sequence_date/output.txt
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
+---------------------------+
| date |
+---------------------------+
| 2024-01-01T00:00:00+00:00 |
| 2024-01-02T00:00:00+00:00 |
| 2024-01-03T00:00:00+00:00 |
| 2024-01-04T00:00:00+00:00 |
| 2024-01-05T00:00:00+00:00 |
| 2024-01-06T00:00:00+00:00 |
| 2024-01-07T00:00:00+00:00 |
| 2024-01-08T00:00:00+00:00 |
| 2024-01-09T00:00:00+00:00 |
| 2024-01-10T00:00:00+00:00 |
| 2024-01-11T00:00:00+00:00 |
| 2024-01-12T00:00:00+00:00 |
| 2024-01-13T00:00:00+00:00 |
| 2024-01-14T00:00:00+00:00 |
| 2024-01-15T00:00:00+00:00 |
| 2024-01-16T00:00:00+00:00 |
| 2024-01-17T00:00:00+00:00 |
| 2024-01-18T00:00:00+00:00 |
| 2024-01-19T00:00:00+00:00 |
| 2024-01-20T00:00:00+00:00 |
| 2024-01-21T00:00:00+00:00 |
| 2024-01-22T00:00:00+00:00 |
| 2024-01-23T00:00:00+00:00 |
| 2024-01-24T00:00:00+00:00 |
| 2024-01-25T00:00:00+00:00 |
| 2024-01-26T00:00:00+00:00 |
| 2024-01-27T00:00:00+00:00 |
| 2024-01-28T00:00:00+00:00 |
| 2024-01-29T00:00:00+00:00 |
| 2024-01-30T00:00:00+00:00 |
| 2024-01-31T00:00:00+00:00 |
| 2024-02-01T00:00:00+00:00 |
| 2024-02-02T00:00:00+00:00 |
| 2024-02-03T00:00:00+00:00 |
| 2024-02-04T00:00:00+00:00 |
| 2024-02-05T00:00:00+00:00 |
| 2024-02-06T00:00:00+00:00 |
| 2024-02-07T00:00:00+00:00 |
| 2024-02-08T00:00:00+00:00 |
| 2024-02-09T00:00:00+00:00 |
| 2024-02-10T00:00:00+00:00 |
| 2024-02-11T00:00:00+00:00 |
| 2024-02-12T00:00:00+00:00 |
| 2024-02-13T00:00:00+00:00 |
| 2024-02-14T00:00:00+00:00 |
| 2024-02-15T00:00:00+00:00 |
| 2024-02-16T00:00:00+00:00 |
| 2024-02-17T00:00:00+00:00 |
| 2024-02-18T00:00:00+00:00 |
| 2024-02-19T00:00:00+00:00 |
| 2024-02-20T00:00:00+00:00 |
| 2024-02-21T00:00:00+00:00 |
| 2024-02-22T00:00:00+00:00 |
| 2024-02-23T00:00:00+00:00 |
| 2024-02-24T00:00:00+00:00 |
| 2024-02-25T00:00:00+00:00 |
| 2024-02-26T00:00:00+00:00 |
| 2024-02-27T00:00:00+00:00 |
| 2024-02-28T00:00:00+00:00 |
| 2024-02-29T00:00:00+00:00 |
+---------------------------+
+------------+
| date |
+------------+
| 2024-01-01 |
| 2024-01-02 |
| 2024-01-03 |
| 2024-01-04 |
| 2024-01-05 |
| 2024-01-06 |
| 2024-01-07 |
| 2024-01-08 |
| 2024-01-09 |
| 2024-01-10 |
| 2024-01-11 |
| 2024-01-12 |
| 2024-01-13 |
| 2024-01-14 |
| 2024-01-15 |
| 2024-01-16 |
| 2024-01-17 |
| 2024-01-18 |
| 2024-01-19 |
| 2024-01-20 |
| 2024-01-21 |
| 2024-01-22 |
| 2024-01-23 |
| 2024-01-24 |
| 2024-01-25 |
| 2024-01-26 |
| 2024-01-27 |
| 2024-01-28 |
| 2024-01-29 |
| 2024-01-30 |
| 2024-01-31 |
| 2024-02-01 |
| 2024-02-02 |
| 2024-02-03 |
| 2024-02-04 |
| 2024-02-05 |
| 2024-02-06 |
| 2024-02-07 |
| 2024-02-08 |
| 2024-02-09 |
| 2024-02-10 |
| 2024-02-11 |
| 2024-02-12 |
| 2024-02-13 |
| 2024-02-14 |
| 2024-02-15 |
| 2024-02-16 |
| 2024-02-17 |
| 2024-02-18 |
| 2024-02-19 |
| 2024-02-20 |
| 2024-02-21 |
| 2024-02-22 |
| 2024-02-23 |
| 2024-02-24 |
| 2024-02-25 |
| 2024-02-26 |
| 2024-02-27 |
| 2024-02-28 |
| 2024-02-29 |
+------------+
60 rows
Loading
Loading