{"action":"created","issue":{"url":"https://api.github.com/repos/MrPowers/spark-daria/issues/50","repository_url":"https://api.github.com/repos/MrPowers/spark-daria","labels_url":"https://api.github.com/repos/MrPowers/spark-daria/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/MrPowers/spark-daria/issues/50/comments","events_url":"https://api.github.com/repos/MrPowers/spark-daria/issues/50/events","html_url":"https://github.com/MrPowers/spark-daria/issues/50","id":391414448,"node_id":"MDU6SXNzdWUzOTE0MTQ0NDg=","number":50,"title":"Functions as column extensions","user":{"login":"MrPowers","id":2722395,"node_id":"MDQ6VXNlcjI3MjIzOTU=","avatar_url":"https://avatars1.githubusercontent.com/u/2722395?v=4","gravatar_id":"","url":"https://api.github.com/users/MrPowers","html_url":"https://github.com/MrPowers","followers_url":"https://api.github.com/users/MrPowers/followers","following_url":"https://api.github.com/users/MrPowers/following{/other_user}","gists_url":"https://api.github.com/users/MrPowers/gists{/gist_id}","starred_url":"https://api.github.com/users/MrPowers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrPowers/subscriptions","organizations_url":"https://api.github.com/users/MrPowers/orgs","repos_url":"https://api.github.com/users/MrPowers/repos","events_url":"https://api.github.com/users/MrPowers/events{/privacy}","received_events_url":"https://api.github.com/users/MrPowers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-15T21:47:18Z","updated_at":"2018-12-16T10:34:33Z","closed_at":null,"author_association":"OWNER","body":"@snithish @gorros @kirubakarrs @oscarvarto - I’ve always thought it’s a bit random how Spark defines some functionality as Column functions and other functionality as SQL functions.  Here’s an example of the inconsistency:\r\n\r\n```\r\nlower(col(\"blah\").substr(0, 2))\r\n```\r\n\r\nHaving two SQL functions would look like this:\r\n\r\n```\r\nlower(substr(col(\"blah\"), 0, 2))\r\n```\r\n\r\nHaving two Column functions would look like this:\r\n\r\n```\r\ncol(\"blah\").substr(0, 2).lower()\r\n```\r\n\r\nI like the Column functions syntax, so I started monkey patching the SQL functions to the Column class: https://github.com/MrPowers/spark-daria/blob/master/src/main/scala/com/github/mrpowers/spark/daria/sql/FunctionsAsColumnExt.scala  Let me know your thoughts."},"comment":{"url":"https://api.github.com/repos/MrPowers/spark-daria/issues/comments/447632458","html_url":"https://github.com/MrPowers/spark-daria/issues/50#issuecomment-447632458","issue_url":"https://api.github.com/repos/MrPowers/spark-daria/issues/50","id":447632458,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzYzMjQ1OA==","user":{"login":"gorros","id":10191638,"node_id":"MDQ6VXNlcjEwMTkxNjM4","avatar_url":"https://avatars1.githubusercontent.com/u/10191638?v=4","gravatar_id":"","url":"https://api.github.com/users/gorros","html_url":"https://github.com/gorros","followers_url":"https://api.github.com/users/gorros/followers","following_url":"https://api.github.com/users/gorros/following{/other_user}","gists_url":"https://api.github.com/users/gorros/gists{/gist_id}","starred_url":"https://api.github.com/users/gorros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gorros/subscriptions","organizations_url":"https://api.github.com/users/gorros/orgs","repos_url":"https://api.github.com/users/gorros/repos","events_url":"https://api.github.com/users/gorros/events{/privacy}","received_events_url":"https://api.github.com/users/gorros/received_events","type":"User","site_admin":false},"created_at":"2018-12-16T10:34:33Z","updated_at":"2018-12-16T10:34:33Z","author_association":"NONE","body":"@MrPowers I prefer this syntax `col(\"blah\").substr(0, 2).lower()`, but I am curious if there is a way to do that for all functions without explicitly defining them."}}
{"actor":{"display_login":"gorros"}}