Repository navigation
Conversation
…float types The internal Arrow chunk fetch and stream take a `schema`, a nanoarrow schema of a struct type, whose children request the types of the result columns by position. The requested types are fixed from the first chunk of the execution on, as if an earlier chunk had decided them, also for columns of only NULL values and for results without rows. Besides the types that a first chunk decides, a fetch can request int8 to int64, uint8 to uint64, bool and float. Values that don't fit go through the warnings about converted values: integer types truncate reals and read text as its leading integer, uint64 also beyond 2^63 - 1, and give NULL beyond their range, negative values in unsigned types too; bool is the integer type of the range 0 to 1; float takes the nearest float and counts integers that it rounds. A schema with another number of columns or an unsupported type fails before any row is read and leaves the result unclaimed. A request after the first chunk must match the types it has fixed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
…uested-types Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
Member
Author
Question: what should a requested
|
A first fetch that failed left the requested types fixed, so a later request for other types failed with an error about them instead of the failure of the execution. The chunk sink now takes the requested types, and the result fixes them only once the chunk is built; an Arrow stream passes its request on with each fetch. The failure of the execution comes before the checks of the request. The comments say that only the types of a requested schema count: columns stay nullable and carry no metadata or flags. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
…uested-types The stream keeps the requested types in its state and passes them on with each fetch, also on a worker thread, whose warnings go through the queue of the main thread. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
…uested-types The `schema` arguments follow the entry points of the stream: the R wrappers flush the warnings of worker reads first, and the C++ functions hold the result for their whole run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
… into claude/rb-arrow-requested-types Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
…uested-types Creating a stream checks the requested types when it claims the result, before it reads the rest of an Arrow stream of parameters. The requested types add no call that can run the busy handler. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
…uested-types Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
… into claude/rb-arrow-requested-types Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
This was referenced Dec 1, 2026
This branch has not been deployed
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.
No change of behavior for users: this adds the internal ability for an Arrow fetch to build its columns as requested types instead of the types that the first chunk infers. The internal chunk fetch (
fetch_arrow_chunk_warn(),result_fetch_arrow_chunk()) and stream creation (read_arrow_stream(),result_create_arrow_stream()) take aschema, a struct nanoarrow schema whose children request the column types by position. Only the types count: the names, nullability, metadata, extension and flags of the schema and its children are ignored, so the columns keep the result's names and are always nullable. Plan item 18 exposes this as the user-facingschemaargument, item 14 adds large, date64, time and timestamp types in other units and time zones.Requested types are fixed from the first chunk of the execution on, as if an earlier chunk had decided them, whatever the values and declared types, also for columns of only NULL values and for results without rows. The result fixes them only once a chunk has been built: after a first fetch that fails partway, later fetches raise that failure, before any check of a new request, and a new execution can request other types. Besides the types that a first chunk decides (null, int64, double, utf8, binary, date32, time64[us], timestamp[us, UTC]), a fetch can request int8, int16, int32, uint8, uint16, uint32, uint64, bool and float. Half float is not supported yet: nanoarrow's encoder truncates and flushes subnormals, so it would need its own conversion.
Values that don't fit go through the warnings of #961, by column and kind, consistent with the existing rules for a fixed int64 column. Integer types truncate reals toward zero (counted as truncated), read text and blobs as their leading integer as for
CAST()(counted as converted), and give NULL beyond their range, negative values in unsigned types included (counted as out of range); uint64 reads text beyond 2^63 - 1 in full where SQLite would saturate it. Bool is the integer type of the range 0 to 1: 0.5 and 1.5 are truncated, -1 and 2 are NULL, and text such as 'true' reads as 0 as forCAST(). Float takes the nearest float, counts integers beyond 2^24 that it rounds (the "rounded" warning now names the type), doesn't count reals, and gives NULL for reals beyond its range; infinities stay. A requested int64 truncates reals in the first chunk instead of widening to double.A schema with another number of columns, a type that can't be built (half float, large types, date64, other time units or zones, dictionaries, nested and extension types), or a non-struct schema fails before any row is read and before the fetch claims the result, so a data-frame fetch still works afterwards. A request after the first chunk must request the types it has fixed; no request keeps them. A new execution infers its types anew unless they are requested again. Byte limits (#963) apply only to utf8 and binary columns, so a requested numeric column takes text of any size; a kept chunk (#962) comes back with its requested types.
Tested in the new
tests/testthat/test-arrow-requested-types.R: a failed first fetch (red before the fix in db996de, which raised the error about fixed types), nullability and metadata, each type at its minimum and maximum and just beyond, reals, text, blobs (also in a UTF-16 database), NULL columns, empty results, declared types, chunks and new executions, warnings, byte limits, kept chunks withwarn = 2, streams, and wrong schemas. Full suite withNOT_CRAN=true: FAIL 0, WARN 3 (thezh_TW.UTF-8locale is missing in the container), SKIP 64, PASS 13710. Valgrind on the new test file: 0 errors, 0 bytes definitely lost.Item 13 of the plan in #829 (comment), a layer of the rebuilt chain planned in #880; based on #978 (item 15, the stream-thread check), which sits on #977. The approach to the integer ranges and to uint64 text is ported from the first draft #801, adapted to the fixed kinds of the rebuilt chain.
Coordinating session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
Generated by Claude Code