Repository navigation
Conversation
…red values Output bindings now take `is_unsigned` from the column's `UNSIGNED_FLAG`, instead of setting it for every column. Unsigned TINYINT, SMALLINT, MEDIUMINT and YEAR stay integer. INT UNSIGNED is fetched as an exact double, so 4294967295 and 2147483648 no longer come back as NA or negative (#132, #412). BIGINT UNSIGNED with `bigint = "integer64"` is a double with class `c("mariadb_uint64", "numeric")` (#593). Its `as.character()`, `format()`, `print()` and `bit64::as.integer64()` methods read the exact values from the fetched chunk. `as.integer64()` gives NA with a warning for values of 2^63 and above. Subsets and duplicates of such a column are new ALTREP columns that index into the same chunk, so `x[2:3]` stays exact. A writable data pointer detaches the column from its storage, and `Ops` work on unclassed copies so that comparisons do not detach the original. Signed BIGINT with `bigint = "integer64"` is built eagerly as integer64, as on `main`. The other `bigint` values make BIGINT and BIGINT UNSIGNED columns ALTREP integer, double or character vectors that convert from the stored values, which replaces `convert_bigint()`. As specified by DBI, `"integer"` gives NA on overflow, `"numeric"` rounds, and `"character"` is exact. `dbColumnInfo()` and `dbFetch(n = 0)` follow `bigint` too. `mariadb_storage()` is left for layer 3. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Question:
|
|
Smoke test on 4e465af: R CMD check is OK (8839 passed, 0 failed). The two red steps share one cause. The "Commit" step merges Generated by Claude Code |
… the values of subsets `c(x)`, `range(x)`, `cumsum(x)`, `ifelse()`, `unlist()`, `which.max()` and `cbind()` request a writable data pointer of a `mariadb_uint64` column. This no longer detaches the column from its stored values, so `as.character()`, `format()`, `print()` and `bit64::as.integer64()` stay exact afterwards. The methods use the stored value of an element only where its double still equals that value. Elements modified through assignment use the new double. Doubles that are not integers in the range from 0 to 2^64 - 1 give `NA` with `as.character()`, instead of text such as "18446744073709551616". Subsets and copies of a `mariadb_uint64` column copy the selected exact values, instead of referencing the fetched data, so that `df$u[1]` no longer keeps the data of all columns alive. Modifying a copy keeps the exact values of the elements that are not modified. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
…e integer64 With an integer64 operand, `Ops` converts the `mariadb_uint64` operand with `bit64::as.integer64()`, which reads the exact values, and dispatches to bit64. The result is integer64 or logical, never a mix of the two classes. On R >= 4.3, a `chooseOpsMethod()` method selects this conversion for `x + y` where `x` is the `mariadb_uint64` and `y` the integer64 operand. For `y + x`, bit64's method is used: its result keeps the class of a longer `mariadb_uint64` operand, and the `mariadb_uint64` methods treat such results as integer64. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
The types of expressions follow the rules of columns since unsigned integers are fetched exactly. With the default `bigint = "integer64"`, `LAST_INSERT_ID()` and `CAST(... AS UNSIGNED)` of large values, which are `BIGINT UNSIGNED`, return `mariadb_uint64` vectors instead of integer64. `CONNECTION_ID()`, `CRC32()` and `CAST(? AS UNSIGNED)` of small values, which are `INT UNSIGNED`, return doubles instead of integers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Resolve the conflict in src/DbResult.cpp by keeping both sides: fetch() and get_column_info() take layer 2's `bigint` argument and start with the check_connection() call from #624, as on main. cpp11 registrations are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
…ary operators on integer64 results R wraps a shared vector of 64 or more elements in a wrapper object when setting attributes, as by `names<-`, `attr<-` and `structure()`. The exact-value methods and `[` now look through these wrappers. The wrapper class is taken from a wrapper created in `.onLoad()`. Unary operators on results of bit64's methods now dispatch to bit64, and `chooseOpsMethod()` selects this method only for integer64 operands. The documentation states that integer64 arithmetic needs R 4.3.0 and when a modified value still shows the fetched value. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Question: High finding left after the third review round (wrapped
|
|
Smoke test on b12e05e (job 141389417174): 9253 passed, 4 failed, all in Generated by Claude Code |
Handover: state of layer 2This session is being archived, at Kirill's request. State at b12e05e:
Generated by Claude Code |
Layer 2 of the ALTREP fetch design, stacked on #587 (layer 1). Closes #412, closes #593, supersedes #413.
What changes
Unsigned integers: each output bind takes
is_unsignedfromUNSIGNED_FLAG; before, every bind set it totrue.BIGINT UNSIGNED under the default
bigint = "integer64"is a double ALTREP column with classc("mariadb_uint64", "numeric"). The double view rounds above 2^53.as.character(),format()andprint()show exact values from storage. Thebit64::as.integer64()method is exact, and gives NA with a warning at 2^63 and above. The exact values survive:x[i],[.mariadb_uint64) hold a copy of only the values they select, so they do not pin the chunk.c(),range(),cumsum(),ifelse()and others) leavexexact.Opsconverts exactly and returns integer64. Fori64 + x, bit64's own method still runs, and the methods treat that mixed-class result as integer64.The class is documented as experimental in
?mariadb_uint64, which has a "Type mapping" section.Signed BIGINT, as decided in Q1:
bigint = "integer64", the default, it is built eagerly as plain integer64, identical tomain."integer","numeric"and"character", it is an ALTREP column that converts from the stored int64 on access, following the DBI spec (kept):"integer"gives a silent NA on overflow,"numeric"rounds silently, and"character"is exact.convert_bigint()is removed.bigintnow reaches C++, sodbColumnInfo()(typesinteger64,mariadb_uint64,integer,double,string) anddbFetch(n = 0)respect it.Behavior changes to note
LAST_INSERT_ID()and bit operations like3 & 1. Under the defaultbigint, these now returnmariadb_uint64instead of integer64, andCONNECTION_ID()andCRC32()return double instead of integer. See the question below.unique(),table(),x[[i]]andsaveRDS()work on the rounded doubles, so 2^53 and 2^53 + 1 compare equal there. This is documented.Testing
tests/testthat/test-fetch-integers.Rcovers:bigintvalue for BIGINT and BIGINT UNSIGNED;as.character()andas.integer64();dbColumnInfo(), and chunked fetch withn = 2.gctorture()run was clean.mainup to fix: Results of a closed connection fail cleanly instead of crashing #624.DbResult.cppkeeps fix: Results of a closed connection fail cleanly instead of crashing #624'scheck_connection()and adds thebigintargument.mariadb_storage()is left for layer 3.https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Generated by Claude Code