{"action":"created","comment":{"url":"https://api.github.com/repos/square/sqldelight/pulls/comments/65409687","id":65409687,"diff_hunk":"@@ -111,4 +122,40 @@ private fun resolve(literalValue: SqliteParser.Literal_valueContext): Resolution\n     return Resolution(values = listOf(Value(null, null, Value.SqliteType.NULL, literalValue, null)))\n   }\n   return Resolution(ResolutionError.IncompleteRule(literalValue, \"Unsupported literal\"))\n+}\n+\n+private fun Resolver.resolveFunction(\n+    expression: SqliteParser.ExprContext,\n+    subqueriesAllowed: Boolean\n+): Resolution {\n+  var sqliteType = Value.SqliteType.INTEGER\n+  val resolutions = expression.expr().map { resolve(it, subqueriesAllowed) }\n+  expression.function_name().text.let { functionName ->\n+    when (functionName) {\n+      \"date\", \"time\", \"datetime\", \"julianday\", \"strftime\", \"char\", \"hex\", \"lower\", \"ltrim\",\n+      \"printf\", \"quote\", \"replace\", \"rtrim\", \"soundex\", \"sqlite_compileoption_get\",\n+      \"sqlite_source_id\", \"sqlite_version\", \"substr\", \"trim\", \"typeof\", \"upper\",\n+      \"group_concat\" -> {\n+        sqliteType = Value.SqliteType.TEXT\n+      }\n+      \"changes\", \"instr\", \"last_insert_rowid\", \"length\", \"random\", \"sqlite_compileoption_used\",\n+      \"total_changes\", \"unicode\", \"count\" -> {\n+        sqliteType = Value.SqliteType.INTEGER\n+      }\n+      \"randomblob\", \"zeroblob\" -> {\n+        sqliteType = Value.SqliteType.BLOB\n+      }\n+      \"round\", \"avg\", \"sum\", \"total\" -> {","path":"sqldelight-compiler/src/main/kotlin/com/squareup/sqldelight/resolution/ExpressionResolver.kt","position":150,"original_position":150,"commit_id":"1056441ea4bba44d0cd0e981a2521a199c8939fb","original_commit_id":"1056441ea4bba44d0cd0e981a2521a199c8939fb","user":{"login":"AlecStrong","id":1675456,"avatar_url":"https://avatars.githubusercontent.com/u/1675456?v=3","gravatar_id":"","url":"https://api.github.com/users/AlecStrong","html_url":"https://github.com/AlecStrong","followers_url":"https://api.github.com/users/AlecStrong/followers","following_url":"https://api.github.com/users/AlecStrong/following{/other_user}","gists_url":"https://api.github.com/users/AlecStrong/gists{/gist_id}","starred_url":"https://api.github.com/users/AlecStrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlecStrong/subscriptions","organizations_url":"https://api.github.com/users/AlecStrong/orgs","repos_url":"https://api.github.com/users/AlecStrong/repos","events_url":"https://api.github.com/users/AlecStrong/events{/privacy}","received_events_url":"https://api.github.com/users/AlecStrong/received_events","type":"User","site_admin":false},"body":"will do.\r\n\r\nThankfully you can always cast data types if you want a certain type on the java side\r\n\r\neg\r\n\r\n```\r\nSELECT CAST (sum(int_column) AS INTEGER)\r\nFROM test\r\n```\r\n\r\nnot ideal but at least its capable in its current state.","created_at":"2016-06-01T17:51:03Z","updated_at":"2016-06-01T17:51:03Z","html_url":"https://github.com/square/sqldelight/pull/303#discussion_r65409687","pull_request_url":"https://api.github.com/repos/square/sqldelight/pulls/303","_links":{"self":{"href":"https://api.github.com/repos/square/sqldelight/pulls/comments/65409687"},"html":{"href":"https://github.com/square/sqldelight/pull/303#discussion_r65409687"},"pull_request":{"href":"https://api.github.com/repos/square/sqldelight/pulls/303"}}},"pull_request":{"url":"https://api.github.com/repos/square/sqldelight/pulls/303","id":72218929,"html_url":"https://github.com/square/sqldelight/pull/303","diff_url":"https://github.com/square/sqldelight/pull/303.diff","patch_url":"https://github.com/square/sqldelight/pull/303.patch","issue_url":"https://api.github.com/repos/square/sqldelight/issues/303","number":303,"state":"open","locked":false,"title":"Get proper types for functions","user":{"login":"AlecStrong","id":1675456,"avatar_url":"https://avatars.githubusercontent.com/u/1675456?v=3","gravatar_id":"","url":"https://api.github.com/users/AlecStrong","html_url":"https://github.com/AlecStrong","followers_url":"https://api.github.com/users/AlecStrong/followers","following_url":"https://api.github.com/users/AlecStrong/following{/other_user}","gists_url":"https://api.github.com/users/AlecStrong/gists{/gist_id}","starred_url":"https://api.github.com/users/AlecStrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlecStrong/subscriptions","organizations_url":"https://api.github.com/users/AlecStrong/orgs","repos_url":"https://api.github.com/users/AlecStrong/repos","events_url":"https://api.github.com/users/AlecStrong/events{/privacy}","received_events_url":"https://api.github.com/users/AlecStrong/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-01T17:17:26Z","updated_at":"2016-06-01T17:51:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74849e035033ad18cdd0627a6ebca6ebd134f1c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/square/sqldelight/pulls/303/commits","review_comments_url":"https://api.github.com/repos/square/sqldelight/pulls/303/comments","review_comment_url":"https://api.github.com/repos/square/sqldelight/pulls/comments{/number}","comments_url":"https://api.github.com/repos/square/sqldelight/issues/303/comments","statuses_url":"https://api.github.com/repos/square/sqldelight/statuses/1056441ea4bba44d0cd0e981a2521a199c8939fb","head":{"label":"square:alec/function_types","ref":"alec/function_types","sha":"1056441ea4bba44d0cd0e981a2521a199c8939fb","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":44677680,"name":"sqldelight","full_name":"square/sqldelight","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/sqldelight","description":"Generates Java models from CREATE TABLE statements.","fork":false,"url":"https://api.github.com/repos/square/sqldelight","forks_url":"https://api.github.com/repos/square/sqldelight/forks","keys_url":"https://api.github.com/repos/square/sqldelight/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/sqldelight/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/sqldelight/teams","hooks_url":"https://api.github.com/repos/square/sqldelight/hooks","issue_events_url":"https://api.github.com/repos/square/sqldelight/issues/events{/number}","events_url":"https://api.github.com/repos/square/sqldelight/events","assignees_url":"https://api.github.com/repos/square/sqldelight/assignees{/user}","branches_url":"https://api.github.com/repos/square/sqldelight/branches{/branch}","tags_url":"https://api.github.com/repos/square/sqldelight/tags","blobs_url":"https://api.github.com/repos/square/sqldelight/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/sqldelight/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/sqldelight/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/sqldelight/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/sqldelight/statuses/{sha}","languages_url":"https://api.github.com/repos/square/sqldelight/languages","stargazers_url":"https://api.github.com/repos/square/sqldelight/stargazers","contributors_url":"https://api.github.com/repos/square/sqldelight/contributors","subscribers_url":"https://api.github.com/repos/square/sqldelight/subscribers","subscription_url":"https://api.github.com/repos/square/sqldelight/subscription","commits_url":"https://api.github.com/repos/square/sqldelight/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/sqldelight/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/sqldelight/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/sqldelight/issues/comments{/number}","contents_url":"https://api.github.com/repos/square/sqldelight/contents/{+path}","compare_url":"https://api.github.com/repos/square/sqldelight/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/sqldelight/merges","archive_url":"https://api.github.com/repos/square/sqldelight/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/sqldelight/downloads","issues_url":"https://api.github.com/repos/square/sqldelight/issues{/number}","pulls_url":"https://api.github.com/repos/square/sqldelight/pulls{/number}","milestones_url":"https://api.github.com/repos/square/sqldelight/milestones{/number}","notifications_url":"https://api.github.com/repos/square/sqldelight/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/sqldelight/labels{/name}","releases_url":"https://api.github.com/repos/square/sqldelight/releases{/id}","deployments_url":"https://api.github.com/repos/square/sqldelight/deployments","created_at":"2015-10-21T13:21:18Z","updated_at":"2016-06-01T17:32:21Z","pushed_at":"2016-06-01T17:35:54Z","git_url":"git://github.com/square/sqldelight.git","ssh_url":"git@github.com:square/sqldelight.git","clone_url":"https://github.com/square/sqldelight.git","svn_url":"https://github.com/square/sqldelight","homepage":"","size":35030,"stargazers_count":683,"watchers_count":683,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":43,"mirror_url":null,"open_issues_count":29,"forks":43,"open_issues":29,"watchers":683,"default_branch":"master"}},"base":{"label":"square:master","ref":"master","sha":"f3bd2cbb60c1674116473338fcb9cb6202b7140c","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":44677680,"name":"sqldelight","full_name":"square/sqldelight","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/sqldelight","description":"Generates Java models from CREATE TABLE statements.","fork":false,"url":"https://api.github.com/repos/square/sqldelight","forks_url":"https://api.github.com/repos/square/sqldelight/forks","keys_url":"https://api.github.com/repos/square/sqldelight/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/sqldelight/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/sqldelight/teams","hooks_url":"https://api.github.com/repos/square/sqldelight/hooks","issue_events_url":"https://api.github.com/repos/square/sqldelight/issues/events{/number}","events_url":"https://api.github.com/repos/square/sqldelight/events","assignees_url":"https://api.github.com/repos/square/sqldelight/assignees{/user}","branches_url":"https://api.github.com/repos/square/sqldelight/branches{/branch}","tags_url":"https://api.github.com/repos/square/sqldelight/tags","blobs_url":"https://api.github.com/repos/square/sqldelight/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/sqldelight/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/sqldelight/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/sqldelight/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/sqldelight/statuses/{sha}","languages_url":"https://api.github.com/repos/square/sqldelight/languages","stargazers_url":"https://api.github.com/repos/square/sqldelight/stargazers","contributors_url":"https://api.github.com/repos/square/sqldelight/contributors","subscribers_url":"https://api.github.com/repos/square/sqldelight/subscribers","subscription_url":"https://api.github.com/repos/square/sqldelight/subscription","commits_url":"https://api.github.com/repos/square/sqldelight/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/sqldelight/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/sqldelight/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/sqldelight/issues/comments{/number}","contents_url":"https://api.github.com/repos/square/sqldelight/contents/{+path}","compare_url":"https://api.github.com/repos/square/sqldelight/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/sqldelight/merges","archive_url":"https://api.github.com/repos/square/sqldelight/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/sqldelight/downloads","issues_url":"https://api.github.com/repos/square/sqldelight/issues{/number}","pulls_url":"https://api.github.com/repos/square/sqldelight/pulls{/number}","milestones_url":"https://api.github.com/repos/square/sqldelight/milestones{/number}","notifications_url":"https://api.github.com/repos/square/sqldelight/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/sqldelight/labels{/name}","releases_url":"https://api.github.com/repos/square/sqldelight/releases{/id}","deployments_url":"https://api.github.com/repos/square/sqldelight/deployments","created_at":"2015-10-21T13:21:18Z","updated_at":"2016-06-01T17:32:21Z","pushed_at":"2016-06-01T17:35:54Z","git_url":"git://github.com/square/sqldelight.git","ssh_url":"git@github.com:square/sqldelight.git","clone_url":"https://github.com/square/sqldelight.git","svn_url":"https://github.com/square/sqldelight","homepage":"","size":35030,"stargazers_count":683,"watchers_count":683,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":43,"mirror_url":null,"open_issues_count":29,"forks":43,"open_issues":29,"watchers":683,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/square/sqldelight/pulls/303"},"html":{"href":"https://github.com/square/sqldelight/pull/303"},"issue":{"href":"https://api.github.com/repos/square/sqldelight/issues/303"},"comments":{"href":"https://api.github.com/repos/square/sqldelight/issues/303/comments"},"review_comments":{"href":"https://api.github.com/repos/square/sqldelight/pulls/303/comments"},"review_comment":{"href":"https://api.github.com/repos/square/sqldelight/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/square/sqldelight/pulls/303/commits"},"statuses":{"href":"https://api.github.com/repos/square/sqldelight/statuses/1056441ea4bba44d0cd0e981a2521a199c8939fb"}}}}
{"actor":{"display_login":"AlecStrong"}}