Repository navigation
Answer COPY TO with RETURN_STATS as the rows, sizes and column statistics of each Parquet file - #2999
Merged
Merged
Conversation
…tics of each Parquet file
tamnd
force-pushed
the
d5-return-stats
branch
from
October 10, 2026 04:00
4854471 to
347a195
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1446.
COPY ... TOa Parquet file now takesRETURN_STATS. The copy answers one row per file withfilename,count,file_size_bytes,footer_size_bytes,column_statistics,partition_keysandextra_info, with the same types as the pin.column_statisticsmaps each column, named in double quotes with inner quotes doubled, to itscolumn_size_bytes,null_count,num_valuesand, when the column has values, its bounds withmin_is_exactandmax_is_exact. The keys are sorted, as the pin sorts them. A bool reports 1 and 0, a blob reports its bytes in hex, and a string or blob longer than 256 bytes is cut short and marked as not exact, with the upper bound raised so it stays above every value.partition_keysholds the partition values as text in the order ofPARTITION_BYand is NULL for a copy that is not partitioned.extra_infoholds the row group count.A float column also reports
has_nanandnan_count, counted over every row group. This follows the corpus, which comes from a DuckDB newer than the pin. v2.0.0-dev84237 has nonan_countand only keepshas_nanfrom the last row group it wrote. A column with no values reports neither, as in the pin.The Parquet writer keeps running totals for each column as it writes row groups, and hands back the footer size when it finishes. The sizes are the writer's own, so they differ from the pin's byte for byte, which the corpus allows for with a regex.