allow custom type converters to be utilized for collection types - #1204
Open
aashishs101 wants to merge 3 commits into
Open
allow custom type converters to be utilized for collection types#1204aashishs101 wants to merge 3 commits into
aashishs101 wants to merge 3 commits into
Conversation
Author
|
test this please |
Author
|
test this please |
Author
|
@RussellSpitzer I'm not sure why the automated testing isn't working on this branch |
Author
|
@RussellSpitzer what steps would I need to go through to get this merged? |
Author
|
@RussellSpitzer: sorry to bother, but wondering if it is possible to get this PR in? |
Member
|
@aashishs101 Sorry about that, we only check the JIRA so I miss if people post PR's without an accompanying ticket. Please file one and we'll get to review and testing ASAP. |
Member
|
test this please |
Member
|
Only authorized users can start the tests :) |
|
Build against Scala 2.11 finished with failure |
Member
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the connector limits users' ability to create custom type converters for collection types. Instead, it only allows the use of the default collection converters, which just apply in-scope converters to the elements of a collection, while ignoring any user-defined converters for the collection type. This prevents use cases where a converter is being used to convert a non-collection type into a collection, or where a collection is being converted into another collection (for instance we want to only store the keys of a map as a list). Currently, when such a custom converter is specified, it will fail with the following exception:
[info] - should write to a table with HLLs *** FAILED *** [info] org.apache.spark.SparkException: Job aborted due to stage failure: Task 11 in stage 0.0 failed 1 times, most recent failure: Lost task 11.0 in stage 0.0 (TID 11, localhost, executor driver): com.datastax.spark.connector.types.TypeConversionException: Cannot convert object OurType(14,16384,0.7212525005219688) of type class com.us.commons.internal.util.fn.OurType to Map[AnyRef,AnyRef]. [info] at com.datastax.spark.connector.types.TypeConverter$$anonfun$convert$1.apply(TypeConverter.scala:45) [info] at com.datastax.spark.connector.types.TypeConverter$CollectionConverter$$anonfun$convertPF$35.applyOrElse(TypeConverter.scala:694) [info] at com.datastax.spark.connector.types.TypeConverter$class.convert(TypeConverter.scala:43) [info] at com.datastax.spark.connector.types.TypeConverter$CollectionConverter.convert(TypeConverter.scala:682)This is because of lines like this one that don't try to look for the correct type converter in scope. The proposed change keeps the current functionality of using the default collection converters, but only when a custom one isn't also in scope.
JIRA Ticket: https://datastax-oss.atlassian.net/browse/SPARKC-556