{"action":"created","issue":{"url":"https://api.github.com/repos/norikra/norikra/issues/55","labels_url":"https://api.github.com/repos/norikra/norikra/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/norikra/norikra/issues/55/comments","events_url":"https://api.github.com/repos/norikra/norikra/issues/55/events","html_url":"https://github.com/norikra/norikra/issues/55","id":43112660,"number":55,"title":"Optional field in queries","user":{"login":"tagomoris","id":230654,"avatar_url":"https://avatars.githubusercontent.com/u/230654?v=3","gravatar_id":"","url":"https://api.github.com/users/tagomoris","html_url":"https://github.com/tagomoris","followers_url":"https://api.github.com/users/tagomoris/followers","following_url":"https://api.github.com/users/tagomoris/following{/other_user}","gists_url":"https://api.github.com/users/tagomoris/gists{/gist_id}","starred_url":"https://api.github.com/users/tagomoris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tagomoris/subscriptions","organizations_url":"https://api.github.com/users/tagomoris/orgs","repos_url":"https://api.github.com/users/tagomoris/repos","events_url":"https://api.github.com/users/tagomoris/events{/privacy}","received_events_url":"https://api.github.com/users/tagomoris/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/norikra/norikra/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"tagomoris","id":230654,"avatar_url":"https://avatars.githubusercontent.com/u/230654?v=3","gravatar_id":"","url":"https://api.github.com/users/tagomoris","html_url":"https://github.com/tagomoris","followers_url":"https://api.github.com/users/tagomoris/followers","following_url":"https://api.github.com/users/tagomoris/following{/other_user}","gists_url":"https://api.github.com/users/tagomoris/gists{/gist_id}","starred_url":"https://api.github.com/users/tagomoris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tagomoris/subscriptions","organizations_url":"https://api.github.com/users/tagomoris/orgs","repos_url":"https://api.github.com/users/tagomoris/repos","events_url":"https://api.github.com/users/tagomoris/events{/privacy}","received_events_url":"https://api.github.com/users/tagomoris/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2014-09-18T09:23:04Z","updated_at":"2015-01-15T20:25:31Z","closed_at":"2015-01-13T08:47:11Z","body":"Norikra query exactly matches events which contains all fields in that query.\r\nThis restriction works well for almost all cases, but does not work for cases like below:\r\n\r\n```\r\n# events\r\nevent1: {\"type\": \"user\", \"data\": {\"username\": \"tagomoris\"} }\r\nevent2: {\"type\": \"bot\", \"data\": {\"bottype\": \"google\"} }\r\n```\r\n\r\n```sql\r\n--- query\r\nSELECT type, COUNT(DISTINCT data.username), COUNT(DISTINCT data.bottype)\r\nFROM target\r\nWHERE type IN (\"user\", \"bot\")\r\n```\r\n\r\nTo solve this case, I have some options to express that specified field may be missing (null if missing):\r\n1. Special function: `NULLABLE(field)`, `MAYBE_MISSING(field)`, `OPTIONAL(field)`, ...\r\n2. Chained name: `field.NULLABE`, `field.MAYBE_MISSING`, `field.OPTIONAL`, ...\r\n\r\nAre there any opinions or ideas? Which one you want? Are there any other naming idea?\r\nPlease note your idea.\r\n\r\nI'll implement this feature in several weeks, in the way which collect many +1s.\r\n"},"comment":{"url":"https://api.github.com/repos/norikra/norikra/issues/comments/70155258","html_url":"https://github.com/norikra/norikra/issues/55#issuecomment-70155258","issue_url":"https://api.github.com/repos/norikra/norikra/issues/55","id":70155258,"user":{"login":"jackxue1","id":8718219,"avatar_url":"https://avatars.githubusercontent.com/u/8718219?v=3","gravatar_id":"","url":"https://api.github.com/users/jackxue1","html_url":"https://github.com/jackxue1","followers_url":"https://api.github.com/users/jackxue1/followers","following_url":"https://api.github.com/users/jackxue1/following{/other_user}","gists_url":"https://api.github.com/users/jackxue1/gists{/gist_id}","starred_url":"https://api.github.com/users/jackxue1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackxue1/subscriptions","organizations_url":"https://api.github.com/users/jackxue1/orgs","repos_url":"https://api.github.com/users/jackxue1/repos","events_url":"https://api.github.com/users/jackxue1/events{/privacy}","received_events_url":"https://api.github.com/users/jackxue1/received_events","type":"User","site_admin":false},"created_at":"2015-01-15T20:25:31Z","updated_at":"2015-01-15T20:25:31Z","body":"If we register queries that use the new NULLABLE(...) function inside CASE...WHEN statements, Norikra engine gives the following error: Unknown single-row function, aggregation function or mapped or indexed property named 'nullable' could not be resolved "}}