{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/21148","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/21148/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/21148/comments","events_url":"https://api.github.com/repos/apache/spark/issues/21148/events","html_url":"https://github.com/apache/spark/pull/21148","id":317474769,"number":21148,"title":"[SPARK-24079][SQL] Update the nullability of Join output based on inferred predicates","user":{"login":"maropu","id":692303,"avatar_url":"https://avatars3.githubusercontent.com/u/692303?v=4","gravatar_id":"","url":"https://api.github.com/users/maropu","html_url":"https://github.com/maropu","followers_url":"https://api.github.com/users/maropu/followers","following_url":"https://api.github.com/users/maropu/following{/other_user}","gists_url":"https://api.github.com/users/maropu/gists{/gist_id}","starred_url":"https://api.github.com/users/maropu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maropu/subscriptions","organizations_url":"https://api.github.com/users/maropu/orgs","repos_url":"https://api.github.com/users/maropu/repos","events_url":"https://api.github.com/users/maropu/events{/privacy}","received_events_url":"https://api.github.com/users/maropu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-25T04:26:46Z","updated_at":"2018-04-25T11:33:46Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/21148","html_url":"https://github.com/apache/spark/pull/21148","diff_url":"https://github.com/apache/spark/pull/21148.diff","patch_url":"https://github.com/apache/spark/pull/21148.patch"},"body":"## What changes were proposed in this pull request?\r\nThis pr added code to update the nullability of `Join.output` based on inferred predicates in `InferFiltersFromConstraints`. In the master, a logical `Join` node does not respect the nullability that the optimizer rule `InferFiltersFromConstraints` might change when inferred predicates have `IsNotNull`,\r\ne.g.,\r\n\r\n```\r\nscala> val df1 = Seq((Some(1), Some(2))).toDF(\"k\", \"v0\")\r\nscala> val df2 = Seq((Some(1), Some(3))).toDF(\"k\", \"v1\")\r\nscala> val joinedDf = df1.join(df2, df1(\"k\") === df2(\"k\"), \"inner\")\r\nscala> joinedDf.explain\r\n== Physical Plan ==\r\n*(2) BroadcastHashJoin [k#83], [k#92], Inner, BuildRight\r\n:- *(2) Project [_1#80 AS k#83, _2#81 AS v0#84]\r\n:  +- *(2) Filter isnotnull(_1#80)\r\n:     +- LocalTableScan [_1#80, _2#81]\r\n+- BroadcastExchange HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)))\r\n   +- *(1) Project [_1#89 AS k#92, _2#90 AS v1#93]\r\n      +- *(1) Filter isnotnull(_1#89)\r\n         +- LocalTableScan [_1#89, _2#90]\r\n\r\nscala> joinedDf.queryExecution.optimizedPlan.output.map(_.nullable)\r\nres15: Seq[Boolean] = List(true, true, true, true)\r\n```\r\n\r\nBut, these `nullable` values should be:\r\n\r\n```\r\nscala> joinedDf.queryExecution.optimizedPlan.output.map(_.nullable)\r\nres15: Seq[Boolean] = List(false, true, false, true)\r\n```\r\n\r\nThis ticket comes from the previous discussion: https://github.com/apache/spark/pull/18576#pullrequestreview-107585997\r\n\r\n## How was this patch tested?\r\nAdded tests in `UpdateNullabilityInAttributeReferencesSuite`.\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/384255433","html_url":"https://github.com/apache/spark/pull/21148#issuecomment-384255433","issue_url":"https://api.github.com/repos/apache/spark/issues/21148","id":384255433,"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":"2018-04-25T11:33:45Z","updated_at":"2018-04-25T11:33:45Z","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/89833/\nTest PASSed."}}
{"actor":{"display_login":"AmplabJenkins"}}