-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: support float4 data type #1481
Conversation
Adds support for the `float4` / `real` data type.
@@ -212,8 +214,6 @@ private static Object toValidSpannerElement(@Nonnull Object value, int elementOi | |||
return ((Short) value).longValue(); | |||
case Oid.INT4: | |||
return ((Integer) value).longValue(); | |||
case Oid.FLOAT4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is being removed now, as these are data types that needed special handling because:
- We allow PostgreSQL clients to send us
int2[]
,int4[]
andfloat4[]
arrays. - These are converted to
int8[]
andfloat8[]
before being sent to Cloud Spanner. - This conversion is no longer needed for
float4
when Cloud Spanner supportsfloat4
natively.
@@ -384,7 +384,6 @@ public class PgType implements PgCatalogTable { | |||
+ " || (case typname\n" | |||
+ " when 'int2' then 'false'\n" | |||
+ " when 'int4' then 'false'\n" | |||
+ " when 'float4' then 'false'\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the 'typisdefined' column in pg_type
. Up until now we listed float4
as a 'type that we know, but that is not implemented'.
+ this.tableColumns.keySet().size() | ||
+ " columns, but only found " | ||
+ record.numColumns(), | ||
String.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not directly related to the addition of float4
, but it popped up during the development that the error message was a bit weird. The error is thrown when the number of columns in the input of the COPY operation is different from the expected number of columns. The error message 'assumed' that the number of input columns was always smaller than the expected number of values (see the '... but only found' part).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## postgresql-dialect #1481 +/- ##
========================================================
+ Coverage 90.72% 90.79% +0.07%
- Complexity 2684 2701 +17
========================================================
Files 144 144
Lines 9226 9249 +23
Branches 1342 1343 +1
========================================================
+ Hits 8370 8398 +28
+ Misses 578 574 -4
+ Partials 278 277 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Adds support for the
float4
/real
data type.Integration tests use
float8
on environments that do not yet supportfloat4
.