NoahKusaba opened a new pull request, #161:
URL: https://github.com/apache/datafusion-iceberg/pull/161

   ## Which issue does this PR close?
   
   Part of #23. Stacked on #158: only the last commit, `test: run every 
sqllogictest through the physical codec`, is new. I'll rebase it once #158 
merges.
   
   ## Rationale for this change
   
   #158 tests the codec case by case. Nothing checks that the queries in this 
crate's SQL tests still return the same rows once their plans have been encoded 
and decoded. That matters more over time: any state a scan gains later, such as 
dynamic filters (#144), sort order (#55) or split offsets (#108), must also be 
added to the codec, or a decoded scan silently runs differently from the 
planned one. Running the existing SQL suite through the codec catches that for 
every query, without a codec test per feature.
   
   ## What changes are included in this PR?
   
   - Every schedule runs a second time, as `schedule (codec round trip): 
<file>`. That run plans scans eagerly. Each plan that reads an Iceberg table is 
encoded with `IcebergPhysicalCodec`, decoded in a fresh session that has none 
of the tables, checked to display the same as the original, and run there.
   - Some plans run unencoded:
     - plans with nodes the codec doesn't encode yet (writes, commits, metadata 
tables), listed in one function to shrink as the codec learns them;
     - `EXPLAIN`, which is planned lazily so that the existing expectations 
still hold.
   - The catalog writes to a temp dir instead of memory, in both runs. 
In-memory files don't survive the codec: a decoded scan gets an empty in-memory 
store. Using the same storage in both runs means they differ only in how plans 
run.
   - A `LIMIT` query in `basic_queries.slt`, so that a scan with a limit goes 
through the codec. No other query did.
   
   #158's follow-ups describe this as running "one partition at a time". It 
runs the whole decoded plan in one session instead. Where a plan repartitions 
the scan's output, running one output partition means running the whole scan in 
each copy, and the copies only agree on which rows go to which partition if the 
scan returns its batches in the same order every time. Reading several files at 
once (`data_file_concurrency_limit` above 1) breaks that, which would make the 
suite flaky. #158's `each_partition_runs_alone_in_its_own_session` already 
covers each partition running alone.
   
   ## Are these tested?
   
   This PR is a test. 89 plans go through the codec, in each of the 10 
schedules that read a table (`df_show_tables` doesn't). They include scans with 
no files, with several files, with pushed-down predicates, with a limit, and of 
the encrypted table.
   
   To check that it catches codec bugs, I broke the codec's decoding in three 
ways. Each failed only the codec run:
   
   - dropping the scan's limit: caught by the display check;
   - keeping only one file per partition: caught by the display check, and, 
with that check turned off, by the query results.
   
   The suite still runs in about a second.
   
   ## Are there any user-facing changes?
   
   No. This only changes the unpublished sqllogictest crate.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to