-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix double encoding of json #1482
Fix double encoding of json #1482
Conversation
Flow PHP - BenchmarksResults 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.801mb +0.01% | 553.020ms +0.47% | ±0.26% -1.09% |
| JsonExtractorBench | bench_extract_10k | 1 | 3 | 4.874mb +0.01% | 1.067s -0.32% | ±0.44% -41.86% |
| ParquetExtractorBench | bench_extract_10k | 1 | 3 | 86.319mb +0.00% | 897.734ms -0.03% | ±1.17% +152.07% |
| TextExtractorBench | bench_extract_10k | 1 | 3 | 4.531mb +0.01% | 35.728ms -1.80% | ±0.60% -43.09% |
| XmlExtractorBench | bench_extract_10k | 1 | 3 | 4.505mb +0.01% | 606.794ms +1.40% | ±0.60% -65.49% |
+-----------------------+-------------------+------+-----+-----------------+------------------+-----------------+
Transformers+-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1 | 3 | 127.327mb +0.00% | 69.252ms -0.21% | ±0.49% +4.69% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+
Loaders+--------------------+----------------+------+-----+------------------+------------------+------------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+--------------------+----------------+------+-----+------------------+------------------+------------------+
| CSVLoaderBench | bench_load_10k | 1 | 3 | 64.000mb +0.00% | 102.795ms -0.75% | ±2.80% +20.46% |
| JsonLoaderBench | bench_load_10k | 1 | 3 | 84.347mb +0.00% | 96.848ms -0.42% | ±0.40% -7.78% |
| ParquetLoaderBench | bench_load_10k | 1 | 3 | 161.190mb +0.00% | 20.528s -0.23% | ±0.18% -48.43% |
| TextLoaderBench | bench_load_10k | 1 | 3 | 17.997mb +0.00% | 30.347ms -2.85% | ±0.94% +1097.00% |
+--------------------+----------------+------+-----+------------------+------------------+------------------+
Building Blocks+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| EntryFactoryBench | bench_entry_factory | 1 | 3 | 105.970mb +0.00% | 459.635ms +1.50% | ±1.22% +161.92% |
| EntryFactoryBench | bench_entry_factory | 1 | 3 | 55.161mb +0.00% | 230.718ms -0.55% | ±1.04% +398.60% |
| EntryFactoryBench | bench_entry_factory | 1 | 3 | 14.683mb +0.00% | 51.637ms +4.41% | ±0.68% -67.27% |
| TypeDetectorBench | bench_type_detector | 1 | 3 | 43.805mb +0.00% | 369.644ms +2.41% | ±1.62% +169.99% |
| TypeDetectorBench | bench_type_detector | 1 | 3 | 11.615mb +0.00% | 73.528ms +0.28% | ±1.59% +61.16% |
| RowsBench | bench_chunk_10_on_10k | 2 | 3 | 97.014mb +0.00% | 3.517ms -7.36% | ±2.48% -30.05% |
| RowsBench | bench_diff_left_1k_on_10k | 2 | 3 | 114.299mb +0.00% | 190.467ms +2.28% | ±0.86% +175.22% |
| RowsBench | bench_diff_right_1k_on_10k | 2 | 3 | 97.019mb +0.00% | 19.062ms -0.33% | ±0.98% -25.37% |
| RowsBench | bench_drop_1k_on_10k | 2 | 3 | 97.888mb +0.00% | 1.485ms +3.88% | ±2.01% -42.08% |
| RowsBench | bench_drop_right_1k_on_10k | 2 | 3 | 97.888mb +0.00% | 1.886ms +19.08% | ±3.11% +72.39% |
| RowsBench | bench_entries_on_10k | 2 | 3 | 96.049mb +0.00% | 4.351ms -3.55% | ±3.36% +274.97% |
| RowsBench | bench_filter_on_10k | 2 | 3 | 96.578mb +0.00% | 16.462ms +0.03% | ±1.02% -37.77% |
| RowsBench | bench_find_on_10k | 2 | 3 | 96.578mb +0.00% | 16.628ms +1.22% | ±0.60% -61.60% |
| RowsBench | bench_find_one_on_10k | 10 | 3 | 95.269mb +0.00% | 1.794μs -5.88% | ±2.67% +9.43% |
| RowsBench | bench_first_on_10k | 10 | 3 | 95.269mb +0.00% | 0.400μs 0.00% | ±0.00% 0.00% |
| RowsBench | bench_flat_map_on_1k | 2 | 3 | 104.487mb +0.00% | 14.461ms -1.20% | ±0.03% -98.21% |
| RowsBench | bench_map_on_10k | 2 | 3 | 134.555mb +0.00% | 70.347ms -2.83% | ±1.64% +223.93% |
| RowsBench | bench_merge_1k_on_10k | 2 | 3 | 97.098mb +0.00% | 1.274ms -1.84% | ±1.39% -55.62% |
| RowsBench | bench_partition_by_on_10k | 2 | 3 | 100.399mb +0.00% | 62.904ms -3.38% | ±1.77% +152.67% |
| RowsBench | bench_remove_on_10k | 2 | 3 | 98.150mb +0.00% | 3.731ms -2.45% | ±1.67% -53.83% |
| RowsBench | bench_sort_asc_on_1k | 2 | 3 | 95.561mb +0.00% | 42.076ms -2.50% | ±0.60% +37.20% |
| RowsBench | bench_sort_by_on_1k | 2 | 3 | 95.561mb +0.00% | 42.639ms -3.58% | ±0.44% -67.39% |
| RowsBench | bench_sort_desc_on_1k | 2 | 3 | 95.561mb +0.00% | 42.707ms -2.67% | ±0.27% -48.09% |
| RowsBench | bench_sort_entries_on_1k | 2 | 3 | 97.710mb +0.00% | 8.279ms +0.80% | ±0.93% -23.28% |
| RowsBench | bench_sort_on_1k | 2 | 3 | 95.460mb +0.00% | 29.253ms +0.03% | ±0.44% -63.09% |
| RowsBench | bench_take_1k_on_10k | 10 | 3 | 95.269mb +0.00% | 13.083μs -1.29% | ±1.64% -51.48% |
| RowsBench | bench_take_right_1k_on_10k | 10 | 3 | 95.269mb +0.00% | 15.404μs -4.02% | ±2.58% -32.88% |
| RowsBench | bench_unique_on_1k | 2 | 3 | 114.300mb +0.00% | 192.249ms +1.81% | ±0.45% +46.84% |
+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 1.x #1482 +/- ##
=======================================
Coverage 83.08% 83.08%
=======================================
Files 666 666
Lines 17899 17899
=======================================
Hits 14871 14871
Misses 3028 3028
|
I would say that this is tricky, cause you may want to double encode json inside json in some edge cases as well. |
Then ArrayEntry still has a place? What are the scenarios where we need to double encode? You could just use a string type in that case? |
No, array entry was entirely removed and it's not coming back, JsonEntry holds an array under the hood. I don't see any good reason to keep double encoding, this behavior is a leftover, but I might be missing something @stloyd you have any specific scenarios in your head? |
I merged it for now as I don't yet see how double encoding can be useful, but feel free to ping me if you can think about anything, we can still revert that change or parametrize it |
Change Log
Added
Fixed
Changed
Removed
Deprecated
Security
Description
I was looking at replacing ArrayEntry with JsonEntry and hit this issue with the JSON serialisation in which it would double encode the JSON result (once in the normaliser, than once more in the loader)