{"action":"created","issue":{"url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/200","repository_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic","labels_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/200/comments","events_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/200/events","html_url":"https://github.com/jupyter-incubator/sparkmagic/issues/200","id":142822438,"number":200,"title":"CREATE TABLE without IF NOT EXISTS fails","user":{"login":"msftristew","id":13972471,"avatar_url":"https://avatars.githubusercontent.com/u/13972471?v=3","gravatar_id":"","url":"https://api.github.com/users/msftristew","html_url":"https://github.com/msftristew","followers_url":"https://api.github.com/users/msftristew/followers","following_url":"https://api.github.com/users/msftristew/following{/other_user}","gists_url":"https://api.github.com/users/msftristew/gists{/gist_id}","starred_url":"https://api.github.com/users/msftristew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msftristew/subscriptions","organizations_url":"https://api.github.com/users/msftristew/orgs","repos_url":"https://api.github.com/users/msftristew/repos","events_url":"https://api.github.com/users/msftristew/events{/privacy}","received_events_url":"https://api.github.com/users/msftristew/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-23T00:52:15Z","updated_at":"2016-03-23T16:53:17Z","closed_at":null,"body":"     %%sql  \r\n     CREATE TABLE bar (\r\n       baz int\r\n     )\r\n\r\nThis fails with this error:\r\n\r\n     An error occurred while calling o56.sql.\r\n: org.apache.spark.sql.execution.QueryExecutionException: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. AlreadyExistsException(message:Table bar already exists)\r\n\r\nThe SQL query actually gets executed twice (once to figure out the dataframe has no data, and another time to get the column names).  But it fails to execute the query the second time because the table was created the first time.\r\n\r\nYou can work around this issue by doing\r\n\r\n    %%sql\r\n    CREATE TABLE IF NOT EXISTS bar (...\r\n\r\n... but it would be ideal if we could avoid this altogether.\r\n\r\nI do not know if it's possible to do queries like `INSERT` in Hive, but this would also affect that by running the `INSERT` query twice."},"comment":{"url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/comments/200438597","html_url":"https://github.com/jupyter-incubator/sparkmagic/issues/200#issuecomment-200438597","issue_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/200","id":200438597,"user":{"login":"msftristew","id":13972471,"avatar_url":"https://avatars.githubusercontent.com/u/13972471?v=3","gravatar_id":"","url":"https://api.github.com/users/msftristew","html_url":"https://github.com/msftristew","followers_url":"https://api.github.com/users/msftristew/followers","following_url":"https://api.github.com/users/msftristew/following{/other_user}","gists_url":"https://api.github.com/users/msftristew/gists{/gist_id}","starred_url":"https://api.github.com/users/msftristew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msftristew/subscriptions","organizations_url":"https://api.github.com/users/msftristew/orgs","repos_url":"https://api.github.com/users/msftristew/repos","events_url":"https://api.github.com/users/msftristew/events{/privacy}","received_events_url":"https://api.github.com/users/msftristew/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T16:53:17Z","updated_at":"2016-03-23T16:53:17Z","body":"I think so.  So the autoviz widget would just be a little text box saying \"No results\" if the result dataframe is empty."}}