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.
COPY FROM parquet
is too strict when matching Postgres tupledesc schema to the parquet file schema.e.g.
INT32
type in the parquet schema cannot be read into a Postgres column withint64
type.We can avoid this situation by casting arrow array to the array that is expected by the tupledesc
schema, if the cast is possible. We can make use of
arrow-cast
crate, which is in the same projectwith
arrow
. Its public api lets us check if a cast possible between 2 arrow types and perform the cast.To make sure the cast is possible, we need to do 2 checks:
generated for tupledesc",
to the arrow type at Parquet file" to "Postgres type at the tupledesc".
With that we can cast between many castable types as shown below:
NOTE: Struct fields must match by name and position to be cast.
Closes #67.
Part of #49.