{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/19252","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/19252/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/19252/comments","events_url":"https://api.github.com/repos/apache/spark/issues/19252/events","html_url":"https://github.com/apache/spark/pull/19252","id":258228232,"number":19252,"title":"[SPARK-21969][SQL] CommandUtils.updateTableStats should call refreshTable","user":{"login":"aokolnychyi","id":6235869,"avatar_url":"https://avatars3.githubusercontent.com/u/6235869?v=4","gravatar_id":"","url":"https://api.github.com/users/aokolnychyi","html_url":"https://github.com/aokolnychyi","followers_url":"https://api.github.com/users/aokolnychyi/followers","following_url":"https://api.github.com/users/aokolnychyi/following{/other_user}","gists_url":"https://api.github.com/users/aokolnychyi/gists{/gist_id}","starred_url":"https://api.github.com/users/aokolnychyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aokolnychyi/subscriptions","organizations_url":"https://api.github.com/users/aokolnychyi/orgs","repos_url":"https://api.github.com/users/aokolnychyi/repos","events_url":"https://api.github.com/users/aokolnychyi/events{/privacy}","received_events_url":"https://api.github.com/users/aokolnychyi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-09-16T12:18:07Z","updated_at":"2017-09-19T00:07:16Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/19252","html_url":"https://github.com/apache/spark/pull/19252","diff_url":"https://github.com/apache/spark/pull/19252.diff","patch_url":"https://github.com/apache/spark/pull/19252.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nTables in the catalog cache are not invalidated once their statistics are updated. As a consequence, existing sessions will use the cached information even though it is not valid anymore. Consider and an example below. \r\n\r\n```\r\n// step 1\r\nspark.range(100).write.saveAsTable(\"tab1\")\r\n// step 2\r\nspark.sql(\"analyze table tab1 compute statistics\")\r\n// step 3\r\nspark.sql(\"explain cost select distinct * from tab1\").show(false)\r\n// step 4\r\nspark.range(100).write.mode(\"append\").saveAsTable(\"tab1\")\r\n// step 5\r\nspark.sql(\"explain cost select distinct * from tab1\").show(false)\r\n```\r\n\r\nAfter step 3, the table will be present in the catalog relation cache. Step 4 will correctly update the metadata inside the catalog but will NOT invalidate the cache.\r\n\r\nBy the way, ``spark.sql(\"analyze table tab1 compute statistics\")`` between step 3 and step 4 would also solve the problem.\r\n\r\n## How was this patch tested?\r\n\r\nCurrent and additional unit tests."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/330390293","html_url":"https://github.com/apache/spark/pull/19252#issuecomment-330390293","issue_url":"https://api.github.com/repos/apache/spark/issues/19252","id":330390293,"user":{"login":"AmplabJenkins","id":4031291,"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":"2017-09-19T00:07:16Z","updated_at":"2017-09-19T00:07:16Z","author_association":"NONE","body":"Test PASSed.\nRefer to this link for build results (access rights to CI server needed): \nhttps://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81897/\nTest PASSed."}}
{"actor":{"display_login":"AmplabJenkins"}}