-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-11679][SQL] Invoking method " apply(fields: java.util.List[StructField])" in "StructType" gets ClassCastException #9649
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 all commits
1208354
647bf2b
c639ab4
4496753
2ebeb4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -328,7 +328,8 @@ object StructType extends AbstractDataType { | |
| def apply(fields: Seq[StructField]): StructType = StructType(fields.toArray) | ||
|
|
||
| def apply(fields: java.util.List[StructField]): StructType = { | ||
| StructType(fields.toArray.asInstanceOf[Array[StructField]]) | ||
| import scala.collection.JavaConverters._ | ||
| StructType(fields.asScala) | ||
|
Contributor
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. Without this change, was there any issue when we use
Contributor
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.
|
||
| } | ||
|
|
||
| protected[sql] def fromAttributes(attributes: Seq[Attribute]): StructType = | ||
|
|
||
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.
Related, we should just deprecate this. Its weird to have an
applyfor java.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. Yes, a java friendly API is preferred.