-
-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlatArray and Text #1856
Draft
workingjubilee
wants to merge
54
commits into
pgcentralfoundation:develop
Choose a base branch
from
workingjubilee:add-borrowing-datums-force
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
FlatArray and Text #1856
workingjubilee
wants to merge
54
commits into
pgcentralfoundation:develop
from
workingjubilee:add-borrowing-datums-force
Conversation
This file contains 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
workingjubilee
force-pushed
the
add-borrowing-datums-force
branch
from
September 11, 2024 16:37
8931538
to
861974c
Compare
workingjubilee
force-pushed
the
add-borrowing-datums-force
branch
4 times, most recently
from
September 28, 2024 21:02
d1ba6a9
to
65d503d
Compare
This needs more tests, and I'll probably split it into components so that it can be reviewed in smaller chunks, but I'm satisfied with the fundamentals of the implementation here. |
workingjubilee
changed the title
BorrowDatum, FlatArray, and Text?
BorrowDatum, FlatArray, and Text
Sep 28, 2024
This is a bit MVP-ish at the moment.
Right now, it only needs to typecheck.
Also comment out a shitton of code that doesn't compile anymore.
also remove irrelevant deny-null tests and fix remaining tests.
workingjubilee
force-pushed
the
add-borrowing-datums-force
branch
from
October 1, 2024 23:32
46d9e78
to
e2ba9ac
Compare
Details of Text's impl are unsound (or at least, hard to use soundly?). I am going to PR it separately with sufficient tests. |
I think it mostly needs to be as pedantic about alignment as I was afraid of. |
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.
Introduce a new Rust type that serves as a definition of what Postgres ArrayTypes "really are", called FlatArray. This is meant to be manipulated via
&FlatArray<'_, T>
... it is an "unsized type". It uses BorrowDatum to power its simplicity in iteration, compared to the incredibly jank implementation inpgrx/src/datum/array.rs
! I should know it's jank, because I wrote it!The cost is that it is much more nitpicky about what it can work with, as for a given
FlatArray<'_, T>
, we also requireBorrowDatum
in order to do anything useful with it! This means FlatArray can't be, say,FlatArray<'mcx, String>
, and implicitly unbox elements into allocated types. You can still just use.iter().map()
, of course, and the good news is this means all FlatArrays must truly be "zero-copy", as the type definition doesn't allow anything else.As part of this compromise, we introduce a new Text type so that it is still possible to work with common array needs like strings.
Together, these are effectively the first varlena types that allow directly interacting with the data in their varlena header instead of "forgetting" it.