{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/6405","labels_url":"https://api.github.com/repos/apache/spark/issues/6405/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/6405/comments","events_url":"https://api.github.com/repos/apache/spark/issues/6405/events","html_url":"https://github.com/apache/spark/pull/6405","id":80852207,"number":6405,"title":"[SPARK-7562][SPARK-6444][SQL] Improve error reporting for expression data type mismatch","user":{"login":"cloud-fan","id":3182036,"avatar_url":"https://avatars.githubusercontent.com/u/3182036?v=3","gravatar_id":"","url":"https://api.github.com/users/cloud-fan","html_url":"https://github.com/cloud-fan","followers_url":"https://api.github.com/users/cloud-fan/followers","following_url":"https://api.github.com/users/cloud-fan/following{/other_user}","gists_url":"https://api.github.com/users/cloud-fan/gists{/gist_id}","starred_url":"https://api.github.com/users/cloud-fan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloud-fan/subscriptions","organizations_url":"https://api.github.com/users/cloud-fan/orgs","repos_url":"https://api.github.com/users/cloud-fan/repos","events_url":"https://api.github.com/users/cloud-fan/events{/privacy}","received_events_url":"https://api.github.com/users/cloud-fan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":91,"created_at":"2015-05-26T08:14:29Z","updated_at":"2015-05-29T16:35:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/6405","html_url":"https://github.com/apache/spark/pull/6405","diff_url":"https://github.com/apache/spark/pull/6405.diff","patch_url":"https://github.com/apache/spark/pull/6405.patch"},"body":"It seems hard to find a common pattern of checking types in `Expression`. Sometimes we know what input types we need(like `And`, we know we need two booleans), sometimes we just have some rules(like `Add`, we need 2 numeric types which are equal). So I defined a general interface `checkInputDataTypes` in `Expression` which returns a `TypeCheckResult`. `TypeCheckResult` can tell whether this expression passes the type checking or what the type mismatch is.\r\n\r\nThis PR mainly works on apply input types checking for arithmetic and predicate expressions.\r\n\r\nTODO: apply type checking interface to more expressions."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/106866062","html_url":"https://github.com/apache/spark/pull/6405#issuecomment-106866062","issue_url":"https://api.github.com/repos/apache/spark/issues/6405","id":106866062,"user":{"login":"cloud-fan","id":3182036,"avatar_url":"https://avatars.githubusercontent.com/u/3182036?v=3","gravatar_id":"","url":"https://api.github.com/users/cloud-fan","html_url":"https://github.com/cloud-fan","followers_url":"https://api.github.com/users/cloud-fan/followers","following_url":"https://api.github.com/users/cloud-fan/following{/other_user}","gists_url":"https://api.github.com/users/cloud-fan/gists{/gist_id}","starred_url":"https://api.github.com/users/cloud-fan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloud-fan/subscriptions","organizations_url":"https://api.github.com/users/cloud-fan/orgs","repos_url":"https://api.github.com/users/cloud-fan/repos","events_url":"https://api.github.com/users/cloud-fan/events{/privacy}","received_events_url":"https://api.github.com/users/cloud-fan/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T16:35:16Z","updated_at":"2015-05-29T16:35:16Z","body":"Hi @rxin , I checked the failed test cases and there is only one case that we do need to check equality for different types: decimal types with different precisions. It seems not worth to remove the type equal constraint from `EqualTo` just for one case, should we cast it to `Decimal.unlimited` like what we did for `LessThan`?"}}