-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20427][SQL] Read JDBC table use custom schema #18266
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
871c303
0444c4d
06881e8
ffaee42
a984f3b
e0fc6b4
9e6f7cf
5fdd2bb
87df014
63d3244
e08ccbb
247fc78
b8b03e2
b040c72
2ea56fc
1e2c1d9
b38a1a8
0b67f0f
7fc97b4
1fdf002
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,8 +82,8 @@ object JDBCRDD extends Logging { | |
| * @return A Catalyst schema corresponding to columns in the given order. | ||
| */ | ||
| private def pruneSchema(schema: StructType, columns: Array[String]): StructType = { | ||
| val fieldMap = Map(schema.fields.map(x => x.name -> x): _*) | ||
| new StructType(columns.map(name => fieldMap(name))) | ||
| val fieldMap = Map(schema.fields.map(x => x.name -> x): _*) | ||
|
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. Sorry, I did not get your point. Could you show me an example? Is it a behavior breaking change?
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.
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. I see. Could we just get rid of the line where we put
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. It seems safe to remove this line. |
||
| new StructType(columns.map(name => fieldMap(name))) | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
x.metadata.getString("name")always equalsx.name:https://github.com/apache/spark/blob/v2.2.0-rc5/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala#L291
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 not a related change. Could you revert it back?
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.
CatalystSqlParser.parseTableSchema(columnTypes)constructed StructType without metadata, error message: