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

Fixed bug in detecting array value type when first element was null #1237

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

norberttech
Copy link
Member

Change Log

Added

Fixed

  • detecting array value type when first element was null

Changed

Removed

Deprecated

Security


Description

Becuse of that bug, values like [null, 2, 3 ,4] were detected as list<null> instead of list<?integer>.
I changed the way how array value type is detected by iterating over all elements and merging their types if needed.

Copy link
Contributor

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   | 4.631mb +0.01%  | 516.052ms -0.24% | ±0.22% -17.81%  |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 4.717mb +0.05%  | 1.080s -0.66%    | ±0.55% -40.47%  |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 29.175mb +0.00% | 427.970ms -2.59% | ±0.38% -4.37%   |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 4.360mb +0.01%  | 33.369ms +1.05%  | ±2.20% +611.52% |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 4.341mb +0.01%  | 663.672ms -1.23% | ±1.68% -21.97%  |
+-----------------------+-------------------+------+-----+-----------------+------------------+-----------------+
Transformers
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| benchmark                   | subject                  | revs | its | mem_peak         | mode            | rstdev         |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 116.700mb +0.00% | 59.776ms -2.39% | ±0.46% -26.16% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
Loaders
+--------------------+----------------+------+-----+------------------+------------------+----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode             | rstdev         |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 54.829mb +0.00%  | 118.088ms -3.10% | ±0.70% +14.77% |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 90.410mb +0.00%  | 98.971ms -3.03%  | ±1.45% +68.06% |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 124.532mb +0.00% | 1.230s -1.25%    | ±0.35% -44.72% |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 17.551mb +0.00%  | 28.233ms -2.63%  | ±1.49% +74.37% |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
Building Blocks
+-------------------------+----------------------------+------+-----+------------------+------------------+-------------------------------+
| benchmark               | subject                    | revs | its | mem_peak         | mode             | rstdev                        |
+-------------------------+----------------------------+------+-----+------------------+------------------+-------------------------------+
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 53.269mb +0.00%  | 397.225ms -0.61% | ±0.81% -23.19%                |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 13.535mb +0.02%  | 80.161ms -0.69%  | ±3.28% +23.75%                |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 107.466mb +0.00% | 475.574ms -0.14% | ±1.18% -2.52%                 |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 55.824mb +0.00%  | 240.265ms +0.29% | ±0.44% -48.56%                |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 14.662mb +0.02%  | 51.682ms -0.91%  | ±1.04% -36.13%                |
| RowsBench               | bench_chunk_10_on_10k      | 2    | 3   | 87.445mb +0.00%  | 3.247ms -11.93%  | ±2.20% +4.81%                 |
| RowsBench               | bench_diff_left_1k_on_10k  | 2    | 3   | 102.983mb +0.00% | 186.253ms -6.81% | ±0.43% -29.13%                |
| RowsBench               | bench_diff_right_1k_on_10k | 2    | 3   | 85.703mb +0.00%  | 18.728ms -6.06%  | ±1.23% -32.83%                |
| RowsBench               | bench_drop_1k_on_10k       | 2    | 3   | 88.684mb +0.00%  | 1.754ms -17.44%  | ±1.02% -54.12%                |
| RowsBench               | bench_drop_right_1k_on_10k | 2    | 3   | 88.684mb +0.00%  | 1.840ms -14.46%  | ±2.78% -13.68%                |
| RowsBench               | bench_entries_on_10k       | 2    | 3   | 85.797mb +0.00%  | 2.681ms -12.83%  | ±0.62% -72.26%                |
| RowsBench               | bench_filter_on_10k        | 2    | 3   | 86.326mb +0.00%  | 17.957ms +6.93%  | ±1.48% +192.87%               |
| RowsBench               | bench_find_on_10k          | 2    | 3   | 86.326mb +0.00%  | 17.877ms +4.94%  | ±1.32% +501.11%               |
| RowsBench               | bench_find_one_on_10k      | 10   | 3   | 84.229mb +0.00%  | 1.594μs -16.11%  | ±3.01% +25747230165530000.00% |
| RowsBench               | bench_first_on_10k         | 10   | 3   | 84.229mb +0.00%  | 0.300μs -25.00%  | ±0.00% -100.00%               |
| RowsBench               | bench_flat_map_on_1k       | 2    | 3   | 93.580mb +0.00%  | 12.365ms -13.24% | ±1.54% -39.25%                |
| RowsBench               | bench_map_on_10k           | 2    | 3   | 122.950mb +0.00% | 60.933ms -3.56%  | ±1.33% +67.48%                |
| RowsBench               | bench_merge_1k_on_10k      | 2    | 3   | 86.845mb +0.00%  | 1.362ms -22.80%  | ±0.75% -21.22%                |
| RowsBench               | bench_partition_by_on_10k  | 2    | 3   | 90.136mb +0.00%  | 58.147ms -10.53% | ±1.51% -32.22%                |
| RowsBench               | bench_remove_on_10k        | 2    | 3   | 88.947mb +0.00%  | 4.114ms -9.57%   | ±0.12% -93.28%                |
| RowsBench               | bench_sort_asc_on_1k       | 2    | 3   | 84.313mb +0.00%  | 39.289ms +1.15%  | ±0.06% -96.39%                |
| RowsBench               | bench_sort_by_on_1k        | 2    | 3   | 84.314mb +0.00%  | 39.222ms +0.59%  | ±0.30% -65.49%                |
| RowsBench               | bench_sort_desc_on_1k      | 2    | 3   | 84.313mb +0.00%  | 39.883ms -1.18%  | ±1.61% +289.60%               |
| RowsBench               | bench_sort_entries_on_1k   | 2    | 3   | 86.671mb +0.00%  | 7.596ms +1.33%   | ±0.47% +2.27%                 |
| RowsBench               | bench_sort_on_1k           | 2    | 3   | 84.229mb +0.00%  | 29.044ms +0.58%  | ±0.64% -31.04%                |
| RowsBench               | bench_take_1k_on_10k       | 10   | 3   | 84.229mb +0.00%  | 14.517μs +5.29%  | ±1.50% +118.52%               |
| RowsBench               | bench_take_right_1k_on_10k | 10   | 3   | 84.229mb +0.00%  | 15.618μs -5.34%  | ±0.90% -69.66%                |
| RowsBench               | bench_unique_on_1k         | 2    | 3   | 102.988mb +0.00% | 193.747ms +0.91% | ±1.51% +430.66%               |
+-------------------------+----------------------------+------+-----+------------------+------------------+-------------------------------+

@norberttech norberttech merged commit 8e8c3a0 into flow-php:1.x Sep 27, 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