Skip to content

Conversation

@norberttech
Copy link
Member

@norberttech norberttech commented Dec 7, 2023

Change Log

Added

  • DataFrame::fromJson()
  • support for running dataframes from json through flow CLI

Fixed

  • phar file

Changed

Removed

Deprecated

Security


Description

Pipelines can now be defined in JSON:

build/flow.phar run pipeline.json
bin/flow.php run pipeline.json
[
  {
    "function" : "data_frame",
    "call": {
      "method": "read",
      "args": [
        {
          "function": "from_array",
          "args": [
            [{"id": 1, "name": "user_01"},{"id": 2, "name": "user_02"},{"id": 3, "name": "user_03"}]
          ]
        }
      ],
      "call": {
        "method": "collect",
        "call": {
          "method": "withEntry",
          "args": ["active", {"function": "lit", "args":  [true]}],
          "call": {
            "method": "write",
            "args": [
              {
                "function": "to_output",
                "args": [false]
              }
            ]
          }
        }
      }
    }
  }
]

or from the code:

DataFrame::fromJson(file_get_contents('pipeline.json'))->run();

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2023

Flow PHP - Benchmarks

Results of the benchmarks from this PR are compared with the results from 1.x branch.

Extractors
+-----------------------+-------------------+------+-----+------------------+------------------+------------------+
| benchmark             | subject           | revs | its | mem_peak         | mode             | rstdev           |
+-----------------------+-------------------+------+-----+------------------+------------------+------------------+
| AvroExtractorBench    | bench_extract_10k | 1    | 3   | 35.129mb +0.00%  | 709.351ms +1.04% | ±1.17% +34.23%   |
| CSVExtractorBench     | bench_extract_10k | 1    | 3   | 4.827mb +0.03%   | 304.565ms +0.75% | ±3.44% +1097.08% |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 4.926mb +0.03%   | 939.090ms +0.13% | ±1.55% +3.04%    |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 239.632mb +0.00% | 1.116s +0.13%    | ±0.32% -17.45%   |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 4.705mb +0.03%   | 24.677ms -1.62%  | ±1.50% +37.65%   |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 4.706mb +0.03%   | 406.168ms +0.31% | ±0.62% -48.11%   |
+-----------------------+-------------------+------+-----+------------------+------------------+------------------+
Transformers
+-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+
| benchmark                   | subject                  | revs | its | mem_peak         | mode            | rstdev        |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 110.391mb +0.00% | 64.365ms +0.91% | ±0.53% -0.33% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+
Loaders
+--------------------+----------------+------+-----+------------------+------------------+----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode             | rstdev         |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
| AvroLoaderBench    | bench_load_10k | 1    | 3   | 94.790mb +0.00%  | 459.916ms +2.46% | ±2.43% -8.71%  |
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 54.867mb +0.00%  | 73.107ms +0.15%  | ±0.63% -67.26% |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 105.450mb +0.00% | 58.250ms +3.72%  | ±0.82% +0.36%  |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 320.660mb +0.00% | 1.358s +5.57%    | ±2.96% +5.09%  |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 17.744mb +0.01%  | 41.694ms -2.17%  | ±0.64% -24.51% |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
Building Blocks
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| benchmark               | subject                    | revs | its | mem_peak         | mode             | rstdev          |
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| RowsBench               | bench_chunk_10_on_10k      | 2    | 3   | 76.441mb +0.00%  | 2.841ms -6.20%   | ±1.28% +71.98%  |
| RowsBench               | bench_diff_left_1k_on_10k  | 2    | 3   | 96.234mb +0.00%  | 182.545ms -0.92% | ±0.55% -12.97%  |
| RowsBench               | bench_diff_right_1k_on_10k | 2    | 3   | 74.760mb +0.00%  | 18.379ms -1.52%  | ±1.06% -53.12%  |
| RowsBench               | bench_drop_1k_on_10k       | 2    | 3   | 77.681mb +0.00%  | 1.760ms -5.13%   | ±1.63% +32.63%  |
| RowsBench               | bench_drop_right_1k_on_10k | 2    | 3   | 77.681mb +0.00%  | 1.691ms -5.11%   | ±0.57% -36.71%  |
| RowsBench               | bench_entries_on_10k       | 2    | 3   | 74.793mb +0.00%  | 2.561ms -10.34%  | ±1.83% +2.75%   |
| RowsBench               | bench_filter_on_10k        | 2    | 3   | 75.322mb +0.00%  | 15.099ms +1.04%  | ±1.50% +2.58%   |
| RowsBench               | bench_find_on_10k          | 2    | 3   | 75.322mb +0.00%  | 15.259ms +0.20%  | ±1.25% +17.76%  |
| RowsBench               | bench_find_one_on_10k      | 10   | 3   | 73.225mb +0.00%  | 1.906μs -4.41%   | ±2.44% +1.72%   |
| RowsBench               | bench_first_on_10k         | 10   | 3   | 73.225mb +0.00%  | 0.500μs +66.67%  | ±0.00% 0.00%    |
| RowsBench               | bench_flat_map_on_1k       | 2    | 3   | 86.782mb +0.00%  | 14.873ms +15.41% | ±1.90% +18.58%  |
| RowsBench               | bench_map_on_10k           | 2    | 3   | 116.141mb +0.00% | 65.366ms +0.59%  | ±1.58% +79.54%  |
| RowsBench               | bench_merge_1k_on_10k      | 2    | 3   | 75.843mb +0.00%  | 2.055ms +0.07%   | ±3.54% +80.17%  |
| RowsBench               | bench_partition_by_on_10k  | 2    | 3   | 78.116mb +0.00%  | 33.416ms -2.81%  | ±1.32% +21.61%  |
| RowsBench               | bench_remove_on_10k        | 2    | 3   | 77.943mb +0.00%  | 4.257ms +0.99%   | ±1.35% -62.30%  |
| RowsBench               | bench_sort_asc_on_1k       | 2    | 3   | 73.370mb +0.00%  | 41.280ms +0.40%  | ±1.15% +29.71%  |
| RowsBench               | bench_sort_by_on_1k        | 2    | 3   | 73.371mb +0.00%  | 40.336ms -1.23%  | ±2.11% +155.88% |
| RowsBench               | bench_sort_desc_on_1k      | 2    | 3   | 73.370mb +0.00%  | 41.411ms +1.78%  | ±0.17% -87.20%  |
| RowsBench               | bench_sort_entries_on_1k   | 2    | 3   | 75.667mb +0.00%  | 7.429ms +0.36%   | ±2.81% +178.30% |
| RowsBench               | bench_sort_on_1k           | 2    | 3   | 73.225mb +0.00%  | 29.015ms -1.90%  | ±2.06% +76.38%  |
| RowsBench               | bench_take_1k_on_10k       | 10   | 3   | 73.225mb +0.00%  | 13.535μs -0.43%  | ±3.05% +35.87%  |
| RowsBench               | bench_take_right_1k_on_10k | 10   | 3   | 73.225mb +0.00%  | 16.366μs +0.58%  | ±1.25% -56.79%  |
| RowsBench               | bench_unique_on_1k         | 2    | 3   | 96.235mb +0.00%  | 186.276ms -0.30% | ±0.26% -22.28%  |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 59.386mb +0.00%  | 332.521ms -1.72% | ±0.74% -50.53%  |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 14.309mb +0.01%  | 68.249ms +2.00%  | ±0.32% -69.42%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 115.984mb +0.00% | 380.918ms -0.69% | ±1.39% -35.75%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 59.702mb +0.00%  | 199.081ms +4.29% | ±2.85% +457.06% |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 14.827mb +0.01%  | 40.295ms -1.17%  | ±1.34% +53.63%  |
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+

@norberttech norberttech changed the title Feature/rdsl builder Building pipelines from JSON Dec 7, 2023
@norberttech norberttech merged commit 44c672b into flow-php:1.x Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant