-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15491][SQL]fix assertion failure for JDBC DataFrame to JSON #13287
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
Conversation
|
Can one of the admins verify this patch? |
|
Thanks for the pull request. Can you format the description better? |
|
@rxin Sorry, I didn't notice your comment until this morning. Reformatted the description. Thanks! |
|
Can we create a unit test for TreeNode, rather than using JDBC? |
|
@rxin Thanks for your comment.
|
|
@rxin gentle ping |
|
Is it still an issue? |
|
@gatorsmile For a class that has two level of constructor parameters, e.g.
|
| // probably a better way to check it. | ||
| case obj if obj.getClass.getName.endsWith("$") => "object" -> obj.getClass.getName | ||
| // returns null if the product type doesn't have a primary constructor, e.g. HiveFunctionWrapper | ||
| case p: Product => try { |
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.
Could you check the master branch? We limit toJson to limited node types after #14990. shouldConvertToJson. It sounds like the class you mentioned above is not part of the support types
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.
Thank you very much for your reply.
Shall we also allow the JDBCRelation to be converted to JSON like the following?
val jdbcDF = sqlContext.read.format("jdbc").options(
Map("url" -> "jdbc:h2:mem:testdb0;user=testUser;password=testPass",
"dbtable" -> "people")).load().queryExecution.logical.toJSON
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.
Maybe not needed now unless it is required.
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.
Thanks. I will close this PR.
What changes were proposed in this pull request?
in TreeNode.scala parseToJson, it has
For a class that has two level of constructor parameters, for example,
val fieldValues = p.productIterator.toSeq will only get the values for the first level of constructor parameters, in this case, 4 parameters, but
val fieldNames = getConstructorParameterNames(p.getClass)
will get all the 5 parameters, so assert(fieldNames.length == fieldValues.length) will fail.
I will change code to make fieldValues have all the parameters.
How was this patch tested?
Added a unit test.