Conversation
|
@stloyd could you please take a look if that would work for you? |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 1.x #2102 +/- ##
==========================================
+ Coverage 82.64% 82.96% +0.31%
==========================================
Files 1168 1171 +3
Lines 41168 41400 +232
==========================================
+ Hits 34024 34346 +322
+ Misses 7144 7054 -90
🚀 New features to boost your workflow:
|
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 | 1 | 5.795mb +0.04% | 585.034ms +97.51% | ±0.00% -100.00% |
| DbalExtractorBench | bench_extract_10k_keyset | 1 | 1 | 35.106mb +0.06% | 505.120ms +138.26% | ±0.00% -100.00% |
| DbalExtractorBench | bench_extract_10k_limit_offset | 1 | 1 | 35.132mb -0.05% | 561.795ms +215.09% | ±0.00% -100.00% |
| ExcelExtractorBench | bench_extract_10k_ods | 1 | 1 | 48.748mb +0.01% | 1.924s +110.18% | ±0.00% -100.00% |
| ExcelExtractorBench | bench_extract_10k_xlsx | 1 | 1 | 49.611mb +0.01% | 2.980s +89.08% | ±0.00% -100.00% |
| JsonExtractorBench | bench_extract_10k | 1 | 1 | 6.521mb +0.04% | 2.013s +83.92% | ±0.00% -100.00% |
| ParquetExtractorBench | bench_extract_10k | 1 | 1 | 11.774mb -0.14% | 14.187s +18.78% | ±0.00% -100.00% |
| PostgreSqlExtractorBench | bench_extract_10k_cursor | 1 | 1 | 37.576mb +0.10% | 356.559ms +59.98% | ±0.00% -100.00% |
| PostgreSqlExtractorBench | bench_extract_10k_keyset | 1 | 1 | 37.603mb -0.02% | 423.357ms +0.87% | ±0.00% -100.00% |
| PostgreSqlExtractorBench | bench_extract_10k_limit_offset | 1 | 1 | 37.603mb +0.01% | 372.898ms -0.75% | ±0.00% -100.00% |
| TextExtractorBench | bench_extract_10k | 1 | 1 | 5.794mb +0.04% | 59.372ms +8.28% | ±0.00% -100.00% |
| XmlExtractorBench | bench_extract_10k | 1 | 1 | 5.814mb +0.04% | 661.175ms +0.73% | ±0.00% -100.00% |
+--------------------------+--------------------------------+------+-----+-----------------+--------------------+-----------------+
Transformers+---------------------------------+--------------------------+------+-----+------------------+--------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+---------------------------------+--------------------------+------+-----+------------------+--------------------+-----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1 | 1 | 124.666mb +0.00% | 184.450ms +166.02% | ±0.00% -100.00% |
| RenameEachEntryTransformerBench | bench_transform_10k_rows | 1 | 1 | 19.861mb +0.01% | 136.136ms +89.92% | ±0.00% -100.00% |
+---------------------------------+--------------------------+------+-----+------------------+--------------------+-----------------+
Loaders+-----------------------+---------------------+------+-----+------------------+-------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-----------------------+---------------------+------+-----+------------------+-------------------+-----------------+
| CSVLoaderBench | bench_load_10k | 1 | 1 | 47.949mb +0.01% | 118.783ms +73.76% | ±0.00% -100.00% |
| DbalLoaderBench | bench_load_10k | 1 | 1 | 35.096mb -0.03% | 2.653s +147.97% | ±0.00% -100.00% |
| ExcelLoaderBench | bench_load_10k_ods | 1 | 1 | ERR | 2.937s +0.00% | ±0.00% 0.00% |
| ExcelLoaderBench | bench_load_10k_xlsx | 1 | 1 | ERR | 4.415s +0.00% | ±0.00% 0.00% |
| JsonLoaderBench | bench_load_10k | 1 | 1 | 82.781mb +0.00% | 169.308ms +62.17% | ±0.00% -100.00% |
| ParquetLoaderBench | bench_load_10k | 1 | 1 | 794.689mb +0.01% | 18.776s -27.42% | ±0.00% -100.00% |
| PostgreSqlLoaderBench | bench_load_10k | 1 | 1 | 37.606mb -0.04% | 859.134ms +5.02% | ±0.00% -100.00% |
| TextLoaderBench | bench_load_10k | 1 | 1 | 19.226mb +0.14% | 35.404ms +5.91% | ±0.00% -100.00% |
+-----------------------+---------------------+------+-----+------------------+-------------------+-----------------+
Building Blocks+-------------------+----------------------------+------+-----+------------------+--------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-------------------+----------------------------+------+-----+------------------+--------------------+-----------------+
| EntryFactoryBench | bench_entry_factory | 1 | 1 | 107.263mb +0.00% | 1.078s +105.66% | ±0.00% -100.00% |
| EntryFactoryBench | bench_entry_factory | 1 | 1 | 56.660mb +0.00% | 693.691ms +158.81% | ±0.00% -100.00% |
| EntryFactoryBench | bench_entry_factory | 1 | 1 | 16.342mb +0.02% | 108.144ms +84.38% | ±0.00% -100.00% |
| RowsBench | bench_chunk_10_on_10k | 2 | 1 | 95.161mb +0.00% | 6.512ms +99.02% | ±0.00% -100.00% |
| RowsBench | bench_diff_left_1k_on_10k | 2 | 1 | 112.555mb +0.00% | 528.952ms +120.75% | ±0.00% -100.00% |
| RowsBench | bench_diff_right_1k_on_10k | 2 | 1 | 95.275mb +0.00% | 59.435ms +143.28% | ±0.00% -100.00% |
| RowsBench | bench_drop_1k_on_10k | 2 | 1 | 96.036mb +0.00% | 2.160ms +56.83% | ±0.00% -100.00% |
| RowsBench | bench_drop_right_1k_on_10k | 2 | 1 | 96.036mb +0.00% | 2.202ms +64.95% | ±0.00% -100.00% |
| RowsBench | bench_entries_on_10k | 2 | 1 | 94.197mb +0.00% | 4.719ms +44.82% | ±0.00% -100.00% |
| RowsBench | bench_filter_on_10k | 2 | 1 | 94.726mb +0.00% | 30.747ms +93.04% | ±0.00% -100.00% |
| RowsBench | bench_find_on_10k | 2 | 1 | 94.726mb +0.00% | 31.239ms +94.72% | ±0.00% -100.00% |
| RowsBench | bench_find_one_on_10k | 10 | 1 | 93.415mb +0.00% | 2.500μs +46.54% | ±0.00% -100.00% |
| RowsBench | bench_first_on_10k | 10 | 1 | 93.415mb +0.00% | 0.200μs -33.33% | ±0.00% 0.00% |
| RowsBench | bench_flat_map_on_1k | 2 | 1 | 102.475mb +0.00% | 30.574ms +106.65% | ±0.00% -100.00% |
| RowsBench | bench_map_on_10k | 2 | 1 | 131.902mb +0.00% | 133.518ms +96.05% | ±0.00% -100.00% |
| RowsBench | bench_merge_1k_on_10k | 2 | 1 | 95.246mb +0.00% | 2.065ms +93.30% | ±0.00% -100.00% |
| RowsBench | bench_partition_by_on_10k | 2 | 1 | 98.637mb +0.00% | 117.671ms +94.12% | ±0.00% -100.00% |
| RowsBench | bench_remove_on_10k | 2 | 1 | 96.298mb +0.00% | 6.182ms +82.18% | ±0.00% -100.00% |
| RowsBench | bench_sort_asc_on_1k | 2 | 1 | 93.799mb +0.00% | 78.751ms +94.82% | ±0.00% -100.00% |
| RowsBench | bench_sort_by_on_1k | 2 | 1 | 93.800mb +0.00% | 79.504ms +95.90% | ±0.00% -100.00% |
| RowsBench | bench_sort_desc_on_1k | 2 | 1 | 93.799mb +0.00% | 77.055ms +88.78% | ±0.00% -100.00% |
| RowsBench | bench_sort_entries_on_1k | 2 | 1 | 95.858mb +0.00% | 16.934ms +101.05% | ±0.00% -100.00% |
| RowsBench | bench_sort_on_1k | 2 | 1 | 93.608mb +0.00% | 57.400ms +86.11% | ±0.00% -100.00% |
| RowsBench | bench_take_1k_on_10k | 10 | 1 | 93.415mb +0.00% | 25.100μs +89.86% | ±0.00% -100.00% |
| RowsBench | bench_take_right_1k_on_10k | 10 | 1 | 93.415mb +0.00% | 33.400μs +114.67% | ±0.00% -100.00% |
| RowsBench | bench_unique_on_1k | 2 | 1 | 112.556mb +0.00% | 486.415ms +98.62% | ±0.00% -100.00% |
| TypeDetectorBench | bench_type_detector | 1 | 1 | 43.522mb +0.01% | 640.841ms +93.89% | ±0.00% -100.00% |
| TypeDetectorBench | bench_type_detector | 1 | 1 | 12.580mb +0.02% | 130.587ms +93.89% | ±0.00% -100.00% |
+-------------------+----------------------------+------+-----+------------------+--------------------+-----------------+
Parquet Library+--------------------+---------------------------------+------+-----+------------------+--------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+--------------------+---------------------------------+------+-----+------------------+--------------------+-----------------+
| ParquetWriterBench | bench_write_batch | 1 | 1 | 12.692mb -12.70% | 374.747ms +68.51% | ±0.00% -100.00% |
| ParquetWriterBench | bench_write_gzip | 1 | 1 | 11.352mb +0.04% | 630.520ms +190.49% | ±0.00% -100.00% |
| ParquetWriterBench | bench_write_row_by_row | 1 | 1 | 12.692mb -12.70% | 341.210ms +53.59% | ±0.00% -100.00% |
| ParquetWriterBench | bench_write_snappy | 1 | 1 | 12.692mb -12.70% | 315.186ms +41.56% | ±0.00% -100.00% |
| ParquetWriterBench | bench_write_uncompressed | 1 | 1 | 11.076mb +0.04% | 373.136ms +95.39% | ±0.00% -100.00% |
| ParquetReaderBench | bench_page_headers | 1 | 1 | 7.820mb +0.03% | 4.265s +129.29% | ±0.00% -100.00% |
| ParquetReaderBench | bench_read_metadata | 1 | 1 | 6.514mb +0.04% | 15.247ms +86.05% | ±0.00% -100.00% |
| ParquetReaderBench | bench_read_schema | 1 | 1 | 6.514mb +0.04% | 15.505ms +87.58% | ±0.00% -100.00% |
| ParquetReaderBench | bench_read_values_all_columns | 1 | 1 | 10.090mb -0.16% | 10.670s +36.93% | ±0.00% -100.00% |
| ParquetReaderBench | bench_read_values_single_column | 1 | 1 | 7.388mb -0.22% | 397.955ms -11.50% | ±0.00% -100.00% |
| ParquetReaderBench | bench_read_values_with_limit | 1 | 1 | 7.915mb -0.36% | 33.592ms +42.75% | ±0.00% -100.00% |
+--------------------+---------------------------------+------+-----+------------------+--------------------+-----------------+
|
| $columnIndex = 0; | ||
|
|
||
| foreach ($row->entries() as $entry) { | ||
| $styles[$columnIndex] = $this->cellStyler->style($entry, $rowIndex + 1, $columnIndex, $sheetName); | ||
| $columnIndex++; | ||
| } |
There was a problem hiding this comment.
Can't be?
| $columnIndex = 0; | |
| foreach ($row->entries() as $entry) { | |
| $styles[$columnIndex] = $this->cellStyler->style($entry, $rowIndex + 1, $columnIndex, $sheetName); | |
| $columnIndex++; | |
| } | |
| foreach ($row->entries() as $columnIndex => $entry) { | |
| $styles[$columnIndex] = $this->cellStyler->style($entry, $rowIndex + 1, $columnIndex, $sheetName); | |
| } |
There was a problem hiding this comment.
Note: after playing with real code, this is correct. Column for entries are names so it can be string not integer.
| if ($this->sheetNameEntryName !== null && $row->has($this->sheetNameEntryName)) { | ||
| $value = $row->get($this->sheetNameEntryName)->value(); | ||
|
|
||
| if (\is_string($value) && $value !== '') { |
There was a problem hiding this comment.
I suppose we can omit that first check, as we use strict comparison anyway, correct?
| if (\is_string($value) && $value !== '') { | |
| if ($value !== '') { |
There was a problem hiding this comment.
Note: after playing with real code, this is correct.
| } | ||
| } | ||
|
|
||
| return $this->sheetName ?? 'Sheet1'; |
There was a problem hiding this comment.
Could it be configurable? IIRC is translatable by default
|
|
||
| $extension = $this->path->extension(); | ||
|
|
||
| return match (\strtolower((string) $extension)) { |
There was a problem hiding this comment.
IIRC it's already lower in Path implementation, no?
| $value = match ($entry::class) { | ||
| BooleanEntry::class, | ||
| IntegerEntry::class, | ||
| FloatEntry::class, | ||
| StringEntry::class => $entry->value(), | ||
| DateTimeEntry::class => $entry->value()?->format($this->dateTimeFormat), | ||
| DateEntry::class => $entry->value()?->format($this->dateFormat), | ||
| TimeEntry::class => $entry->value()?->format($this->timeFormat), | ||
| UuidEntry::class => $entry->toString(), | ||
| EnumEntry::class => $this->normalizeEnumEntry($entry), | ||
| JsonEntry::class, | ||
| ListEntry::class, | ||
| MapEntry::class, | ||
| StructureEntry::class => $this->normalizeToJson($entry->value()), | ||
| XMLEntry::class, | ||
| XMLElementEntry::class, | ||
| HTMLEntry::class, | ||
| HTMLElementEntry::class => $entry->toString(), | ||
| default => $entry->toString(), | ||
| }; |
There was a problem hiding this comment.
Should we reduce to just those that don't use ->toString()?
| $row = \count($filteredStyles) > 0 | ||
| ? OpenSpoutRow::fromValuesWithStyles($values, $filteredStyles) | ||
| : OpenSpoutRow::fromValues($values); |
There was a problem hiding this comment.
This seems to be wrong; it should be cell or row style? If row, we can use: fromValues(), in fact, in both cases we can use fromValuesWithStyles(), as they have defaults.
| private string $dateFormat = 'Y-m-d'; | ||
|
|
||
| private string $dateTimeFormat = 'Y-m-d H:i:s'; |
There was a problem hiding this comment.
Seems repeated in normalizer, no?
|
|
||
| if ($this->withHeader && !$manager->isHeaderWritten($sheetName)) { | ||
| $headers = $normalizer->headers($rowForExcel); | ||
| $manager->writeHeader($sheetName, $headers, $this->headerStyle); |
There was a problem hiding this comment.
Missing continue;? Or do we write both the header and row the same?
There was a problem hiding this comment.
Note: after playing with real code, this is correct.
| self::assertEquals( | ||
| [ | ||
| ['e00' => 2, 'e01' => 'Bob'], | ||
| ], | ||
| $rows | ||
| ); |
There was a problem hiding this comment.
This seems to be wrong. Why is it written only one row when two were passed?
There was a problem hiding this comment.
Noticed confusing from_excel()->withHeader(false) which skips the first row.
Resolves: #1500
Resolves: #1904
Change Log
Added
Fixed
Changed
Removed
Deprecated
Security