Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing split function to ScalarFunctionChain #1163

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

norberttech
Copy link
Member

Change Log

Added

Fixed

  • Added missing split function to ScalarFunctionChain

Changed

Removed

Deprecated

Security


Description

Now we can use it like this:

ref('photo_links')->split(lit('|'))
ref('photo_links')->split('|')

I think what we should start doing from now is to make ScalarFunction to accept union type arguments, like for example:

ScalarFuncton|string so in case it's not string, then we should execute scalar functon.

We might want to create some simple ScalarFunctionResolver that would give us:

ScalarFunctionResolver::eval(ScalarFunction $function) : ScalarFunctionResult

ScalarFunctionResult::asInt() : ?int
ScalarFunctionResult::asString() : ?string
ScalarFunctionResult::cast(Type $to) : mixed

Copy link
Contributor

github-actions bot commented Aug 1, 2024

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         |
+-----------------------+-------------------+------+-----+-----------------+------------------+----------------+
| CSVExtractorBench     | bench_extract_10k | 1    | 3   | 3.953mb +0.00%  | 472.413ms -9.22% | ±0.21% -93.70% |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 4.086mb +0.00%  | 992.658ms -6.82% | ±0.21% -52.44% |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 28.545mb +0.00% | 399.521ms -7.33% | ±0.11% -94.59% |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 3.713mb +0.00%  | 32.133ms -6.08%  | ±1.17% +59.81% |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 3.659mb +0.00%  | 409.345ms -6.41% | ±1.46% -41.40% |
+-----------------------+-------------------+------+-----+-----------------+------------------+----------------+
Transformers
+-----------------------------+--------------------------+------+-----+------------------+-----------------+-----------------+
| benchmark                   | subject                  | revs | its | mem_peak         | mode            | rstdev          |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+-----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 116.054mb +0.00% | 56.346ms -8.40% | ±1.67% +222.84% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+-----------------+
Loaders
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode             | rstdev          |
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 54.175mb +0.00%  | 80.280ms -5.66%  | ±1.13% -18.27%  |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 102.497mb +0.00% | 49.451ms -8.71%  | ±1.32% +25.81%  |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 123.823mb +0.00% | 1.123s -9.16%    | ±1.04% +201.88% |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 16.969mb +0.00%  | 39.662ms -10.64% | ±3.20% +946.57% |
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
Building Blocks
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| benchmark               | subject                    | revs | its | mem_peak         | mode             | rstdev          |
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 52.638mb +0.00%  | 363.576ms -6.11% | ±1.10% +599.35% |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 12.904mb +0.00%  | 74.367ms -7.42%  | ±1.98% -27.13%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 106.829mb +0.00% | 424.256ms -8.04% | ±1.39% +42.15%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 55.187mb +0.00%  | 218.532ms -7.87% | ±0.72% +216.69% |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 14.025mb +0.00%  | 47.454ms -9.83%  | ±1.69% -15.62%  |
| RowsBench               | bench_chunk_10_on_10k      | 2    | 3   | 86.812mb +0.00%  | 2.972ms -17.04%  | ±1.39% +68.24%  |
| RowsBench               | bench_diff_left_1k_on_10k  | 2    | 3   | 102.412mb +0.00% | 173.590ms -7.28% | ±0.44% -61.01%  |
| RowsBench               | bench_diff_right_1k_on_10k | 2    | 3   | 85.132mb +0.00%  | 17.405ms -8.90%  | ±0.79% +50.36%  |
| RowsBench               | bench_drop_1k_on_10k       | 2    | 3   | 88.052mb +0.00%  | 1.415ms -35.63%  | ±3.06% +39.35%  |
| RowsBench               | bench_drop_right_1k_on_10k | 2    | 3   | 88.052mb +0.00%  | 1.460ms -29.17%  | ±2.59% +10.48%  |
| RowsBench               | bench_entries_on_10k       | 2    | 3   | 85.164mb +0.00%  | 2.271ms -22.24%  | ±0.38% -40.87%  |
| RowsBench               | bench_filter_on_10k        | 2    | 3   | 85.693mb +0.00%  | 14.415ms -5.29%  | ±2.00% +130.14% |
| RowsBench               | bench_find_on_10k          | 2    | 3   | 85.693mb +0.00%  | 14.369ms -7.58%  | ±0.85% -29.27%  |
| RowsBench               | bench_find_one_on_10k      | 10   | 3   | 83.596mb +0.00%  | 1.606μs -11.07%  | ±2.89% +12.24%  |
| RowsBench               | bench_first_on_10k         | 10   | 3   | 83.596mb +0.00%  | 0.300μs -25.00%  | ±0.00% -100.00% |
| RowsBench               | bench_flat_map_on_1k       | 2    | 3   | 92.947mb +0.00%  | 11.253ms -15.93% | ±0.52% -76.71%  |
| RowsBench               | bench_map_on_10k           | 2    | 3   | 122.318mb +0.00% | 55.872ms -12.31% | ±0.22% -83.04%  |
| RowsBench               | bench_merge_1k_on_10k      | 2    | 3   | 86.212mb +0.00%  | 1.078ms -39.72%  | ±1.54% -18.25%  |
| RowsBench               | bench_partition_by_on_10k  | 2    | 3   | 89.561mb +0.00%  | 56.098ms -14.51% | ±1.08% -9.30%   |
| RowsBench               | bench_remove_on_10k        | 2    | 3   | 88.314mb +0.00%  | 3.505ms -22.94%  | ±0.77% -37.64%  |
| RowsBench               | bench_sort_asc_on_1k       | 2    | 3   | 83.743mb +0.00%  | 36.148ms -12.24% | ±0.37% -82.76%  |
| RowsBench               | bench_sort_by_on_1k        | 2    | 3   | 83.743mb +0.00%  | 35.434ms -11.84% | ±1.29% -11.40%  |
| RowsBench               | bench_sort_desc_on_1k      | 2    | 3   | 83.743mb +0.00%  | 36.558ms -6.39%  | ±0.74% -22.18%  |
| RowsBench               | bench_sort_entries_on_1k   | 2    | 3   | 86.038mb +0.00%  | 6.838ms -6.96%   | ±1.41% +63.33%  |
| RowsBench               | bench_sort_on_1k           | 2    | 3   | 83.596mb +0.00%  | 26.252ms -9.56%  | ±0.31% -71.58%  |
| RowsBench               | bench_take_1k_on_10k       | 10   | 3   | 83.596mb +0.00%  | 12.241μs -15.48% | ±2.06% +38.94%  |
| RowsBench               | bench_take_right_1k_on_10k | 10   | 3   | 83.596mb +0.00%  | 14.810μs -19.42% | ±3.57% +427.54% |
| RowsBench               | bench_unique_on_1k         | 2    | 3   | 102.413mb +0.00% | 180.929ms -5.92% | ±2.22% +122.75% |
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+

@norberttech norberttech merged commit be9cdca into flow-php:1.x Aug 1, 2024
26 checks passed
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