Skip to content
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

Cosmos Spark: Fixes conversion for MapType schema #22291

Merged
merged 3 commits into from Jun 16, 2021

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented Jun 15, 2021

When converting from JSON (ObjectNode) to Row (Spark) a document that had a nested object, for example:

{
    "nested" : {
        "property": "value"
    }
}

If the pre-defined schema was using MapType, for example MapType(keyType = StringType, valueType = StringType, valueContainsNull = false), it was throwing the following error:

Error while encoding: java.lang.RuntimeException: scala.collection.Iterator$$anon$10 is not a valid external type for schema of map<string,string>

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick help!

Copy link
Contributor

@moderakh moderakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thanks

@ealsur
Copy link
Member Author

ealsur commented Jun 15, 2021

/azp run java - cosmos - spark

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ealsur ealsur enabled auto-merge (squash) June 15, 2021 23:35
@ealsur
Copy link
Member Author

ealsur commented Jun 16, 2021

/azp run java - cosmos - spark

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ealsur ealsur merged commit 77f6412 into master Jun 16, 2021
@ealsur ealsur deleted the users/ealsur/mapconversion branch June 16, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmos:spark3 Cosmos DB Spark3 OLTP Connector Cosmos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants