-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-10186][SQL][WIP] Array types using JDBCRDD and postgres #9137
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
Changes from 1 commit
72beea6
c55e5ff
bcbafc4
5db8589
2664dc8
755ec14
c07e5f2
8d40495
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Added array type writes
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,6 +225,8 @@ case object PostgresDialect extends JdbcDialect { | |
| Some(StringType) | ||
| } else if (sqlType == Types.OTHER && typeName.equals("jsonb")) { | ||
| Some(StringType) | ||
| } else if (sqlType == Types.OTHER && typeName.equals("uuid")) { | ||
| Some(StringType) | ||
| } else if (sqlType == Types.ARRAY) { | ||
| typeName match { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does we need underscores in the head of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The underscores are particularly for the array types. Postgres prepends them to all array types here https://github.com/pgjdbc/pgjdbc/blob/REL9_4_1204/org/postgresql/jdbc2/TypeInfoCache.java#L159
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood. |
||
| case "_bit" | "_bool" => Some(ArrayType(BooleanType)) | ||
|
|
@@ -235,7 +237,7 @@ case object PostgresDialect extends JdbcDialect { | |
| case "_money" | "_float8" => Some(ArrayType(DoubleType)) | ||
| case "_text" | "_varchar" | "_char" | "_bpchar" | "_name" => Some(ArrayType(StringType)) | ||
| case "_bytea" => Some(ArrayType(BinaryType)) | ||
| case "_timestamp" | "timestamptz" | "time" | "timetz" => Some(ArrayType(TimestampType)) | ||
| case "_timestamp" | "_timestamptz" | "_time" | "_timetz" => Some(ArrayType(TimestampType)) | ||
| case "_date" => Some(ArrayType(DateType)) | ||
| case "_numeric" | ||
| if size != 0 || scale != 0 => Some(ArrayType(DecimalType(size, scale))) | ||
|
|
||
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.
ISTM we need to check if input types are valid for target databases in advance, e.g., in JavaUtils#saveTable.
JavaUtils#savePartition should simply put input data as given typed-data.
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.
If the particular dialect does not support these types saveTable should toss an exception when building the nullTypes array