From b0c8e6daca4ec75be856d82e43f7836f56e545d1 Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Mon, 23 Nov 2026 19:43:53 -0600 Subject: [PATCH] feat(flow-php/postgresql): migration lock - Migrator takes an advisory lock, throws MigrationLockedException when busy - executeVersion() refuses an executed (up) or not executed (down) version - bundle: migrations.lock config (advisory, symfony, service, none) - bundle: flow:migrations:migrate waits for a busy lock - bundle: optional symfony/lock adapter - upgrading.md wording cleanup --- composer.json | 1 + composer.lock | 85 +- .../bridges/symfony-postgresql-bundle.md | 95 ++ documentation/upgrading.md | 1265 +++++++++-------- .../symfony/postgresql-bundle/composer.json | 2 + .../Command/ExecuteCommand.php | 9 +- .../Command/MigrateCommand.php | 45 +- .../PostgreSqlBundle/FlowPostgreSqlBundle.php | 110 +- .../Lock/SymfonyMigrationLock.php | 54 + .../Resources/config/migrations.php | 2 + .../Tests/Double/ForgetfulLockStore.php | 24 + .../FlowPostgreSqlExtensionTest.php | 72 + .../Tests/Unit/Command/ExecuteCommandTest.php | 51 + .../Tests/Unit/Command/MigrateCommandTest.php | 125 ++ .../DependencyInjection/ConfigurationTest.php | 96 ++ .../Unit/Lock/SymfonyMigrationLockTest.php | 61 + .../PostgreSql/Migrations/Configuration.php | 9 +- .../Exception/MigrationException.php | 29 + .../Exception/MigrationLockedException.php | 18 + .../Migrations/Lock/AdvisoryMigrationLock.php | 39 + .../Migrations/Lock/MigrationLock.php | 17 + .../Migrations/Lock/NoMigrationLock.php | 15 + .../Flow/PostgreSql/Migrations/Migrator.php | 143 +- .../Tests/Context/MigratorContext.php | 66 + .../Migrations/Tests/Double/SpyClient.php | 22 +- .../Tests/Double/SpyMigrationLock.php | 43 + .../Lock/AdvisoryMigrationLockTest.php | 92 ++ .../Tests/Integration/MigratorTest.php | 111 ++ .../PostgreSqlMigrationsContext.php | 11 + .../Tests/Unit/ConfigurationTest.php | 18 + .../Unit/Exception/MigrationExceptionTest.php | 32 + .../MigrationLockedExceptionTest.php | 25 + .../Unit/Lock/AdvisoryMigrationLockTest.php | 56 + .../Tests/Unit/Lock/NoMigrationLockTest.php | 26 + .../Migrations/Tests/Unit/MigratorTest.php | 991 +++++++------ 35 files changed, 2741 insertions(+), 1119 deletions(-) create mode 100644 src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/Lock/SymfonyMigrationLock.php create mode 100644 src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Double/ForgetfulLockStore.php create mode 100644 src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Lock/SymfonyMigrationLockTest.php create mode 100644 src/lib/postgresql/src/Flow/PostgreSql/Migrations/Exception/MigrationLockedException.php create mode 100644 src/lib/postgresql/src/Flow/PostgreSql/Migrations/Lock/AdvisoryMigrationLock.php create mode 100644 src/lib/postgresql/src/Flow/PostgreSql/Migrations/Lock/MigrationLock.php create mode 100644 src/lib/postgresql/src/Flow/PostgreSql/Migrations/Lock/NoMigrationLock.php create mode 100644 src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Context/MigratorContext.php create mode 100644 src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Double/SpyMigrationLock.php create mode 100644 src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Integration/Lock/AdvisoryMigrationLockTest.php create mode 100644 src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Exception/MigrationLockedExceptionTest.php create mode 100644 src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/AdvisoryMigrationLockTest.php create mode 100644 src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/NoMigrationLockTest.php diff --git a/composer.json b/composer.json index 82d750d59f..9f66e4485a 100644 --- a/composer.json +++ b/composer.json @@ -75,6 +75,7 @@ "symfony/finder": "^6.4 || ^7.4 || ^8.0", "symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0", "symfony/http-client": "^6.4 || ^7.4 || ^8.0", + "symfony/lock": "^6.4 || ^7.4 || ^8.0", "symfony/messenger": "^6.4 || ^7.4 || ^8.0", "symfony/options-resolver": "^6.4 || ^7.4 || ^8.0", "symfony/password-hasher": "^6.4 || ^7.4 || ^8.0", diff --git a/composer.lock b/composer.lock index c7cc7d89b3..901d313fba 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "53bad3529c625f3560c847099bd3ec7b", + "content-hash": "0c6f0e0d64957a028deb45975bbbaf98", "packages": [ { "name": "async-aws/core", @@ -6763,6 +6763,89 @@ ], "time": "2026-11-04T07:46:24+00:00" }, + { + "name": "symfony/lock", + "version": "v7.4.23", + "source": { + "type": "git", + "url": "https://github.com/symfony/lock.git", + "reference": "1c89b44cf414dfb98e2f83a02b6a7487ccedeb17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/lock/zipball/1c89b44cf414dfb98e2f83a02b6a7487ccedeb17", + "reference": "1c89b44cf414dfb98e2f83a02b6a7487ccedeb17", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/log": "^1|^2|^3" + }, + "conflict": { + "doctrine/dbal": "<3.6", + "symfony/cache": "<6.4" + }, + "require-dev": { + "doctrine/dbal": "^3.6|^4", + "predis/predis": "^1.1|^2.0", + "symfony/serializer": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Lock\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jérémy Derussé", + "email": "jeremy@derusse.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Creates and manages locks, a mechanism to provide exclusive access to a shared resource", + "homepage": "https://symfony.com", + "keywords": [ + "cas", + "flock", + "locking", + "mutex", + "redlock", + "semaphore" + ], + "support": { + "source": "https://github.com/symfony/lock/tree/v7.4.23" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-11-01T22:26:51+00:00" + }, { "name": "symfony/messenger", "version": "v7.4.23", diff --git a/documentation/components/bridges/symfony-postgresql-bundle.md b/documentation/components/bridges/symfony-postgresql-bundle.md index 9171402ef4..9396a0fa4b 100644 --- a/documentation/components/bridges/symfony-postgresql-bundle.md +++ b/documentation/components/bridges/symfony-postgresql-bundle.md @@ -232,6 +232,12 @@ flow_postgresql: generate_rollback: true # Generate rollback files automatically drop_if_exists: false # Emit IF EXISTS on diff-generated DROP statements mode: all_pending # Which pending migrations migrate runs: all_pending or strict_order + lock: + type: advisory # advisory, symfony, service or none + timeout: 300 # Seconds flow:migrations:migrate waits for a busy lock + ttl: 3600 # type: symfony - seconds the lock lives + factory_service_id: lock.factory # type: symfony - the LockFactory service + service_id: ~ # type: service - your MigrationLock service ``` #### `mode` @@ -243,6 +249,95 @@ the latest executed migration. - `strict_order`: `flow:migrations:migrate` stops with an error and exit code 1. It runs no migration. Run the older version with `flow:migrations:execute`, or set the mode to `all_pending`. +#### `lock` + +A lock stops two processes from running the same migrations at the same time, for example two application instances +that deploy at once. `flow:migrations:migrate` and `flow:migrations:execute` take the lock. A `--dry-run` takes no +lock. + +```yaml +flow_postgresql: + migrations: + lock: + type: advisory # default, a session advisory lock in PostgreSQL + timeout: 300 +``` + +```yaml +framework: + lock: '%env(LOCK_DSN)%' # registers the lock.factory service + +flow_postgresql: + migrations: + lock: + type: symfony # requires symfony/lock + factory_service_id: lock.factory + ttl: 3600 +``` + +```yaml +flow_postgresql: + migrations: + lock: + type: service + service_id: App\Migrations\MyMigrationLock # implements Flow\PostgreSql\Migrations\Lock\MigrationLock +``` + +```yaml +flow_postgresql: + migrations: + lock: + type: none +``` + +Each type accepts only its own keys. Any other key fails at configuration time. + +| type | keys | +|------------|----------------------------------------| +| `advisory` | `timeout` | +| `symfony` | `timeout`, `ttl`, `factory_service_id` | +| `service` | `timeout`, `service_id` | +| `none` | - | + +If the lock is busy, `flow:migrations:migrate` waits up to `timeout` seconds: + +``` +$ bin/console flow:migrations:migrate + ! [NOTE] Another process is running migrations. Waiting up to 300 seconds for it to finish... + [OK] Already up to date. +``` + +`flow:migrations:execute` does not wait. It fails at once. + +The advisory lock needs a direct session with PostgreSQL. If migrations connect through a pooler in transaction mode +(for example PgBouncer), use `type: symfony` with a store outside the database. A lock outside the database must +outlive the longest migration run, so set `ttl` above its duration. + +Without the bundle, pass the lock to `Configuration`. The default is `AdvisoryMigrationLock`. `Migrator` never waits. +A busy lock throws `MigrationLockedException`: + +```php +migrate(); +} catch (MigrationLockedException $exception) { + // another process runs the migrations: wait and retry, skip, or fail +} +``` + #### `drop_if_exists` To add `IF EXISTS` to every `DROP` that the diff generates, set `drop_if_exists: true`. Use it for convergence diff --git a/documentation/upgrading.md b/documentation/upgrading.md index 181d523496..b5aeba1f01 100644 --- a/documentation/upgrading.md +++ b/documentation/upgrading.md @@ -97,26 +97,33 @@ A custom `Backend` must implement the two methods. Update or rebuild the flow_ph | a partitioned write refuses an empty value | it writes the folder `country=` | | a read ignores a folder `country=` | it reads it as the partition column `country` | +### 9) `flow-php/postgresql` - `Migrator::executeVersion()` checks the state of the version + +| Before | After | +|----------------------------------------------------------------------|----------------------------------------------| +| `UP` on an executed version ran the migration, then failed on insert | throws `MigrationException` and runs nothing | +| `DOWN` on a version that is not executed ran the rollback | throws `MigrationException` and runs nothing | + --- ## Upgrading from 0.47.x to 0.48.x ### 1) `flow-php/etl` - `Transformation` is invokable and every DataFrame method has a pipe step; `print_rows()` and `WithColumn` changed -| Before | After | -|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `interface Transformation { public function transform(DataFrame $dataFrame): DataFrame; }` | `public function __invoke(DataFrame $dataFrame): DataFrame;` - rename `transform()` to `__invoke()` in your Transformations; call one as `$transformation($dataFrame)` | -| `print_rows(Rows $rows, int\|bool $truncate = false, ?Formatter $formatter = null): string` | `format_rows(...)`, same arguments; `print_rows()` is now the `printRows()` pipe step | -| `Flow\ETL\Functions\WithColumn` | `Flow\ETL\API\Transformation\WithColumn`, a `Transformation` that also works as `with_column(...)($df)` | -| `WithColumn::$name` is `string`, `::$function` is `ScalarFunction` | `string\|Definition`, `ScalarFunction\|WindowFunction`, as `withColumn()` takes | -| `DataFrame::with(Transformer\|Transformation\|WithColumn $transformer)` | `with(Transformer\|Transformation $transformer)`; a `WithColumn` passes as a `Transformation` | -| `duplicateRow()`, `duplicate_row()` accept every `WithColumn` | a Definition name or a window function throws `InvalidArgumentException`: add that column with `withColumn()` first | +| Before | After | +|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `interface Transformation { public function transform(DataFrame $dataFrame): DataFrame; }` | `public function __invoke(DataFrame $dataFrame): DataFrame;` - rename `transform()` to `__invoke()` in your Transformations, and call one as `$transformation($dataFrame)` | +| `print_rows(Rows $rows, int\|bool $truncate = false, ?Formatter $formatter = null): string` | `format_rows(...)`, same arguments. `print_rows()` is now the `printRows()` pipe step | +| `Flow\ETL\Functions\WithColumn` | `Flow\ETL\API\Transformation\WithColumn`, a `Transformation` that also works as `with_column(...)($df)` | +| `WithColumn::$name` is `string`, `::$function` is `ScalarFunction` | `string\|Definition`, `ScalarFunction\|WindowFunction`, as `withColumn()` takes | +| `DataFrame::with(Transformer\|Transformation\|WithColumn $transformer)` | `with(Transformer\|Transformation $transformer)`. A `WithColumn` passes as a `Transformation` | +| `duplicateRow()`, `duplicate_row()` accept every `WithColumn` | a Definition name or a window function throws `InvalidArgumentException`: add that column with `withColumn()` first | ### 2) `flow-php/symfony-filesystem-bundle` - each mount is a service; `FstabBuilder` is removed | Before | After | |------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| -| `Flow\Bridge\Symfony\FilesystemBundle\Filesystem\FstabBuilder::build()` built each fstab | removed; each mount is the service `flow.filesystem.mount..`, and the fstab is built from those services | +| `Flow\Bridge\Symfony\FilesystemBundle\Filesystem\FstabBuilder::build()` built each fstab | removed. Each mount is the service `flow.filesystem.mount..`, and the fstab is built from those services | ### 3) `flow-php/postgresql` - schema objects store and inherit their schema, extensions belong to the catalog @@ -208,7 +215,7 @@ and passes it to `SchemaInferrer::infer()`. A custom `Sniffer` or `CSVOpenSource | Before | After | |-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------| -| `memoryLimit()` compared with the process memory | compared with the memory the operation itself added; each live operation gets its own limit | +| `memoryLimit()` compared with the process memory | compared with the memory the operation itself added, and each live operation gets its own limit | | `FLOW_MAX_MEMORY`: the default limit, compared with the process memory | the default per-operation limit and, with a finite `memory_limit`, the process cap | | - | with a finite `memory_limit`, the process over 70% of it (or `FLOW_MAX_MEMORY`) also spills, after the operation added `min(128 MiB, cap / 16)` | | `MemoryBudget::exceeded()` / `exceededWith()` compare the process memory with the limit | compare the memory added since the budget started or since `released()` with the limit, and the process with the cap | @@ -221,7 +228,7 @@ and passes it to `SchemaInferrer::infer()`. A custom `Sniffer` or `CSVOpenSource | `new BoundedRead(Unit, Backend)` | `new BoundedRead(MemoryBudget)` | | `new ExternalSort(array, Buckets, Buckets, RandomValueGenerator, Unit $memoryLimit, ...)`, `::$memoryLimit` | no `$memoryLimit`: the limit comes from the `MemoryBudget` passed to `sort()` | | `ExternalSort::sort(Generator, Backend, ?int)` | `sort(Generator, Backend, MemoryBudget, ?int)` | -| - | with a finite `memory_limit`, a sort whose working memory would pass the cap sorts and spills in runs that fit | +| - | with a finite `memory_limit`, a sort whose working memory passes the cap sorts and spills in runs that fit | | `Backend` implementations | implement `sortWorkingBytes(Rows $rows, array $columns): int` | ### 11) `flow-php/etl` - a failed run ends its sources first @@ -300,15 +307,15 @@ before it returns it fails with PHP's `Cannot rewind a generator that was alread ### 17) `flow-php/filesystem-async-aws-bridge` - the client has HTTP limits, `mv()` and appends copy in ranged parts -| Before | After | -|-------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| -| idle timeout `default_socket_timeout` (60 s by default) | 30 s, set `http.timeout` in the client configuration | -| no limit for one call | 300 s for one call with its retries; a `content()` of a large object can hit it, raise `http.max_duration` | -| an object moved by `mv()` gets a single-part ETag | an object above `copy_part_size` gets a multipart ETag `-` | -| an append writes a `/_flow_php_append_` object | no `_flow_php_append_` object | -| `AsyncAWSS3DestinationStream::openAppend($s3Client, $bucket, $path, $blockFactory, $blockSize)` | `openAppend(..., $blockSize, int $copyPartSize = 256 * 1024 * 1024)` | -| `Options::fromArray()` takes a description without `copy_part_size` | the description must hold `copy_part_size` (int) | -| `openBlank()`, `openExclusive()`, `openAppend()` default `$blockSize` 4 MiB | 5 MiB, the S3 minimum part size | +| Before | After | +|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| +| idle timeout `default_socket_timeout` (60 s by default) | 30 s, set `http.timeout` in the client configuration | +| no limit for one call | 300 s for one call with its retries. A `content()` of a large object can hit it, so raise `http.max_duration` | +| an object moved by `mv()` gets a single-part ETag | an object above `copy_part_size` gets a multipart ETag `-` | +| an append writes a `/_flow_php_append_` object | no `_flow_php_append_` object | +| `AsyncAWSS3DestinationStream::openAppend($s3Client, $bucket, $path, $blockFactory, $blockSize)` | `openAppend(..., $blockSize, int $copyPartSize = 256 * 1024 * 1024)` | +| `Options::fromArray()` takes a description without `copy_part_size` | the description must hold `copy_part_size` (int) | +| `openBlank()`, `openExclusive()`, `openAppend()` default `$blockSize` 4 MiB | 5 MiB, the S3 minimum part size | ### 18) `flow-php/filesystem-azure-bridge` - the blob service has HTTP limits and retries @@ -366,7 +373,7 @@ PHP engine. | Before | After | |----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------| -| no `engine:` is `AdaptiveParquetEngine`: `RustParquetEngine` when `arrow` is loaded | `FlowPhpParquetEngine` when `flow_php` is loaded, else `PhpParquetEngine` | +| no `engine:` is `AdaptiveParquetEngine`: if `arrow` is loaded, `RustParquetEngine` | if `flow_php` is loaded, `FlowPhpParquetEngine`, else `PhpParquetEngine` | | `arrow` alone: ETL reads and writes on `RustParquetEngine` | `PhpParquetEngine`. Pass `engine: new RustParquetEngine()` to keep `arrow`. A memory limit does not count its bytes | | both loaded, `engine: new RustParquetEngine()`: batches into native columns through the Arrow C data interface | PHP values from `arrow`, adopted by the backend | | `RustParquetOpenSource::__construct(RustParquetFileReader $file)` | `__construct(FlowPhpParquetFileReader $file)` | @@ -395,32 +402,32 @@ PHP engine. ### 1) `flow-php/types` - leaf types are no longer generic -| Before | After | -|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| `StringType`, `DateTimeType<\DateTimeInterface>`, `UuidType`, ... | `StringType`, `DateTimeType`, `UuidType` - leaf types implement `Type`, ... directly | -| `ListType>`, `MapType>` | `ListType`, `MapType` | -| Mago `plugins = ["flow-php"]` infers `type_structure()` shapes | Built-in plugin no longer infers them - use `flow-php/mago-types-bridge` (`plugins = ["flow/types"]`) | +| Before | After | +|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| +| `StringType`, `DateTimeType<\DateTimeInterface>`, `UuidType`, ... | `StringType`, `DateTimeType`, `UuidType` - leaf types implement `Type`, ... directly | +| `ListType>`, `MapType>` | `ListType`, `MapType` | +| Mago `plugins = ["flow-php"]` infers `type_structure()` shapes | Built-in plugin no longer infers them. Use `flow-php/mago-types-bridge` (`plugins = ["flow/types"]`) | ### 2) `flow-php/parquet` - statistics are written and read as arrow-rs does; one physical schema for one logical schema on both engines -| Before | After | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| PHP writer string bounds by PHP `<` (`'9'` below `'10'`), whole strings, no exactness flags, no `nan_count`, no `column_orders`, deprecated `min`/`max` for every type | unsigned-byte order, truncated to `Option::STATISTICS_TRUNCATE_LENGTH` (64) bytes, exactness flags, `nan_count` for floats, `column_orders` per leaf, deprecated `min`/`max` only for signed sort orders | -| statistics of files written by older flow versions read as written | `ColumnOrder::Absent`: no bounds are trusted, so such files are never pruned; a statistic of the wrong width (older INT64 bounds are 16 bytes) reads as `null` | -| `StatisticsReader` read BYTE_ARRAY statistics with a length prefix, a FLBA decimal as a float, an INT64 decimal as the unscaled int | raw bytes for BYTE_ARRAY/FLBA (decimals as unscaled two's complement bytes, uuid as 16 bytes), the unscaled int for INT32/INT64 decimals | -| `FlatColumn::decimal()` of precision up to 18 written as FIXED_LEN_BYTE_ARRAY | INT32 up to precision 9, INT64 up to 18, FIXED_LEN_BYTE_ARRAY above; older files still read | -| the packer/unpacker encoded FLBA/BYTE_ARRAY decimals and UUIDs; `DecimalConverter` took INT-backed decimals only | `new DecimalConverter($physicalType, $precision, $scale, $byteLength)` and `UuidConverter` convert to the physical bytes; the packer/unpacker take them as-is | -| `FlatColumn::int32()` / `int64()` wrote converted `INT_32` / `INT_64` | plain `INT32` / `INT64`, as arrow-rs | -| a column with a logical type and no converted type written without one (other readers read a logical `UINT_64` as signed) | the converted type derived from the logical type, as arrow-rs; a `FlatColumn` whose converted and logical types disagree is refused, on read and write | -| the arrow writer named map entries `m.entries.key` | `m.key_value.key` (LogicalTypes.md): `COLUMNS_*` options keyed by `...key_value.key` address the same leaf on both engines | -| the arrow writer wrote `FlatColumn::enum()` as `STRING` | `ENUM` | -| `Option::ARROW_BATCH_SIZE`, read by nothing | removed | -| `Flow\Parquet\Dremel\Statistics\Comparator` | removed: `Flow\Parquet\Data\PhysicalOrder` | -| `new StatisticsCounter($column)` | `new StatisticsCounter($column, new StatisticsTruncation($length))` | -| `new UnsignedIntegerConverter($path, $bitWidth)` | `new UnsignedInt32Converter()`; UINT_64 is `UnsignedInt64Converter` | +| Before | After | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| PHP writer string bounds by PHP `<` (`'9'` below `'10'`) and whole strings. No exactness flags, no `nan_count`, no `column_orders`, deprecated `min`/`max` for every type. | unsigned-byte order, truncated to `Option::STATISTICS_TRUNCATE_LENGTH` (64) bytes. Exactness flags, `nan_count` for floats, `column_orders` per leaf, deprecated `min`/`max` only for signed sort orders | +| statistics of files written by older flow versions read as written | `ColumnOrder::Absent`: no bounds are trusted, so such files are never pruned. A statistic of the wrong width (older INT64 bounds are 16 bytes) reads as `null` | +| `StatisticsReader` read BYTE_ARRAY statistics with a length prefix, a FLBA decimal as a float, an INT64 decimal as the unscaled int | raw bytes for BYTE_ARRAY/FLBA (decimals as unscaled two's complement bytes, uuid as 16 bytes), the unscaled int for INT32/INT64 decimals | +| `FlatColumn::decimal()` of precision up to 18 written as FIXED_LEN_BYTE_ARRAY | INT32 up to precision 9, INT64 up to 18, FIXED_LEN_BYTE_ARRAY above. Older files still read | +| the packer/unpacker encoded FLBA/BYTE_ARRAY decimals and UUIDs, and `DecimalConverter` took INT-backed decimals only | `new DecimalConverter($physicalType, $precision, $scale, $byteLength)` and `UuidConverter` convert to the physical bytes. The packer/unpacker take them as-is | +| `FlatColumn::int32()` / `int64()` wrote converted `INT_32` / `INT_64` | plain `INT32` / `INT64`, as arrow-rs | +| a column with a logical type and no converted type written without one (other readers read a logical `UINT_64` as signed) | the converted type derived from the logical type, as arrow-rs. A `FlatColumn` whose converted and logical types disagree is refused, on read and write | +| the arrow writer named map entries `m.entries.key` | `m.key_value.key` (LogicalTypes.md): `COLUMNS_*` options keyed by `...key_value.key` address the same leaf on both engines | +| the arrow writer wrote `FlatColumn::enum()` as `STRING` | `ENUM` | +| `Option::ARROW_BATCH_SIZE`, read by nothing | removed | +| `Flow\Parquet\Dremel\Statistics\Comparator` | removed: `Flow\Parquet\Data\PhysicalOrder` | +| `new StatisticsCounter($column)` | `new StatisticsCounter($column, new StatisticsTruncation($length))` | +| `new UnsignedIntegerConverter($path, $bitWidth)` | `new UnsignedInt32Converter()`, and UINT_64 is `UnsignedInt64Converter` | ### 3) `flow-php/parquet`, `flow-php/etl-adapter-parquet` - @@ -428,7 +435,7 @@ both engines | Before | After | |-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| -| `UINT_64` read as `int`, refused above `PHP_INT_MAX` on both engines | read as the decimal string (`'18446744073709551615'`) on both engines; `UINT_8/16/32` stay `int` | +| `UINT_64` read as `int`, refused above `PHP_INT_MAX` on both engines | read as the decimal string (`'18446744073709551615'`) on both engines. `UINT_8/16/32` stay `int` | | `from_parquet()` typed a `UINT_64` column `integer` | `numeric_string` | | writes accepted an int from 0 to `PHP_INT_MAX` into `UINT_64` | an int >= 0 or a canonical digit string up to `18446744073709551615` | | `to_parquet()` refused a `numeric_string` column (`NumericStringType is not supported`) | written as a parquet `STRING` | @@ -444,38 +451,38 @@ both engines `ReadPlan`) instead of limit/offset, the PHP writer writes the page index, the reader exposes its `Footer`; the `arrow` and `flow_php` extensions must be rebuilt -| Before | After | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `ParquetFile::values(array $columns, ?int $limit, ?int $offset)` | `values(Query $query)`: `$file->values(parquet_query()->select(...$columns)->offset($offset)->limit($limit))` | -| `ParquetFile::columns(int $batchSize, array $columns, ?int $limit, ?int $offset)` | `columns(Query $query, int $batchSize = 1024)` | -| a limit of `0` refused (`Limit must be greater than 0`); a negative offset or limit refused by `columns()` | `limit(0)` reads no row; a negative offset or limit is refused by `Query` | -| `ParquetFileReader::metadata()`, `schema()`, `rowsNumber()`, `totalByteSize()` | `ParquetFileReader::footer(): Footer` holds them (and `rowGroupChunks()`); a footer taken before `close()` stays readable | -| `ParquetFileReader::readColumns(array $columns, int $batchSize, ?int $limit, ?int $offset)` | `readColumns(array $columns, int $batchSize, ReadPlan $plan)`, returning the rows `$plan->selection` selects that match `$plan->rowFilter`, at most `$plan->limit` after `$plan->offset` matches are skipped, one `SkippedMatches` first when the offset is above 0; build the plan with `ReadPlan::forFilter(...)` or `ReadPlan::window($rows, $file->indexes(), $offset, $limit)` | -| `RustParquetFileReader::thrift()` | `RustParquetFileReader::footer()->thrift()` (`RustParquetFooter`) | -| a `ParquetFileReader` / `ParquetFileWriter` implementation | also `readStoredColumns(array $columns, int $batchSize, ReadPlan $plan): Iterator` and `writeStoredColumns(array $columns): void`: DATE, TIMESTAMP, TIME and UUID values as stored (days, µs since the epoch, µs since midnight, 16 bytes) | -| the arrow writer refused a value outside the range arrow stores it in with `RuntimeException` | `InvalidArgumentException`, as the PHP writer refuses it (e.g. a `DateTime` outside `TIMESTAMP(NANOS)`) | -| `ParquetOpenSource::batches(Schema $schema, int $batchSize, ?int $offset, ?int $limit, Backend $backend)` | `batches(Schema $schema, int $batchSize, ReadPlan $plan, Backend $backend)` | -| `RustBatchReader` / `RustColumnsReader::__construct(..., int $batchSize, ?int $offset, ?int $limit)` | `__construct(..., int $batchSize, ReadPlan $plan)` | -| `ColumnReader::read(Column, Metadata, SourceStream, ?int $limit, ?int $offset)` | `readRowGroup(Column, RowGroup, int $group, SourceStream, RowSelection, Indexes, array $decoded = [])`, one row group at a time; `$decoded` pages, keyed by their first row, are served instead of read | -| `new ColumnReader(ColumnChunkReader $chunks, DremelAssembler $assembler)` | `new ColumnReader(new SelectedPages($chunks), $assembler)` | -| `ColumnChunkReader::read(ColumnChunk, FlatColumn, SourceStream)` yielded a list of pages | pages keyed by their first row in the row group; `?OffsetIndex $offsetIndex` with `list $pages` reads only those pages of it, `?Dictionary $dictionary` replaces the dictionary page, the generator returns the dictionary | -| `RowGroupContainer(string, RowGroup)` | `RowGroupContainer(string, RowGroup, list, list)` | -| `new PlainFlatColumnChunkBuilder($column, $options, $compression)` (and the RLE_DICTIONARY, DELTA_BINARY_PACKED builders, `ColumnChunkBuilderFactory::createBuilder()`) | a 4th argument, `StatisticsOptions::fromOptions($options)` | -| `ColumnChunk::dataPageOffset(): ?int` | `int`: a column chunk always records it | -| the PHP writer wrote no column index or offset index | both, by default (`Option::STATISTICS_LEVEL`, `StatisticsLevel::PAGE`; `CHUNK` drops the column index, `NONE` all statistics) | -| the PHP writer wrote page-header statistics on `DATA_PAGE_V2` | none, as arrow-rs: `Option::PAGE_HEADER_STATISTICS` (`true`) writes them, on v1 and v2 pages | -| `Option::PAGE_MAXIMUM_ROWS_COUNT` (default `1000`) was read by nothing | the PHP writer closes a page at exactly that many rows; the arrow writer treats it as a target (arrow-rs `data_page_row_count_limit`, checked between write batches), so its pages can hold more; below 1 is refused (`InvalidArgumentException`) | -| the arrow writer skipped a `COLUMNS_COMPRESSIONS` / `COLUMNS_ENCODINGS` entry whose column path is digits only (`'2024'`, an int array key) | applies it; a key that is not UTF-8 is refused (`InvalidArgumentException`) instead of crashing the process | -| `Option::ROW_GROUP_SIZE_BYTES` below 1 was taken by both writers | refused (`InvalidArgumentException`) by both writers | -| the arrow writer threw `Error` (a Rust panic) on `PLAIN_DICTIONARY` / `RLE_DICTIONARY` in `COLUMNS_ENCODINGS` | enables the column's dictionary: `RLE_DICTIONARY` data pages and a `PLAIN` dictionary page, as the PHP writer writes | -| the arrow writer skipped a `COLUMNS_COMPRESSIONS` / `COLUMNS_ENCODINGS` value that is not a string | refused (`InvalidArgumentException`) | -| files with an `RLE_DICTIONARY` column spanning more than one page, written by the PHP writer | were corrupt (later pages decoded to wrong values): rewrite them; one dictionary per chunk, `PLAIN` past `Option::DICTIONARY_PAGE_SIZE` | -| `Option::DICTIONARY_PAGE_MIN_CARDINALITY_RATION` | removed: it was never read; the dictionary falls back to `PLAIN` on `Option::DICTIONARY_PAGE_SIZE` only, as arrow-rs | -| `Options::set()` / `get()` took scalars and arrays | also a `UnitEnum`; `Options::getEnum(Option $option, string $class)` | -| no column index truncation option | `Option::COLUMN_INDEX_TRUNCATE_LENGTH` (64): BYTE_ARRAY/FIXED_LEN_BYTE_ARRAY page bounds in the column index | -| `DataPageHeaderV2::statistics(Options $options)` | `statistics()`, as `DataPageHeader::statistics()` | -| `ParquetFile::pageHeaders()` repeated every chunk of a row group under each column | each column's own chunk pages, once | -| `FLOW_PHP_ABI` / `FlowPhpExtension::ABI` 1 | 2 (covering every contract change below): rebuild the `flow_php` extension (and `arrow`, item 4); an older build is refused by `available()` | +| Before | After | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ParquetFile::values(array $columns, ?int $limit, ?int $offset)` | `values(Query $query)`: `$file->values(parquet_query()->select(...$columns)->offset($offset)->limit($limit))` | +| `ParquetFile::columns(int $batchSize, array $columns, ?int $limit, ?int $offset)` | `columns(Query $query, int $batchSize = 1024)` | +| a limit of `0` refused (`Limit must be greater than 0`), and a negative offset or limit refused by `columns()` | `limit(0)` reads no row, and a negative offset or limit is refused by `Query` | +| `ParquetFileReader::metadata()`, `schema()`, `rowsNumber()`, `totalByteSize()` | `ParquetFileReader::footer(): Footer` holds them (and `rowGroupChunks()`). A footer taken before `close()` stays readable | +| `ParquetFileReader::readColumns(array $columns, int $batchSize, ?int $limit, ?int $offset)` | `readColumns(array $columns, int $batchSize, ReadPlan $plan)` returns the rows that `$plan->selection` selects and that match `$plan->rowFilter`. It skips `$plan->offset` matches and returns at most `$plan->limit` rows. If the offset is above 0, one `SkippedMatches` comes first. Build the plan with `ReadPlan::forFilter(...)` or `ReadPlan::window($rows, $file->indexes(), $offset, $limit)` | +| `RustParquetFileReader::thrift()` | `RustParquetFileReader::footer()->thrift()` (`RustParquetFooter`) | +| a `ParquetFileReader` / `ParquetFileWriter` implementation | also `readStoredColumns(array $columns, int $batchSize, ReadPlan $plan): Iterator` and `writeStoredColumns(array $columns): void`: DATE, TIMESTAMP, TIME and UUID values as stored (days, µs since the epoch, µs since midnight, 16 bytes) | +| the arrow writer refused a value outside the range arrow stores it in with `RuntimeException` | `InvalidArgumentException`, as the PHP writer refuses it (for example a `DateTime` outside `TIMESTAMP(NANOS)`) | +| `ParquetOpenSource::batches(Schema $schema, int $batchSize, ?int $offset, ?int $limit, Backend $backend)` | `batches(Schema $schema, int $batchSize, ReadPlan $plan, Backend $backend)` | +| `RustBatchReader` / `RustColumnsReader::__construct(..., int $batchSize, ?int $offset, ?int $limit)` | `__construct(..., int $batchSize, ReadPlan $plan)` | +| `ColumnReader::read(Column, Metadata, SourceStream, ?int $limit, ?int $offset)` | `readRowGroup(Column, RowGroup, int $group, SourceStream, RowSelection, Indexes, array $decoded = [])`, one row group at a time. `$decoded` pages, keyed by their first row, are served instead of read | +| `new ColumnReader(ColumnChunkReader $chunks, DremelAssembler $assembler)` | `new ColumnReader(new SelectedPages($chunks), $assembler)` | +| `ColumnChunkReader::read(ColumnChunk, FlatColumn, SourceStream)` yielded a list of pages | pages keyed by their first row in the row group. `?OffsetIndex $offsetIndex` with `list $pages` reads only those pages of it. `?Dictionary $dictionary` replaces the dictionary page. The generator returns the dictionary | +| `RowGroupContainer(string, RowGroup)` | `RowGroupContainer(string, RowGroup, list, list)` | +| `new PlainFlatColumnChunkBuilder($column, $options, $compression)` (and the RLE_DICTIONARY, DELTA_BINARY_PACKED builders, `ColumnChunkBuilderFactory::createBuilder()`) | a 4th argument, `StatisticsOptions::fromOptions($options)` | +| `ColumnChunk::dataPageOffset(): ?int` | `int`: a column chunk always records it | +| the PHP writer wrote no column index or offset index | both, by default (`Option::STATISTICS_LEVEL`, `StatisticsLevel::PAGE`. `CHUNK` drops the column index, `NONE` all statistics) | +| the PHP writer wrote page-header statistics on `DATA_PAGE_V2` | none, as arrow-rs: `Option::PAGE_HEADER_STATISTICS` (`true`) writes them, on v1 and v2 pages | +| `Option::PAGE_MAXIMUM_ROWS_COUNT` (default `1000`) was read by nothing | the PHP writer closes a page at exactly that many rows. The arrow writer treats it as a target (arrow-rs `data_page_row_count_limit`, read between write batches), so its pages can hold more. A value below 1 is refused (`InvalidArgumentException`) | +| the arrow writer skipped a `COLUMNS_COMPRESSIONS` / `COLUMNS_ENCODINGS` entry whose column path is digits only (`'2024'`, an int array key) | applies it. A key that is not UTF-8 is refused (`InvalidArgumentException`) instead of crashing the process | +| `Option::ROW_GROUP_SIZE_BYTES` below 1 was taken by both writers | refused (`InvalidArgumentException`) by both writers | +| the arrow writer threw `Error` (a Rust panic) on `PLAIN_DICTIONARY` / `RLE_DICTIONARY` in `COLUMNS_ENCODINGS` | enables the column's dictionary: `RLE_DICTIONARY` data pages and a `PLAIN` dictionary page, as the PHP writer writes | +| the arrow writer skipped a `COLUMNS_COMPRESSIONS` / `COLUMNS_ENCODINGS` value that is not a string | refused (`InvalidArgumentException`) | +| files with an `RLE_DICTIONARY` column spanning more than one page, written by the PHP writer | were corrupt (later pages decoded to wrong values): rewrite them. One dictionary per chunk, `PLAIN` past `Option::DICTIONARY_PAGE_SIZE` | +| `Option::DICTIONARY_PAGE_MIN_CARDINALITY_RATION` | removed: it was never read. The dictionary falls back to `PLAIN` on `Option::DICTIONARY_PAGE_SIZE` only, as arrow-rs | +| `Options::set()` / `get()` took scalars and arrays | also a `UnitEnum`, with `Options::getEnum(Option $option, string $class)` | +| no column index truncation option | `Option::COLUMN_INDEX_TRUNCATE_LENGTH` (64): BYTE_ARRAY/FIXED_LEN_BYTE_ARRAY page bounds in the column index | +| `DataPageHeaderV2::statistics(Options $options)` | `statistics()`, as `DataPageHeader::statistics()` | +| `ParquetFile::pageHeaders()` repeated every chunk of a row group under each column | each column's own chunk pages, once | +| `FLOW_PHP_ABI` / `FlowPhpExtension::ABI` 1 | 2 (covering every contract change below): rebuild the `flow_php` extension (and `arrow`, item 4). An older build is refused by `available()` | ### 6) `flow-php/etl`, `flow-php/types` - string comparisons in filters use byte order, as sort already does @@ -483,29 +490,29 @@ both engines |------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `ref('a')->lessThan(lit('10'))` on `'9'`: `true` (PHP `<` compares numeric strings as numbers) | `false`: `lessThan`, `lessThanEqual`, `greaterThan`, `greaterThanEqual`, `between`, `greatest` and `least` order two strings by bytes (`strcmp`), as `sortBy()` does | | `greatest(lit('9'), lit('10'))`: `'10'` | `'9'` | -| a `numeric_string` column was comparable only with another `numeric_string` | comparable with a `string` literal too (`ref('id')->greaterThan(lit('1000'))`), and ordered numerically; still not comparable with an `integer` | -| `Between\Boundary::compareValues(mixed $left, mixed $right)` | removed: `(new ValueOrder(...$operandTypes))->compare($left, $right)`; `Boundary::compare($value, $lower, $upper, ValueOrder $order = new ValueOrder())` | +| a `numeric_string` column was comparable only with another `numeric_string` | comparable with a `string` literal too (`ref('id')->greaterThan(lit('1000'))`), and ordered numerically. It is still not comparable with an `integer` | +| `Between\Boundary::compareValues(mixed $left, mixed $right)` | removed: `(new ValueOrder(...$operandTypes))->compare($left, $right)`, and `Boundary::compare($value, $lower, $upper, ValueOrder $order = new ValueOrder())` | ### 7) `flow-php/etl` - a file extractor reads a `Criteria` and returns only rows matching its conjuncts; `Read` and `Executor\Pipeline` carry it -| Before | After | -|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `FileExtractor::extract(FlowContext $context, ?int $limit = null, Filter $pathFilter = new OnlyFiles())` | `FileExtractor::extract(Backend $backend, Criteria $criteria)`, returning only rows matching every one of `$criteria->conjuncts` | -| `$extractor->extract($context, pathFilter: $filter)` | `$extractor->extract($backend, new Criteria(pathFilter: $filter))` | -| `Read::limit()`, `Read::pathFilter()`, `new Read($extractor, $limit, $pathFilter)` | `Read::criteria()->limit`, `->pathFilter`, `->conjuncts`; `new Read($extractor, new Criteria($limit, $pathFilter))` | -| `Read::withPathFilter()` on any extractor | refused (`InvalidArgumentException`) on an extractor that is no `FileExtractor`, as `withFilter()` | -| `Executor\Pipeline::limit()`, `pathFilter()`, `new Pipeline(..., $limit, $pathFilter, $sources)` | `new Pipeline($id, Plan\Node\Read\|Pipeline\|null $input, PipelineSteps $steps)`; the read is the `Read` node, its criteria `$pipeline->input->criteria()`; the counters are an `Executor::execute()` argument (row 95) | -| a `filter()` over a file source stayed a `Filter` step | each deterministic part the source uses is pushed into it (`Criteria::$conjuncts`) and leaves the step: a part over partition columns only, on every source, and a part `FileExtractor::prunes()` accepts (Parquet: a part it translates into a Parquet filter); an emptied step is removed; a `limit()` after it is pushed beside it, so the read stops after that many matching rows; `explain()` prints each pushed part as `Filter: ...` under `Read`; a part after one kept in the step is pushed too, so the kept parts, in written order, can run on fewer rows; a `>`/`>=` on a float column is pushed only into files whose statistics prove no NaN | -| a custom `FileExtractor` | implements `prunes(ScalarFunction $conjunct): bool`: true only when the source skips data with the conjunct before it decodes rows; `false` keeps the conjunct in its `Filter` step | -| `new FileReadLoop($fileColumns, $schema)`, `read($sources, $batches, $batchSize, Backend $backend, $window)` | `new FileReadLoop($fileColumns, $schema, $criteria->conjuncts)`, `read($sources, $batches, $batchSize, Backend $backend, $window)` | -| `Optimizer::default()` ran `PushLimitIntoSource` before `PushFilterIntoSource` | after it | -| `Rewrite::of(Node $node)` | `of(Node $original, Node $rebuilt)`: the node as it was and rebuilt over its rewritten children | -| `new Flow\ETL\Plan\ReplaceLeaf($target, $replacement)` | `ReplaceNodes::one($target, $replacement)`, or `new ReplaceNodes($replacements, $removals)` for several in one rewrite (a removed node gives way to its child) | -| `new ScalarFunctionFilterTransformer($function, ?ScalarFunction $resolved)` | the second argument is `?Functions\Evaluation\Filter`; `bind()` sets it, as before | -| `explain()`: `Select` printed `Columns: ...`, other nodes `Defines columns: ...` | `Keeps only: ...` and `Changes columns: ...` (a column defined, renamed or dropped) | -| `Redefined::$unknown` | `Redefined::isUnknown()`; `Redefined::isAllBut()` tells an `allBut()` apart | +| Before | After | +|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `FileExtractor::extract(FlowContext $context, ?int $limit = null, Filter $pathFilter = new OnlyFiles())` | `FileExtractor::extract(Backend $backend, Criteria $criteria)`, returning only rows matching every one of `$criteria->conjuncts` | +| `$extractor->extract($context, pathFilter: $filter)` | `$extractor->extract($backend, new Criteria(pathFilter: $filter))` | +| `Read::limit()`, `Read::pathFilter()`, `new Read($extractor, $limit, $pathFilter)` | `Read::criteria()->limit`, `->pathFilter`, `->conjuncts`, and `new Read($extractor, new Criteria($limit, $pathFilter))` | +| `Read::withPathFilter()` on any extractor | refused (`InvalidArgumentException`) on an extractor that is no `FileExtractor`, as `withFilter()` | +| `Executor\Pipeline::limit()`, `pathFilter()`, `new Pipeline(..., $limit, $pathFilter, $sources)` | `new Pipeline($id, Plan\Node\Read\|Pipeline\|null $input, PipelineSteps $steps)`. The read is the `Read` node, its criteria `$pipeline->input->criteria()`. The counters are an `Executor::execute()` argument (row 95) | +| a `filter()` over a file source stayed a `Filter` step | each deterministic part the source uses is pushed into it (`Criteria::$conjuncts`) and leaves the step. These parts are a part over partition columns only, on every source, and a part that `FileExtractor::prunes()` accepts (Parquet: a part it translates into a Parquet filter). An emptied step is removed. A `limit()` after it is pushed beside it, so the read stops after that many matching rows. `explain()` prints each pushed part as `Filter: ...` under `Read`. A part after one kept in the step is pushed too, so the kept parts, in written order, can run on fewer rows. A `>`/`>=` on a float column is pushed only into files whose statistics prove no NaN | +| a custom `FileExtractor` | implements `prunes(ScalarFunction $conjunct): bool`. It returns true only if the source skips data with the conjunct before it decodes rows. `false` keeps the conjunct in its `Filter` step | +| `new FileReadLoop($fileColumns, $schema)`, `read($sources, $batches, $batchSize, Backend $backend, $window)` | `new FileReadLoop($fileColumns, $schema, $criteria->conjuncts)`, `read($sources, $batches, $batchSize, Backend $backend, $window)` | +| `Optimizer::default()` ran `PushLimitIntoSource` before `PushFilterIntoSource` | after it | +| `Rewrite::of(Node $node)` | `of(Node $original, Node $rebuilt)`: the node as it was and rebuilt over its rewritten children | +| `new Flow\ETL\Plan\ReplaceLeaf($target, $replacement)` | `ReplaceNodes::one($target, $replacement)`, or `new ReplaceNodes($replacements, $removals)` for several in one rewrite (a removed node gives way to its child) | +| `new ScalarFunctionFilterTransformer($function, ?ScalarFunction $resolved)` | the second argument is `?Functions\Evaluation\Filter`, and `bind()` sets it, as before | +| `explain()`: `Select` printed `Columns: ...`, other nodes `Defines columns: ...` | `Keeps only: ...` and `Changes columns: ...` (a column defined, renamed or dropped) | +| `Redefined::$unknown` | `Redefined::isUnknown()`, and `Redefined::isAllBut()` tells an `allBut()` apart | A custom file extractor: @@ -533,11 +540,11 @@ public function prunes(ScalarFunction $conjunct): bool `flow-php/symfony-telemetry-bundle` - HTTP URLs are redacted, stack traces carry no argument values -| Before | After | -|---------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `url.full` (PSR-18 and Symfony HttpClient), `url.query` (HttpKernel), `exception.message` and the client span status description held the raw URL | userinfo and the values of `UrlSanitizer::DEFAULT_SENSITIVE_QUERY_PARAMETERS` (OpenTelemetry, OAuth 2.0 / OpenID Connect, API key and credential keys) are `REDACTED`; configure the list with `url_sanitizer([...])` or `flow_telemetry.instrumentation.sanitization.url.sensitive_query_parameters` (replaces the default) | -| Symfony HttpClient `url.full`, `url.scheme`, `server.address`, `server.port` came from the `$url` argument (`/me`, `unknown` with `base_uri`) | they come from the effective URL, `base_uri` and the `query` option included | -| `exception.stacktrace` was `getTraceAsString()`, with argument values when `zend.exception_ignore_args` is off | `StackTrace::format()`: every frame renders `()`, whatever `zend.exception_ignore_args` is | +| Before | After | +|---------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `url.full` (PSR-18 and Symfony HttpClient), `url.query` (HttpKernel), `exception.message` and the client span status description held the raw URL | userinfo and the values of `UrlSanitizer::DEFAULT_SENSITIVE_QUERY_PARAMETERS` are `REDACTED`. The list holds OpenTelemetry, OAuth 2.0 / OpenID Connect, API key and credential keys. Configure the list with `url_sanitizer([...])` or `flow_telemetry.instrumentation.sanitization.url.sensitive_query_parameters` (replaces the default) | +| Symfony HttpClient `url.full`, `url.scheme`, `server.address`, `server.port` came from the `$url` argument (`/me`, `unknown` with `base_uri`) | they come from the effective URL, `base_uri` and the `query` option included | +| `exception.stacktrace` was `getTraceAsString()`. If `zend.exception_ignore_args` is off, it held argument values. | `StackTrace::format()`: every frame renders `()`, whatever `zend.exception_ignore_args` is | ### 9) `flow-php/etl`, @@ -546,36 +553,36 @@ public function prunes(ScalarFunction $conjunct): bool | Before | After | |---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| -| an empty source (`from_all()`, `from_array([])`, a glob that matches no file) described an empty schema | `schema()` throws `InferredSchemaException`; declare the schema with `->withSchema(...)` to read an empty source | -| `df()->read(from_array([]))->fetch()` returned 0 rows | throws `InferredSchemaException`; `from_array([], schema: $schema)` returns 0 rows | +| an empty source (`from_all()`, `from_array([])`, a glob that matches no file) described an empty schema | `schema()` throws `InferredSchemaException`. Declare the schema with `->withSchema(...)` to read an empty source | +| `df()->read(from_array([]))->fetch()` returned 0 rows | throws `InferredSchemaException`. `from_array([], schema: $schema)` returns 0 rows | | `from_parquet(...)->withSchema()`, `from_floe(...)->withSchema()` threw `InvalidArgumentException` | read every file by name against the declared schema: undeclared columns are not read, a missing nullable column is null | -| `from_cache($id)` without a cache instance described an empty schema | `SchemaNotDerivableException`; the plan runs unbound | +| `from_cache($id)` without a cache instance described an empty schema | `SchemaNotDerivableException`, and the plan runs unbound | ### 10) `flow-php/parquet` - the PHP engine reads and writes DELTA_LENGTH_BYTE_ARRAY / DELTA_BYTE_ARRAY; both engines write the same default encodings (dictionary on, arrow-rs fallbacks); COLUMNS_ENCODINGS is literal on both engines -| Before | After | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `WRITER_VERSION 2` fallback encoding of BYTE_ARRAY / FIXED_LEN_BYTE_ARRAY: PLAIN | `DELTA_BYTE_ARRAY`, as arrow-rs and parquet-java | -| dictionary overflow past `DICTIONARY_PAGE_SIZE`: the rest of the chunk PLAIN | the `WRITER_VERSION` fallback: under v2 `DELTA_BINARY_PACKED` (INT32/INT64), `DELTA_BYTE_ARRAY` (BYTE_ARRAY/FLBA); PLAIN under v1 | -| arrow writer: a non-dictionary `COLUMNS_ENCODINGS` entry kept the column's dictionary, used only once it fell back | turns the column's dictionary off: the entry is the column's encoding, as the PHP writer writes it | -| `DeltaBinaryPackedDecoder::decode(string $data, int $valueCount)` | `decode(BinaryBufferReader $reader, int $valueCount)`, leaving the reader at the end of its stream | -| `new PlainFlatColumnChunkBuilder($column, $options, $compression, $statistics)`; `DeltaBinaryPackedColumnChunkBuilder` | `new FlatColumnChunkBuilder($column, $options, $compression, $statistics, ValueStorage $valueStorage)`; `DeltaBinaryPackedColumnChunkBuilder` removed | -| `ValueStorage` without an encoding | `ValueStorage::encoding(): Encodings`; `ValueStorage::size()` renamed to `plainSize()`, the PLAIN-encoded byte size | -| `new RLEDictionaryChunkBuilder($column, $options, $compression, $statistics)` | `new RLEDictionaryChunkBuilder($column, $options, $compression, $statistics, ValueStorage $fallback)` | -| a failed `Writer::write()` / `Writer::open()` left a 4-byte `PAR1` file behind | the file is removed; the exception is rethrown | -| PHP writer: columns without `COLUMNS_ENCODINGS` written without a dictionary | `RLE_DICTIONARY` (except BOOLEAN, and FIXED_LEN_BYTE_ARRAY under v1), as the arrow writer, arrow-rs and parquet-java; `Option::DICTIONARY_ENABLED` `false` restores the fallback encodings | -| - | `Option::DICTIONARY_ENABLED` (default `true`), on both engines | -| PHP writer `WRITER_VERSION 2`: BOOLEAN written PLAIN | `RLE`, as the arrow writer | -| `RLE_DICTIONARY` on a FIXED_LEN_BYTE_ARRAY column threw | allowed under `WRITER_VERSION 2`; still refused under 1 | -| PHP writer fell back once the dictionary exceeded `DICTIONARY_PAGE_SIZE` | once it reaches it (`>=`), as arrow-rs | -| PHP writer v2 chunks listed only the data page encoding | also `RLE` for the levels, as arrow-rs | -| PHP writer `DELTA_BINARY_PACKED`: a miniblock whose largest delta sits at or just above a power of two from about 2^47, or needs more than 55 bits, was packed wrong and read back wrong values | packed exactly; rewrite `WRITER_VERSION 2` files written by earlier versions whose INT32/INT64 columns hold such deltas | -| `COLUMNS_ENCODINGS` `RLE_DICTIONARY` on a BOOLEAN column: the PHP writer wrote a dictionary, the arrow writer ignored it | refused by both engines (`InvalidArgumentException`), as arrow-rs and parquet-java never dictionary-encode booleans | -| arrow writer: a `COLUMNS_ENCODINGS` entry the column type cannot take panicked (`\Error: Rust panic`) or was ignored (FIXED_LEN_BYTE_ARRAY dictionary under v1) | `InvalidArgumentException` with the PHP writer's message | -| INT32 `DELTA_BINARY_PACKED` with consecutive values more than 2^31 apart: written with 64-bit deltas arrow-rs refuses, read back as wrong values | 32-bit wrapping deltas, as arrow-rs and parquet-java; such INT32 files from earlier versions must be rewritten | +| Before | After | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `WRITER_VERSION 2` fallback encoding of BYTE_ARRAY / FIXED_LEN_BYTE_ARRAY: PLAIN | `DELTA_BYTE_ARRAY`, as arrow-rs and parquet-java | +| dictionary overflow past `DICTIONARY_PAGE_SIZE`: the rest of the chunk PLAIN | the `WRITER_VERSION` fallback: under v2 `DELTA_BINARY_PACKED` (INT32/INT64), `DELTA_BYTE_ARRAY` (BYTE_ARRAY/FLBA), PLAIN under v1 | +| arrow writer: a non-dictionary `COLUMNS_ENCODINGS` entry kept the column's dictionary, used only once it fell back | turns the column's dictionary off: the entry is the column's encoding, as the PHP writer writes it | +| `DeltaBinaryPackedDecoder::decode(string $data, int $valueCount)` | `decode(BinaryBufferReader $reader, int $valueCount)`, leaving the reader at the end of its stream | +| `new PlainFlatColumnChunkBuilder($column, $options, $compression, $statistics)`, `DeltaBinaryPackedColumnChunkBuilder` | `new FlatColumnChunkBuilder($column, $options, $compression, $statistics, ValueStorage $valueStorage)`; `DeltaBinaryPackedColumnChunkBuilder` removed | +| `ValueStorage` without an encoding | `ValueStorage::encoding(): Encodings`. `ValueStorage::size()` renamed to `plainSize()`, the PLAIN-encoded byte size | +| `new RLEDictionaryChunkBuilder($column, $options, $compression, $statistics)` | `new RLEDictionaryChunkBuilder($column, $options, $compression, $statistics, ValueStorage $fallback)` | +| a failed `Writer::write()` / `Writer::open()` left a 4-byte `PAR1` file behind | the file is removed, and the exception is rethrown | +| PHP writer: columns without `COLUMNS_ENCODINGS` written without a dictionary | `RLE_DICTIONARY` (except BOOLEAN, and FIXED_LEN_BYTE_ARRAY under v1), as the arrow writer, arrow-rs and parquet-java. `Option::DICTIONARY_ENABLED` `false` restores the fallback encodings | +| - | `Option::DICTIONARY_ENABLED` (default `true`), on both engines | +| PHP writer `WRITER_VERSION 2`: BOOLEAN written PLAIN | `RLE`, as the arrow writer | +| `RLE_DICTIONARY` on a FIXED_LEN_BYTE_ARRAY column threw | allowed under `WRITER_VERSION 2`, still refused under 1 | +| PHP writer fell back once the dictionary exceeded `DICTIONARY_PAGE_SIZE` | once it reaches it (`>=`), as arrow-rs | +| PHP writer v2 chunks listed only the data page encoding | also `RLE` for the levels, as arrow-rs | +| PHP writer `DELTA_BINARY_PACKED`: some miniblocks were packed wrong and read back wrong values. These are miniblocks whose largest delta sits at or just above a power of two from about 2^47, or needs more than 55 bits. | packed exactly. Rewrite `WRITER_VERSION 2` files written by earlier versions whose INT32/INT64 columns hold such deltas | +| `COLUMNS_ENCODINGS` `RLE_DICTIONARY` on a BOOLEAN column: the PHP writer wrote a dictionary, the arrow writer ignored it | refused by both engines (`InvalidArgumentException`), as arrow-rs and parquet-java never dictionary-encode booleans | +| arrow writer: a `COLUMNS_ENCODINGS` entry the column type cannot take panicked (`\Error: Rust panic`) or was ignored (FIXED_LEN_BYTE_ARRAY dictionary under v1) | `InvalidArgumentException` with the PHP writer's message | +| INT32 `DELTA_BINARY_PACKED` with consecutive values more than 2^31 apart: written with 64-bit deltas arrow-rs refuses, read back as wrong values | 32-bit wrapping deltas, as arrow-rs and parquet-java. Such INT32 files from earlier versions must be rewritten | The `arrow` extension must be rebuilt. @@ -583,26 +590,26 @@ The `arrow` extension must be rebuilt. `flow-php/etl-adapter-json`, `flow-php/cli` - "entry" renamed to "column" -| Before | After | -|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| -| `DataFrame::withEntry()` / `withEntries()` | `withColumn()` / `withColumns()` (old names deprecated) | -| `with_entry()`, `Flow\ETL\WithEntry` | `with_column()`, `Flow\ETL\Functions\WithColumn` | -| `entry()` | removed, use `ref()` or `col()` | -| `Definition::entry()` | `Definition::reference()` | -| `SchemaDefinitionNotFoundException::entry()` | `column()` | -| `RenameEntryStrategy`, `Rename{Case,Map,Replace}EntryStrategy` | `Flow\ETL\Operators\Transformer\Rename\{RenameColumnStrategy, Rename{Case,Map,Replace}ColumnStrategy}` | -| `RenameEntryTransformer`, `RenameEachEntryTransformer` | `Flow\ETL\Operators\Transformer\{RenameColumnTransformer, RenameEachColumnTransformer}` | -| `{Select,Drop,Prune}EntriesTransformer` | `Flow\ETL\Operators\Transformer\{Select,Drop,Prune}ColumnsTransformer` | -| `DuplicatedEntriesException` | `DuplicatedColumnsException` | -| `Plan\Node\{WithColumn,WindowColumn,ExpandColumn}::$entry`, `Plan\Node\{Select,Drop,Distinct,DuplicateRow}::$entries` | `$column`, `$columns` | -| `new SequenceExtractor($generator)` wrote a column named `entry` | the column name is required: `new SequenceExtractor($generator, 'name')` | -| `Flow\ETL\Adapter\PostgreSql\EntryTypesMap` | `Flow\ETL\Adapter\PostgreSql\Values\Schema\TypesMap` | -| `ExcelLoader::withSheetNameFromEntry()` | `withSheetNameFromColumn()` | -| `SealLoader::withIdentifierEntry()` | `withIdentifierColumn()` | -| `JsonExtractor::withPointer($pointer, pointerToEntryName: true)` | `pointerToColumnName: true` | -| CLI option `--input-json-pointer-entry-name` | `--input-json-pointer-column-name` | -| named arguments `entry:` / `entries:` (`select`, `drop`, `sortBy`, `groupBy`, `duplicateRow`, `ref`, `partition_by`, ...), `entry_name:` (`from_sequence_*`), `entryLeft:` / `entryRight:` (`Join\Comparison\{Equal,Identical}`) | `column:` / `columns:`, `column_name:`, `leftReference:` / `rightReference:` | -| exception messages saying `entry` / `entries` for a column (`Schema definition for entry "x" not found`, ...) | say `column` / `columns` | +| Before | After | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| `DataFrame::withEntry()` / `withEntries()` | `withColumn()` / `withColumns()` (old names deprecated) | +| `with_entry()`, `Flow\ETL\WithEntry` | `with_column()`, `Flow\ETL\Functions\WithColumn` | +| `entry()` | removed, use `ref()` or `col()` | +| `Definition::entry()` | `Definition::reference()` | +| `SchemaDefinitionNotFoundException::entry()` | `column()` | +| `RenameEntryStrategy`, `Rename{Case,Map,Replace}EntryStrategy` | `Flow\ETL\Operators\Transformer\Rename\{RenameColumnStrategy, Rename{Case,Map,Replace}ColumnStrategy}` | +| `RenameEntryTransformer`, `RenameEachEntryTransformer` | `Flow\ETL\Operators\Transformer\{RenameColumnTransformer, RenameEachColumnTransformer}` | +| `{Select,Drop,Prune}EntriesTransformer` | `Flow\ETL\Operators\Transformer\{Select,Drop,Prune}ColumnsTransformer` | +| `DuplicatedEntriesException` | `DuplicatedColumnsException` | +| `Plan\Node\{WithColumn,WindowColumn,ExpandColumn}::$entry`, `Plan\Node\{Select,Drop,Distinct,DuplicateRow}::$entries` | `$column`, `$columns` | +| `new SequenceExtractor($generator)` wrote a column named `entry` | the column name is required: `new SequenceExtractor($generator, 'name')` | +| `Flow\ETL\Adapter\PostgreSql\EntryTypesMap` | `Flow\ETL\Adapter\PostgreSql\Values\Schema\TypesMap` | +| `ExcelLoader::withSheetNameFromEntry()` | `withSheetNameFromColumn()` | +| `SealLoader::withIdentifierEntry()` | `withIdentifierColumn()` | +| `JsonExtractor::withPointer($pointer, pointerToEntryName: true)` | `pointerToColumnName: true` | +| CLI option `--input-json-pointer-entry-name` | `--input-json-pointer-column-name` | +| named arguments `entry:` / `entries:` (`select`, `drop`, `sortBy`, `groupBy`, `duplicateRow`, `ref`, `partition_by`, ...). Also `entry_name:` (`from_sequence_*`) and `entryLeft:` / `entryRight:` (`Join\Comparison\{Equal,Identical}`) | `column:` / `columns:`, `column_name:`, `leftReference:` / `rightReference:` | +| exception messages saying `entry` / `entries` for a column (`Schema definition for entry "x" not found`, ...) | say `column` / `columns` | --- @@ -610,28 +617,28 @@ The `arrow` extension must be rebuilt. `flow-php/etl-adapter-google-sheet` - `SchemaSampler` + `SniffsColumnTypes` merged into `Sniffer` -Schema inference samples a source through one contract. Each adapter builds its `Sniffer` inside `schema()`; a unit is +Schema inference samples a source through one contract. Each adapter builds its `Sniffer` inside `schema()`. A unit is one listed file (one sheet range, one in-memory dataset). A bounded `sampleSize` still drains one budget across the units in -listing order; `everyRow()` sniffs every unit whole and independently and merges the partials in unit order, so the +listing order. `everyRow()` sniffs every unit whole and independently and merges the partials in unit order, so the result does not depend on the order the units ran in. | Before | After | |---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `Flow\ETL\Schema\Inference\SchemaSampler`, `SniffsColumnTypes` | `Flow\ETL\IO\Inference\Sniffer` - `names(): list`, `units(): int`, `sniff(int $unit, int $rowBudget): Sample`, `bytes(int $unit): int`, `parts(int $unit, int $targetBytes): non-empty-list`, `close(): void` | -| `new SchemaInferrer($inference, $typer)->infer($names, $samples)` | `new SchemaInferrer($inference)->infer($sniffer): Inferred` (`->schema`, `->units`) - the narrower is the sniffer's; `everyRow()` sniffs through `infer_schema()->sniffWith($launcher)`, in this process by default | +| `new SchemaInferrer($inference, $typer)->infer($names, $samples)` | `new SchemaInferrer($inference)->infer($sniffer): Inferred` (`->schema`, `->units`) - the narrower is the sniffer's. `everyRow()` sniffs through `infer_schema()->sniffWith($launcher)`, in this process by default | | `SchemaInferrer::sniff($names, $rows, $rowBudget)` | `ColumnTypes::sniff($names, $rows, $rowBudget, $typer)` | | `CSVOpenSource::sniff($names, $rowBudget, $inference, $typer)` | `CSVOpenSource::sniff($names, $rowBudget, $typer)` (PHP, adaptive and `flow_php` native sources) | -| `CSVFileReader::samples()`, `CSVFileSample`, `CSVSamples` | `CSVSniffer(CSVSourceOpener $opener, $sources, InferredTypes $candidates, ?CSVHeader $header = null)` - `header()`; what a sniff read is on its `Sample` | -| `JsonFileReader::samples()`, `JsonSamples`, `new JsonFileReader(..., $sources)` | `JsonSniffer($reader, $sources)`; the reader no longer takes the listing; `JsonFileSample::bytes()` / `complete()` | +| `CSVFileReader::samples()`, `CSVFileSample`, `CSVSamples` | `CSVSniffer(CSVSourceOpener $opener, $sources, InferredTypes $candidates, ?CSVHeader $header = null)` - `header()`. What a sniff read is on its `Sample` | +| `JsonFileReader::samples()`, `JsonSamples`, `new JsonFileReader(..., $sources)` | `JsonSniffer($reader, $sources)`. The reader no longer takes the listing. `JsonFileSample::bytes()` / `complete()` | | `Flow\ETL\Adapter\CSV\{CSVSampledFiles, CSVSampledRows}` | removed: `Flow\ETL\IO\Inference\SampledUnits` (the row estimate over every sampled file) and `Flow\ETL\IO\Inference\Sample` (one file's sniff: columns, bytes, complete) | | `Flow\ETL\Adapter\JSON\JSONMachine\{JsonSampledFiles, JsonSampledRows}` | removed: `Flow\ETL\IO\Inference\SampledUnits` and `Flow\ETL\IO\Inference\Sample`, as for CSV | | `WorkbookSampler($workbook, $files)` | `ExcelSniffer($workbook, $files, InferredTypes $candidates, ?ExcelHeader $header = null)` | | `GoogleSheetSampler($reader, $rowBudget)` | `GoogleSheetSniffer($reader, $rowBudget, $typer)` | | `InMemoryRows::samples()`, `SpilledRows::samples()` | `sniff(0, $rowBudget)` - one unit, no header | -| `everyRow()`: `filesToSniff` counted files that yielded a row | `everyRow()`: every listed unit up to `filesToSniff` is sniffed whole and independently; empty files count | +| `everyRow()`: `filesToSniff` counted files that yielded a row | `everyRow()`: every listed unit up to `filesToSniff` is sniffed whole and independently, and empty files count | | `ColumnTypes::merge()`, `ColumnTypes::schema()` | `ColumnTypes::folded(): SniffedColumns`, then `SniffedColumns::merge()` / `schema()` | -| `infer_schema()->sampleSize(-1)`, `->filesToSniff(-1)` | `infer_schema()->everyRow()`, `->everySource()`; `sampleSize()` and `filesToSniff()` refuse anything below 1 | +| `infer_schema()->sampleSize(-1)`, `->filesToSniff(-1)` | `infer_schema()->everyRow()`, `->everySource()`. `sampleSize()` and `filesToSniff()` refuse anything below 1 | --- @@ -639,22 +646,22 @@ result does not depend on the order the units ran in. `flow-php/etl-adapter-parquet` and every file adapter - file sources say where they may be cut -Additive. A `SplittableExtractor` cuts its source into `FileSplit`s at plan time by arithmetic alone - one split per -file for JSON documents, text, XML, Excel and listings; byte windows for CSV, JSON lines, Parquet and Floe - and reads +Additive. A `SplittableExtractor` cuts its source into `FileSplit`s at plan time by arithmetic alone. It makes one split per +file for JSON documents, text, XML, Excel and listings, and byte windows for CSV, JSON lines, Parquet and Floe. It reads one through `scan()` with the split on its `Criteria`. Splits cover every row exactly once, in source order. A CSV -window resyncs both ends to a record start, so a quoted newline never splits a record; a JSON lines window resyncs both -ends to a line start; a Parquet or Floe window owns the row groups or sections whose midpoint it holds. Through a +window resyncs both ends to a record start, so a quoted newline never splits a record. A JSON lines window resyncs both +ends to a line start. A Parquet or Floe window owns the row groups or sections whose midpoint it holds. Through a `Launcher` with more than one slot, set with `config_builder()->launcher()`, the splits are read in worker processes. One launcher serves the whole run, joined frames included. | Before | After | |-------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Criteria(?int $limit, Filter $pathFilter, list $conjuncts)` | `Criteria(..., ?FileSplit $split = null)`, `withSplit(FileSplit)`; `narrows()` is true with a split; a read with a split lists nothing but the split's file | -| every file extractor read whole files only | `SplittableExtractor extends Extractor { splits(Criteria, int $targetSplitBytes): non-empty-list; reader(): Reader }` on `files()`, `from_csv()`, `from_json()`, `from_json_lines()`, `from_text()`, `from_xml()`, `from_excel()`, `from_parquet()`, `from_floe()`; each split is read with `extract($backend, $criteria->withSplit($split))`, or through the config's launcher | -| `SelfDescribingFile { close(), schema(), source(), statistics() }` | `+ units(): list` - row groups (Parquet) or sections (Floe) as byte ranges; a window owns the units whose midpoint it holds | +| `Criteria(?int $limit, Filter $pathFilter, list $conjuncts)` | `Criteria(..., ?FileSplit $split = null)`, `withSplit(FileSplit)`. `narrows()` is true with a split. A read with a split lists nothing but the split's file | +| every file extractor read whole files only | `SplittableExtractor extends Extractor { splits(Criteria, int $targetSplitBytes): non-empty-list; reader(): Reader }` on `files()`, `from_csv()`, `from_json()`, `from_json_lines()`, `from_text()`, `from_xml()`, `from_excel()`, `from_parquet()`, `from_floe()`. Each split is read with `extract($backend, $criteria->withSplit($split))`, or through the config's launcher | +| `SelfDescribingFile { close(), schema(), source(), statistics() }` | `+ units(): list` - row groups (Parquet) or sections (Floe) as byte ranges. A window owns the units whose midpoint it holds | | `ParquetFileBatches(..., array $conjuncts)`, `FloeFileBatches(..., ?DerivedSchema $derived)`, `CSVFileBatches(CSVFileReader, ?InferredColumns)` | each reads `Criteria::$split` in `batches()` (see 121) | -| `AdaptiveCSVOpenSource` opened and detected the dialect itself | `CSVSourceOpener(Filesystem, CSVReadOptions, ?FlowPhpExtension)` - `open(SourceFile)`, `openSplit(SourceFile, FileSplit, list $columns)`, `dialect()`, `over()`; `AdaptiveCSVOpenSource` delegates to it | -| `CSVDecoder(..., bool $emptyToNull)`, `RecordDecoder(..., bool $dropExtraColumns)`, `RustCSVOpenSource(..., ?int $charactersReadInLine)` | each gains `?array $headers = null` - the names of a stream that carries no header record (a window past a file's first record); `withHeader` must be false with them | +| `AdaptiveCSVOpenSource` opened and detected the dialect itself | `CSVSourceOpener(Filesystem, CSVReadOptions, ?FlowPhpExtension)` - `open(SourceFile)`, `openSplit(SourceFile, FileSplit, list $columns)`, `dialect()`, `over()`. `AdaptiveCSVOpenSource` delegates to it | +| `CSVDecoder(..., bool $emptyToNull)`, `RecordDecoder(..., bool $dropExtraColumns)`, `RustCSVOpenSource(..., ?int $charactersReadInLine)` | each gains `?array $headers = null`. These are the names of a stream that carries no header record (a window past a file's first record). `withHeader` must be false with them | ### 14) `flow-php/filesystem-async-aws-bridge`, `-azure-bridge`, `-sftp-bridge` - filesystems take a client source @@ -666,18 +673,18 @@ in worker processes. One launcher serves the whole run, joined frames included. | async-aws `Options::withBlockSize()` refused 5 MiB | 5 MiB, S3's inclusive minimum part size, is accepted | `aws_s3_filesystem()`, `azure_filesystem()` and `sftp_filesystem()` keep their parameter names and also accept a plain -configuration array; only a filesystem built from configuration can be described for a worker process. The Symfony +configuration array. Only a filesystem built from configuration can be described for a worker process. The Symfony filesystem bundle builds the configured form unless an HTTP client, a factory or a logger is injected. --- ### 15) `flow-php/filesystem`, `flow-php/parquet` - every filesystem and parquet engine is configurable -| Before | After | -|--------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `interface Filesystem` (10 methods) | `+ normalize(): ?array`, `+ static fromArray(array $configuration): static` - the plain configuration a worker rebuilds the filesystem from; `null` / throw when the instance holds live state (a client, memory). Core wraps it in `Flow\ETL\Foundation\Describe\ConfiguredFilesystem` | -| `interface ParquetEngine` (3 methods) | the same two methods (`fromArray(): self`); `PhpParquetEngine` and `AdaptiveParquetEngine` normalize `{byte_order, options}`, `RustParquetEngine` `{options}`; wrapped by `Flow\ETL\Adapter\Parquet\IO\ConfiguredParquetEngine` | -| `Path` | `+ normalize(): PathData`, `+ static fromArray(array)`; `NativeLocalFileBlocksFactory::blockLocation()`; `OptionalType::assert()` is documented as returning `null \|T` | +| Before | After | +|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `interface Filesystem` (10 methods) | `+ normalize(): ?array`, `+ static fromArray(array $configuration): static` - the plain configuration a worker rebuilds the filesystem from. If the instance holds live state (a client, memory), `null` / throw. Core wraps it in `Flow\ETL\Foundation\Describe\ConfiguredFilesystem` | +| `interface ParquetEngine` (3 methods) | the same two methods (`fromArray(): self`); `PhpParquetEngine` and `AdaptiveParquetEngine` normalize `{byte_order, options}`, `RustParquetEngine` `{options}`. Wrapped by `Flow\ETL\Adapter\Parquet\IO\ConfiguredParquetEngine` | +| `Path` | `+ normalize(): PathData`, `+ static fromArray(array)`, `NativeLocalFileBlocksFactory::blockLocation()`. `OptionalType::assert()` is documented as returning `null \|T` | --- @@ -685,33 +692,33 @@ filesystem bundle builds the configured form unless an HTTP client, a factory or | Before | After | |-----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `interface BucketsStorage { append(), get(), remove(), set() }` | `+ close(string $bucketId): void` - finishes the bucket's pending writes so another process can read it; a no-op without any. `FilesystemBuckets implements Describable` | +| `interface BucketsStorage { append(), get(), remove(), set() }` | `+ close(string $bucketId): void` - finishes the bucket's pending writes so another process can read it. A no-op without any. `FilesystemBuckets implements Describable` | --- ### 17) `flow-php/etl` - the default batch size is 2048 rows -| Before | After | -|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `batchSize()` is 100 for every extractor using `Batches` | 2048 - the per-batch cost dominated the read at 100 rows (a parallel read handed rows back in 100-row Floe frames; 10 GiB CSV: 51 s to 39 s single-process, 28 s to 9 s at 8 workers). `withBatchSize()` is unchanged; `PostgreSql*`/`Dbal*` extractors keep 1000. `FilesystemBuckets` defaults to 2048 as well, so a handed-back batch is never re-sliced | +| Before | After | +|----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `batchSize()` is 100 for every extractor using `Batches` | 2048 - the per-batch cost dominated the read at 100 rows (a parallel read handed rows back in 100-row Floe frames. 10 GiB CSV: 51 s to 39 s single-process, 28 s to 9 s at 8 workers). `withBatchSize()` is unchanged. `PostgreSql*`/`Dbal*` extractors keep 1000. `FilesystemBuckets` defaults to 2048 as well, so a handed-back batch is never re-sliced | ### 18) `flow-php/etl` and every adapter - functions, transformers, loaders and error handlers describe themselves -| Before | After | -|---------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `interface ScalarFunction`, `Transformer`, `Loader`, `ErrorHandler` | each `extends Describable`: implement `describe(): ?Description` and `static fromDescription(array $data, Rebuild $rebuild): static`; return `null` / throw when the instance holds live state - it then always runs in the parent process | +| Before | After | +|---------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `interface ScalarFunction`, `Transformer`, `Loader`, `ErrorHandler` | each `extends Describable`: implement `describe(): ?Description` and `static fromDescription(array $data, Rebuild $rebuild): static`. If the instance holds live state, return `null` / throw. It then always runs in the parent process | ### 19) `flow-php/etl`, `flow-php/etl-adapter-*` - `FileLoader` copies itself to another destination; `{part}` is reserved -| Before | After | -|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `interface FileLoader { destination(), saveMode() }` | `interface FileLoader extends Loader`, `+ inTask(Part $task): static`, `+ commit(string $run, int $tasks): ?FileCommit` | -| `interface PartitioningLoader { partitionBy() }` | removed: `FileLoader` takes `partitionBy(Partitioning $partitioning): static` and `partitioning(): Partitioning` | -| `{part}` in a destination named a partition column `part` | `{part}` is the part number: `to_parquet('out/orders-{part}.parquet')` writes `out/orders-00000.parquet` in one process and one part per task when a launcher splits the read | -| `partitionBy('part')` with a `'.../{part}/...'` destination | throws `InvalidArgumentException` when the plan is built: rename the column | -| SaveMode on a `{part}` destination checked per file | checked over every existing part (`orders-*.parquet`): `ExceptionIfExists`/`Ignore` see any part, `Overwrite` removes every stale part, `Append` names carry a run id | +| Before | After | +|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `interface FileLoader { destination(), saveMode() }` | `interface FileLoader extends Loader`, `+ inTask(Part $task): static`, `+ commit(string $run, int $tasks): ?FileCommit` | +| `interface PartitioningLoader { partitionBy() }` | removed: `FileLoader` takes `partitionBy(Partitioning $partitioning): static` and `partitioning(): Partitioning` | +| `{part}` in a destination named a partition column `part` | `{part}` is the part number: `to_parquet('out/orders-{part}.parquet')` writes `out/orders-00000.parquet` in one process. If a launcher splits the read, it writes one part per task | +| `partitionBy('part')` with a `'.../{part}/...'` destination | throws `InvalidArgumentException` at plan build: rename the column | +| SaveMode on a `{part}` destination checked per file | checked over every existing part (`orders-*.parquet`): `ExceptionIfExists`/`Ignore` see any part, `Overwrite` removes every stale part, `Append` names carry a run id | ### 20) `flow-php/filesystem` - `NativeLocalFilesystem::mv()` creates the target's parent directory @@ -721,33 +728,33 @@ filesystem bundle builds the configured form unless an HTTP client, a factory or ### 21) `flow-php/etl` - aggregating and window functions describe themselves and expose a partial state -| Before | After | -|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `interface AggregatingFunction extends FunctionTree` | `extends FunctionTree, Describable`; `+ partialType(): StructureType`, `+ partial(): array`, `+ mergePartial(array $partial, FlowContext $context): void` - every custom aggregator implements them (a group by read by workers merges partials) | -| `interface WindowFunction extends FunctionTree`, `interface WindowFrame` | each `extends Describable`; return `null` / throw when the instance holds live state - it then runs in the parent process | -| `Aggregators::cloned()` | `Aggregators::fresh()` - `withChildren(children())` per aggregator, never `clone`: a custom aggregator's `withChildren()` must return an instance without state | -| `Aggregators::aggregate(Rows $rows, array $indices, FlowContext $context)`, `Aggregators::merge(Aggregators $other, FlowContext $context)` | removed: `AggregatedGroups` accumulates and absorbs the groups; a caller aggregates each `AggregatingFunction` itself | +| Before | After | +|--------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `interface AggregatingFunction extends FunctionTree` | `extends FunctionTree, Describable`, with `+ partialType(): StructureType`, `+ partial(): array`, `+ mergePartial(array $partial, FlowContext $context): void` - every custom aggregator implements them (a group by read by workers merges partials) | +| `interface WindowFunction extends FunctionTree`, `interface WindowFrame` | each `extends Describable`. If the instance holds live state, return `null` / throw. It then runs in the parent process | +| `Aggregators::cloned()` | `Aggregators::fresh()` - `withChildren(children())` per aggregator, never `clone`: a custom aggregator's `withChildren()` must return an instance without state | +| `Aggregators::aggregate(Rows $rows, array $indices, FlowContext $context)`, `Aggregators::merge(Aggregators $other, FlowContext $context)` | removed: `AggregatedGroups` accumulates and absorbs the groups. A caller aggregates each `AggregatingFunction` itself | ### 22) `flow-php/etl` - join expressions describe themselves; `HashJoinConfig` carries the broadcast limit | Before | After | |------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| -| `interface Comparison` | `extends Describable`; a custom comparison returning `null` keeps the join in the parent process | -| `new HashJoinConfig($bucketing, $memoryLimit)` | `new HashJoinConfig($bucketing, $memoryLimit, $broadcastLimit)`; `hash_join()->broadcastLimit(Unit)` sets it, default 10 MB | +| `interface Comparison` | `extends Describable`. A custom comparison returning `null` keeps the join in the parent process | +| `new HashJoinConfig($bucketing, $memoryLimit)` | `new HashJoinConfig($bucketing, $memoryLimit, $broadcastLimit)`. `hash_join()->broadcastLimit(Unit)` sets it, default 10 MB | ### 23) `flow-php/etl` - `dropDuplicates()` runs as a processor -| Before | After | -|-------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| `dropDuplicates()` planned as a `DropDuplicatesTransformer` step; a failure in it is offered to the error handler | planned as a `Flow\ETL\Operators\Processor\DistinctProcessor`; a failure in it propagates like any processor's; rows and streaming are unchanged | -| `explain()` prints `DropDuplicatesTransformer` among a segment's steps | `explain()` prints `DistinctProcessor` among the steps of its pipeline | +| Before | After | +|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| +| `dropDuplicates()` planned as a `DropDuplicatesTransformer` step, and a failure in it is offered to the error handler | planned as a `Flow\ETL\Operators\Processor\DistinctProcessor`. A failure in it propagates like any processor's. Rows and streaming are unchanged | +| `explain()` prints `DropDuplicatesTransformer` among a segment's steps | `explain()` prints `DistinctProcessor` among the steps of its pipeline | ### 24) `flow-php/etl` - the step factories take a built algorithm config | Before | After | |---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `GroupBySteps::of($groupBy, $config, ?GroupByAlgorithmBuilder $algorithm)` | `GroupBySteps::of($groupBy, $config, ?HashGroupByConfig $grouping)` - pass `$builder->build($config->cache->localFilesystemCacheDir, $config->backend())` | -| `SortSteps::of()` / `SortSteps::external($refs, $config, ?SortAlgorithmBuilder $algorithm)` | `SortSteps::of($refs, $config, null\|MemorySortConfig\|ExternalSortConfig $sort)`; `SortSteps::external($refs, ExternalSortConfig $sort, RandomValueGenerator $random): ExternalSort` | +| `SortSteps::of()` / `SortSteps::external($refs, $config, ?SortAlgorithmBuilder $algorithm)` | `SortSteps::of($refs, $config, null\|MemorySortConfig\|ExternalSortConfig $sort)`, `SortSteps::external($refs, ExternalSortConfig $sort, RandomValueGenerator $random): ExternalSort` | | `RepartitionSteps::of($by, $config, ?RepartitionAlgorithmBuilder $algorithm)` | `RepartitionSteps::of($by, $config, ?HashRepartitionConfig $repartition)` | | `JoinSteps::of($right, $on, $type, $config, ?JoinAlgorithmBuilder $algorithm)` | `JoinSteps::of($right, $on, $type, $config, ?HashJoinConfig $join)` | @@ -773,14 +780,14 @@ The footer struct (`rows`, `byteSize`) is no longer a third `Statistics` beside | `RangeSourceStream` reads only through `iterate()`/`read()` | `stream()`, `start()`, `end()` (exclusive) name the inner stream and the window it is cut from | The native CSV reader opens a `NativeLocalSourceStream` (or a `RangeSourceStream` over one) by its path and reads the -window itself; every other stream is still read through its PHP `iterate()`. `NativeLocalFilesystem::readFrom()` no +window itself. Every other stream is still read through its PHP `iterate()`. `NativeLocalFilesystem::readFrom()` no longer creates the file's parent directory, and `NativeLocalSourceStream::size()` is the open handle's size. ### 28) `flow-php/etl` - a Floe BATCH frame is decoded by the `Backend` | Before | After | |------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `(new FrameDecoder($codec))->decode($body, $schema, $backend)` | `$backend->decodeFrame($body, $schema, $codec)`; `Flow\Floe\FrameDecoder` is removed | +| `(new FrameDecoder($codec))->decode($body, $schema, $backend)` | `$backend->decodeFrame($body, $schema, $codec)`, and `Flow\Floe\FrameDecoder` is removed | | `Backend` implementors: `builder`, `constant`, `decode`, `adopt`, `allocatedBytes` | also `decodeFrame(string $body, Schema $schema, Codec $codec): Rows`, `encodeFrame(Rows $rows, Codec $codec): string` | | - | also `compare(Column $left, Operator $operator, Column $right, string $leftName, string $rightName): Column`, `isNull(Column $column): Column`, `isNotNull(Column $column): Column` | | - | also `add`, `subtract`, `multiply`, `modulo`, each `(Column $left, Column $right): Column` | @@ -793,7 +800,7 @@ longer creates the file's parent directory, and `NativeLocalSourceStream::size() natively and points the Arrow buffers into the body string instead of copying every buffer through `decode()`. `PhpBackend` answers comparisons, null tests, arithmetic and sorts as `Comparison`, `IsNull`, `IsNotNull`, `Plus`, -`Minus`, `Multiply`, `Mod` and the sort processors did; `RustBackend` answers the ones it can natively and the rest +`Minus`, `Multiply`, `Mod` and the sort processors did. `RustBackend` answers the ones it can natively and the rest through `PhpBackend`. `Divide` and the `exact` mode of `Plus`, `Minus` and `Multiply` stay in their functions. A custom backend can delegate and adopt the result: @@ -812,12 +819,12 @@ public function compare(Column $left, Operator $operator, Column $right, string | Before | After | |------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Processor` implementors: `bind`, `process` | also `breaks(): bool` - true when `process()` needs every input row before it emits one; such a processor ends its pipeline | +| `Processor` implementors: `bind`, `process` | also `breaks(): bool`. It is true if `process()` needs every input row before it emits one. Such a processor ends its pipeline | | a pipeline ended after a blocking node | it ends at a processor that `breaks()`: a loader after `collect()` runs in the next pipeline, a window's `WindowProcessor` opens the pipeline after its repartition | -| `Executor\Segment`, `Executor\Segments`, `Pipeline::segments()` | removed; `Pipeline::$steps` is a `PipelineSteps(list $steps, null\|Processor\|JoinStep $breaker)`, run by `StepRunner::steps()` | -| `new Pipeline(..., ?Pipeline $input)` | `new Pipeline($id, $input, $steps)`: `$input` is the pipeline read; `Pipeline::input()` stays | +| `Executor\Segment`, `Executor\Segments`, `Pipeline::segments()` | removed. `Pipeline::$steps` is a `PipelineSteps(list $steps, null\|Processor\|JoinStep $breaker)`, run by `StepRunner::steps()` | +| `new Pipeline(..., ?Pipeline $input)` | `new Pipeline($id, $input, $steps)`: `$input` is the pipeline read, and `Pipeline::input()` stays | | `Plan\Materialization`, `Node::materialization()` | removed | -| `explain()`: `streaming` / `blocking` on a declarations line, `Buffers all rows before passing them on` under a node | removed; `explain()->toString(Stage::physical)` shows where pipelines end | +| `explain()`: `streaming` / `blocking` on a declarations line, `Buffers all rows before passing them on` under a node | removed. `explain()->toString(Stage::physical)` shows where pipelines end | | `Planner\PipelineSplit` | removed: `Planner::pipelines()` builds the physical plan | | `new GroupByAggregationProcessor($groupBy, HashBucketing $bucketing, Buckets $buckets, Unit $memoryLimit, int $batchSize)` | `new GroupByAggregationProcessor($groupBy, BucketingConfig $config, RandomValueGenerator $random)` | | `new PivotProcessor($groupBy, int $batchSize)` | `new PivotProcessor($groupBy, BucketingConfig $config)` | @@ -825,20 +832,20 @@ public function compare(Column $left, Operator $operator, Column $right, string | `new TopNProcessor($refs, $limit, ?ExternalSort $fallback)` | `new TopNProcessor($refs, $limit, MemorySortConfig\|ExternalSortConfig $config, RandomValueGenerator $random)` | | `TopNProcessor::top(Rows $rows)` | `top(Rows $rows, Backend $backend)`: the backend sorts the rows | | `new MergeSortProcessor(ExternalSort $sort)` | `new MergeSortProcessor(ExternalSortConfig $config, References $refs, RandomValueGenerator $random)` | -| `InvalidLogicException::pipelineWithoutSource()` | removed - every pipeline reads an extractor or another pipeline | +| `InvalidLogicException::pipelineWithoutSource()` | removed. Every pipeline reads an extractor or another pipeline | ### 30) `flow-php/etl`, `flow-php/postgresql`, `flow-php/azure-sdk`, `flow-php/cli` - no traits | Before | After | |--------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| | `use Flow\ETL\Extractor\Batches` | a `BatchSize` field set in the constructor, plus your own `withBatchSize(int): static` (`new BatchSize($size)`) and `batchSize(): int` (`->size`) | -| `use Flow\ETL\Extractor\File\FileReading` / `ListingPartitions` | a `FileColumnsSource(SourceFiles $files)` field: `columns(): FileColumns`; `new SourceFiles($filesystem, $path)` lists the files (`statuses($criteria)`) | -| `use Flow\ETL\Extractor\File\PathFiltering` | a `DerivedFromFiles` field: `fold()`, `footers()`, `from()`, `schema()`, `learn()`; `with*()` replaces it with `new DerivedFromFiles()` | -| `use Flow\ETL\Extractor\File\MetadataColumns` / `DeclaresPartitionTypes` | `FileColumnsSource::withMetadataColumns()` / `withPartitionTypes()` / `partitionTypes()`; the host replaces its field | -| `use Flow\ETL\Function\ResolvesFromChildren` | your own `resolved()` and `deterministic()`, each `true` when every child is | +| `use Flow\ETL\Extractor\File\FileReading` / `ListingPartitions` | a `FileColumnsSource(SourceFiles $files)` field: `columns(): FileColumns`. `new SourceFiles($filesystem, $path)` lists the files (`statuses($criteria)`) | +| `use Flow\ETL\Extractor\File\PathFiltering` | a `DerivedFromFiles` field: `fold()`, `footers()`, `from()`, `schema()`, `learn()`. `with*()` replaces it with `new DerivedFromFiles()` | +| `use Flow\ETL\Extractor\File\MetadataColumns` / `DeclaresPartitionTypes` | `FileColumnsSource::withMetadataColumns()` / `withPartitionTypes()` / `partitionTypes()`. The host replaces its field | +| `use Flow\ETL\Function\ResolvesFromChildren` | your own `resolved()` and `deterministic()`. Each is `true` if every child is | | `use Flow\PostgreSql\QueryBuilder\AstToSql` | `public function toSql(): string { return (new AstDeparser())->deparse($this->toAst()); }` | | `Statement::assert(SelectStatement::class)`, `StatementTrait` | `type_instance_of(SelectStatement::class)->assert($statement)` | -| `use Flow\Azure\SDK\Endpoints\UserAgentHeader` | removed; every endpoint options class keeps its `userAgentHeader()` / `withUserAgent()` | +| `use Flow\Azure\SDK\Endpoints\UserAgentHeader` | removed. Every endpoint options class keeps its `userAgentHeader()` / `withUserAgent()` | | `Flow\CLI\Command\Traits\*Options`, `DBOptions::DB_CONNECTION_HELP` | `Flow\CLI\Options\*Options::configure(Command)`, `ConfigOption::configure()`, `SchemaInferenceOptions::apply()`, `DbConnectionOptions::HELP` | `ScalarFunctionChain` is the one trait left. `mago guard` refuses any new trait outside the test folders. @@ -860,7 +867,7 @@ public function compare(Column $left, Operator $operator, Column $right, string | `GroupBy::tag()` | removed: `(new KeyEncoder($columns))->of($rows)` keys a batch | | `Hasher::hash(list> $values)` | `hash(list $keys)`: one key per row, from a `KeyEncoder` | | `KeyValues::of()` returned `list>` | `list`, the join-match key | -| `new HashBucketing(list $by, ...)`, `HashBucketing::indexOf(list $values)` | `new HashBucketing(KeyEncoder $keys, ...)`; `indexOf(string $key)` | +| `new HashBucketing(list $by, ...)`, `HashBucketing::indexOf(list $values)` | `new HashBucketing(KeyEncoder $keys, ...)`, `indexOf(string $key)` | | `new KeyGrouping(KeyValues $keys, ...)` | `new KeyGrouping(KeyEncoder $keys, Backend $backend)` | | `RowHashes` hashed column names with the values | the values only, `KeyEncoder` over the sorted columns | @@ -876,11 +883,11 @@ public function compare(Column $left, Operator $operator, Column $right, string | Before | After | |------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Executor\PhysicalPlan` interface, `Executor\Described`, `Executor\Raw` | `final readonly class PhysicalPlan(Pipeline $root, ?Schema $schema, ?SchemaNotDerivableException $refusal = null, bool $countsOnly = false)`; the config's `Launcher::read(PhysicalPlan $plan, ...): ?Launch` cuts the launch at run time | +| `Executor\PhysicalPlan` interface, `Executor\Described`, `Executor\Raw` | `final readonly class PhysicalPlan(Pipeline $root, ?Schema $schema, ?SchemaNotDerivableException $refusal = null, bool $countsOnly = false)`. The config's `Launcher::read(PhysicalPlan $plan, ...): ?Launch` cuts the launch at run time | | `$plan instanceof Described`, `Raw::$why`, `Described::$schema` | `$plan->described()`, `$plan->refusal()`, `$plan->schema()` | -| `NodeTranslator::algorithm()`, `NodeTranslator::toSteps($node, $context, $frames, $algorithm)` | removed; `steps(Node $node)` on an instance (row 103) | +| `NodeTranslator::algorithm()`, `NodeTranslator::toSteps($node, $context, $frames, $algorithm)` | removed. `steps(Node $node)` on an instance (row 103) | | `Optimizer\TopNRewrite` | removed: `CombineSortAndLimit` is the `Rewrite` | -| `new SinkAttachment($planned, $context)`, `SinkAttachment::next()` | `new WritePlanner($planned)`, `WritePlanner::next()`; it returns `BranchPipeline` and `TransactionGroup` plan values (row 95) | +| `new SinkAttachment($planned, $context)`, `SinkAttachment::next()` | `new WritePlanner($planned)`, `WritePlanner::next()`. It returns `BranchPipeline` and `TransactionGroup` plan values (row 95) | | `(new CountingProcessor())->rows($count, $backend)` / `->schema()` | `CountingProcessor::rows($count, $backend)` / `CountingProcessor::schema()` | | logs `Error during ETL segment execution.` (and the `Skipping ...` variants) | `... ETL pipeline execution.` | @@ -888,24 +895,24 @@ public function compare(Column $left, Operator $operator, Column $right, string | Before | After | |--------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| -| `PartitionColumns` | removed: `FileColumns::declare()`; the names are listed by `FileColumnsSource::columns()` | +| `PartitionColumns` | removed: `FileColumns::declare()`. The names are listed by `FileColumnsSource::columns()` | | `new FileColumns(PartitionColumns $columns, array $names, PartitionTypes $types, bool $metadataColumns)`, `FileColumns::fromArray($data, $filesystem)` | `new FileColumns(array $names, PartitionTypes $types, bool $metadataColumns)`, `FileColumns::fromArray($data)` | -| `new FileColumnsSource($filesystem, $path, $types, $metadataColumns)` | a fifth argument, `?array $partitionNames = null` (listed on the first `columns()` call when null) | +| `new FileColumnsSource($filesystem, $path, $types, $metadataColumns)` | a fifth argument, `?array $partitionNames = null` (if null, listed on the first `columns()` call) | | `new CSVSplitReader($filesystem, $source, $fileColumns, $schema, $batchSize, ...)` (and the JSON, Excel, XML, Text, Parquet and Floe split readers) | `new FileSplitReader(new FileRead($filesystem, $source, $fileColumns, $schema, $batchSize), new CSVFileBatches(...))` (see 121) | -| `CSVFileReader` | removed: `new CSVFileBatches(CSVSourceOpener $opener, ?InferredColumns $inferred)`; `CSVSniffer::header()` | +| `CSVFileReader` | removed: `new CSVFileBatches(CSVSourceOpener $opener, ?InferredColumns $inferred)`, `CSVSniffer::header()` | | `CSVHeader`, `ExcelHeader` | `Flow\ETL\IO\Extractor\Grid\GridHeader` | | `ExcelExtractor::reader(?ExcelSniffer $sampled)`, `ParquetExtractor::reader(?ParquetSourceFile $firstFile)` | `reader()` | | a split reader rebuilt in a worker detected the CSV dialect of a file the parent had detected | `CSVSourceOpener` describes the dialects it learned | -| `DerivedFromFiles::learn(Schema $schema)` | `learn(Schema $schema, string $from = '')`; `from()` also names the learned source | +| `DerivedFromFiles::learn(Schema $schema)` | `learn(Schema $schema, string $from = '')`. `from()` also names the learned source | | `DerivedFromFiles::footers()` after `learn()` returned empty footer statistics | throws `InvalidLogicException` | -| `new InferredRows($source, $sample)`, `InferredRows::of(array $rows, Schema $schema, Backend $backend)` | `new InferredRows($source, $sample, Schema $schema, Backend $backend, int $batchSize)`; `add(array $record): ?Rows`, `flush(): ?Rows` | -| `JsonFileReader::batches(SourceFile $source, int $batchSize, ?FileSplit $window)` | removed: `sample($source, window: $window)` yields the records; `Flow\ETL\Values\Rows\RecordBatch` batches them | +| `new InferredRows($source, $sample)`, `InferredRows::of(array $rows, Schema $schema, Backend $backend)` | `new InferredRows($source, $sample, Schema $schema, Backend $backend, int $batchSize)`, `add(array $record): ?Rows`, `flush(): ?Rows` | +| `JsonFileReader::batches(SourceFile $source, int $batchSize, ?FileSplit $window)` | removed: `sample($source, window: $window)` yields the records, and `Flow\ETL\Values\Rows\RecordBatch` batches them | ### 37) `flow-php/etl` - one listing extractor, Floe and row-building internals trimmed | Before | After | |----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| -| `files()` returned `FilesExtractor` (a `SplittableExtractor`), `from_path_partitions()` returned `PathPartitionsExtractor` | both return `FileListingExtractor`; it is not a `SplittableExtractor`; `FilesSplitReader` removed | +| `files()` returned `FilesExtractor` (a `SplittableExtractor`), `from_path_partitions()` returned `PathPartitionsExtractor` | both return `FileListingExtractor`. It is not a `SplittableExtractor`. `FilesSplitReader` removed | | `from_path_partitions()` statistics: rows only | rows and the listed bytes | | `ListedFileRow` implementors: `row()` | also `schema(): Schema`, the default body columns | | `Flow\Floe\FrameReader` | removed, no replacement: read Floe files through `from_floe()` | @@ -920,22 +927,22 @@ public function compare(Column $left, Operator $operator, Column $right, string ### 38) `flow-php/etl` - bound steps are immutable -| Before | After | -|-----------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `HashJoinProcessor`, `GroupByAggregationProcessor`, `PivotProcessor`, `DuplicateRowTransformer`: `final class`, `bind()` set fields on a copy | `final readonly class`; the bound state is a trailing optional constructor argument (`?Schema $left`, `?Schema $declaredRight`; `?GroupByShape $shape`; `?PivotShape $shape`; `$resolved`, `?Schema $output`) | -| `new DuplicateRowTransformer($condition, WithColumn ...$columns)` | `new DuplicateRowTransformer($condition, array $columns)` | +| Before | After | +|-----------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `HashJoinProcessor`, `GroupByAggregationProcessor`, `PivotProcessor`, `DuplicateRowTransformer`: `final class`, `bind()` set fields on a copy | `final readonly class`. The bound state is a trailing optional constructor argument (`?Schema $left`, `?Schema $declaredRight`, then `?GroupByShape $shape`, then `?PivotShape $shape`, then `$resolved`, `?Schema $output`) | +| `new DuplicateRowTransformer($condition, WithColumn ...$columns)` | `new DuplicateRowTransformer($condition, array $columns)` | ### 39) `flow-php/etl` - join rules live on the join type; one join schema, one probe loop -| Before | After | -|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| -| `JoinShape::of($expression, $type)->schema()->of($type, $left, $right)` | `JoinSchema::of($expression, $type)->output($left, $right)`; `JoinShape` removed | -| `JoinShape::of(...)->merger()`, `new RowMerger($prefix, $dropLeft, $dropRight)` | `JoinSchema::of(...)->merger($left, $right)`, `new RowMerger(Schema $output, list $left, list $right)` | -| `new JoinSchema($prefix, $dropLeft, $dropRight)`, `JoinSchema::of(Join $type, $left, $right)` | a fourth argument, `Join $type`; `output($left, $right)` | -| `RowMerger::merge()` threw `DuplicatedColumnsException` on a name collision | the collision is refused by `JoinSchema::output()` (`SchemaDefinitionNotUniqueException`) | -| `NullRowBuilder` | removed: `Rows::nulls(Schema $schema, Backend $backend)` | -| `JoinSide::of($rows, ?Rows $nullRow, ?Schema $schema)` | `JoinSide::of($rows, ?Schema $schema)`; `nullRow(Schema $fallback, Backend $backend)` | -| - | `Join::dropsNullKeys(Side $side)`, `Join::padsWithNullRow(Side $side)`, `enum Side` | +| Before | After | +|-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| `JoinShape::of($expression, $type)->schema()->of($type, $left, $right)` | `JoinSchema::of($expression, $type)->output($left, $right)`, and `JoinShape` removed | +| `JoinShape::of(...)->merger()`, `new RowMerger($prefix, $dropLeft, $dropRight)` | `JoinSchema::of(...)->merger($left, $right)`, `new RowMerger(Schema $output, list $left, list $right)` | +| `new JoinSchema($prefix, $dropLeft, $dropRight)`, `JoinSchema::of(Join $type, $left, $right)` | a fourth argument, `Join $type`, and `output($left, $right)` | +| `RowMerger::merge()` threw `DuplicatedColumnsException` on a name collision | the collision is refused by `JoinSchema::output()` (`SchemaDefinitionNotUniqueException`) | +| `NullRowBuilder` | removed: `Rows::nulls(Schema $schema, Backend $backend)` | +| `JoinSide::of($rows, ?Rows $nullRow, ?Schema $schema)` | `JoinSide::of($rows, ?Schema $schema)`, `nullRow(Schema $fallback, Backend $backend)` | +| - | `Join::dropsNullKeys(Side $side)`, `Join::padsWithNullRow(Side $side)`, `enum Side` | ### 40) `flow-php/etl` - join equality, grouping, pivot, batch size and telemetry internals @@ -949,7 +956,7 @@ public function compare(Column $left, Operator $operator, Column $right, string | - | `ReferenceResolver::bind(FunctionTree $function, Schema $schema, string $method, ?Type $returns = null)` | | `Flow\ETL\Extractor\BatchSize` | `Flow\ETL\BatchSize` | -| `new Transformation\BatchSize(int $size)` | `new Transformation\BatchSize(BatchSize $size)`; `batch_size(int $size)` unchanged | +| `new Transformation\BatchSize(int $size)` | `new Transformation\BatchSize(BatchSize $size)`, and `batch_size(int $size)` unchanged | | `int $batchSize` in `new Joiner()`, `new ExternalSort()`, `new KWayMerge()`, `new PivotAggregation()`, `new ExpandingProcessor()`, `new SpillingBuckets()`, `PivotedTable::flush()` | `BatchSize $batchSize` | | `new BatchingProcessor(int $size)`, `new Plan\Node\Batch($input, int $size)`, `int $size` property | `BatchSize $size` | | these threw `InvalidArgumentException` `Batch size must be greater than 0, given: 0` | `new BatchSize(0)` throws `Batch size must be greater than 0, got 0` | @@ -973,7 +980,7 @@ public function compare(Column $left, Operator $operator, Column $right, string | `ParquetSchemaPassFile` | removed: `DerivedFromFiles::fold()` leaves the first file open for its owner | | - | `ParquetSourceFile::forSource(SourceFile $source)`, `FileSplit::window(SourceStream $stream, ?int $start, ?int $end)` | | `JsonLineResync::window($stream, $split)` | `$split->window($stream, $resync->after(...), $resync->after(...))` | -| `new JsonFileBatches($filesystem, $reader, $format, $pointer, $split)` | `new JsonFileBatches($filesystem, $reader)`; the split arrives through `batches()` (see 121) | +| `new JsonFileBatches($filesystem, $reader, $format, $pointer, $split)` | `new JsonFileBatches($filesystem, $reader)`. The split arrives through `batches()` (see 121) | | - | `JsonFileReader::pointsInto()`, `JsonFileReader::window(?FileSplit $split)` | | `ParquetStoredType::of($normalized)` | `ParquetSchemaConformance::storedType($normalized)` | | `WorkbookSheetSample::rows()` | removed | @@ -983,11 +990,11 @@ public function compare(Column $left, Operator $operator, Column $right, string | Before | After | |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| | `ResolvedLeaf` (`?PhysicalIntervals $intervals`), `LeafResolver::resolve()` | `ExactLeaf` (`PhysicalIntervals $intervals`), `InexactLeaf`, `BoundFilter::resolve()` | -| `StatisticsReader`; `statistics(): ?StatisticsReader` on `ColumnChunk`, `DataPageHeader`, `DataPageHeaderV2` | `statistics(): ?Statistics`; `Statistics::min()`, `max()`, `minValue()`, `maxValue()`; counts and exactness as properties (`$statistics->nullCount`) | +| `StatisticsReader`, and `statistics(): ?StatisticsReader` on `ColumnChunk`, `DataPageHeader`, `DataPageHeaderV2` | `statistics(): ?Statistics`. `Statistics::min()`, `max()`, `minValue()`, `maxValue()`. Counts and exactness as properties (`$statistics->nullCount`) | | engine configuration `byte_order` as a case name (`'LITTLE_ENDIAN'`) | the value (`'V'`, `'N'`) | | `ReadFlatColumnValues::rawValues(): Generator` | `rawValues(): array` | | `new RustCSVEncoder($separator, $enclosure, $escape, $newLineSeparator, $dateTimeFormat, $dateFormat, $php)` | `new RustCSVEncoder(CSVWriteOptions $options, PhpCSVEncoder $php)` | -| `new RustJsonEncoder($flags, $dateTimeFormat, $dateFormat, $php)` | `new RustJsonEncoder(PhpJsonEncoder $php)`; `PhpJsonEncoder::$flags`, `$dateTimeFormat`, `$dateFormat` are public | +| `new RustJsonEncoder($flags, $dateTimeFormat, $dateFormat, $php)` | `new RustJsonEncoder(PhpJsonEncoder $php)`. `PhpJsonEncoder::$flags`, `$dateTimeFormat`, `$dateFormat` are public | | `ParquetFile\Page\ColumnData`, `RowGroup\FlowColumnChunk`, `RowGroup::addColumnChunk()`, `RowGroup::setRowsCount()`, `ColumnChunkBuilders::builders()`, `PageContainer::dataSize()`, `WriteFlatColumnValues::definitionLevelsCount()`, `addRaw()`, `skipRows()`, `splitByRows()` | removed | | `ColumnRef` threw `\InvalidArgumentException` | `Flow\Parquet\Exception\InvalidArgumentException` | | - | `Reader\ChunkBuffer`, `RustRowGroupChunks::decoded()` | @@ -1029,7 +1036,7 @@ under `Flow\ETL\Values\Memory`. Class names do not change. ### 46) `flow-php/etl` - value types moved to the `Flow\ETL\Values` namespace -Rows, schemas, definitions, columns and their physical layouts move under `Flow\ETL\Values`; the Floe frame codec +Rows, schemas, definitions, columns and their physical layouts move under `Flow\ETL\Values`. The Floe frame codec contract moves to `Flow\ETL\Values\Column\Frame`. Class names do not change. | Before | After | @@ -1208,7 +1215,7 @@ position in the whole source, not in the batch. | Before | After | |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------| -| `InferredRows` | removed - the extractors' `RecordBatch` keeps the source offset | +| `InferredRows` | removed. The extractors' `RecordBatch` keeps the source offset | | `InferredSchemaException::pastTheSample($source, $row, $inference, $mismatch)` | `InferredSchemaException::whenPastTheSample($source, $sampleSize, $mismatch)` - returns `$mismatch` within the sample | | `SchemaMismatchException::$rowIndex` - position in the batch | position in the whole source | @@ -1222,10 +1229,10 @@ position in the whole source, not in the batch. ### 54) `flow-php/etl` - storage types moved to the `Flow\ETL\Storage` namespace -Batch storage, the Floe file encoding, the serializers and `Memory` move under `Flow\ETL\Storage`; +Batch storage, the Floe file encoding, the serializers and `Memory` move under `Flow\ETL\Storage`. `TelemetryAttributes` moves to `Flow\ETL\Foundation\Telemetry`. The bucket storages are renamed after the one contract they implement (row 55). The Floe source and sink (`FloeExtractor`, `FloeLoader`) move to -`Flow\ETL\IO\Floe` (row 112); the `Flow\Floe\DSL` and `Flow\Serializer\DSL` functions keep their namespace. +`Flow\ETL\IO\Floe` (row 112). The `Flow\Floe\DSL` and `Flow\Serializer\DSL` functions keep their namespace. | Before | After | |----------------------------------------------------|----------------------------------------------------------------| @@ -1435,7 +1442,7 @@ distinct key. | `ref('n')->isIn(lit(['1', 'x']))` with `n` = 1: true | throws the same exception | | `lit('a')->isIn(lit([1, 'a']))`: true | throws: `Column "needle" value 'a' cannot be cast to integer` | -A haystack of mixed types throws when one candidate cannot be cast. Cast the haystack, or make it one type. +If one candidate of a haystack of mixed types cannot be cast, it throws. Cast the haystack, or make it one type. ### 67) `flow-php/etl` - one `Comparison` function replaces the 8 comparison classes @@ -1495,7 +1502,7 @@ Use `ref('b')` to read column b. |---------------------------------------------------------------------------------|--------------------------------------------------------------------| | `ref('a')->desc()`, `->asc()`: a `Reference` | a `SortColumn` (`name`, `order`, `nulls`) | | `Reference::sort()`, `Reference::nulls()` | removed: read `$sortColumn->order`, `$sortColumn->nulls` | -| `sortBy()`, `Window::orderBy()`, `constraint_sorted_by()`: `Reference` | `Reference`, `SortColumn` or `string`; a reference sorts ascending | +| `sortBy()`, `Window::orderBy()`, `constraint_sorted_by()`: `Reference` | `Reference`, `SortColumn` or `string`. A reference sorts ascending | | `new Sort($input, References $refs)`, `new TopN(...)`, sort processors: `$refs` | `list $columns` | | `Window::order()`: `list` | `list` | @@ -1527,7 +1534,7 @@ Before: `[]`, an empty `.jsonl` and a 0-row parquet file. CSV, Text, XML and Exc | Before | After | |------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| -| a frame run again: the inferred schema, partitions and statistics of the first run | listed and inferred again on every run; an `explain()` or `schema()` before the run shares its listing | +| a frame run again: the inferred schema, partitions and statistics of the first run | listed and inferred again on every run. An `explain()` or `schema()` before the run shares its listing | | `new FileColumnsSource($filesystem, $path, $types, $metadata, $names)` | `new FileColumnsSource(new SourceFiles($filesystem, $path), $types, $metadata)` | | `new FileRead($filesystem, $path, $columns, $schema, $batchSize)` | `new FileRead(new SourceFiles($filesystem, $path), $columns, $schema, $batchSize)` | | `FileExtractor` | extends `Flow\ETL\IO\Extractor\Refreshable` (`refresh(): void`) | @@ -1545,13 +1552,13 @@ wrapped source. ### 76) `flow-php/etl` - `batches()`, `batched_by()` and the collecting extractor are removed -| Before | After | -|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------| -| `read(batches($extractor, $n))` | `read($extractor)->batchSize($n)` | -| `read(batched_by($extractor, $column, $min))` | `read($extractor)->batchBy($column, $min)` | -| `batches($child, $n)` inside `from_all(...)` | `$child->withBatchSize($n)` when the child is a `BatchableExtractor`, otherwise `->batchSize($n)` on the frame | -| `read(new CollectingExtractor($extractor))` | `read($extractor)->collect()` | -| `Flow\ETL\Extractor\{BatchExtractor, BatchByExtractor, CollectingExtractor}` | removed | +| Before | After | +|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| +| `read(batches($extractor, $n))` | `read($extractor)->batchSize($n)` | +| `read(batched_by($extractor, $column, $min))` | `read($extractor)->batchBy($column, $min)` | +| `batches($child, $n)` inside `from_all(...)` | if the child is a `BatchableExtractor`, `$child->withBatchSize($n)`, otherwise `->batchSize($n)` on the frame | +| `read(new CollectingExtractor($extractor))` | `read($extractor)->collect()` | +| `Flow\ETL\Extractor\{BatchExtractor, BatchByExtractor, CollectingExtractor}` | removed | ### 77) `flow-php/etl` and every adapter - sources and sinks take the `Backend`, not the `FlowContext` @@ -1598,8 +1605,8 @@ public function load(Rows $rows, Backend $backend): void | `from_parquet($path)->withOffset($n)`, `from_parquet($path, offset: $n)` | `df()->read(from_parquet($path))->offset($n)` | | `from_floe($path)->withOffset($n)` | `df()->read(from_floe($path))->offset($n)` | | `from_excel($path)->withOffset($n)` (a start row, the header counted) | `df()->read(from_excel($path))->offset($n - 2)` with a header, `->offset($n - 1)` without one | -| `ExcelReadOptions(bool $withHeader, bool $convertEmptyToNull, int $offset, ...)`, `withOffset()` | `ExcelReadOptions(bool $withHeader, bool $convertEmptyToNull, ?string $sheetName, ?ExcelReader $format)`; `SheetCells(SheetInterface $sheet, bool $withHeader)` | -| `from_dbal_limit_offset_qb($connection, $queryBuilder, offset: $n)`, `DbalLimitOffsetExtractor::withOffset($n)` | `$queryBuilder->setFirstResult($n)`; without a maximum it read no rows, it now reads from the offset | +| `ExcelReadOptions(bool $withHeader, bool $convertEmptyToNull, int $offset, ...)`, `withOffset()` | `ExcelReadOptions(bool $withHeader, bool $convertEmptyToNull, ?string $sheetName, ?ExcelReader $format)`, `SheetCells(SheetInterface $sheet, bool $withHeader)` | +| `from_dbal_limit_offset_qb($connection, $queryBuilder, offset: $n)`, `DbalLimitOffsetExtractor::withOffset($n)` | `$queryBuilder->setFirstResult($n)`. Without a maximum it read no rows. It now reads from the offset | | `ExplainedRows::of(..., ?int $maximum, int $offset)` | `of(..., ?int $maximum)` | | `FooterStatistics::of(int $listedFiles, int $offset)` | `of(int $listedFiles)` | | `flow` CLI `--input-parquet-offset`, `--input-excel-offset` | `--input-file-offset` | @@ -1611,12 +1618,12 @@ public function load(Rows $rows, Backend $backend): void | Before | After | |--------------------------------------------------------------|-------------------------------------------------------------------------------------------| -| `implements RewindableExtractor` + `isRepeatable(): bool` | `Extractor::isRepeatable(): bool` on every extractor; a one-shot stream returns `false` | +| `implements RewindableExtractor` + `isRepeatable(): bool` | `Extractor::isRepeatable(): bool` on every extractor. A one-shot stream returns `false` | | an extractor that did not implement `RewindableExtractor` | implements `isRepeatable()` returning `false` | -| `OverridingExtractor::extractors()` | removed; a wrapper answers `isRepeatable()` for what it reads (`from_all()`: every child) | +| `OverridingExtractor::extractors()` | removed. A wrapper answers `isRepeatable()` for what it reads (`from_all()`: every child) | | `(new Repeatability())->of($extractor)` | `$extractor->isRepeatable()` | | `(new Repeatability())->ofPlan($plan)` | `$plan->isRepeatable()` | -| `from_cache($id)->withFallbackExtractor($e)->isRepeatable()` | `false` also when `$e` is not repeatable | +| `from_cache($id)->withFallbackExtractor($e)->isRepeatable()` | if `$e` is not repeatable, also `false` | ### 80) `flow-php/etl` - `MemoryExtractor` merges into `ArrayExtractor` @@ -1651,7 +1658,7 @@ one framing enum, one converter vocabulary, a required XML writer, one copy of t | Before | After | |----------------------------------------------------------------------------------------|------------------------------------------------------------------| -| `Flow\ETL\Formatter\ASCII\{ASCIITable, Headers, Body, ASCIIHeaders, ASCIIBody}` | removed; `(new AsciiTableFormatter())->format($rows, $truncate)` | +| `Flow\ETL\Formatter\ASCII\{ASCIITable, Headers, Body, ASCIIHeaders, ASCIIBody}` | removed, `(new AsciiTableFormatter())->format($rows, $truncate)` | | `AsciiTableFormatter::format()`, `to_output()` of a batch: time grew with rows squared | one pass over the cells | ### 84) `flow-php/etl-adapter-csv`, `flow-php/etl-adapter-json`, `flow-php/etl-adapter-parquet` - the `Adaptive*` lane @@ -1660,11 +1667,11 @@ wrappers are gone, the class that builds the sink or source picks the lane | Before | After | |-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| -| `Flow\ETL\Adapter\CSV\AdaptiveCSVEncoder` | removed; `CSVLoader::open()` picks `RustCSVEncoder` or `PhpCSVEncoder` | -| `Flow\ETL\Adapter\JSON\AdaptiveJsonEncoder` | removed; `JsonLoader::open()` picks `RustJsonEncoder` or `PhpJsonEncoder` | -| `Flow\ETL\Adapter\JSON\AdaptiveJsonOpenSource` | removed; `JsonFileBatches::open(SourceFile $source, ?FileSplit $split = null): JsonOpenSource` picks the lane | -| `Flow\ETL\Adapter\Parquet\AdaptiveParquetOpenSource` | removed; `ParquetSourceFile::open()` picks the lane | -| `Flow\ETL\Adapter\Parquet\AdaptiveParquetOpenSink` | removed; `ParquetFileWriterFactory::writer(): FileWriter` picks the lane | +| `Flow\ETL\Adapter\CSV\AdaptiveCSVEncoder` | removed. `CSVLoader::open()` picks `RustCSVEncoder` or `PhpCSVEncoder` | +| `Flow\ETL\Adapter\JSON\AdaptiveJsonEncoder` | removed. `JsonLoader::open()` picks `RustJsonEncoder` or `PhpJsonEncoder` | +| `Flow\ETL\Adapter\JSON\AdaptiveJsonOpenSource` | removed. `JsonFileBatches::open(SourceFile $source, ?FileSplit $split = null): JsonOpenSource` picks the lane | +| `Flow\ETL\Adapter\Parquet\AdaptiveParquetOpenSource` | removed. `ParquetSourceFile::open()` picks the lane | +| `Flow\ETL\Adapter\Parquet\AdaptiveParquetOpenSink` | removed. `ParquetFileWriterFactory::writer(): FileWriter` picks the lane | | `new CSVLoader($path, $filesystem)`, `new JsonLoader($path, $filesystem, $framing)` | a last `?FlowPhpExtension $extension = null` | ### 85) `flow-php/etl` and every adapter - IO types moved to `Flow\ETL\IO`, adapter types to their layer namespaces (`IO`, `Values`, `Functions`, `Foundation`) @@ -1755,7 +1762,7 @@ wrappers are gone, the class that builds the sink or source picks the lane | `Flow\ETL\Adapter\Logger\PsrLoggerLoader` | `Flow\ETL\Adapter\Logger\IO\Loader\PsrLoggerLoader` | | `Flow\ETL\Adapter\Logger\Logger\DumpLogger` | `Flow\ETL\Adapter\Logger\IO\Loader\DumpLogger` | | `Flow\ETL\Adapter\Parquet\SchemaConverter` | `Flow\ETL\Adapter\Parquet\Values\Schema\SchemaConverter` | -| `Flow\ETL\Adapter\Parquet\{ParquetEncoder, ParquetFileSink, ParquetFileSinks, ParquetLoader, ParquetOpenSink}` | `Flow\ETL\Adapter\Parquet\IO\Loader\{ParquetFileWriter, ParquetFileWriterFactory, ParquetLoader}`; `ParquetEncoder` removed | +| `Flow\ETL\Adapter\Parquet\{ParquetEncoder, ParquetFileSink, ParquetFileSinks, ParquetLoader, ParquetOpenSink}` | `Flow\ETL\Adapter\Parquet\IO\Loader\{ParquetFileWriter, ParquetFileWriterFactory, ParquetLoader}`, and `ParquetEncoder` removed | | `Flow\ETL\Adapter\Parquet\{ParquetSchemaConformance, PhpParquetOpenSink, RustParquetOpenSink}` | `Flow\ETL\Adapter\Parquet\IO\Loader\{ParquetSchemaConformance, RustParquetFileWriter}` | | `Flow\ETL\Adapter\Parquet\{ParquetExtractor, ParquetFileBatches, ParquetOpenSource, ParquetSourceFile, ParquetSourceFileOpener}` | `Flow\ETL\Adapter\Parquet\IO\Extractor\{ParquetExtractor, ParquetFileBatches, ParquetOpenSource, ParquetSourceFile, ParquetSourceFileOpener}` | | `Flow\ETL\Adapter\Parquet\{PhpParquetOpenSource, RustParquetOpenSource}` | `Flow\ETL\Adapter\Parquet\IO\Extractor\{PhpParquetOpenSource, RustParquetOpenSource}` | @@ -1903,10 +1910,10 @@ final class MyTransformer implements Transformer | Before | After | |----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Flow\ETL\GroupBy\GroupBySteps::of()` | removed: the planner builds `[PruneColumnsTransformer, GroupByAggregationProcessor]` (the prune only when `GroupBy::readColumns(): ?list` is not null) or `[PivotProcessor]` | +| `Flow\ETL\GroupBy\GroupBySteps::of()` | removed: the planner builds `[PruneColumnsTransformer, GroupByAggregationProcessor]` (the prune only for a non-null `GroupBy::readColumns(): ?list`) or `[PivotProcessor]` | | `Flow\ETL\Join\JoinSteps::of()` | removed: the planner builds a `JoinStep` over a `HashJoin` (row 94) | | `Flow\ETL\Repartition\RepartitionSteps::of()` | removed: `new RepartitionProcessor(References $by, BucketingConfig $config, RandomValueGenerator $random)` | -| `new RepartitionProcessor($by, HashBucketing $bucketing, Buckets $buckets, Unit $memoryLimit, Hasher $hasher)` | `new RepartitionProcessor($by, BucketingConfig $config, RandomValueGenerator $random)`: it builds its bucketing and its spilling buckets from `$config`; `$memoryLimit` is `$config->memoryLimit` | +| `new RepartitionProcessor($by, HashBucketing $bucketing, Buckets $buckets, Unit $memoryLimit, Hasher $hasher)` | `new RepartitionProcessor($by, BucketingConfig $config, RandomValueGenerator $random)`: it builds its bucketing and its spilling buckets from `$config`. `$memoryLimit` is `$config->memoryLimit` | | `Flow\ETL\Sort\SortSteps::of()` | removed: `new MemorySortProcessor($columns)` or `new MergeSortProcessor($config, $columns, $random)` | | `SortSteps::external()` | `Flow\ETL\Kernels\Sort\ExternalSort::of($columns, ExternalSortConfig $config, RandomValueGenerator $random)` | @@ -1923,11 +1930,11 @@ final class MyTransformer implements Transformer | Before | After | |----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `Flow\ETL\Processor\HashJoinProcessor` (a `Processor`) | `Flow\ETL\Operators\Join\HashJoin`, not a `Processor`: `join(Generator $left, Generator $right, Backend $backend): Generator`, `bind(Schema $left, Schema $right): BoundStep` | -| `new HashJoinProcessor(PhysicalPlan $right, Executor $executor, $on, $type, $config, $random, $backend)` | `new HashJoin($on, $type, $config, $random)`; the right plan is not the operator's | +| `new HashJoinProcessor(PhysicalPlan $right, Executor $executor, $on, $type, $config, $random, $backend)` | `new HashJoin($on, $type, $config, $random)`. The right plan is not the operator's | | `Flow\ETL\Transformer\CrossJoinRowsTransformer` (a `Transformer`) | `Flow\ETL\Operators\Join\CrossJoin`, not a `Transformer`: `join(Generator $left, Generator $right, Backend $backend): Generator`, `bind(Schema $left, Schema $right): BoundStep` | | `new CrossJoinRowsTransformer(PhysicalPlan $right, Executor $executor, string $prefix)` | `new CrossJoin(string $prefix)` | -| a join step holds its right plan | the plan holds `Flow\ETL\Planning\Physical\JoinStep(HashJoin\|CrossJoin $join, PhysicalPlan $right)`; the runtime runs the right plan once and hands its rows to `join()` | -| `crossJoin()`: a failure in it is offered to the error handler (`onTransformation()`) | a failure in it propagates like any processor's, a failure of the right side included; the error handler is not asked | +| a join step holds its right plan | the plan holds `Flow\ETL\Planning\Physical\JoinStep(HashJoin\|CrossJoin $join, PhysicalPlan $right)`. The runtime runs the right plan once and hands its rows to `join()` | +| `crossJoin()`: a failure in it is offered to the error handler (`onTransformation()`) | a failure in it propagates like any processor's, a failure of the right side included. The error handler is not asked | | `crossJoin()`: one transformation span per batch | no span, as for every processor and for `join()` | | `BoundStep::$step` is `Processor\|Transformer` | `Processor\|Transformer\|HashJoin\|CrossJoin`, typed by `@template`: `Processor::bind()` returns `BoundStep`, `Transformer::bind()` `BoundStep` | | `explain()` prints `Processor: HashJoinProcessor`, `Transformer: CrossJoinRowsTransformer` | `Join: HashJoin`, `Join: CrossJoin` | @@ -1936,27 +1943,27 @@ final class MyTransformer implements Transformer | Before | After | |---------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Planner::plan(LogicalPlan $logical, FlowContext $context, ?SourceRows $sources)` | `plan(LogicalPlan $logical)` (row 103); the counters go to `Executor::execute()` | +| `Planner::plan(LogicalPlan $logical, FlowContext $context, ?SourceRows $sources)` | `plan(LogicalPlan $logical)` (row 103). The counters go to `Executor::execute()` | | `Executor::execute(PhysicalPlan $plan)`, `fetch(PhysicalPlan $plan)` | `execute(LogicalPlan $logical, FlowContext $context, ?RunCounts $sources = null)`, `fetch(LogicalPlan $logical, FlowContext $context)`: the executor plans, and `execute()` returns the `PhysicalPlan` (`getReturn()`) | | `Executor::executePlan(PhysicalPlan $plan)`, `executePipeline(Pipeline $pipeline)` | `executePlan(PhysicalPlan $plan, FlowContext $context, ?RunCounts $sources = null)`, `executePipeline(Pipeline $pipeline, FlowContext $context, ?Extractor $source = null)` | | `Executor::merge(Generator $batches, PhysicalPlan $plan)` | `merge(Generator $batches, Backend $backend)`: an empty result takes its schema from the `PhysicalPlan` `$batches` returns | -| `Flow\ETL\Planner\SinkFeedFactory` (built the sink pipelines at plan time) | `Flow\ETL\Runtime\Executor\WriteLoaderFactory`: `feed(BranchPipeline, ErrorHandler, FlowContext): BranchLoader`, `transactional(TransactionGroup, FlowContext): TransactionLoader`; the plan holds `BranchPipeline`/`TransactionGroup` and the runtime builds the loaders each run | +| `Flow\ETL\Planner\SinkFeedFactory` (built the sink pipelines at plan time) | `Flow\ETL\Runtime\Executor\WriteLoaderFactory`: `feed(BranchPipeline, ErrorHandler, FlowContext): BranchLoader`, `transactional(TransactionGroup, FlowContext): TransactionLoader`. The plan holds `BranchPipeline`/`TransactionGroup` and the runtime builds the loaders each run | | `new SinkRun(Pipeline $side, Executor $executor)` | `new BranchFiber(Pipeline $side, Executor $executor, FlowContext $context, FeedExtractor $feed)` | | `explain()` prints `Loader: SinkFeed`, `Loader: TransactionalSinks` for a sink with steps of its own, a transaction | `Branch: BranchPipeline`, `Transaction: TransactionGroup` | ### 96) `flow-php/etl` - `explain()` formats a join and a sort once for both plans -| Before | After | -|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------| -| `Flow\ETL\Plan\Explain\Details` | `Flow\ETL\Planning\Explain\NodeDetails` | -| `Flow\ETL\Plan\Explain\Outline` | `Flow\ETL\Planning\Explain\LogicalOutline` | -| `Flow\ETL\Plan\Explain\Branches`, `Branches::of($entry, $indent)` | removed: `TreeLayout::branches($entry, $indent)` | -| `Details::join(Node\Join $join)`, `Details::crossJoin(Node\CrossJoin $join)`, `Details::references()` | `NodeDetails::join(JoinType $type, Expression $on)`, `NodeDetails::crossJoin(string $prefix)`; `references()` removed | -| `StepDetails::sort()`, `StepDetails::columns(References $refs)` | `NodeDetails::sort(list $columns)`, `NodeDetails::columns($refs->all())` | -| `explain()` logical join: `Left on: id, tag` / `Right on: user_id, tag` | `On: id = user_id` / `On: tag = tag`, one line per condition, as the physical plan prints it | -| `explain()` physical join: `Join: left`, `Join: cross` | `Type: left`, `Type: cross`, as the logical plan prints it | -| `explain()` logical sort: `Sort by: id, name` (names only) | `Sort by: id desc, name asc nulls last` (direction, and a nulls order that is not the default) | -| `explain()` physical sort and top N: `Sort: id asc` | `Sort by: id asc` | +| Before | After | +|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| +| `Flow\ETL\Plan\Explain\Details` | `Flow\ETL\Planning\Explain\NodeDetails` | +| `Flow\ETL\Plan\Explain\Outline` | `Flow\ETL\Planning\Explain\LogicalOutline` | +| `Flow\ETL\Plan\Explain\Branches`, `Branches::of($entry, $indent)` | removed: `TreeLayout::branches($entry, $indent)` | +| `Details::join(Node\Join $join)`, `Details::crossJoin(Node\CrossJoin $join)`, `Details::references()` | `NodeDetails::join(JoinType $type, Expression $on)`, `NodeDetails::crossJoin(string $prefix)`, and `references()` removed | +| `StepDetails::sort()`, `StepDetails::columns(References $refs)` | `NodeDetails::sort(list $columns)`, `NodeDetails::columns($refs->all())` | +| `explain()` logical join: `Left on: id, tag` / `Right on: user_id, tag` | `On: id = user_id` / `On: tag = tag`, one line per condition, as the physical plan prints it | +| `explain()` physical join: `Join: left`, `Join: cross` | `Type: left`, `Type: cross`, as the logical plan prints it | +| `explain()` logical sort: `Sort by: id, name` (names only) | `Sort by: id desc, name asc nulls last` (direction, and a nulls order that is not the default) | +| `explain()` physical sort and top N: `Sort: id asc` | `Sort by: id asc` | ### 97) `flow-php/etl` - planning types moved to `Flow\ETL\Planning` @@ -2035,8 +2042,8 @@ holds in a `Transactional` child too. | `Rule::apply(LogicalPlan $plan, FlowContext $context)` | `apply(LogicalPlan $plan, Backend $backend)` | | `Optimizer::optimize(LogicalPlan $plan, FlowContext $context)` | `optimize(LogicalPlan $plan, Backend $backend)` | | `new JoinSides(Optimizer $optimizer, FlowContext $context)` | `new JoinSides(Optimizer $optimizer, Backend $backend)` | -| `new Planner(Optimizer $optimizer = new Optimizer())` | `new Planner(Optimizer $optimizer, NodeTranslator $translator, Backend $backend)`; `Config::planner()` returns the one the config builds | -| `Planner::plan()` (row 95) | `plan(LogicalPlan $logical)`; `Planner::optimize(LogicalPlan $logical)` runs the planner's optimizer alone | +| `new Planner(Optimizer $optimizer = new Optimizer())` | `new Planner(Optimizer $optimizer, NodeTranslator $translator, Backend $backend)`. `Config::planner()` returns the one the config builds | +| `Planner::plan()` (row 95) | `plan(LogicalPlan $logical)`. `Planner::optimize(LogicalPlan $logical)` runs the planner's optimizer alone | | `NodeTranslator::steps()` (row 35), static | `new NodeTranslator($backend, $randomValueGenerator, $id, $cache, $cacheDir, $sort, $grouping, $join, $repartition)`, `steps(Node $node)` | | `Plan::of(LogicalPlan $logical, FlowContext $context)`, `Plan::$context` | `Plan::of(LogicalPlan $logical, Planner $planner)`, `Plan::$planner` | @@ -2198,37 +2205,37 @@ before). | `FileSink`, `FileSinks::open(DestinationStream $stream, Backend $backend)` | `FileWriter`, `FileWriterFactory::writer(DestinationStream $stream, Schema $schema, Backend $backend)` | | `CSVOpenSink`, `JsonOpenSink`, `TextOpenSink`, `XMLOpenSink` | `CSVFileWriter`, `JsonFileWriter`, `TextFileWriter`, `XMLFileWriter` | | `FloeFileSink`, `FloeFileSinks` | `FloeFileWriter`, `FloeFileWriterFactory` | -| `ParquetFileSink`, `PhpParquetOpenSink`, `ParquetOpenSink` | `ParquetFileWriter`; `ParquetOpenSink` removed: both lanes implement `FileWriter` | +| `ParquetFileSink`, `PhpParquetOpenSink`, `ParquetOpenSink` | `ParquetFileWriter`, and `ParquetOpenSink` removed: both lanes implement `FileWriter` | | `ParquetFileSinks::conform()`, `ParquetFileSinks::writer(DestinationStream)` | removed: `ParquetFileWriterFactory::writer(DestinationStream, Schema, Backend)` returns the lane | | `new RustParquetOpenSink(RustParquetFileWriter $writer)` | `new RustParquetFileWriter(ArrowRustParquetFileWriter $writer, ParquetSchemaConformance $conformance, Backend $backend)` | ### 116) `flow-php/filesystem` - `MemoryFilesystem::mv()` moves files and directories -| Before | After | -|-------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| -| `mv()` throws `RuntimeException` `Cannot move files around in memory` | a file: its content moves to the target, which it replaces; the source is removed | -| - | a directory: every file under it moves to the same relative path under the target | -| - | a missing source returns `false` | -| `to_csv('memory://...')->saveMode(overwrite())` throws at the end | the write replaces the file | +| Before | After | +|-----------------------------------------------------------------------|-----------------------------------------------------------------------------------| +| `mv()` throws `RuntimeException` `Cannot move files around in memory` | a file: its content moves to the target, which it replaces. The source is removed | +| - | a directory: every file under it moves to the same relative path under the target | +| - | a missing source returns `false` | +| `to_csv('memory://...')->saveMode(overwrite())` throws at the end | the write replaces the file | ### 117) `flow-php/etl`, `flow-php/etl-adapter-*` - one file commit protocol; readers skip hidden paths Every file write runs through one `FileCommit`. Files that replace others (Overwrite) and every parallel task's files -are written under a temporary output inside the destination, then moved into place; the other modes write in place. +are written under a temporary output inside the destination, then moved into place. The other modes write in place. The save mode decides once for the whole destination. Readers skip the temporary output of a running or crashed write because it sits under a `.` or `_` path segment. -| Before | After | -|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `FilesSink` | `FileCommit`: a task stages its files, the job commits them; a serial write is one task | -| Overwrite wrote `._flow_php_tmp.` beside each file | every Overwrite and every parallel task writes under `/.flow-tmp--/` first; an aborted parallel write leaves the destination directory behind, empty | -| Append beside an existing plain file: `_.` | `-.` | -| Ignore / ExceptionIfExists on a partitioned plain destination: decided per partition file | decided once over `/**/.`: an existing file in any partition skips (Ignore) or refuses (ExceptionIfExists) the whole write | -| Overwrite removed `*.` in each written partition (`data_backup.csv` too) | removes only `.` and `-.`, partitioned or not; files an older Append named `_.` stay | -| Overwrite removed the stale files, then moved the new ones | moves first, then removes: a failed commit leaves duplicates, never loses the old files | -| a write without rows touched nothing | Overwrite empties an unpartitioned destination (a partitioned one keeps every partition); ExceptionIfExists over an existing destination throws; Ignore and Append write nothing | -| `to_excel()->saveMode(ignore())` over an existing workbook overwrote it | keeps it | -| file extractors and `files()` list every file the path matches | skip a file under a `.` or `_` path segment below the path's static part, except segments with `=`, `_metadata` and `_common_metadata`; a path you name yourself is read | +| Before | After | +|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `FilesSink` | `FileCommit`: a task stages its files, the job commits them. A serial write is one task | +| Overwrite wrote `._flow_php_tmp.` beside each file | every Overwrite and every parallel task writes under `/.flow-tmp--/` first. An aborted parallel write leaves the destination directory behind, empty | +| Append beside an existing plain file: `_.` | `-.` | +| Ignore / ExceptionIfExists on a partitioned plain destination: decided per partition file | decided once over `/**/.`: an existing file in any partition skips (Ignore) or refuses (ExceptionIfExists) the whole write | +| Overwrite removed `*.` in each written partition (`data_backup.csv` too) | removes only `.` and `-.`, partitioned or not. Files an older Append named `_.` stay | +| Overwrite removed the stale files, then moved the new ones | moves first, then removes: a failed commit leaves duplicates, never loses the old files | +| a write without rows touched nothing | Overwrite empties an unpartitioned destination (a partitioned one keeps every partition). ExceptionIfExists over an existing destination throws. Ignore and Append write nothing | +| `to_excel()->saveMode(ignore())` over an existing workbook overwrote it | keeps it | +| file extractors and `files()` list every file the path matches | skip a file under a `.` or `_` path segment below the path's static part. Segments with `=`, `_metadata` and `_common_metadata` are not skipped. A path you name yourself is read | ### 118) `flow-php/etl` - a limit ends the stream without an exception @@ -2250,15 +2257,15 @@ because it sits under a `.` or `_` path segment. ### 121) `flow-php/etl`, `flow-php/etl-adapter-*` - one mechanism per operation -| Before | After | -|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `FileBatches { batches(SourceFile $source, Schema $body, int $batchSize, Backend $backend, ReadWindow $window) }` | `FileBatches extends Describable { batches(FileRead $read, Criteria $criteria, SourceFile $source, Schema $body, Backend $backend, ReadWindow $window); close() }` - each format's batches holds its settings and describes itself; the batch size is `$read->batchSize`, the split `$criteria->split` | -| `ConfigBuilder::groupBy(GroupByAlgorithmBuilder $algorithm)`, `ConfigBuilder::repartition(RepartitionAlgorithmBuilder $algorithm)` | `ConfigBuilder::groupBy(BucketingAlgorithmBuilder $algorithm)`, `ConfigBuilder::repartition(BucketingAlgorithmBuilder $algorithm)` | -| `DataFrame::aggregate(array $aggregations, ?GroupByAlgorithmBuilder $algorithm)`, `DataFrame::groupBy(..., ?GroupByAlgorithmBuilder $algorithm)` | `?BucketingAlgorithmBuilder $algorithm`; `BucketingConfigBuilder` implements it | -| `to_branch($condition, $write)->withTransformation($transformation)` | `to_branch($condition, to_transformation($transformation, $write))` | -| `abstract class StopWhen { shouldStop(); and(); or() }` (`flow-php/etl-adapter-http`) | `interface StopWhen { shouldStop(DecodedResponse $response, PageState $state): bool }` - a custom condition `implements StopWhen` | -| `http_stop_when_flag_false('has_more')->or(http_stop_when_max_pages(1000))` | `http_stop_when_any_of(http_stop_when_flag_false('has_more'), http_stop_when_max_pages(1000))` | -| `$a->and($b)` on a stop condition | `http_stop_when_all_of($a, $b)` | +| Before | After | +|--------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `FileBatches { batches(SourceFile $source, Schema $body, int $batchSize, Backend $backend, ReadWindow $window) }` | `FileBatches extends Describable { batches(FileRead $read, Criteria $criteria, SourceFile $source, Schema $body, Backend $backend, ReadWindow $window); close() }`. Each format's batches holds its settings and describes itself. The batch size is `$read->batchSize`, the split `$criteria->split` | +| `ConfigBuilder::groupBy(GroupByAlgorithmBuilder $algorithm)`, `ConfigBuilder::repartition(RepartitionAlgorithmBuilder $algorithm)` | `ConfigBuilder::groupBy(BucketingAlgorithmBuilder $algorithm)`, `ConfigBuilder::repartition(BucketingAlgorithmBuilder $algorithm)` | +| `DataFrame::aggregate(array $aggregations, ?GroupByAlgorithmBuilder $algorithm)`, `DataFrame::groupBy(..., ?GroupByAlgorithmBuilder $algorithm)` | `?BucketingAlgorithmBuilder $algorithm`, and `BucketingConfigBuilder` implements it | +| `to_branch($condition, $write)->withTransformation($transformation)` | `to_branch($condition, to_transformation($transformation, $write))` | +| `abstract class StopWhen { shouldStop(); and(); or() }` (`flow-php/etl-adapter-http`) | `interface StopWhen { shouldStop(DecodedResponse $response, PageState $state): bool }` - a custom condition `implements StopWhen` | +| `http_stop_when_flag_false('has_more')->or(http_stop_when_max_pages(1000))` | `http_stop_when_any_of(http_stop_when_flag_false('has_more'), http_stop_when_max_pages(1000))` | +| `$a->and($b)` on a stop condition | `http_stop_when_all_of($a, $b)` | ### 122) `flow-php/etl` - `mod()` refuses a negative modulus on every `brick/math` version @@ -2274,16 +2281,16 @@ because it sits under a `.` or `_` path segment. |----------------------------------------------------------|------------------------------------------------------------------------------------------| | `interface Filesystem` | `+ create(Path $path): DestinationStream` - custom implementations add it | | `Filesystem::rm(Path $path): bool` | `rm(Path $path, bool $recursive = true): bool` - custom implementations add the argument | -| `final class Flow\Filesystem\Exception\RuntimeException` | not final; `FileExistsException` extends it | +| `final class Flow\Filesystem\Exception\RuntimeException` | not final, and `FileExistsException` extends it | | `SFTPFilesystem`, `StdOutFilesystem` | `create()` throws `RuntimeException` | ### 124) `flow-php/filesystem` - `NativeLocalFilesystem` takes `Permissions` -| Before | After | -|--------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------| -| `NativeLocalFilesystem::normalize()`: `{protocol}` | `{protocol, permissions}`; `fromArray()` rejects a configuration without `permissions` | -| `AsyncAWS\Options::normalize()`, `Azure\Options::normalize()`, `SFTP\Options::normalize()` | `+ block_permissions`; `fromArray()` rejects a configuration without it | -| `NativeLocalFilesystem::mv()` from a missing source raised an `E_WARNING`, created the target's parent directory, and removed an existing target first | returns `false` and changes nothing; an existing file target is replaced by `rename()` | +| Before | After | +|--------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| +| `NativeLocalFilesystem::normalize()`: `{protocol}` | `{protocol, permissions}`, and `fromArray()` rejects a configuration without `permissions` | +| `AsyncAWS\Options::normalize()`, `Azure\Options::normalize()`, `SFTP\Options::normalize()` | `+ block_permissions`, and `fromArray()` rejects a configuration without it | +| `NativeLocalFilesystem::mv()` from a missing source raised an `E_WARNING`, created the target's parent directory, and removed an existing target first | returns `false` and changes nothing. An existing file target is replaced by `rename()` | ### 125) `flow-php/filesystem-azure-bridge` - a blob written in blocks is invisible until `close()` @@ -2293,28 +2300,28 @@ because it sits under a `.` or `_` path segment. ### 126) `flow-php/etl` - extractors yield corrupted records, the run routes or refuses them -| Before | After | -|------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Extractor::extract()`, `Reader::extract()` yielded `Rows` | they may also yield a `CorruptedRecordException`, one per record that cannot become a row; a direct caller routes or refuses it (`instanceof Rows`) | -| a reader refused a corrupted record itself | the run routes it to `withCorruptedRecords($loader)`, loaded, closed and discarded like the run's other loaders; without a loader it fails the run, whatever the `ErrorHandler` - a corrupted record is not an extraction error | -| `ExtractionError::$extractor` was an `Extractor` | `Extractor\|Reader`: a task's source is a `Reader` | -| `StepRunner::steps()`, `run()`: `?Extractor $source` | `Extractor\|Reader\|null $source`; a source implementing `CorruptedRecordsRouter` routes its corrupted records | +| Before | After | +|------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `Extractor::extract()`, `Reader::extract()` yielded `Rows` | they can also yield a `CorruptedRecordException`, one per record that cannot become a row. A direct caller routes or refuses it (`instanceof Rows`) | +| a reader refused a corrupted record itself | the run routes it to `withCorruptedRecords($loader)`, loaded, closed and discarded like the run's other loaders. Without a loader it fails the run, whatever the `ErrorHandler`, because a corrupted record is not an extraction error | +| `ExtractionError::$extractor` was an `Extractor` | `Extractor\|Reader`: a task's source is a `Reader` | +| `StepRunner::steps()`, `run()`: `?Extractor $source` | `Extractor\|Reader\|null $source`. A source implementing `CorruptedRecordsRouter` routes its corrupted records | ### 127) `flow-php/etl`, `flow-php/etl-adapter-csv`, `-json`, `-excel`, `-google-sheet` - a record that cannot become a row throws | Before | After | |-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| a CSV line or a sheet row with fewer cells than the header was padded with nulls | `CorruptedRecordException`; `->withMissingColumnsAsNull(true)` pads it (CSV, Google Sheet), Excel pads by default (`->withMissingColumnsAsNull(false)` refuses) | -| a CSV line or an Excel row with more cells than the header lost them | `CorruptedRecordException` for a non-empty extra cell; an empty one is dropped | -| Google Sheet `->withDropExtraColumns(bool)` | removed: a non-empty extra cell is a corrupted record; `->withMissingColumnsAsNull(bool)` pads a short row | +| a CSV line or a sheet row with fewer cells than the header was padded with nulls | `CorruptedRecordException`. `->withMissingColumnsAsNull(true)` pads it (CSV, Google Sheet). Excel pads by default (`->withMissingColumnsAsNull(false)` refuses) | +| a CSV line or an Excel row with more cells than the header lost them | `CorruptedRecordException` for a non-empty extra cell. An empty one is dropped | +| Google Sheet `->withDropExtraColumns(bool)` | removed: a non-empty extra cell is a corrupted record. `->withMissingColumnsAsNull(bool)` pads a short row | | an empty CSV line was a row of nulls | skipped | | a value that does not cast to the type `->withSchema()` declares threw `SchemaMismatchException` | `CorruptedRecordException` (route it with `->withCorruptedRecords($loader)`) | -| a value or a JSON key a file shows only after the inference sample: `SchemaMismatchException`, or the key was dropped | `InferredSchemaException::outsideTheSample()`, naming the file, offset, line and sample size; `from_array()` and sequences throw `InferredSchemaException` | +| a value or a JSON key a file shows only after the inference sample: `SchemaMismatchException`, or the key was dropped | `InferredSchemaException::outsideTheSample()`, naming the file, offset, line and sample size. `from_array()` and sequences throw `InferredSchemaException` | | a `->withSchema()` column missing from a CSV, Excel or Google Sheet header was null on every row | `SchemaValidationException` | | `new RecordDecoder($withHeader, $emptyToNull, $dropExtraColumns, $headers)`, `decode(list $batch): list` | `new RecordDecoder($withHeader, $emptyToNull, $missingColumnsAsNull, $headers)`, `decode(array $cells): null\|array\|string` (null: header or empty record, string: why it is corrupted) | | `CSVDecoder::decode(list $lines)` | `CSVDecoder::decode(CSVDecoder::cells(string $line))`, one record | -| `CSVOpenSource::batches($schema, $batchSize, $backend)` | `+ ?int $sampleSize = null`; `JsonOpenSource::batches()` also `+ ?Schema $known = null`; both yield `CorruptedRecordException\|Rows` | -| `to_date_time(null)` threw `InvalidArgumentException` | returns null; a null format or time zone still throws | +| `CSVOpenSource::batches($schema, $batchSize, $backend)` | `+ ?int $sampleSize = null`. `JsonOpenSource::batches()` also `+ ?Schema $known = null`. Both yield `CorruptedRecordException\|Rows` | +| `to_date_time(null)` threw `InvalidArgumentException` | returns null. A null format or time zone still throws | ### 128) `flow-php/etl` - the Report's memory is named for what it measures, and every process has a peak @@ -2334,7 +2341,7 @@ because it sits under a `.` or `_` path segment. | `new DataFrame(Extractor $extractor, Config\|FlowContext $context)` | `df($config)->read($extractor)` | | `new DataFrame(Extractor $extractor, FlowContext $context)` | `new DataFrame(new \Flow\ETL\Planning\Logical\Node\Read($extractor), new \Flow\ETL\Planning\Logical\Writes(), $context)` | -PHP 8.5 warns about a dropped result (`#[\NoDiscard]`); PHP 8.3 and 8.4 do not. +PHP 8.5 warns about a dropped result (`#[\NoDiscard]`), but PHP 8.3 and 8.4 do not. Before: @@ -2389,10 +2396,10 @@ public function transform(DataFrame $dataFrame): DataFrame ### 131) `flow-php/parquet` - both engines cap a row group at `ROW_GROUP_MAXIMUM_ROWS_COUNT` rows and write the same footer -| Before | After | -|-----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| -| the PHP engine closed a row group on `ROW_GROUP_SIZE_BYTES` only; the arrow engine also at 1 048 576 rows | `Option::ROW_GROUP_MAXIMUM_ROWS_COUNT` (default `1_048_576`): both engines close a row group at that many rows exactly | -| the arrow engine wrote `created_by` `parquet-rs version 60.0.0` and an `ARROW:schema` key | `flow-php parquet version ` and no `ARROW:schema` key, as the PHP engine writes | +| Before | After | +|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| the PHP engine closed a row group on `ROW_GROUP_SIZE_BYTES` only, and the arrow engine also at 1 048 576 rows | `Option::ROW_GROUP_MAXIMUM_ROWS_COUNT` (default `1_048_576`): both engines close a row group at that many rows exactly | +| the arrow engine wrote `created_by` `parquet-rs version 60.0.0` and an `ARROW:schema` key | `flow-php parquet version ` and no `ARROW:schema` key, as the PHP engine writes | ## Upgrading from 0.45.x to 0.46.x @@ -2403,24 +2410,24 @@ public function transform(DataFrame $dataFrame): DataFrame | a NULL key: rows lost or `NULL value found in column ...`, depending on the batch size | one check query before the first page, then `RuntimeException` `Keyset pagination requires non-null keys ...` | | no query before the first page | `SELECT 1 FROM () ... WHERE k IS NULL LIMIT 1` (DBAL: the builder plus `IS NULL` conditions) | -Filter NULL keys out with `IS NOT NULL`, or page by non-null columns. Index the keys - on an unindexed key the check is +Filter NULL keys out with `IS NOT NULL`, or page by non-null columns. Index the keys, because on an unindexed key the check is one full scan. ### 2) `flow-php/etl-adapter-postgresql`, `flow-php/etl-adapter-doctrine` - keyset reads reject duplicate keys -| Before | After | -|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| -| two rows with the same key: rows at a page boundary silently skipped | `RuntimeException` `Keyset pagination requires unique keys ...` | -| keys equal in the database but different in PHP (`'a'`/`'A'` under a `_ci` collation, `1.0`/`1.00`) | `RuntimeException` `Keyset pagination expected the next page to start at the key ...` when a page boundary splits them | +| Before | After | +|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------| +| two rows with the same key: rows at a page boundary silently skipped | `RuntimeException` `Keyset pagination requires unique keys ...` | +| keys equal in the database but different in PHP (`'a'`/`'A'` under a `_ci` collation, `1.0`/`1.00`) | if a page boundary splits them, `RuntimeException` `Keyset pagination expected the next page to start at the key ...` | Add a unique column (for example the primary key) to the key set as its least significant key. ### 3) `flow-php/etl-adapter-postgresql`, `flow-php/etl-adapter-doctrine` - a short keyset page ends the read -| Before | After | -|-------------------------------------------------------|---------------------------------------------------------------------------------------------------| -| each page `LIMIT n`; reading stopped on an empty page | each page `LIMIT n + 1` (the extra row is not yielded); a page of `n` rows or fewer ends the read | -| one trailing empty `SELECT` | none | +| Before | After | +|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------| +| each page `LIMIT n`, and reading stopped on an empty page | each page `LIMIT n + 1` (the extra row is not yielded). A page of `n` rows or fewer ends the read | +| one trailing empty `SELECT` | none | Nothing to change unless you count queries: a read sends the NULL check plus the page queries. @@ -2431,7 +2438,7 @@ Nothing to change unless you count queries: a read sends the NULL check plus the | `sql_to_keyset_query('SELECT ... LIMIT 5', 10, ...)` - LIMIT silently replaced by 10 | `PaginationException` `Keyset pagination sets its own LIMIT; ...` | | `from_pgsql_key_set($client, 'SELECT ... LIMIT 5', ...)` | same `PaginationException`, before any query | -Drop LIMIT/OFFSET from the query; use `withMaximum()` or `DataFrame::limit()`. +Drop LIMIT/OFFSET from the query. Use `withMaximum()` or `DataFrame::limit()`. ### 5) `flow-php/etl-adapter-doctrine` - `from_dbal_key_set_qb()` rejects `setMaxResults()` / `setFirstResult()` @@ -2440,7 +2447,7 @@ Drop LIMIT/OFFSET from the query; use `withMaximum()` or `DataFrame::limit()`. | `$qb->setMaxResults(5)` - silently overwritten by the page size | `InvalidArgumentException` `Keyset pagination sets its own LIMIT and OFFSET, ...` | | `$qb->setFirstResult(5)` - applied to every page | same `InvalidArgumentException` | -Remove them from the builder; use `withMaximum()` or `DataFrame::limit()`. +Remove them from the builder. Use `withMaximum()` or `DataFrame::limit()`. ### 6) `flow-php/postgresql`, `flow-php/etl-adapter-postgresql` - a query's own ORDER BY must equal the keys @@ -2466,7 +2473,7 @@ Page by non-null key columns. | `created_at > $1 OR (created_at = $1 AND id > $2)` | `(created_at, id) > ($1, $2)` | | all DESC: `created_at < $1 OR (created_at = $1 AND id < $2)` | `(created_at, id) < ($1, $2)` | -Nothing to change; the row comparison is an index range bound. Mixed ASC/DESC keys keep the `OR` form. Update assertions +Nothing to change. The row comparison is an index range bound. Mixed ASC/DESC keys keep the `OR` form. Update assertions on the generated SQL. ### 9) `flow-php/etl-adapter-doctrine` - a non-scalar keyset value is rejected @@ -2479,9 +2486,9 @@ Page by scalar columns. ### 10) `flow-php/etl-adapter-doctrine` - `pagination_key_set()` rejects zero keys -| Before | After | -|--------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| -| `pagination_key_set()` built; `from_dbal_key_set_qb()` threw `KeySet must contain at least one key for pagination` | `pagination_key_set()` throws `InvalidArgumentException` `KeySet requires at least one key` | +| Before | After | +|------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| +| `pagination_key_set()` built, but `from_dbal_key_set_qb()` threw `KeySet must contain at least one key for pagination` | `pagination_key_set()` throws `InvalidArgumentException` `KeySet requires at least one key` | Pass at least one key. @@ -2495,7 +2502,7 @@ Pass at least one key. | `from_path_partitions()` / `files()` / an undeclared partition column - `'2026-10-02'` | `'2026-10-02T13:00:00+00:00'` | Directories written before keep reading as midnight. Writing into a dataset that has them adds a second directory per -day, and `overwrite()` replaces only the new one - rewrite the dataset, or partition by a `date` column to keep +day, and `overwrite()` replaces only the new one. Rewrite the dataset, or partition by a `date` column to keep `date=2026-10-02`: ```php @@ -2510,7 +2517,7 @@ $df->withEntry('date', ref('date')->cast(type_date())) |------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------| | `from_parquet()` / `from_floe()` over `writeColumns()` data - `partitionSchema()` types `date` `string` | the file's type (`datetime`, `date`, `integer`, ...) | | `filter(ref('date')->between(lit(DateTime), lit(DateTime)))` - throws `Boundary::compare requires value and bounds to be of a comparable type` | returns the matching rows, directories outside the range are skipped | -| same filter with `lit('2026-10-02')` bounds | returns the same rows - see `### 14)` | +| same filter with `lit('2026-10-02')` bounds | returns the same rows, see `### 14)` | ### 13) `flow-php/etl` - `RoundTripPrecision` moved to `flow-php/types` @@ -2525,8 +2532,8 @@ $df->withEntry('date', ref('date')->cast(type_date())) |---------------------------------------------------------------------------------------------|------------------------------------------------------------------| | `ref('ts')->between(lit('2026-10-02'), lit('2026-10-03'))` - throws `Boundary::compare ...` | rows between those dates | | `ref('ts')->equals(lit('2026-10-02'))` - throws `Can't compare '(datetime == string)'` | compares as `datetime` | -| `ref('ts')->equals(ref('s'))`, `s` a string column - throws `Can't compare` | `s` cast per row; a non-date value throws `Cast function failed` | -| `ref('a')->between(lit(1), lit($dateTime))` - throws at evaluation | throws `Can't compare` when the plan binds | +| `ref('ts')->equals(ref('s'))`, `s` a string column: throws `Can't compare` | `s` cast per row. A non-date value throws `Cast function failed` | +| `ref('a')->between(lit(1), lit($dateTime))`: throws at evaluation | throws `Can't compare` at plan bind | `same()` / `notSame()` stay strict. @@ -2534,7 +2541,7 @@ $df->withEntry('date', ref('date')->cast(type_date())) | Before | After | |---------------------------------------------------|----------------------------------------------------------------------------------| -| one output batch per input batch, of any size | batches of at most 1,000 rows; an input that expands to nothing: one empty batch | +| one output batch per input batch, of any size | batches of at most 1,000 rows. An input that expands to nothing: one empty batch | | every input column copied into every expanded row | only the columns a later `select()` / `drop()` keeps | ### 16) `flow-php/etl` - `ScalarFunctionTransformer` refuses `array_expand()`, `NestedExpandTransformer` removed @@ -2549,7 +2556,7 @@ $df->withEntry('item', array_expand(ref('items'))); ### 17) `flow-php/etl` - a serialized `Rows` holds a list of frames -A `Rows` serialized by 0.45 (e.g. a `FilesystemCache` entry) is not read by 0.46: clear such caches after upgrading. A +A `Rows` serialized by 0.45 (for example a `FilesystemCache` entry) is not read by 0.46: clear such caches after upgrading. A batch over 2 GiB of strings in one column is now split across frames instead of throwing `OffsetOverflow`. @@ -2562,20 +2569,20 @@ over 2 GiB of strings in one column is now split across frames instead of throwi | Before | After | |-----------------------------------------------------------------------------------------------------------------|----------------------------------------------| | `QueryException` `[25P02] Invalid transaction state. SQL: CLOSE flow_cursor_...`, real error in `getPrevious()` | the failing statement's own `QueryException` | -| the client left inside an aborted transaction - every later query fails with `25P02` | the extractor's own transaction rolled back | -| a failure while reading rows (e.g. a row that does not match the schema) committed the transaction | rolled back | +| the client left inside an aborted transaction: every later query fails with `25P02` | the extractor's own transaction rolled back | +| a failure while reading rows (for example a row that does not match the schema) committed the transaction | rolled back | ### 2) `flow-php/etl-adapter-postgresql` - `from_pgsql_*()` read exactly one read-only `SELECT` or `VALUES` statement -| Query | Before | After | -|-----------------------------------------------------------------------------|--------------------------------------------------------------------------|------------------------------------------| -| `INSERT ... RETURNING` through `from_pgsql_cursor()` | the PHP process crashes (segfault) | `InvalidArgumentException`, nothing runs | -| `INSERT ... RETURNING` through `from_pgsql_key_set()` | the `INSERT` runs, then `QueryException` `08P01` | `InvalidArgumentException`, nothing runs | -| two statements through `from_pgsql_cursor()` | the second statement silently dropped | `InvalidArgumentException` | -| two statements through `from_pgsql_limit_offset()` / `from_pgsql_key_set()` | `QueryException` `42601` | `InvalidArgumentException` | -| a data-modifying `WITH` through `from_pgsql_key_set()` | the write runs once per page - an `INSERT` twice, an `UPDATE` never ends | `InvalidArgumentException`, nothing runs | -| `SELECT ... INTO` through `from_pgsql_key_set()` | the table is created | `InvalidArgumentException`, nothing runs | -| either through `from_pgsql_cursor()` / `from_pgsql_limit_offset()` | `QueryException` after a round trip | `InvalidArgumentException`, nothing runs | +| Query | Before | After | +|-----------------------------------------------------------------------------|-------------------------------------------------------------------------|------------------------------------------| +| `INSERT ... RETURNING` through `from_pgsql_cursor()` | the PHP process crashes (segfault) | `InvalidArgumentException`, nothing runs | +| `INSERT ... RETURNING` through `from_pgsql_key_set()` | the `INSERT` runs, then `QueryException` `08P01` | `InvalidArgumentException`, nothing runs | +| two statements through `from_pgsql_cursor()` | the second statement silently dropped | `InvalidArgumentException` | +| two statements through `from_pgsql_limit_offset()` / `from_pgsql_key_set()` | `QueryException` `42601` | `InvalidArgumentException` | +| a data-modifying `WITH` through `from_pgsql_key_set()` | the write runs once per page: an `INSERT` twice, an `UPDATE` never ends | `InvalidArgumentException`, nothing runs | +| `SELECT ... INTO` through `from_pgsql_key_set()` | the table is created | `InvalidArgumentException`, nothing runs | +| either through `from_pgsql_cursor()` / `from_pgsql_limit_offset()` | `QueryException` after a round trip | `InvalidArgumentException`, nothing runs | ### 3) `flow-php/postgresql` - `declare_cursor()` over SQL takes exactly one `SELECT` or `VALUES` @@ -2613,19 +2620,19 @@ Applies to `PaginationModifier`, `CountModifier` and `KeysetPaginationModifier` ### 7) `flow-php/etl` - `Pipeline\Optimizer` replaced by `Optimizer` + `Planner`, the `Pipeline` class removed -| Before | After | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Config::optimizer()`, `new Config(..., Optimizer $optimizer, ...)` | `Config::optimizer(): Flow\ETL\Optimizer`, `new Config(..., Optimizer $optimizer, Executor $executor, ...)`; added `Config::planner()` / `Config::executor()` | -| `config_builder()->optimizer($optimizer)` | `config_builder()->optimizer(Flow\ETL\Optimizer $optimizer)`, `->executor(Executor $executor)` | -| `Flow\ETL\Pipeline` (class, with `Pipeline::has()`), `Pipeline\Optimizer`, `Pipeline\Optimizer\Optimization`, `Pipeline\Optimizer\LimitOptimization`, `Pipeline\BoundPlan`, `Pipeline\PlanBinder` | removed - an `Optimizer\Rule` rewrites the `Plan\LogicalPlan`: `apply(LogicalPlan $plan, FlowContext $context): LogicalPlan`; drop one with `Optimizer::default()->without(Rule::class)`, add one with `->with(new MyRule())` | -| `new Pipeline\Optimizer(Optimization ...)`, `->disabled()`, `->optimizations()` | `new Optimizer(Rule ...)`, `new Optimizer()` (no rules - nothing is rewritten), `->rules()`; `Optimizer::default()` holds the built-in rules, `->without(Rule::class)` / `->with(new MyRule())` change them | -| - | `Flow\ETL\Executor\PhysicalPlan` interface (`root(): Executor\Pipeline`, `schema(): Schema`): `Executor\Described` returns its schema, `Executor\Raw` throws its `SchemaNotDerivableException` | -| `Segments::replaceExtractor()` / `has()` / `current()` / `segmentFor()`, `Segment::withExtractor()` / `has()` / `contains()` | removed - `Segments::extractor()` / `Segment::extractor()` | -| `new DataFrame(Pipeline $pipeline, $context)` | `new DataFrame(Extractor $extractor, Config\|FlowContext $context)` | -| `new HashJoinProcessor(DataFrame $right, ...)`, `new CrossJoinRowsTransformer(DataFrame $frame, ...)` | take the right side's `Executor\PhysicalPlan` and an `Executor` | -| `JoinSteps::of(DataFrame $right, ...)` | `JoinSteps::of(PhysicalPlan $right, Expression $expression, Join $type, Config $config, ?JoinAlgorithmBuilder $algorithm)` | -| `InvalidLogicException::cyclicPlanOnDescribe()` | removed | -| telemetry debug-log field `optimizers` | `optimizer_rules` | +| Before | After | +|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `Config::optimizer()`, `new Config(..., Optimizer $optimizer, ...)` | `Config::optimizer(): Flow\ETL\Optimizer`, `new Config(..., Optimizer $optimizer, Executor $executor, ...)`. Added `Config::planner()` / `Config::executor()` | +| `config_builder()->optimizer($optimizer)` | `config_builder()->optimizer(Flow\ETL\Optimizer $optimizer)`, `->executor(Executor $executor)` | +| `Flow\ETL\Pipeline` (class, with `Pipeline::has()`), `Pipeline\Optimizer`, `Pipeline\Optimizer\Optimization`, `Pipeline\Optimizer\LimitOptimization`, `Pipeline\BoundPlan`, `Pipeline\PlanBinder` | removed. An `Optimizer\Rule` rewrites the `Plan\LogicalPlan`: `apply(LogicalPlan $plan, FlowContext $context): LogicalPlan`. Drop one with `Optimizer::default()->without(Rule::class)`, add one with `->with(new MyRule())` | +| `new Pipeline\Optimizer(Optimization ...)`, `->disabled()`, `->optimizations()` | `new Optimizer(Rule ...)`, `new Optimizer()` (no rules: nothing is rewritten), `->rules()`. `Optimizer::default()` holds the built-in rules, `->without(Rule::class)` / `->with(new MyRule())` change them | +| - | `Flow\ETL\Executor\PhysicalPlan` interface (`root(): Executor\Pipeline`, `schema(): Schema`): `Executor\Described` returns its schema, `Executor\Raw` throws its `SchemaNotDerivableException` | +| `Segments::replaceExtractor()` / `has()` / `current()` / `segmentFor()`, `Segment::withExtractor()` / `has()` / `contains()` | removed - `Segments::extractor()` / `Segment::extractor()` | +| `new DataFrame(Pipeline $pipeline, $context)` | `new DataFrame(Extractor $extractor, Config\|FlowContext $context)` | +| `new HashJoinProcessor(DataFrame $right, ...)`, `new CrossJoinRowsTransformer(DataFrame $frame, ...)` | take the right side's `Executor\PhysicalPlan` and an `Executor` | +| `JoinSteps::of(DataFrame $right, ...)` | `JoinSteps::of(PhysicalPlan $right, Expression $expression, Join $type, Config $config, ?JoinAlgorithmBuilder $algorithm)` | +| `InvalidLogicException::cyclicPlanOnDescribe()` | removed | +| telemetry debug-log field `optimizers` | `optimizer_rules` | ### 8) `flow-php/etl` - `extract()` receives the pushed limit and path filter, `LimitPushDown` and @@ -2633,58 +2640,58 @@ Applies to `PaginationModifier`, `CountModifier` and `KeysetPaginationModifier` | Before | After | |----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| -| `Extractor::extract(FlowContext $context): Generator` | `extract(FlowContext $context, ?int $limit = null): Generator` - every implementation adds the parameter, and may ignore it | -| `Extractor\LimitPushDown` + `PushesLimit` trait, `pushLimit()` / `pushedLimit()` | removed - read `$limit` in `extract()` | +| `Extractor::extract(FlowContext $context): Generator` | `extract(FlowContext $context, ?int $limit = null): Generator`. Every implementation adds the parameter, and can ignore it | +| `Extractor\LimitPushDown` + `PushesLimit` trait, `pushLimit()` / `pushedLimit()` | removed. Read `$limit` in `extract()` | | `FileExtractor::withPathFilter($filter)` / `filter()`, `PathFiltering` held the filter | removed - `FileExtractor::extract(FlowContext $context, ?int $limit = null, Filter $pathFilter = new OnlyFiles()): Generator` | | `interface FileExtractor` | gains `partitionSchema(): Schema` - every implementor must add it | | `interface Function\FunctionTree` | gains `deterministic(): bool` - implementors using neither `ScalarFunctionChain` nor `ResolvesFromChildren` must add it | ### 9) `flow-php/etl` - `filterPartitions()` removed, the optimizer pushes `filter()` into the source -| Before | After | -|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `$df->filterPartitions(ref('date')->equals(lit('2024-01-01')))` | `$df->filter(ref('date')->equals(lit('2024-01-01')))` - pushed into the source as a path filter, only matching partitions are read | -| `$df->filterPartitions(new OnlyFiles())` (`Path\Filter` form) | removed, no replacement | -| `$df->read(files($glob))->filterPartitions(...)`, same over `from_path_partitions($glob)` | `filter()` on the partition column - both sources now emit one string column per `key=value` directory (next to `partitions`), and the filter is pushed into the listing | -| a partition-predicate error was thrown by the verb | thrown at plan / bind time - an optimizer rule can fail a plan | -| `->write($sink)->filter(...)` narrowed the earlier sink | a filter is pushed only when every root reaches the source through it - the sink gets every row | +| Before | After | +|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `$df->filterPartitions(ref('date')->equals(lit('2024-01-01')))` | `$df->filter(ref('date')->equals(lit('2024-01-01')))` - pushed into the source as a path filter, only matching partitions are read | +| `$df->filterPartitions(new OnlyFiles())` (`Path\Filter` form) | removed, no replacement | +| `$df->read(files($glob))->filterPartitions(...)`, same over `from_path_partitions($glob)` | `filter()` on the partition column. Both sources now emit one string column per `key=value` directory (next to `partitions`). The filter is pushed into the listing | +| a partition-predicate error was thrown by the verb | thrown at plan / bind time, because an optimizer rule can fail a plan | +| `->write($sink)->filter(...)` narrowed the earlier sink | a filter is pushed only if every root reaches the source through it. The sink gets every row | ### 10) `flow-php/etl` - frames are snapshotted when embedded, fewer limits are pushed -| Before | After | -|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| -| `$left->join($right, ...); $right->select('id');` - the `select()` was part of the join's right side | ignored - a frame is snapshotted at `join()` / `from_data_frame()` time | -| `$frame->join(df()->read(from_data_frame($frame)), ...)` threw `InvalidLogicException` "Cannot describe this plan:" | runs as a self-join against the snapshot; a run-time cycle still throws `cyclicPlanOnRun()` | -| `->rows($t)->limit(n)`, `->transform($t)->limit(n)`, `->void()->limit(n)` pushed the limit into the source for seven allow-listed transformers | not pushed - `->withEntry(...)->limit(n)` still pushes; with several sinks the widest limit is pushed, a `limit(3)` inside a sink limits the whole run | -| - | `schema()` followed by a terminal verb plans twice, `Extractor::schema()` is called once per planning - memoise a sniffing extractor | -| `add_row_index()` on a frame run twice continued counting (`[0,1,2]` then `[3,4,5]`) | starts again on every run; a `Transformer` keeping state between batches implements `Flow\ETL\Transformer\Stateful` (`fresh()`) to do the same | -| a joined frame ran with its own config and `onError()` | runs with the outer frame's config, optimizer and error handler; its own `onError()` is ignored - a `from_data_frame()` frame still runs with its own | -| each joined frame opened its own `DataFrame` span | one `DataFrame` span per run; a `from_data_frame()` frame still opens its own | +| Before | After | +|------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `$left->join($right, ...); $right->select('id');` - the `select()` was part of the join's right side | ignored - a frame is snapshotted at `join()` / `from_data_frame()` time | +| `$frame->join(df()->read(from_data_frame($frame)), ...)` threw `InvalidLogicException` "Cannot describe this plan:" | runs as a self-join against the snapshot. A run-time cycle still throws `cyclicPlanOnRun()` | +| `->rows($t)->limit(n)`, `->transform($t)->limit(n)`, `->void()->limit(n)` pushed the limit into the source for seven allow-listed transformers | not pushed. `->withEntry(...)->limit(n)` still pushes. With several sinks the widest limit is pushed, and a `limit(3)` inside a sink limits the whole run | +| - | `schema()` followed by a terminal verb plans twice, `Extractor::schema()` is called once per planning. Memoise a sniffing extractor | +| `add_row_index()` on a frame run twice continued counting (`[0,1,2]` then `[3,4,5]`) | starts again on every run. A `Transformer` keeping state between batches implements `Flow\ETL\Transformer\Stateful` (`fresh()`) to do the same | +| a joined frame ran with its own config and `onError()` | runs with the outer frame's config, optimizer and error handler. Its own `onError()` is ignored. A `from_data_frame()` frame still runs with its own | +| each joined frame opened its own `DataFrame` span | one `DataFrame` span per run. A `from_data_frame()` frame still opens its own | ### 11) `flow-php/etl` - one balanced `DataFrame` telemetry span per run -| Before | After | -|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------| -| the `DataFrame` span started when the frame was built | starts when the plan executes - `Executor::execute()` owns both ends | -| a planning failure under `schema()` emitted no span | `dataFrameStarted` + `dataFrameFailed` for every verb | -| an abandoned `get*()` generator left its span open | closes it | -| a failure inside a verb's own loop body (a `forEach` callback, the formatter) closed the span as failed | closed as completed | -| a `from_data_frame()` frame emitted no span | one balanced span per run | -| `to_dbal_transaction()` / `to_pgsql_transaction()` emitted their own span | no span | +| Before | After | +|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| +| the `DataFrame` span started when the frame was built | starts at plan execution. `Executor::execute()` owns both ends | +| a planning failure under `schema()` emitted no span | `dataFrameStarted` + `dataFrameFailed` for every verb | +| an abandoned `get*()` generator left its span open | closes it | +| a failure inside a verb's own loop body (a `forEach` callback, the formatter) closed the span as failed | closed as completed | +| a `from_data_frame()` frame emitted no span | one balanced span per run | +| `to_dbal_transaction()` / `to_pgsql_transaction()` emitted their own span | no span | ### 12) `flow-php/etl` - `to_branch()` / `to_transformation()` return a `Sink`, the wrapper loaders are removed | Before | After | |----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `to_branch($condition, $loader, $transformation)` returned `BranchingLoader` | `to_branch($condition, $sink)->withTransformation($transformation)` returns `Sink\Branched` | -| `to_transformation($transformation, $loader)` returned `TransformerLoader` | returns `Sink\Transformed`; both take a `Loader` or another `Sink`, neither is accepted where a `Loader` is required | +| `to_transformation($transformation, $loader)` returned `TransformerLoader` | returns `Sink\Transformed`. Both take a `Loader` or another `Sink`, and neither is accepted where a `Loader` is required | | `Loader\OverridingLoader`, `Loader\LoaderTree`, `Loader\TransformerLoader`, `Loader\BranchingLoader` | removed - `Flow\ETL\Sink` interface (`write(DataFrame $prefix): void`) | | a `Transformation` calling `$df->fetch()` / `count()` / `schema()` / `run()` inside `to_transformation()` or `to_branch()` threw `InvalidLogicException` | executes the prefix plan, as `from_data_frame()` executes a frame | | `onError()` inside a sink's `Transformation` | throws `InvalidLogicException` at `write()` - set it on the frame | -| an unresolved column or a non-boolean condition in a sink failed at the first batch | fails at plan time; one undescribable sink operation makes the whole plan run raw; `schema()` still describes the frame's own rows | -| a transformer failing inside a non-transactional sink was a LOADING error | a TRANSFORMATION error offered to `onTransformation()` once: `SkipRows` / `IgnoreError` drop the batch (after a blocking operation, the whole buffered batch); a `limit()` completing the sink mid-load is a LOADING error on `Executor\SinkFeed` | +| an unresolved column or a non-boolean condition in a sink failed at the first batch | fails at plan time. One undescribable sink operation makes the whole plan run raw. `schema()` still describes the frame's own rows | +| a transformer failing inside a non-transactional sink was a LOADING error | a TRANSFORMATION error offered to `onTransformation()` once. `SkipRows` / `IgnoreError` drop the batch (after a blocking operation, the whole buffered batch). A `limit()` completing the sink mid-load is a LOADING error on `Executor\SinkFeed` | | `write_with_retries($loader)` around `to_transformation(...)` or `to_branch(...)` threw at the first `load()` | removed with the retry surface, see 14) | -| telemetry `flow.etl.loading.rows` counted the rows offered to the branch | counts the rows the branch's loader writes; an empty batch never reaches the loader | +| telemetry `flow.etl.loading.rows` counted the rows offered to the branch | counts the rows the branch's loader writes. An empty batch never reaches the loader | | `SkipRows`: a drain failure of `to_transformation()` / `to_branch()` at `closure()` was rethrown | offered to `onTransformation()` once - `SkipRows` drops the buffered batch | | `$df->load(loader: $l)`, `$df->write(loader: $l)`, `to_transformation($t, loader: $l)`, `to_branch($c, loader: $l)` | the named argument is `sink:` | @@ -2694,12 +2701,12 @@ Applies to `PaginationModifier`, `CountModifier` and `KeysetPaginationModifier` | Before | After | |-----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `to_dbal_transaction($connection, Loader ...$loaders): TransactionalDbalLoader` | `to_dbal_transaction($connection, Loader\|Sink ...$sinks): Transactional` - `Sink\Transactional` over a `DbalTransaction`; `TransactionalDbalLoader` removed | -| `to_pgsql_transaction($client, Loader ...$loaders): TransactionalPostgreSqlLoader` | `to_pgsql_transaction($client, Loader\|Sink ...$sinks): Transactional` - over a `PostgreSqlTransaction`; `TransactionalPostgreSqlLoader` removed | -| `to_dbal_transaction(...)->withIsolationLevel($level)` | `new Transactional(DbalTransaction::fromConnection($connection)->withIsolationLevel($level), ...$sinks)` - returns a new instance; the same on `PostgreSqlTransaction`, which runs `SET TRANSACTION` after `BEGIN` and rolls back a failed `SET` | -| a failure a non-throwing `onError()` handler suppressed still committed the batch | the batch (or the closure drain) rolls back and is never re-delivered; the handler only decides whether the run continues - the failing sink restarts on the next batch, its buffered rows lost | -| `LoadingError::$loader` for a `begin()` / `commit()` failure was `TransactionalDbalLoader` | `Executor\TransactionalSinks`; for a sink failure, the sink's own loader when bare, `Executor\SinkFeed` otherwise; the exception is always the cause, never `TransactionRolledBack` | -| `withIsolationLevel()` on `to_dbal_transaction()` / `to_pgsql_transaction()` applied to every transaction the wrapper opens | set on `DbalTransaction` / `PostgreSqlTransaction`; applies to every transaction opened | +| `to_dbal_transaction($connection, Loader ...$loaders): TransactionalDbalLoader` | `to_dbal_transaction($connection, Loader\|Sink ...$sinks): Transactional` - `Sink\Transactional` over a `DbalTransaction`. `TransactionalDbalLoader` removed | +| `to_pgsql_transaction($client, Loader ...$loaders): TransactionalPostgreSqlLoader` | `to_pgsql_transaction($client, Loader\|Sink ...$sinks): Transactional` - over a `PostgreSqlTransaction`. `TransactionalPostgreSqlLoader` removed | +| `to_dbal_transaction(...)->withIsolationLevel($level)` | `new Transactional(DbalTransaction::fromConnection($connection)->withIsolationLevel($level), ...$sinks)` - returns a new instance. The same on `PostgreSqlTransaction`, which runs `SET TRANSACTION` after `BEGIN` and rolls back a failed `SET` | +| a failure a non-throwing `onError()` handler suppressed still committed the batch | the batch (or the closure drain) rolls back and is never re-delivered. The handler only decides whether the run continues. The failing sink restarts on the next batch, and its buffered rows are lost | +| `LoadingError::$loader` for a `begin()` / `commit()` failure was `TransactionalDbalLoader` | `Executor\TransactionalSinks`. For a sink failure: for a bare sink, the sink's own loader, otherwise `Executor\SinkFeed`. The exception is always the cause, never `TransactionRolledBack` | +| `withIsolationLevel()` on `to_dbal_transaction()` / `to_pgsql_transaction()` applied to every transaction the wrapper opens | set on `DbalTransaction` / `PostgreSqlTransaction`, and applies to every transaction opened | ### 14) `flow-php/etl` - `write_with_retries()` and the retry surface are removed @@ -2714,13 +2721,13 @@ Applies to `PaginationModifier`, `CountModifier` and `KeysetPaginationModifier` | Before | After | |--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| a query the driver cannot describe (multi-statement, data-modifying CTE, `INSERT ... RETURNING`) threw `SchemaNotDerivableException` | a missing table or column throws what the read throws (`TableNotFoundException`, `InvalidFieldNameException`, on SQLite `DriverException`); any other query the driver refuses to describe throws `SchemaNotDerivableException` with the DBAL exception as `getPrevious()` | +| a query the driver cannot describe (multi-statement, data-modifying CTE, `INSERT ... RETURNING`) threw `SchemaNotDerivableException` | a missing table or column throws what the read throws (`TableNotFoundException`, `InvalidFieldNameException`, on SQLite `DriverException`). Any other query the driver refuses to describe throws `SchemaNotDerivableException` with the DBAL exception as `getPrevious()` | ### 16) `flow-php/etl-adapter-postgresql` - a PostgreSQL read keeps the database error, reads that write are refused | Before | After | |-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| a query that cannot run as a subquery (multi-statement, data-modifying CTE, `INSERT ... RETURNING`) threw `SchemaNotDerivableException` | a missing table, column, function, type or privilege throws PostgreSQL's `QueryException`, as the read does; a query that writes (a data-modifying `WITH`, `SELECT ... INTO`) throws `InvalidArgumentException` before any query runs | +| a query that cannot run as a subquery (multi-statement, data-modifying CTE, `INSERT ... RETURNING`) threw `SchemaNotDerivableException` | a missing table, column, function, type or privilege throws PostgreSQL's `QueryException`, as the read does. A query that writes (a data-modifying `WITH`, `SELECT ... INTO`) throws `InvalidArgumentException` before any query runs | ### 17) `flow-php/flow-php-ext` - the `flow_php` extension is versioned with `flow-php/etl` @@ -2735,12 +2742,12 @@ Applies to `PaginationModifier`, `CountModifier` and `KeysetPaginationModifier` | `DataFrame::extractor()` (`@internal`) | removed - `(new Repeatability())->ofPlan($dataFrame->explain()->logical)` answers whether every source the frame reads can be read twice | | `DataFrame::registerGroupBy($groupBy, $algorithm)` (`@internal`) | removed - `groupBy($entries, $algorithm)->aggregate(...)` | | `new GroupedDataFrame($df, $groupBy, $algorithm)` | `new GroupedDataFrame($df, $input, $groupBy)` - built by `DataFrame::groupBy()` | -| `SchemaNotDerivableException::nonRewindable($extractorClass)` | `nonRewindable()`; the message no longer names the extractor | -| `discover_pivot_values()` over a frame joining a source that cannot be read twice - pivot silently null | throws `SchemaNotDerivableException` | -| `discover_pivot_values()` over `from_data_frame()` of a repeatable frame - refused | allowed | -| a `Transformation` writing inside a sink - its write ran after the sink's own write | runs before it; a transaction's writes run in `write()` call order | -| a `Transformation` inside a sink returning another frame - failed at `run()` "A sink root shares no node with the plan" | throws at `write()` | -| `$frame->onError()` after `join($frame)` / `from_data_frame($frame)` - reached the embedded frame | ignored - a joined frame runs with the outer frame's handler, a `from_data_frame()` frame with the one it had when embedded | +| `SchemaNotDerivableException::nonRewindable($extractorClass)` | `nonRewindable()`. The message no longer names the extractor | +| `discover_pivot_values()` over a frame joining a source that cannot be read twice: pivot silently null | throws `SchemaNotDerivableException` | +| `discover_pivot_values()` over `from_data_frame()` of a repeatable frame: refused | allowed | +| a `Transformation` writing inside a sink: its write ran after the sink's own write | runs before it. A transaction's writes run in `write()` call order | +| a `Transformation` inside a sink returning another frame: failed at `run()` "A sink root shares no node with the plan" | throws at `write()` | +| `$frame->onError()` after `join($frame)` / `from_data_frame($frame)`: reached the embedded frame | ignored. A joined frame runs with the outer frame's handler, a `from_data_frame()` frame with the one it had at embedding | | an embedded frame sharing the outer `FlowContext` left a `DataFrame` span open | balanced spans | | `discover_pivot_values()` over a frame with `write()` before `groupBy()` - the sink received every row twice (discovery ran it) | discovery reads only the rows feeding the pivot, sinks run once | @@ -2755,19 +2762,19 @@ Applies to `PaginationModifier`, `CountModifier` and `KeysetPaginationModifier` ### 20) `flow-php/etl` - the trigger builds the plan's consumer, `run()` takes no callback -| Before | After | -|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| -| `$frame->run(fn (Rows $rows) => ...)` | `$frame->forEach(fn (Rows $rows) => ...)`; `run(bool\|Analyze $analyze = false)` | -| `$frame->explain()` on a frame ending in `write()` - printed a `Result` nobody reads | prints the writes; `explain(Trigger::run)` for the plan `run()` executes | -| `Plan\LogicalPlan::of()` / `cursor()` / `withCursor()` / `withSinks()` | removed - `Trigger::rows->plan($root, $sinks)`, `LogicalPlan::$root`, `LogicalPlan::spine()` | -| `new Plan\Node\Outputs(Result $result, Sinks $sinks)` | `new Plan\Node\Outputs(Result\|Write\|Transaction ...$consumers)` - two or more | -| `InvalidLogicException::resultRewritten()` | `consumerRewritten()`; a `Transaction` as the first consumer is refused | +| Before | After | +|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| +| `$frame->run(fn (Rows $rows) => ...)` | `$frame->forEach(fn (Rows $rows) => ...)`, `run(bool\|Analyze $analyze = false)` | +| `$frame->explain()` on a frame ending in `write()`: printed a `Result` nobody reads | prints the writes. `explain(Trigger::run)` for the plan `run()` executes | +| `Plan\LogicalPlan::of()` / `cursor()` / `withCursor()` / `withSinks()` | removed - `Trigger::rows->plan($root, $sinks)`, `LogicalPlan::$root`, `LogicalPlan::spine()` | +| `new Plan\Node\Outputs(Result $result, Sinks $sinks)` | `new Plan\Node\Outputs(Result\|Write\|Transaction ...$consumers)` - two or more | +| `InvalidLogicException::resultRewritten()` | `consumerRewritten()`. A `Transaction` as the first consumer is refused | ### 21) `flow-php/etl` - explain layouts render a described entry, a joined frame is drawn without its `Result` `Plan\Explain\Outline` now applies `Details` while it builds, so a layout prints what the entry carries instead of asking for it. A joined frame's `Result` is no longer drawn: the join reads its right side directly, and the numbers -after it shift by one. `Stage::physical` is new - see the core documentation. +after it shift by one. `Stage::physical` is new. See the core documentation. | Before | After | |---------------------------------------------------------|-----------------------------------------------------------------------------------| @@ -2795,7 +2802,7 @@ after it shift by one. `Stage::physical` is new - see the core documentation. | `$open->stream`, `$open->dialect`, `$open->encoder`, `$open->lineReader` | removed | | `(new CSVSourceOpener($filesystem, $options))->open($source)` | `new AdaptiveCSVOpenSource($filesystem, $source, $options)` | | `new CSVFileReader($opener, $sources)` | `new CSVFileReader($filesystem, $options, $sources)` | -| `CSVFileReader::samples()` yields `Generator`s | yields `CSVFileSample` (`IteratorAggregate`); `$unit->getIterator()` for the generator | +| `CSVFileReader::samples()` yields `Generator`s | yields `CSVFileSample` (`IteratorAggregate`), `$unit->getIterator()` for the generator | | `CSVFileReader::sample($source)` | `new CSVFileSample($filesystem, $options, $source)` | ### 24) `flow-php/etl` - Floe footer carries a statistics block, existing `.floe` files must be rewritten @@ -2846,7 +2853,7 @@ final class MyExtractor implements Extractor | `sql_query_tables('CREATE VIEW v AS SELECT a FROM src')` - `[]` | `[v, src]` | | `sql_query_tables('SELECT a INTO new_t FROM src')` - `[src]` | `[new_t, src]` | | `sql_query_columns('... ON CONFLICT (name) DO UPDATE SET name = excluded.name')` - `[]` | `[excluded.name]` | -| `OrderBy` of `SELECT a, row_number() OVER (ORDER BY b) FROM t ORDER BY a` - 1 clause | 2 clauses - window `ORDER BY` included | +| `OrderBy` of `SELECT a, row_number() OVER (ORDER BY b) FROM t ORDER BY a`: 1 clause | 2 clauses, window `ORDER BY` included | | `sql_query_tables('SELECT (SELECT x FROM a) FROM b')` - `[b, a]` | `[a, b]` - descriptor (PostgreSQL walker) order | | `sql_query_depth()`: `EXPLAIN SELECT 1` 0, `CREATE VIEW v AS SELECT 1` 0, window subquery 1 | 1, 1, 2 | | `sql_to_keyset_query()` cursor on `... WHERE $1 IN (SELECT ...)` - `$1`, clashing with the user's | `$2` | @@ -2858,19 +2865,19 @@ final class MyExtractor implements Extractor |-------------------------------------------------------------------|------------------------------------------------------------------------------------------| | `ModificationContext::ancestors()` / `parent()` - `Node` wrappers | the real messages (`SelectStmt`, `RangeSubselect`, ...), no `Node` wrappers | | depth of a CTE body - 3 | 4 - `WithClause`, `WindowDef`, `IntoClause`, `OnConflictClause` are levels too | -| a replacement returned below the top-level statement - ignored | written into its slot | -| a replacement of the wrong class - ignored | `ParserException` | -| `NodeVisitor::REMOVE_NODE` - declared, never honoured | removed; `NodeModifier::REMOVE_NODE` removes a node from a list, throws on a single slot | +| a replacement returned below the top-level statement: ignored | written into its slot | +| a replacement of the wrong class: ignored | `ParserException` | +| `NodeVisitor::REMOVE_NODE`: declared, never honoured | removed. `NodeModifier::REMOVE_NODE` removes a node from a list, throws on a single slot | ### 29) `flow-php/postgresql` - `EXPLAIN` wraps every explainable statement, ANALYZE is rolled back -| Before | After | -|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| -| `ExplainModifier::nodeClasses()` - `[SelectStmt::class]` | `[ParseResult::class]` | -| INSERT/UPDATE/DELETE/MERGE/CTAS/EXECUTE/DECLARE - returned unwrapped | wrapped in `EXPLAIN` | -| `sql_to_explain('CREATE TABLE x (a int)')`, `sql_to_explain('EXPLAIN SELECT 1')` - returned unwrapped | `InvalidStatementException` | -| `$client->explain('INSERT ...')` - the `INSERT` ran and committed | EXPLAIN; with ANALYZE inside a transaction (savepoint when one is open) that is always rolled back | -| `traverse(new PaginationModifier(...), new ExplainModifier(...))` - both applied | the pagination is dropped (or the traversal throws) - call `traverse()` again with `ExplainModifier` alone, last | +| Before | After | +|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| `ExplainModifier::nodeClasses()` - `[SelectStmt::class]` | `[ParseResult::class]` | +| INSERT/UPDATE/DELETE/MERGE/CTAS/EXECUTE/DECLARE: returned unwrapped | wrapped in `EXPLAIN` | +| `sql_to_explain('CREATE TABLE x (a int)')`, `sql_to_explain('EXPLAIN SELECT 1')` - returned unwrapped | `InvalidStatementException` | +| `$client->explain('INSERT ...')`: the `INSERT` ran and committed | EXPLAIN. With ANALYZE, inside a transaction that is always rolled back (a savepoint if one is open) | +| `traverse(new PaginationModifier(...), new ExplainModifier(...))`: both applied | the pagination is dropped (or the traversal throws). Call `traverse()` again with `ExplainModifier` alone, last | ### 30) `flow-php/postgresql` - keyset pagination wraps `UNION` / `INTERSECT` / `EXCEPT` @@ -2883,11 +2890,11 @@ final class MyExtractor implements Extractor | Before | After | |------------------------------------------------------------------|------------------------------------------------------------------------------------| -| `Column::$generationExpression` - normalised (`lower(i)`) | declared/catalog text (`lower(i::text)`); compare with `generationExpressionKey()` | -| `CheckConstraint::$expression` - normalised | declared/catalog text; `expressionKey()` | -| `Index::$predicate` - normalised | declared/catalog text; `predicateKey()` | -| `Trigger::$whenCondition` - compared verbatim | declared/catalog text; compared by `whenConditionKey()` | -| `ColumnDefault` EXPRESSION `literal` - normalised | declared/catalog text; `equals()` normalises | +| `Column::$generationExpression`: normalised (`lower(i)`) | declared/catalog text (`lower(i::text)`). Compare with `generationExpressionKey()` | +| `CheckConstraint::$expression`: normalised | declared/catalog text, `expressionKey()` | +| `Index::$predicate`: normalised | declared/catalog text, `predicateKey()` | +| `Trigger::$whenCondition`: compared verbatim | declared/catalog text, compared by `whenConditionKey()` | +| `ColumnDefault` EXPRESSION `literal`: normalised | declared/catalog text, and `equals()` normalises | | `CheckDefinitionParser::parse()` - normalised expression | the catalog text, still validated | | `ExpressionParser::normalizeNode(Node)` | removed - `deparseNode(Node)` keeps the text, `normalize(string)` strips casts | | DDL emitted the normalised text - `lower(i)` failed with `42883` | DDL emits the declared expression | @@ -2899,14 +2906,14 @@ final class MyExtractor implements Extractor | `CREATE UNIQUE INDEX t_email_live ON s.t (email)` | `CREATE UNIQUE INDEX t_email_live ON s.t (email) WHERE deleted_at IS NULL` | | `CREATE TRIGGER t_trg ... FOR EACH ROW EXECUTE FUNCTION f()` | `CREATE TRIGGER t_trg ... FOR EACH ROW WHEN (new.i > 0) EXECUTE FUNCTION s.f()` | | an unqualified trigger function resolved through `search_path` | resolved to the table's schema | -| introspected `Trigger::$functionName` - `name` | `schema.name`; new `Trigger::withFunctionSchema()` | +| introspected `Trigger::$functionName`: `name` | `schema.name`, new `Trigger::withFunctionSchema()` | | a declared `'s.f'` always drifted against the catalog | no drift | ### 33) `flow-php/postgresql` - a failed `SAVEPOINT` leaves the outer transaction open | Before | After | |---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------| -| nesting level reset to 0, the caller's `rollBack()` throws, the connection stays in `25P02` | nesting level kept; the caller's `rollBack()` ends the outer transaction | +| nesting level reset to 0, the caller's `rollBack()` throws, the connection stays in `25P02` | nesting level kept. The caller's `rollBack()` ends the outer transaction | ### 34) `flow-php/postgresql` - `sql_query_tables()` skips CTE references, reports `DROP` / `COMMENT ON` targets @@ -2931,7 +2938,7 @@ final class MyExtractor implements Extractor | `new UnionDefinition('a', type_union(type_integer(), type_string()))` | `str_schema('a')`, or `json_schema('a')` for dynamic data | Removed with them: `UnionMembers`, `UnionTypeNormalizer`, `Row\EntryTypeResolver`, `TypeProjection::union()`. -`TypeProjection` now takes the column's `Reference`; `TypeFloor` no longer takes a `TypeProjection`. +`TypeProjection` now takes the column's `Reference`, and `TypeFloor` no longer takes a `TypeProjection`. ### 37) `flow-php/etl` - a union inside a list, map or structure column type @@ -2964,17 +2971,17 @@ The same applies to map values and structure elements. | `type_datetime()->cast('2026-01-02 03:04')` in `date.timezone` | in the column zone: UTC, or `type_datetime('Europe/Warsaw')` | | `cast('2026-01-02T03:04:05+02:00')` keeps `+02:00`, `cast('...Z')` keeps `Z` | the same instant in the column zone (`2026-01-02 01:04:05 UTC`) | | a `DateTimeInterface` value in `rows()`, `from_rows()`, a cast or a Floe read keeps its own zone | converted to the column zone, instant unchanged | -| `to_csv()` / `to_json()` / `to_xml()` write each value's own offset (`+02:00` in, `+02:00` out) | the column zone's offset (`2026-01-02T01:04:05+00:00`); declare `datetime_schema('at', zone: 'Europe/Warsaw')` on the extractor to write a local one | -| `from_dbal_*()` naive `timestamp` / MySQL `datetime` text, and naive CSV/JSON text, read in `date.timezone` | read in the column zone (UTC); `->withSchema(schema(datetime_schema('at', zone: 'Europe/Warsaw')))` keeps a local reading | +| `to_csv()` / `to_json()` / `to_xml()` write each value's own offset (`+02:00` in, `+02:00` out) | the column zone's offset (`2026-01-02T01:04:05+00:00`). Declare `datetime_schema('at', zone: 'Europe/Warsaw')` on the extractor to write a local one | +| `from_dbal_*()` naive `timestamp` / MySQL `datetime` text, and naive CSV/JSON text, read in `date.timezone` | read in the column zone (UTC). `->withSchema(schema(datetime_schema('at', zone: 'Europe/Warsaw')))` keeps a local reading | | `type_datetime('CEST')`, `to_timezone($ref, 'PST')`, `'EST'`, `'CET'` | `InvalidArgumentException` - an IANA region name, `UTC` or `+HH:MM` | | `to_timezone($v, lit('UTC'))` | `TypeError` - pass `'UTC'` or a `DateTimeZone` | | `to_timezone($ref, ref('tz'))` - a per-row zone | `TypeError` - the zone of `to_timezone()` and `new ToTimeZone()` is `DateTimeZone\|string` | -| `now($tz)`, `to_date_time(..., $tz)`, `to_timezone(..., $tz)` return a `datetime` (UTC) column | a `datetime` column in `$tz`; a `ScalarFunction` zone in `now()` / `to_date_time()` yields UTC; `now(new DateTimeZone('EST'))`, `to_date_time(..., new DateTimeZone('PST'))` throw `InvalidArgumentException` (abbreviation zones) | +| `now($tz)`, `to_date_time(..., $tz)`, `to_timezone(..., $tz)` return a `datetime` (UTC) column | a `datetime` column in `$tz`. A `ScalarFunction` zone in `now()` / `to_date_time()` yields UTC. `now(new DateTimeZone('EST'))`, `to_date_time(..., new DateTimeZone('PST'))` throw `InvalidArgumentException` (abbreviation zones) | | `to_date_time($dateTimeObject)` truncates to midnight | keeps the time, converted to the zone | | merging `datetime` columns ignores zones | equal zones kept, different zones become `UTC` | | merging `time` with `date` / `datetime` gives `datetime` | `string` | | `?T` inside a list, map or structure passes a valid value through `cast()` unchanged | cast like `T`: a `?datetime` moves to its zone, a `?structure` keeps only its declared keys, in declared order | -| `type_date()->cast('2026-01-02T23:00:00-05:00')` midnight `-05:00` | `2026-01-02 00:00:00 UTC`; every non-object date input lands at midnight UTC | +| `type_date()->cast('2026-01-02T23:00:00-05:00')` midnight `-05:00` | `2026-01-02 00:00:00 UTC`. Every non-object date input lands at midnight UTC | | `type_date()->cast($dateTime)` sets the caller's `DateTime` to midnight | returns a new `DateTimeImmutable` | | `type_time()->cast(new DateTimeImmutable('10:00+05:00'))` = `05:00:00` | `10:00:00` - the value's wall clock | | Excel date cells in the host zone | UTC wall clock | @@ -2989,7 +2996,7 @@ The same applies to map values and structure elements. |--------------------------------------------------------------------|------------------------------------------------------------------------------------| | `Converter::isFor(FlatColumn, Options): bool` on a shared instance | `static Converter::forColumn(FlatColumn, Options): ?self` - a converter per column | | `new DataConverter([new TimeConverter(), ...], $options)` | `new DataConverter([TimeConverter::class, ...], $options)` | -| `Int32DateTimeConverter` | removed - INT32 TIMESTAMP is not a legal Parquet carrier | +| `Int32DateTimeConverter` | removed. INT32 TIMESTAMP is not a legal Parquet carrier | ### 42) `flow-php/parquet` - `LogicalType\Timestamp` / `Time` take a `TimeUnit` @@ -3000,9 +3007,9 @@ The same applies to map values and structure elements. ### 43) `flow-php/parquet` - `Option::ROUND_NANOSECONDS` removed -| Before | After | -|-----------------------------|---------------------------------------------------------------------------------------| -| `Option::ROUND_NANOSECONDS` | removed - NANOS timestamps always read as `DateTimeImmutable` floored to microseconds | +| Before | After | +|-----------------------------|--------------------------------------------------------------------------------------| +| `Option::ROUND_NANOSECONDS` | removed. NANOS timestamps always read as `DateTimeImmutable` floored to microseconds | ### 44) `flow-php/parquet` - `encode_decimal()` / `decode_decimal()` drop `ByteOrder` and the read-side precision check @@ -3015,7 +3022,7 @@ The same applies to map values and structure elements. | Before | After | |--------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| -| `FlatColumn::dateTime()` / arrow `TIMESTAMP` written `isAdjustedToUTC=false` (DuckDB/Spark read `TIMESTAMP`) | written `isAdjustedToUTC=true` (DuckDB/Spark read `TIMESTAMPTZ`); reading `false` files is unchanged | +| `FlatColumn::dateTime()` / arrow `TIMESTAMP` written `isAdjustedToUTC=false` (DuckDB/Spark read `TIMESTAMP`) | written `isAdjustedToUTC=true` (DuckDB/Spark read `TIMESTAMPTZ`). Reading `false` files is unchanged | ### 46) `flow-php/parquet`, `flow-php/etl-adapter-parquet` - ConvertedType-only TIMESTAMP/TIME/DECIMAL columns are typed @@ -3036,34 +3043,34 @@ The same applies to map values and structure elements. | Before | After | |--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------| | `type_structure($elements, allow_extra: true)` | `Error: Unknown named parameter $allow_extra` | -| `type_structure($elements, true)`, `StructureType::fromElements($elements, true)` | the extra argument is ignored by PHP - the structure is sealed | -| `new StructureType($elements, true)` | the extra argument is ignored by PHP - the structure is sealed | +| `type_structure($elements, true)`, `StructureType::fromElements($elements, true)` | the extra argument is ignored by PHP, and the structure is sealed | +| `new StructureType($elements, true)` | the extra argument is ignored by PHP, and the structure is sealed | | `StructureType::allowsExtra()` | removed | | `normalize()` / `schema_to_json()` write `"allow_extra": false` on every structure | the key is not written | | a stored schema with `"allow_extra": false` | read, the key is ignored | | a stored schema with `"allow_extra": true` | `InvalidArgumentException: Structure "allow_extra": true is no longer supported` | | `Rows` / `Schema` with a structure column natively serialized by 0.44.x (`ApcuCache`, `NativePHPSerializer`) | `Error: Cannot create dynamic property StructureType::$allowExtra` | -A value with a key its structure does not declare is invalid. Declare every element, or use `type_map()` / -`type_json()` when the keys are dynamic. flow-php 0.44.x cannot read a Floe file, cached schema or `schema_to_json()` +A value with a key its structure does not declare is invalid. If the keys are dynamic, use `type_map()` / +`type_json()`. Otherwise declare every element. flow-php 0.44.x cannot read a Floe file, cached schema or `schema_to_json()` document written by 0.45.x that has a structure column. Clear APCu and natively serialized caches after upgrading. ### 49) `flow-php/etl` - `Rows` is a columnar batch, `Row` is a view -| Before | After | -|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------| -| `new Rows($schema, ...$rows)` | `Rows::of($schema, ...$rows)` / `rows($schema, ...$rows)` | -| `Rows::trusted($schema, $rows)` / `Rows::conformed($schema, $rows)` | `Rows::of($schema, ...$rows)` (views) / `Rows::fromColumns($schema, $columns, $count)` (columns) | -| `new Row(array $values)` | `array_to_row($values, $schema)` | -| - | `new Row(Rows $rows, int $index)` - a view over row `$index` of `$rows` | -| `Row::matchTo()` / `Row::conformTo()` / `Row::project()` | removed - `Rows::matchTo()` / `Rows::project()` | -| `Rows::empty(): bool` | `Rows::isEmpty(): bool` | -| `Row::get()` of a datetime / date / time / uuid / json / xml / html cell - the instance handed in | a new object per call - compare with `assertEquals`, not `assertSame` | -| a `DOMElement` / `HTMLElement` cell keeps its document (parent and siblings reachable) | the cell is the element's own markup - navigate from the document column (`xpath()`) | -| an optional and nullable structure element given `null` | reads back absent (the element's validity bit) | -| `$row == $other` - compares the rows' values | compares both views' whole batches and indices - compare `toArray()` | -| `serialize(Rows)` payload `{schema, rows}` | `{schema, frame}` - the Floe BATCH body; payloads of 0.44.x cannot be unserialized, a corrupt payload throws `FloeException` | -| `Rows::drop()` / `dropRight()` / `take()` / `takeRight()` with a negative size - `array_slice()` semantics | `InvalidArgumentException` | +| Before | After | +|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| +| `new Rows($schema, ...$rows)` | `Rows::of($schema, ...$rows)` / `rows($schema, ...$rows)` | +| `Rows::trusted($schema, $rows)` / `Rows::conformed($schema, $rows)` | `Rows::of($schema, ...$rows)` (views) / `Rows::fromColumns($schema, $columns, $count)` (columns) | +| `new Row(array $values)` | `array_to_row($values, $schema)` | +| - | `new Row(Rows $rows, int $index)` - a view over row `$index` of `$rows` | +| `Row::matchTo()` / `Row::conformTo()` / `Row::project()` | removed - `Rows::matchTo()` / `Rows::project()` | +| `Rows::empty(): bool` | `Rows::isEmpty(): bool` | +| `Row::get()` of a datetime / date / time / uuid / json / xml / html cell: the instance handed in | a new object per call. Compare with `assertEquals`, not `assertSame` | +| a `DOMElement` / `HTMLElement` cell keeps its document (parent and siblings reachable) | the cell is the element's own markup. Navigate from the document column (`xpath()`) | +| an optional and nullable structure element given `null` | reads back absent (the element's validity bit) | +| `$row == $other`: compares the rows' values | compares both views' whole batches and indices. Compare `toArray()` | +| `serialize(Rows)` payload `{schema, rows}` | `{schema, frame}`, the Floe BATCH body. Payloads of 0.44.x cannot be unserialized, and a corrupt payload throws `FloeException` | +| `Rows::drop()` / `dropRight()` / `take()` / `takeRight()` with a negative size - `array_slice()` semantics | `InvalidArgumentException` | ### 50) `flow-php/etl` - `row()`, `InferredBatch` and `DataFrame::getEach()` removed @@ -3075,18 +3082,18 @@ document written by 0.45.x that has a structure column. Clear APCu and natively | `DataFrame::getEach()` | `getEachAsArray()` (values) / `get()` (batches with their schema) | `array_to_row()` / `array_to_rows()` cast values to the declared type and refuse keys the schema does not declare -(`SchemaMismatchException` naming the row and the column; before, those keys were silently dropped). +(`SchemaMismatchException` naming the row and the column. Before, those keys were silently dropped). ### 51) `flow-php/etl` - date and time columns store days and microseconds | Before | After | |-----------------------------------------------------------------------------------------|----------------------------------------------------------------------| -| a `date` cell - the value as given | midnight UTC (zone `UTC`) of its calendar day | +| a `date` cell: the value as given | midnight UTC (zone `UTC`) of its calendar day | | a `time` cell - `d` kept | `d` folded into hours, `$days` is `false` | | a `time` string with months / years (`'P1M'`) - accepted by the hydrate path | `SchemaMismatchException` "could not convert 'P1M' (string) to time" | | a `datetime` / `time` beyond ±9 223 372 036 854.775807 s (about year ±292 000) - stored | refused | | a `date` beyond the `i32` day range (about year ±5 880 000) - stored | refused | -| a PHP 8.4 `\Dom\Element` in an `xml_element` column - kept | read back as a `DOMElement` | +| a PHP 8.4 `\Dom\Element` in an `xml_element` column: kept | read back as a `DOMElement` | ### 52) `flow-php/etl` - batch columns refuse wildcard enums, `mixed` elements and foreign definitions @@ -3135,11 +3142,11 @@ document written by 0.45.x that has a structure column. Clear APCu and natively ### 57) `flow-php/etl` - a join name collision suggests a prefix -| Before | After | -|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| -| `SchemaDefinitionNotUniqueException`: `Entry definitions must be unique, duplicated entries: [id], all: [id, id]` | the same message with `. Please consider using join prefix option` appended - the text before it is unchanged | +| Before | After | +|-------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------| +| `SchemaDefinitionNotUniqueException`: `Entry definitions must be unique, duplicated entries: [id], all: [id, id]` | the same message with `. Please consider using join prefix option` appended. The text before it is unchanged | -Every join shape (`joinCross()`, `join()`, `joinEach()`) reports the collision through `JoinSchema::of()`; the original +Every join shape (`joinCross()`, `join()`, `joinEach()`) reports the collision through `JoinSchema::of()`. The original exception is the new one's `previous`. Only an exact match on the whole message is affected. ### 58) `flow-php/types` - a date is midnight at UTC @@ -3147,12 +3154,12 @@ exception is the new one's `previous`. Only an exact match on the whole message | Before | After | |------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| | `type_date()->isValid()` / `DateDefinition::matches()` - midnight in any zone (`2026-01-01 00:00 Europe/Warsaw`) | only midnight at UTC offset `+00:00` | -| `row(['at' => new DateTimeImmutable('2026-01-01', new DateTimeZone('Europe/Warsaw'))])` - a `date` column | a `datetime` column - the instant is kept | +| `row(['at' => new DateTimeImmutable('2026-01-01', new DateTimeZone('Europe/Warsaw'))])`: a `date` column | a `datetime` column, and the instant is kept | | `rows(schema(date_schema('at')), $rowWithWarsawMidnight)` / `matchTo()` - accepted | `SchemaMismatchException` "could not convert 2026-01-01T00:00:00.000000+01:00 (datetime) to date" | -| `type_date()->cast($warsawMidnight)` | unchanged - the value's own calendar day | +| `type_date()->cast($warsawMidnight)` | unchanged: the value's own calendar day | A date column stores days and reads back midnight UTC (row 51), so a midnight in another zone was silently moved to a -different instant; it now stays a `datetime` unless it is cast to a date explicitly. +different instant. It now stays a `datetime`, except for an explicit cast to a date. ### 59) `flow-php/types` - `Comparator` takes no arguments @@ -3164,7 +3171,7 @@ different instant; it now stays a `datetime` unless it is cast to a date explici | Before | After | |---------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| `Hydrator`, `PhpRowHydrator`, `TypedRowValues`, `Row\Encoder` | removed - readers build with `RowsBuilder`, encoders take `encode(Rows)` | +| `Hydrator`, `PhpRowHydrator`, `TypedRowValues`, `Row\Encoder` | removed. Readers build with `RowsBuilder`, and encoders take `encode(Rows)` | | `Row\RowsBuffer(Schema, int $size, ?Closure $batch)` | `Rows\RowsBuffer(Schema, Backend, int $size)` - `append()`, `appendFrom()`, `appendTake()`, `flush()` | | `Config::hydrator()`, `FlowContext::hydrator()` | removed - `Config::backend()`, `FlowContext::backend()` | @@ -3190,13 +3197,13 @@ No default: the caller passes the backend the rows are built in (`$context->back | `new CSVEncoder(withHeader:, emptyToNull:, ...)` | `new CSVDecoder(withHeader:, emptyToNull:, ...)` - `CSVEncoder` keeps only the write options | | `TextEncoder::decode()` | removed - `TextExtractor` builds `['text' => $line]` rows itself | | `XMLEncoder::decode()` | removed - `XMLReaderExtractor` builds `['node' => $xml]` rows itself | -| `ExcelEncoder(withHeader:, convertEmptyToNull:, timeFormat:)`, `decode()`, `headers()` | `ExcelDecoder(withHeader:, convertEmptyToNull:)` with `decode()`, `headers()`; `ExcelEncoder(timeFormat:)` | +| `ExcelEncoder(withHeader:, convertEmptyToNull:, timeFormat:)`, `decode()`, `headers()` | `ExcelDecoder(withHeader:, convertEmptyToNull:)` with `decode()`, `headers()`, and `ExcelEncoder(timeFormat:)` | | `OpenSheet::$encoder` (`ExcelEncoder`) | `OpenSheet::$decoder` (`ExcelDecoder`) | | `GoogleSheetEncoder` | `GoogleSheetDecoder` - its throwing `encode()` is removed | | `GoogleSheetReadOptions::encoder(): GoogleSheetEncoder` | `GoogleSheetReadOptions::decoder(): GoogleSheetDecoder` | | `HttpEncoder` | `HttpDecoder` - `decode()` returns `list`, its throwing `encode()` is removed, `structuredBody()` stays | | `JSONEncoder::decode()`, `DbalEncoder::decode()`, `PostgreSqlEncoder::decode()`, `SealEncoder::decode()`, `ParquetEncoder::decode()` | removed | -| `*Encoder::encode(list)` | `*Encoder::encode(Rows)`; no encoder implements `Row\Encoder` | +| `*Encoder::encode(list)` | `*Encoder::encode(Rows)`. No encoder implements `Row\Encoder` | | `CSVLoader::write(Rows, array, FlowContext, array)` | `CSVLoader::write(Rows, array $headers, array $partitions)` | | `JsonLoader::write(Rows, array, FlowContext)`, `JsonLinesLoader::write(...)`, `XMLLoader::write(...)` | `write(Rows, array $partitions)` | | `XMLEncoder` refusing a structure value with more values than elements | removed - a structure cast drops undeclared keys, so the case cannot occur | @@ -3208,7 +3215,7 @@ No default: the caller passes the backend the rows are built in (`$context->back |-----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| | `ParquetEngine::readValues(SourceStream, Schema, array $columns = [], ?int $limit = null, ?int $offset = null)` | `ParquetEngine::readColumns(SourceStream, Schema, list $columns, int $batchSize, ?int $limit, ?int $offset)` - chunks keyed by column | | - | `ParquetFile::columns(int $batchSize, array $columns = [], ?int $limit = null, ?int $offset = null)` | -| `ParquetFile::values(offset: -1)` without a limit - read from row 0 | `InvalidArgumentException` | +| `ParquetFile::values(offset: -1)` without a limit: read from row 0 | `InvalidArgumentException` | ### 64) `flow-php/etl-adapter-parquet`, `flow-php/etl` - self-describing formats take no schema @@ -3216,9 +3223,9 @@ No default: the caller passes the backend the rows are built in (`$context->back |-------------------------------------------------------------------------|------------------------------------------------------------| | `from_parquet(...)->withSchema(...)`, `from_floe(...)->withSchema(...)` | `InvalidArgumentException` - the file footer is the schema | | `InferredSchemaException::filesDiverge` suggesting `->withSchema(...)` | suggests only `->unionByName()` | -| `ValueConverter::decode()` | removed - values are cast by the batch builder | +| `ValueConverter::decode()` | removed. Values are cast by the batch builder | -Project with `from_parquet(..., columns: [...])`. Change a type after reading, e.g. a JSON column another tool wrote as +Project with `from_parquet(..., columns: [...])`. Change a type after reading, for example a JSON column another tool wrote as `string`: `->withEntry('payload', ref('payload')->cast(type_json()))`. Re-zone a datetime after reading: `->withEntry('at', to_timezone(ref('at'), 'Europe/Warsaw'))`. @@ -3238,8 +3245,8 @@ Project with `from_parquet(..., columns: [...])`. Change a type after reading, e | `ValueEncoder::{xmlDocument,xmlElement,htmlElement}ToString()`, `ValueDecoder::{xmlDocument,xmlElement,htmlDocument,htmlElement}FromString()` | removed - `(new XmlDocumentPhysical())->toPhysical()` / `fromPhysical()` and the other `Flow\ETL\Column\Php\*Physical` | | `Flow\Floe\Decoding\TimeZones` | `Flow\ETL\Column\Physical\TimeZones` | | `Offsets::pack()` throws `InvalidArgumentException` past 2³¹−1 | throws `Flow\ETL\Exception\OffsetOverflow` (extends `InvalidArgumentException`) | -| `from_floe()->withBatchSize($n)`, `FloeReader::rows($n)` - batches of exactly `$n` rows | at most `$n` rows, never spanning two BATCH frames - re-batch with `->batchSize($n)` | -| a codec wraps every frame body | a codec wraps each buffer of a BATCH frame behind an i64 uncompressed length (`-1` = stored raw); the directory stays plaintext | +| `from_floe()->withBatchSize($n)`, `FloeReader::rows($n)`: batches of exactly `$n` rows | at most `$n` rows, never spanning two BATCH frames. Re-batch with `->batchSize($n)` | +| a codec wraps every frame body | a codec wraps each buffer of a BATCH frame behind an i64 uncompressed length (`-1` = stored raw). The directory stays plaintext | | a null in a NOT NULL column refused by the Floe writer (`SchemaMismatchException`) | refused by `Rows::fromColumns()` / `withColumns()` with the same exception and message, whatever the sink | | an XML/HTML value that cannot be converted to or from its string while building a column throws `FloeException` | throws `Flow\ETL\Exception\InvalidArgumentException`, same message | @@ -3249,7 +3256,7 @@ Project with `from_parquet(..., columns: [...])`. Change a type after reading, e |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | `Flow\Floe\RustFloeEncoderNative`, `Flow\ETL\Row\RustRowHydratorNative` | removed | | - | `flow_php` registers `Flow\ETL\Column\{Backend, Column, ColumnBuilder, RustBackend, RustColumn, RustColumnBuilder}` | -| any `flow_php` installs beside `flow-php/etl` | Composer refuses `ext-flow_php` < 0.45 (`conflict`); forced past it: `Class "Flow\ETL\Column\RustBackend" not found` | +| any `flow_php` installs beside `flow-php/etl` | Composer refuses `ext-flow_php` < 0.45 (`conflict`). Forced past it: `Class "Flow\ETL\Column\RustBackend" not found` | | untagged builds report `0.44.1+65.g...` | `0.45.0-dev+65.g...` (next minor, pre-release) | | - | `Backend`: `builder()`, `constant()`, `decode()`, `adopt(Definition, Column): Column`, `allocatedBytes(): int` | | `Consumption` / `analyze()` / telemetry memory = `memory_get_usage()` | plus the configured backend's `allocatedBytes()` (native columns are not bound by `memory_limit`) | @@ -3265,12 +3272,12 @@ Project with `from_parquet(..., columns: [...])`. Change a type after reading, e ### 68) `flow-php/etl`, adapters - `RawRowValues` removed, CSV sources yield batches -| Before | After | -|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------| -| `RawRowValues`; `SchemaSampler`, `SniffsColumnTypes`, `SchemaInferrer::infer()/sniff()`, `ColumnTypes::observe()` over it | plain `array` rows | -| `CSVOpenSource::records(): Generator` | `Iterator>` | -| - | `CSVOpenSource::batches(Schema, int, Backend): Iterator` | -| `CSVFileReader::batches(SourceFile, int): Generator>` returning the header | `batches(SourceFile, Schema, int, Backend): Generator`, no return value | +| Before | After | +|-------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------| +| `RawRowValues`, and `SchemaSampler`, `SniffsColumnTypes`, `SchemaInferrer::infer()/sniff()`, `ColumnTypes::observe()` over it | plain `array` rows | +| `CSVOpenSource::records(): Generator` | `Iterator>` | +| - | `CSVOpenSource::batches(Schema, int, Backend): Iterator` | +| `CSVFileReader::batches(SourceFile, int): Generator>` returning the header | `batches(SourceFile, Schema, int, Backend): Generator`, no return value | ### 69) `flow-php/etl` - `Row` removed, `Rows` is a columnar batch @@ -3331,11 +3338,11 @@ public function eval(Rows $rows, FlowContext $context): Column | Before | After | |------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------| -| `ref('a')->multiply(lit(3))` with `a = 0.1` - `0.3` | `0.30000000000000004`; `ref('a')->multiply(lit(3), exact: true)` - `0.3` | -| `plus()`, `minus()`, `power()` - decimal arithmetic | IEEE 754; `exact: true` keeps decimal arithmetic | +| `ref('a')->multiply(lit(3))` with `a = 0.1`: `0.3` | `0.30000000000000004`. `ref('a')->multiply(lit(3), exact: true)`: `0.3` | +| `plus()`, `minus()`, `power()`: decimal arithmetic | IEEE 754. `exact: true` keeps decimal arithmetic | | an integer result past `PHP_INT_MAX` - `Brick\Math\Exception\IntegerOverflowException` | `EvaluationException`: `Plus function integer overflow (row N)` | | `power()` of an integer with a negative exponent | `EvaluationException`: `Power function of an integer requires a non-negative exponent (row N)` | -| `average(ref('amount'))` - decimal sum (`Calculator` per value), then rounded to `scale` | IEEE sum with Neumaier compensation, then the same rounding; `average(ref('amount'), exact: true)` keeps the decimal sum | +| `average(ref('amount'))`: decimal sum (`Calculator` per value), then rounded to `scale` | IEEE sum with Neumaier compensation, then the same rounding. `average(ref('amount'), exact: true)` keeps the decimal sum | | `sum(ref('amount'))` (default `exact: false`) - plain IEEE addition, `0.1` ten times: `0.9999999999999999` | compensated IEEE addition: `1.0` | | `RunningSum::add(float\|int $sum, $value, bool $exact): float\|int` | stateful: `add($value, bool $exact): void`, `value(): float\|int`, `merge(RunningSum, bool $exact)` | @@ -3348,16 +3355,16 @@ public function eval(Rows $rows, FlowContext $context): Column ### 73) `flow-php/etl` - uuid, json, enum, xml, html and date/time values compare by value -| Before | After | -|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------| -| `equals()`, `same()`, `isIn()`, join `Identical`, `batchBy()` over these types - always false / one batch per row | value equality | -| json values | compare by their stored text - `{"a":1,"b":2}` and `{"b":2,"a":1}` are not equal | +| Before | After | +|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------| +| `equals()`, `same()`, `isIn()`, join `Identical`, `batchBy()` over these types: always false / one batch per row | value equality | +| json values | compare by their stored text - `{"a":1,"b":2}` and `{"b":2,"a":1}` are not equal | ### 74) `flow-php/etl` - `array_keys_style_convert()` declares the converted nested shape -| Before | After | -|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------| -| `returns()` renames the top-level keys only; a nested conversion stored with `withEntry()` failed | `returns()` renames structure fields at every level (structures, lists, maps); key collisions are refused at every level | +| Before | After | +|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------| +| `returns()` renames the top-level keys only, and a nested conversion stored with `withEntry()` failed | `returns()` renames structure fields at every level (structures, lists, maps). Key collisions are refused at every level | ### 75) `flow-php/etl` - extension points take a batch @@ -3373,69 +3380,69 @@ public function eval(Rows $rows, FlowContext $context): Column ### 76) `flow-php/etl` - one sort order: nulls smallest, strings by bytes -| Before | After | -|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| -| `sortBy(ref('code')->asc())` over `'9', '10', '100'` - `'9', '10', '100'` (numeric when every value looked numeric) | `'10', '100', '9'` - strings always compare by bytes | -| `sortBy(ref('v')->asc())` over `3, null, 1` - unsorted (a null compared equal to every value) | `null, 1, 3` - nulls first ascending, last descending; descending is the exact reverse of ascending | -| NaN - no defined position | after every other value, equal to NaN; `-0.0` equals `0.0` | -| external sort (spilled runs) could order differently from the in-memory sort | both, `constraint_sorted_by()` and window peers use the same order | -| `Flow\ETL\Sort\ValuesSorter`, `Sort\Merge\RowsMinHeap`, `Sort\Merge\ComparableBucketRow` | removed - `Flow\ETL\Sort\RowOrder` | -| `new BucketCursor(Generator, References)`, `keys(): list`, `next()` | `new BucketCursor(Generator, RowOrder)`, `keys(): list`, `advance(int)` | -| - | `ref('x')->asc(NullsOrder::LAST)`, `ref('x')->desc(NullsOrder::FIRST)` move nulls to the other end | -| a custom `Reference` implementation | adds `nulls(): NullsOrder` | +| Before | After | +|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| +| `sortBy(ref('code')->asc())` over `'9', '10', '100'`: `'9', '10', '100'` (numeric if every value looked numeric) | `'10', '100', '9'`, because strings always compare by bytes | +| `sortBy(ref('v')->asc())` over `3, null, 1`: unsorted (a null compared equal to every value) | `null, 1, 3`: nulls first ascending, last descending. Descending is the exact reverse of ascending | +| NaN: no defined position | after every other value, equal to NaN. `-0.0` equals `0.0` | +| external sort (spilled runs) sometimes ordered differently from the in-memory sort | both, `constraint_sorted_by()` and window peers use the same order | +| `Flow\ETL\Sort\ValuesSorter`, `Sort\Merge\RowsMinHeap`, `Sort\Merge\ComparableBucketRow` | removed - `Flow\ETL\Sort\RowOrder` | +| `new BucketCursor(Generator, References)`, `keys(): list`, `next()` | `new BucketCursor(Generator, RowOrder)`, `keys(): list`, `advance(int)` | +| - | `ref('x')->asc(NullsOrder::LAST)`, `ref('x')->desc(NullsOrder::FIRST)` move nulls to the other end | +| a custom `Reference` implementation | adds `nulls(): NullsOrder` | ### 77) `flow-php/etl` - spilling steps stop at a memory limit, not a row count -| Before | After | -|----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `external_sort()->runSize(int)` - rows per sorted run, default `10000` | `external_sort()->memoryLimit(Unit)`; data under it sorts in memory without spilling | -| - | `hash_join()->memoryLimit(Unit)`, `hash_group_by()->memoryLimit(Unit)`, `hash_repartition()->memoryLimit(Unit)` | -| - | every limit defaults to `Config\MemoryLimit::default()`: `FLOW_MAX_MEMORY`, otherwise 70% of `memory_limit`, 1 GiB when `memory_limit` is `-1` | -| - | a limit is compared with the whole process (`memory_get_usage()` + the backend's native memory), not with the step's own buffer - a sort and a join in one pipeline stay under it together | -| `hash_join()` with a disk storage partitioned both sides into buckets | the right side stays in memory under the limit and the left side streams in its own order; past it both sides are partitioned | -| `groupBy()` / window partitions always hash-partitioned their input into buckets | under the limit a group-by aggregates in one pass and a window groups its partitions in memory - no bucket is written; past it the rest of the stream is partitioned (group-by merges the groups aggregated before the limit) | -| group-by / repartition / join wrote one bucket frame per bucket per input batch | buckets stay in memory under the limit; past it every frame holds `batchSize` rows | -| `GroupBySteps::of()` / `RepartitionSteps::of()` - `[BucketingProcessor, GroupByAggregationProcessor]` / `[BucketingProcessor, RepartitionProcessor]` | `[GroupByAggregationProcessor]` / `[RepartitionProcessor]`; both take `HashBucketing` and `Unit $memoryLimit`; `GroupBy\BucketAggregation` removed | -| `new ExternalSortConfig($bucketing, ?BucketsStorage $merge = null, int $runSize)` | `new ExternalSortConfig($bucketing, Unit $memoryLimit, ?BucketsStorage $merge = null)` | -| `new HashJoinConfig($bucketing)`, `new HashGroupByConfig($bucketing)`, `new HashRepartitionConfig($bucketing)` | `new ...Config($bucketing, Unit $memoryLimit)` | -| `new HashJoinProcessor($right, $executor, $on, $type, $left, $right, $random, $bucketsCount, $batchSize)` | `new HashJoinProcessor($right, $executor, $on, $type, $left, $right, $random, Unit $memoryLimit, $bucketsCount, $batchSize)` | -| `new MergeSortProcessor(References, Buckets, Buckets, RandomValueGenerator, int, int)` | `new MergeSortProcessor(ExternalSort)` | -| `SortSteps::of()` - `[BucketingProcessor, MergeSortProcessor]` for the external sort | `[MergeSortProcessor]`; `SortSteps::external(): ?ExternalSort` | -| `Flow\ETL\Bucketing\SortedRunBucketing` | removed - `Flow\ETL\Sort\ExternalSort` | -| `Flow\ETL\Processor\BucketingProcessor`, `Flow\ETL\Bucketing\BucketingStrategy`, `Flow\ETL\Bucketing\BucketShape`, `Bucket::schema()`, `Bucket::toRow()` | removed - sort, join, group-by and repartition partition inside their own step | -| `sortBy()->limit(n)` over the external sort became a top-n only when `n <= runSize` | always a top-n; past the memory limit it hands its kept rows and the rest of the stream to the external sort, whose merge stops after `n` rows | -| `new TopNRewrite(FlowContext)` | `new TopNRewrite()` | -| `new TopNProcessor(References, int, ?Schema)` | `new TopNProcessor(References, int, ?ExternalSort $fallback = null, ?Schema)` | -| `new Plan\Node\TopN(Node, References, int)` | `new TopN(Node, References, int, ?SortAlgorithmBuilder $algorithm = null)` | -| explain: `Storage: FilesystemBuckets` | adds `Memory: N MB` under the storage of a sort, join, group-by and repartition step | +| Before | After | +|----------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `external_sort()->runSize(int)`: rows per sorted run, default `10000` | `external_sort()->memoryLimit(Unit)`. Data under it sorts in memory without spilling | +| - | `hash_join()->memoryLimit(Unit)`, `hash_group_by()->memoryLimit(Unit)`, `hash_repartition()->memoryLimit(Unit)` | +| - | every limit defaults to `Config\MemoryLimit::default()`: `FLOW_MAX_MEMORY`, otherwise 70% of `memory_limit`. If `memory_limit` is `-1`, 1 GiB | +| - | a limit is compared with the whole process (`memory_get_usage()` + the backend's native memory), not with the step's own buffer. A sort and a join in one pipeline stay under it together | +| `hash_join()` with a disk storage partitioned both sides into buckets | the right side stays in memory under the limit and the left side streams in its own order. Past it both sides are partitioned | +| `groupBy()` / window partitions always hash-partitioned their input into buckets | under the limit a group-by aggregates in one pass and a window groups its partitions in memory. No bucket is written. Past it the rest of the stream is partitioned (group-by merges the groups aggregated before the limit) | +| group-by / repartition / join wrote one bucket frame per bucket per input batch | buckets stay in memory under the limit. Past it every frame holds `batchSize` rows | +| `GroupBySteps::of()` / `RepartitionSteps::of()`: `[BucketingProcessor, GroupByAggregationProcessor]` / `[BucketingProcessor, RepartitionProcessor]` | `[GroupByAggregationProcessor]` / `[RepartitionProcessor]`. Both take `HashBucketing` and `Unit $memoryLimit`. `GroupBy\BucketAggregation` removed | +| `new ExternalSortConfig($bucketing, ?BucketsStorage $merge = null, int $runSize)` | `new ExternalSortConfig($bucketing, Unit $memoryLimit, ?BucketsStorage $merge = null)` | +| `new HashJoinConfig($bucketing)`, `new HashGroupByConfig($bucketing)`, `new HashRepartitionConfig($bucketing)` | `new ...Config($bucketing, Unit $memoryLimit)` | +| `new HashJoinProcessor($right, $executor, $on, $type, $left, $right, $random, $bucketsCount, $batchSize)` | `new HashJoinProcessor($right, $executor, $on, $type, $left, $right, $random, Unit $memoryLimit, $bucketsCount, $batchSize)` | +| `new MergeSortProcessor(References, Buckets, Buckets, RandomValueGenerator, int, int)` | `new MergeSortProcessor(ExternalSort)` | +| `SortSteps::of()`: `[BucketingProcessor, MergeSortProcessor]` for the external sort | `[MergeSortProcessor]`, `SortSteps::external(): ?ExternalSort` | +| `Flow\ETL\Bucketing\SortedRunBucketing` | removed - `Flow\ETL\Sort\ExternalSort` | +| `Flow\ETL\Processor\BucketingProcessor`, `Flow\ETL\Bucketing\BucketingStrategy`, `Flow\ETL\Bucketing\BucketShape`, `Bucket::schema()`, `Bucket::toRow()` | removed. Sort, join, group-by and repartition partition inside their own step | +| `sortBy()->limit(n)` over the external sort became a top-n only for `n <= runSize` | always a top-n. Past the memory limit it hands its kept rows and the rest of the stream to the external sort, whose merge stops after `n` rows | +| `new TopNRewrite(FlowContext)` | `new TopNRewrite()` | +| `new TopNProcessor(References, int, ?Schema)` | `new TopNProcessor(References, int, ?ExternalSort $fallback = null, ?Schema)` | +| `new Plan\Node\TopN(Node, References, int)` | `new TopN(Node, References, int, ?SortAlgorithmBuilder $algorithm = null)` | +| explain: `Storage: FilesystemBuckets` | adds `Memory: N MB` under the storage of a sort, join, group-by and repartition step | ### 78) `flow-php/etl` - `sum(exact:)` is a bool; `batched_by()`, `string_agg()` and `pivot()` follow the one order | Before | After | |---------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| | `sum(ref('a'), exact: ref('is_exact'))` - exactness chosen per row | `sum(ref('a'), exact: true)` - one `bool` for the aggregate, as `average()` and `plus/minus/multiply/power` | -| `sum(..., exact: ScalarFunction)` disabled spill column pruning (`references()` was `null`) | `sum()` always enumerates its reference; a custom `AggregatingFunction` may still return `null` | -| `batched_by(from_..., 'at')` - equal datetimes / uuids split into one batch per row, a `null` value joined the next group | value equality, as `batchBy()`; nulls are a group of their own | +| `sum(..., exact: ScalarFunction)` disabled spill column pruning (`references()` was `null`) | `sum()` always enumerates its reference. A custom `AggregatingFunction` can still return `null` | +| `batched_by(from_..., 'at')`: equal datetimes / uuids split into one batch per row, a `null` value joined the next group | value equality, as `batchBy()`. Nulls are a group of their own | | `string_agg(ref('code'), ',', SortOrder::ASC)` over `'9', '10', '100'` - `9,10,100` (numeric-looking strings numerically) | `10,100,9` - strings by bytes, as `sortBy()` | -| `discover_pivot_values()` over `'9', '10', '100'` - columns `9, 10, 100` | `10, 100, 9`; integer pivot values stay numeric | -| `->stringMatch()` / `->stringMatchAll()` turned a PHP `\Error` into an exception `optional()` swallowed | an `\Error` propagates; `->jsonDecode()`, `cast()`, `->arrayPathExists()`, `->stringMatch*()` errors keep their cause as `getPrevious()` | +| `discover_pivot_values()` over `'9', '10', '100'`: columns `9, 10, 100` | `10, 100, 9`. Integer pivot values stay numeric | +| `->stringMatch()` / `->stringMatchAll()` turned a PHP `\Error` into an exception `optional()` swallowed | an `\Error` propagates. `->jsonDecode()`, `cast()`, `->arrayPathExists()`, `->stringMatch*()` errors keep their cause as `getPrevious()` | ### 79) `flow-php/etl-adapter-parquet` - with `flow_php` and arrow-ext loaded and no engine given, Parquet is read and written as native columns -| Before | After | -|--------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `from_parquet($path)` / `to_parquet($path)` - `AdaptiveParquetEngine` (arrow-ext when loaded, else the PHP engine) | with `flow_php` and arrow-ext loaded: arrow-ext's batches straight into native columns and back (Arrow C Data Interface); `flow_php` alone: the PHP engine, its values adopted into native columns; without `flow_php`: unchanged | -| `engine: new PhpParquetEngine()` / `new ArrowParquetEngine()` | `engine: new PhpParquetEngine()` opts out; `new AdaptiveParquetEngine()` reads and writes native columns when both extensions are loaded, `new RustParquetEngine()` reads them | -| a column type arrow-ext could not read failed inside arrow-ext | refused before the first batch: `Flow\Parquet\Exception\RuntimeException` `Parquet column "" () is not supported by the arrow Parquet reader; read the file with \Flow\Parquet\Reader::php()` | -| `flow-php/etl-adapter-parquet` installable with any `flow_php` or arrow-ext version | `conflict: ext-flow_php <0.45`, `ext-arrow <0.45` - load extensions of this release or none | +| Before | After | +|-----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `from_parquet($path)` / `to_parquet($path)`: `AdaptiveParquetEngine` (arrow-ext if loaded, else the PHP engine) | with `flow_php` and arrow-ext loaded: arrow-ext's batches straight into native columns and back (Arrow C Data Interface). `flow_php` alone: the PHP engine, its values adopted into native columns. Without `flow_php`: unchanged | +| `engine: new PhpParquetEngine()` / `new ArrowParquetEngine()` | `engine: new PhpParquetEngine()` opts out. If both extensions are loaded, `new AdaptiveParquetEngine()` reads and writes native columns, and `new RustParquetEngine()` reads them | +| a column type that arrow-ext does not support failed inside arrow-ext | refused before the first batch: `Flow\Parquet\Exception\RuntimeException` `Parquet column "" () is not supported by the arrow Parquet reader; read the file with \Flow\Parquet\Reader::php()` | +| `flow-php/etl-adapter-parquet` installable with any `flow_php` or arrow-ext version | `conflict: ext-flow_php <0.45`, `ext-arrow <0.45` - load extensions of this release or none | ### 80) `flow-php/etl-adapter-parquet` - Flow `float` columns are written as Parquet `DOUBLE` | Before | After | |---------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| -| `float_schema('amount')` written as Parquet `FLOAT` (32-bit): `0.14` read back as `0.14000000059604645` | written as `DOUBLE` (64-bit), read back exactly; readers of the file see a `DOUBLE` column | +| `float_schema('amount')` written as Parquet `FLOAT` (32-bit): `0.14` read back as `0.14000000059604645` | written as `DOUBLE` (64-bit), read back exactly. Readers of the file see a `DOUBLE` column | ### 81) `flow-php/etl-adapter-parquet` - with @@ -3444,7 +3451,7 @@ public function eval(Rows $rows, FlowContext $context): Column | Before | After | |------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | without arrow-ext, `PhpParquetEngine` wrote `"\xff\xfe"` into a `STRING` column other readers reject (DuckDB: `is not valid UTF8`) | `Flow\Parquet\Exception\RuntimeException` `Parquet column "name" row 0 holds a string that is not valid UTF-8; Parquet STRING columns require UTF-8` - the row is 0-based within the batch written | -| with arrow-ext: `Column 'name': expected string, got string` | the same refusal; invalid UTF-8 into `STRING` / `JSON` / `ENUM` is refused by both engines; `Option::VALIDATE_DATA = false` on `PhpParquetEngine` writes it unvalidated (a file other readers reject); arrow-ext always refuses | +| with arrow-ext: `Column 'name': expected string, got string` | the same refusal. Invalid UTF-8 into `STRING` / `JSON` / `ENUM` is refused by both engines. `Option::VALIDATE_DATA = false` on `PhpParquetEngine` writes it unvalidated (a file other readers reject). Arrow-ext always refuses | ### 82) `flow-php/parquet` - `DELTA_BINARY_PACKED` follows the spec; affected files written by @@ -3452,7 +3459,7 @@ public function eval(Rows $rows, FlowContext $context): Column | Before | After | |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------| -| `PhpParquetEngine` wrote `DELTA_BINARY_PACKED` blocks that other readers misread (a partial last block without all miniblock bit widths, zero-width miniblocks with 4 padding bytes) | spec-conformant blocks; DuckDB, arrow-rs and `flow_php` read the values back | +| `PhpParquetEngine` wrote `DELTA_BINARY_PACKED` blocks that other readers misread (a partial last block without all miniblock bit widths, zero-width miniblocks with 4 padding bytes) | spec-conformant blocks. DuckDB, arrow-rs and `flow_php` read the values back | | it read other writers' `DELTA_BINARY_PACKED` `INT64` wrong after an outlier (`9223372036854645807` read as `9223372036788279061`, garbage after) | reads them as DuckDB and arrow-rs do | | affected: `INT32`/`INT64` columns `PhpParquetEngine` wrote with `Option::WRITER_VERSION` `2` or `COLUMNS_ENCODINGS` `DELTA_BINARY_PACKED` (the default is version `1`, `PLAIN`) | no spec-conformant reader returns their values: read them with the Flow version that wrote them and write them again (or re-export from the source) | @@ -3463,25 +3470,25 @@ public function eval(Rows $rows, FlowContext $context): Column | `$engine->readColumns($stream, $schema, $columns, $batchSize, $limit, $offset)` | `$engine->openForRead($stream)->readColumns($columns, $batchSize, $limit, $offset)` | | a custom `ParquetEngine` implements `readColumns()` | it implements `openForRead(SourceStream): ParquetFileReader` - `metadata()`, `schema()`, `rowsNumber()`, `totalByteSize()`, `readColumns()`, `close()` (which closes the stream) | | `new ParquetFile($stream, $byteOrder, $options, $engine)` | `new ParquetFile($stream, $options, $engine->openForRead($stream))` | -| a `ParquetFile` closed its stream only when destroyed | `ParquetFile::close()` closes its reader (once); `ParquetFile::reader()` returns it | +| a `ParquetFile` closed its stream only at destruction | `ParquetFile::close()` closes its reader (once), and `ParquetFile::reader()` returns it | ### 84) `flow-php/parquet` - the arrow engine (`RustParquetEngine`, was `ArrowParquetEngine`) reads and writes through arrow-ext's new Parquet core -| Before | After | -|----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `DATE` read as `DateTimeImmutable` in zone `+00:00` | zone `UTC`, as `PhpParquetEngine` | -| `TIME` of 25 hours read as `PT25H`, `days` `false` | `d` = 1, `h` = 1, `days` an int (the `diff()` interval `PhpParquetEngine` returns) | -| `INT96` outside 1677-2262 read wrapped (0001-01-01 → 1754-08-30) | read exactly, floored to the microsecond | -| `UINT_64` above `PHP_INT_MAX` read as a numeric string | refused, as by `PhpParquetEngine` | -| writes accepted an int into `FLOAT` / `DOUBLE` / `DATE` / `TIMESTAMP` / `TIME`, a numeric string into `DECIMAL` / `UINT_64` | refused - writes accept what `PhpParquetEngine` accepts; decimals are written from floats (or ints) as `PhpParquetEngine` writes them; an object with `toString()` into `UUID` is accepted | -| `TIME` writes dropped the interval's `d` | kept | -| an offset read decoded every row group before the offset; page headers were read to the end of the file | only the row groups a read needs, each column chunk read once | -| an `INTERVAL`, a path into a `LIST` / `MAP`, `LZO` or `INT96` under `Option::INT_96_AS_DATETIME = false` failed inside arrow-ext | refused before the first batch naming the column and `\Flow\Parquet\Reader::php()` | -| `Reader::read()` returned without touching the file; an invalid file failed at `metadata()` | the footer is read when the file is opened: `Reader::read()` / `readStream()` throw `InvalidArgumentException` `Given file is not valid Parquet file: ...` | -| `Flow\Arrow\Parquet\Reader` / `Writer` / `Exception` | removed: `Flow\Parquet\Engine\{RustParquetFileReader, RustParquetFileWriter}`, `Flow\Arrow\Parquet\{RustColumnsReader, RustBatchReader}`; refusals are `Flow\Parquet\Exception\*` | -| `flow-php/parquet` installable with any arrow-ext version | `conflict: ext-arrow <0.45` | +| Before | After | +|----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `DATE` read as `DateTimeImmutable` in zone `+00:00` | zone `UTC`, as `PhpParquetEngine` | +| `TIME` of 25 hours read as `PT25H`, `days` `false` | `d` = 1, `h` = 1, `days` an int (the `diff()` interval `PhpParquetEngine` returns) | +| `INT96` outside 1677-2262 read wrapped (0001-01-01 → 1754-08-30) | read exactly, floored to the microsecond | +| `UINT_64` above `PHP_INT_MAX` read as a numeric string | refused, as by `PhpParquetEngine` | +| writes accepted an int into `FLOAT` / `DOUBLE` / `DATE` / `TIMESTAMP` / `TIME`, a numeric string into `DECIMAL` / `UINT_64` | refused. Writes accept what `PhpParquetEngine` accepts. Decimals are written from floats (or ints) as `PhpParquetEngine` writes them. An object with `toString()` into `UUID` is accepted | +| `TIME` writes dropped the interval's `d` | kept | +| an offset read decoded every row group before the offset, and page headers were read to the end of the file | only the row groups a read needs, each column chunk read once | +| an `INTERVAL`, a path into a `LIST` / `MAP`, `LZO` or `INT96` under `Option::INT_96_AS_DATETIME = false` failed inside arrow-ext | refused before the first batch naming the column and `\Flow\Parquet\Reader::php()` | +| `Reader::read()` returned without touching the file, and an invalid file failed at `metadata()` | the footer is read at file open: `Reader::read()` / `readStream()` throw `InvalidArgumentException` `Given file is not valid Parquet file: ...` | +| `Flow\Arrow\Parquet\Reader` / `Writer` / `Exception` | removed: `Flow\Parquet\Engine\{RustParquetFileReader, RustParquetFileWriter}`, `Flow\Arrow\Parquet\{RustColumnsReader, RustBatchReader}`. Refusals are `Flow\Parquet\Exception\*` | +| `flow-php/parquet` installable with any arrow-ext version | `conflict: ext-arrow <0.45` | ### 85) `flow-php/parquet` - `PhpParquetEngine` reads unsigned integers and INT96 exactly; @@ -3489,7 +3496,7 @@ public function eval(Rows $rows, FlowContext $context): Column | Before | After | |-----------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `UINT_32` 4000000000 read as `-294967296`; `UINT_64` 18446744073709551615 read as `-1` | `4000000000`; a `UINT_64` above `PHP_INT_MAX` is refused | +| `UINT_32` 4000000000 read as `-294967296`, and `UINT_64` 18446744073709551615 read as `-1` | `4000000000`. A `UINT_64` above `PHP_INT_MAX` is refused | | `INT96` 1960-01-01 23:59:59.999999999 read as 1960-01-02 00:00:00 (rounded) | 1960-01-01 23:59:59.999999 (floored, integer arithmetic) | | `FlatColumn::enum()` wrote logical `STRING` + converted `ENUM`, a file arrow-rs refuses | logical `ENUM` + converted `ENUM` | | `from_parquet()` refused a logical `ENUM` column (`ENUM is not supported`) | read as a `string` column, as `STRING` | @@ -3498,35 +3505,35 @@ public function eval(Rows $rows, FlowContext $context): Column | invalid UTF-8 into `STRING` / `JSON` / `ENUM` written (other readers reject the file) | refused naming column and row | | these checks | run under `Option::VALIDATE_DATA` (default `true`), as every other validator check | | `Validator::validate(Column $column, mixed $data): void` | `Validator::validate(Column $column, mixed $data, int $row): void` - custom validators add the parameter (the 0-based row within the writer) | -| logical `INTEGER` read without its width and sign; written back as an `IntType` missing both (a footer arrow-rs refuses) | `LogicalType::integerData(): ?LogicalType\Integer` keeps them and writes them back; `LogicalType::integer()` → `LogicalType::integer(int $bitWidth, bool $isSigned)` | +| logical `INTEGER` read without its width and sign, and written back as an `IntType` missing both (a footer arrow-rs refuses) | `LogicalType::integerData(): ?LogicalType\Integer` keeps them and writes them back. `LogicalType::integer()` → `LogicalType::integer(int $bitWidth, bool $isSigned)` | ### 86) `flow-php/arrow-ext` - Parquet core replaced -| Before | After | -|-------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `Flow\Arrow\Parquet\Reader` / `Writer` - PHP values per call (`readRowGroup()`, `writeBatch()`) | `Flow\Parquet\Engine\{RustParquetEngine, RustParquetFileReader, RustParquetFileWriter}` implement `ParquetEngine`, `ParquetFileReader`, `ParquetFileWriter` - the values `PhpParquetEngine` reads and accepts; `Flow\Arrow\Parquet\RustBatchReader` and `RustParquetFileWriter::writeArrowBatch()` hand batches to other extensions through the Arrow C Data Interface | +| Before | After | +|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `Flow\Arrow\Parquet\Reader` / `Writer`: PHP values per call (`readRowGroup()`, `writeBatch()`) | `Flow\Parquet\Engine\{RustParquetEngine, RustParquetFileReader, RustParquetFileWriter}` implement `ParquetEngine`, `ParquetFileReader`, `ParquetFileWriter`, with the values `PhpParquetEngine` reads and accepts. `Flow\Arrow\Parquet\RustBatchReader` and `RustParquetFileWriter::writeArrowBatch()` hand batches to other extensions through the Arrow C Data Interface | ### 87) `flow-php/etl-adapter-csv` - `to_csv()` writes a boolean as `true` / `false` | Before | After | |------------------------------------------------------------------|--------------------------------------------------------------------| -| `true` → `1`, `false` → an empty field, the same bytes as `null` | `true` / `false`; `null` stays an empty field | -| a NOT NULL boolean column could not be read back by `from_csv()` | reads back equal; a nullable column keeps `false` and `null` apart | +| `true` → `1`, `false` → an empty field, the same bytes as `null` | `true` / `false`, and `null` stays an empty field | +| `from_csv()` failed to read back a NOT NULL boolean column | reads back equal. A nullable column keeps `false` and `null` apart | ### 88) `flow-php/etl-adapter-csv`, `-xml`, `-text`, `-json` - a float is written as the shortest text that reads back as the same float -| Before | After | -|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------| -| CSV / XML / Text: `(string) $float`, 14 digits under the `precision` ini: `0.1 + 0.2` → `0.3` | `0.30000000000000004` | -| `1 / 3` → `0.33333333333333`, `123456789012345.678` → `1.2345678901235E+14` | `0.3333333333333333`, `123456789012345.67` | -| `1.0` → `1`, `1e25` → `1.0E+25`, `-0.0` → `-0` | `1.0`, `1.0e+25`, `-0.0` - always a fraction or an exponent | -| `NAN`, `INF`, `-INF` | unchanged; refused inside a nested CSV cell (`JsonException`) | -| JSON: the digits followed the `serialize_precision` ini (`17` → `0.10000000000000001`) | the shortest digits under any ini value | +| Before | After | +|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------| +| CSV / XML / Text: `(string) $float`, 14 digits under the `precision` ini: `0.1 + 0.2` → `0.3` | `0.30000000000000004` | +| `1 / 3` → `0.33333333333333`, `123456789012345.678` → `1.2345678901235E+14` | `0.3333333333333333`, `123456789012345.67` | +| `1.0` → `1`, `1e25` → `1.0E+25`, `-0.0` → `-0` | `1.0`, `1.0e+25`, `-0.0` - always a fraction or an exponent | +| `NAN`, `INF`, `-INF` | unchanged, but refused inside a nested CSV cell (`JsonException`) | +| JSON: the digits followed the `serialize_precision` ini (`17` → `0.10000000000000001`) | the shortest digits under any ini value | -Writing a float column forces `serialize_precision = -1` for the render and restores the ini afterwards. When the ini -holds another value, `ini_set()` must be allowed; otherwise the writers throw +Writing a float column forces `serialize_precision = -1` for the render and restores the ini afterwards. If the ini +holds another value, `ini_set()` must be allowed. Otherwise the writers throw `RuntimeException('Writing floats requires serialize_precision = -1 and ini_set() cannot change it')`. ### 89) `flow-php/etl-adapter-csv`, `-json`, `-xml`, @@ -3536,11 +3543,11 @@ holds another value, `ini_set()` must be allowed; otherwise the writers throw | Before | After | |---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------| | CSV `list`: `[{"date":"2026-01-02 03:04:05.000000","timezone_type":3,"timezone":"UTC"}]` | `["2026-01-02T03:04:05+00:00"]` (the loader's datetime format) | -| CSV `list`: `[{}]`; `list