{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/21550","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/21550/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/21550/comments","events_url":"https://api.github.com/repos/apache/spark/issues/21550/events","html_url":"https://github.com/apache/spark/pull/21550","id":331888817,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0NTA0NTY5","number":21550,"title":"[SPARK-24543][SQL] Support any type as DDL string for from_json's schema","user":{"login":"MaxGekk","id":1580697,"node_id":"MDQ6VXNlcjE1ODA2OTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1580697?v=4","gravatar_id":"","url":"https://api.github.com/users/MaxGekk","html_url":"https://github.com/MaxGekk","followers_url":"https://api.github.com/users/MaxGekk/followers","following_url":"https://api.github.com/users/MaxGekk/following{/other_user}","gists_url":"https://api.github.com/users/MaxGekk/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxGekk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxGekk/subscriptions","organizations_url":"https://api.github.com/users/MaxGekk/orgs","repos_url":"https://api.github.com/users/MaxGekk/repos","events_url":"https://api.github.com/users/MaxGekk/events{/privacy}","received_events_url":"https://api.github.com/users/MaxGekk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-13T08:17:35Z","updated_at":"2018-06-13T08:22:02Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/21550","html_url":"https://github.com/apache/spark/pull/21550","diff_url":"https://github.com/apache/spark/pull/21550.diff","patch_url":"https://github.com/apache/spark/pull/21550.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nIn the PR, I propose to support any DataType represented as DDL string for the from_json function. After the changes, it will be possible to specify `MapType` in SQL like:\r\n```sql\r\nselect from_json('{\"a\":1, \"b\":2}', 'map<string, int>')\r\n```\r\nand in Scala (similar in other languages)\r\n```scala\r\nval in = Seq(\"\"\"{\"a\": {\"b\": 1}}\"\"\").toDS()\r\nval schema = \"map<string, map<string, int>>\"\r\nval out = in.select(from_json($\"value\", schema, Map.empty[String, String]))\r\n```\r\n\r\n## How was this patch tested?\r\n\r\nAdded a couple sql tests and modified existing tests for Python and Scala. The former tests were modified because it is not imported for them in which format schema for `from_json` is provided."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/396855789","html_url":"https://github.com/apache/spark/pull/21550#issuecomment-396855789","issue_url":"https://api.github.com/repos/apache/spark/issues/21550","id":396855789,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Njg1NTc4OQ==","user":{"login":"AmplabJenkins","id":4031291,"node_id":"MDQ6VXNlcjQwMzEyOTE=","avatar_url":"https://avatars3.githubusercontent.com/u/4031291?v=4","gravatar_id":"","url":"https://api.github.com/users/AmplabJenkins","html_url":"https://github.com/AmplabJenkins","followers_url":"https://api.github.com/users/AmplabJenkins/followers","following_url":"https://api.github.com/users/AmplabJenkins/following{/other_user}","gists_url":"https://api.github.com/users/AmplabJenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/AmplabJenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmplabJenkins/subscriptions","organizations_url":"https://api.github.com/users/AmplabJenkins/orgs","repos_url":"https://api.github.com/users/AmplabJenkins/repos","events_url":"https://api.github.com/users/AmplabJenkins/events{/privacy}","received_events_url":"https://api.github.com/users/AmplabJenkins/received_events","type":"User","site_admin":false},"created_at":"2018-06-13T08:22:02Z","updated_at":"2018-06-13T08:22:02Z","author_association":"NONE","body":"Can one of the admins verify this patch?"}}
{"actor":{"display_login":"AmplabJenkins"}}