Skip to content

Commit 4d7fb91

Browse files
committed
Simplify array_to_rows checks
1 parent 47aeef5 commit 4d7fb91

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

src/core/etl/src/Flow/ETL/DSL/functions.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,24 +1667,13 @@ function array_to_rows(array $data, EntryFactory $entryFactory, array|Partitions
16671667
{
16681668
$partitions = \is_array($partitions) ? new Partitions(...$partitions) : $partitions;
16691669

1670-
$isRows = true;
1671-
1672-
foreach ($data as $v) {
1673-
if (!\is_array($v)) {
1674-
$isRows = false;
1675-
1676-
break;
1677-
}
1678-
}
1679-
1680-
if (!$isRows) {
1681-
return Rows::partitioned([array_to_row($data, $entryFactory, $partitions, $schema)], $partitions);
1682-
}
1683-
16841670
$rows = [];
16851671

16861672
foreach ($data as $row) {
1687-
$row = type_array_new()->assert($row);
1673+
if (!\is_array($row)) {
1674+
return Rows::partitioned([array_to_row($data, $entryFactory, $partitions, $schema)], $partitions);
1675+
}
1676+
16881677
$rows[] = array_to_row($row, $entryFactory, $partitions, $schema);
16891678
}
16901679

0 commit comments

Comments
 (0)