Skip to content

Commit cce95cd

Browse files
authored
Merge pull request #1266 from norberttech/feature/date-time-entries
* Added Date and Time entry types * Updated documentation and examples * Support Time/Date in Parquet Schema Converter * CS Fixes
2 parents 575ea8a + f41f8d7 commit cce95cd

File tree

110 files changed

+1889
-1087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1889
-1087
lines changed

docs/components/core/building-blocks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ $rows = array_to_rows([
4545

4646
## Entry Types
4747

48-
- [Array](../../../src/core/etl/src/Flow/ETL/Row/Entry/ArrayEntry.php)
4948
- [Boolean](../../../src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php)
49+
- [Time](../../../src/core/etl/src/Flow/ETL/Row/Entry/TimeEntry.php)
50+
- [Date](../../../src/core/etl/src/Flow/ETL/Row/Entry/DateEntry.php)
5051
- [DateTime](../../../src/core/etl/src/Flow/ETL/Row/Entry/DateTimeEntry.php)
5152
- [Enum](../../../src/core/etl/src/Flow/ETL/Row/Entry/EnumEntry.php)
5253
- [Float](../../../src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php)
5354
- [Integer](../../../src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php)
5455
- [Json](../../../src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php)
5556
- [List](../../../src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php)
5657
- [Map](../../../src/core/etl/src/Flow/ETL/Row/Entry/MapEntry.php)
57-
- [Object](../../../src/core/etl/src/Flow/ETL/Row/Entry/ObjectEntry.php)
5858
- [String](../../../src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php)
5959
- [Structure](../../../src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php)
6060
- [Uuid](../../../src/core/etl/src/Flow/ETL/Row/Entry/UuidEntry.php)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
+-----+
2-
| a |
3-
+-----+
4-
| 100 |
5-
+-----+
1+
+---------+
2+
| a_first |
3+
+---------+
4+
| 100 |
5+
+---------+
66
1 rows
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
+-----+
2-
| a |
3-
+-----+
4-
| 400 |
5-
+-----+
1+
+--------+
2+
| a_last |
3+
+--------+
4+
| 400 |
5+
+--------+
66
1 rows

examples/topics/data_frame/data_frame/code.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22

33
declare(strict_types=1);
44

5-
use function Flow\ETL\DSL\{array_entry, array_expand, data_frame, from_rows, int_entry, ref, row, rows, to_stream};
5+
use function Flow\ETL\DSL\{
6+
array_expand,
7+
data_frame,
8+
from_rows,
9+
int_entry,
10+
json_entry,
11+
ref,
12+
row,
13+
rows,
14+
to_stream};
615

716
data_frame()
817
->read(
918
from_rows(
1019
rows(
11-
row(int_entry('id', 1), array_entry('array', ['a' => 1, 'b' => 2, 'c' => 3])),
20+
row(int_entry('id', 1), json_entry('array', ['a' => 1, 'b' => 2, 'c' => 3])),
1221
)
1322
)
1423
)

examples/topics/data_frame/rename_entries/code.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
data_frame()
1010
->read(from_array([
11-
['id' => 1, 'name' => 'Norbert', 'joined_id' => 1, 'joined_Status' => 'active'],
12-
['id' => 2, 'name' => 'John', 'joined_id' => 2, 'joined_Status' => 'inactive'],
13-
['id' => 3, 'name' => 'Jane', 'joined_id' => 3, 'joined_Status' => 'active'],
11+
['id' => 1, 'name' => 'Norbert', 'joined_id' => 1, 'joined_status' => 'active'],
12+
['id' => 2, 'name' => 'John', 'joined_id' => 2, 'joined_status' => 'inactive'],
13+
['id' => 3, 'name' => 'Jane', 'joined_id' => 3, 'joined_status' => 'active'],
1414
]))
1515
->rename('id', 'user_id')
1616
->renameAll('joined_', '')
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
+---------+----+----------+--------+
2-
| name | id | status | userId |
3-
+---------+----+----------+--------+
4-
| Norbert | 1 | active | 1 |
5-
| John | 2 | inactive | 2 |
6-
| Jane | 3 | active | 3 |
7-
+---------+----+----------+--------+
1+
+---------+----+----------+---------+
2+
| name | id | status | user_id |
3+
+---------+----+----------+---------+
4+
| Norbert | 1 | active | 1 |
5+
| John | 2 | inactive | 2 |
6+
| Jane | 3 | active | 3 |
7+
+---------+----+----------+---------+
88
3 rows

examples/topics/data_frame/reorder_entries/code.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
use function Flow\ETL\DSL\{array_entry,
5+
use function Flow\ETL\DSL\{
66
bool_entry,
77
compare_entries_by_type_and_name,
88
data_frame,
@@ -13,7 +13,6 @@
1313
json_entry,
1414
list_entry,
1515
map_entry,
16-
object_entry,
1716
row,
1817
rows,
1918
str_entry,
@@ -44,13 +43,6 @@
4443
str_entry('string_b', 'string'),
4544
uuid_entry('uuid', '06143adb-3009-45c8-a4f0-c7016f97cab7'),
4645
json_entry('json', ['id' => 1, 'status' => 'NEW']),
47-
array_entry(
48-
'array',
49-
[
50-
['id' => 1, 'status' => 'NEW'],
51-
['id' => 2, 'status' => 'PENDING'],
52-
]
53-
),
5446
list_entry('list', [1, 2, 3], type_list(type_int())),
5547
map_entry('map', [0 => 'zero', 1 => 'one', 2 => 'two'], type_map(type_int(), type_string())),
5648
struct_entry(
@@ -76,7 +68,6 @@
7668
),
7769
]),
7870
),
79-
object_entry('object', new ArrayIterator([1, 2, 3])),
8071
)
8172
)))
8273
->reorderEntries(compare_entries_by_type_and_name())
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+-------------------------------------------------------+---------+-------------------------+----------------------+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
2-
| 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 |
3-
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+-------------------------------------------------------+---------+-------------------------+----------------------+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
4-
| 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}} |
5-
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+-------------------------------------------------------+---------+-------------------------+----------------------+------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
1+
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+---------+-------------------------+----------------------+----------------------------------------------------------------------------------------------------+
2+
| 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 |
3+
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+---------+-------------------------+----------------------+----------------------------------------------------------------------------------------------------+
4+
| 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}} |
5+
+--------------------------------------+-------+-------+-------+--------+--------+---------+---------+---------------------------+---------------------------+----------+----------+---------+-------------------------+----------------------+----------------------------------------------------------------------------------------------------+
66
1 rows
1 Byte
Binary file not shown.

examples/topics/data_source/http_dynamic/code.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function create(?Message\ResponseInterface $previousResponse = null) : ?M
3333
data_frame()
3434
->read($from_github_api)
3535
->withEntry('unpacked', ref('response_body')->jsonDecode())
36-
->select('unpacked')
3736
->withEntry('unpacked', ref('unpacked')->unpack())
3837
->renameAll('unpacked.', '')
3938
->drop('unpacked')

0 commit comments

Comments
 (0)