{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/11766","repository_url":"https://api.github.com/repos/cockroachdb/cockroach","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/11766/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/11766/comments","events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/11766/events","html_url":"https://github.com/cockroachdb/cockroach/pull/11766","id":192988830,"number":11766,"title":"sql: support ARRAY(subquery) constructor syntax","user":{"login":"jordanlewis","id":43821,"avatar_url":"https://avatars.githubusercontent.com/u/43821?v=3","gravatar_id":"","url":"https://api.github.com/users/jordanlewis","html_url":"https://github.com/jordanlewis","followers_url":"https://api.github.com/users/jordanlewis/followers","following_url":"https://api.github.com/users/jordanlewis/following{/other_user}","gists_url":"https://api.github.com/users/jordanlewis/gists{/gist_id}","starred_url":"https://api.github.com/users/jordanlewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordanlewis/subscriptions","organizations_url":"https://api.github.com/users/jordanlewis/orgs","repos_url":"https://api.github.com/users/jordanlewis/repos","events_url":"https://api.github.com/users/jordanlewis/events{/privacy}","received_events_url":"https://api.github.com/users/jordanlewis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"knz","id":642886,"avatar_url":"https://avatars.githubusercontent.com/u/642886?v=3","gravatar_id":"","url":"https://api.github.com/users/knz","html_url":"https://github.com/knz","followers_url":"https://api.github.com/users/knz/followers","following_url":"https://api.github.com/users/knz/following{/other_user}","gists_url":"https://api.github.com/users/knz/gists{/gist_id}","starred_url":"https://api.github.com/users/knz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knz/subscriptions","organizations_url":"https://api.github.com/users/knz/orgs","repos_url":"https://api.github.com/users/knz/repos","events_url":"https://api.github.com/users/knz/events{/privacy}","received_events_url":"https://api.github.com/users/knz/received_events","type":"User","site_admin":false},"assignees":[{"login":"knz","id":642886,"avatar_url":"https://avatars.githubusercontent.com/u/642886?v=3","gravatar_id":"","url":"https://api.github.com/users/knz","html_url":"https://github.com/knz","followers_url":"https://api.github.com/users/knz/followers","following_url":"https://api.github.com/users/knz/following{/other_user}","gists_url":"https://api.github.com/users/knz/gists{/gist_id}","starred_url":"https://api.github.com/users/knz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knz/subscriptions","organizations_url":"https://api.github.com/users/knz/orgs","repos_url":"https://api.github.com/users/knz/repos","events_url":"https://api.github.com/users/knz/events{/privacy}","received_events_url":"https://api.github.com/users/knz/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-12-01T23:11:02Z","updated_at":"2016-12-01T23:17:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/11766","html_url":"https://github.com/cockroachdb/cockroach/pull/11766","diff_url":"https://github.com/cockroachdb/cockroach/pull/11766.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/11766.patch"},"body":"This commit adds support for array constructors that use the results of a single-column, multi-row subquery to populate the array.\r\n\r\nSee https://www.postgresql.org/docs/9.1/static/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS for more details on this syntax.\r\n\r\nResolves #10763.\r\nUpdates #5582.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/cockroachdb/cockroach/11766)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments/264325779","html_url":"https://github.com/cockroachdb/cockroach/pull/11766#issuecomment-264325779","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/11766","id":264325779,"user":{"login":"knz","id":642886,"avatar_url":"https://avatars.githubusercontent.com/u/642886?v=3","gravatar_id":"","url":"https://api.github.com/users/knz","html_url":"https://github.com/knz","followers_url":"https://api.github.com/users/knz/followers","following_url":"https://api.github.com/users/knz/following{/other_user}","gists_url":"https://api.github.com/users/knz/gists{/gist_id}","starred_url":"https://api.github.com/users/knz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knz/subscriptions","organizations_url":"https://api.github.com/users/knz/orgs","repos_url":"https://api.github.com/users/knz/repos","events_url":"https://api.github.com/users/knz/events{/privacy}","received_events_url":"https://api.github.com/users/knz/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T23:17:50Z","updated_at":"2016-12-01T23:17:50Z","body":"Excellent work.\nI think the code will be simpler/cleaner if you split the Expr nodes though. \n\n---\n\nReviewed 9 of 9 files at r1.\nReview status: all files reviewed at latest revision, 3 unresolved discussions.\n\n---\n\n*[pkg/sql/parser/eval.go, line 2353 at r1](https://reviewable.io:443/reviews/cockroachdb/cockroach/11766#-KXwemkTCDARqqMXgtYU:-KXwemkU4KqI3Y1oNeY1:b-xxtszd) ([raw file](https://github.com/cockroachdb/cockroach/blob/a0af85caf4d459d401c3ddaddebb883d3219108a/pkg/sql/parser/eval.go#L2353)):*\n> ```Go\n> \t\t}\n> \t} else {\n> \t\td, err := t.Subquery.(TypedExpr).Eval(ctx)\n> ```\n\nIs this eval call necessary? I though that the walk code was depth-first so you only arrive here after the arguments have been evaluated/substituted already.\n\n---\n\n*[pkg/sql/parser/expr.go, line 605 at r1](https://reviewable.io:443/reviews/cockroachdb/cockroach/11766#-KXwf-v5btw4Q-ICtCG9:-KXwf-v6YvlozoNiygRf:b-4gfkg6) ([raw file](https://github.com/cockroachdb/cockroach/blob/a0af85caf4d459d401c3ddaddebb883d3219108a/pkg/sql/parser/expr.go#L605)):*\n> ```Go\n> }\n> \n> // Array represents an array constructor.\n> ```\n\nCan we split this node in two. They are really two different concepts: Array and Flatten :)\n\n---\n\n*[pkg/sql/parser/sql.y, line 3826 at r1](https://reviewable.io:443/reviews/cockroachdb/cockroach/11766#-KXwfDwk6NrIGyIFzQjs:-KXwfDwla-InifAts3dg:bhh7ril) ([raw file](https://github.com/cockroachdb/cockroach/blob/a0af85caf4d459d401c3ddaddebb883d3219108a/pkg/sql/parser/sql.y#L3826)):*\n> ```Yacc\n>   }\n> | ARRAY select_with_parens\n>   // $$.val = &FlattenExpr{Subquery: &Subquery{Select: $2.selectStmt()}}\n> ```\n\nI like \"Flatten\" more :)\n\n---\n\n\n*Comments from [Reviewable](https://reviewable.io:443/reviews/cockroachdb/cockroach/11766#-:-KXwfOz9cr_g_jNwuxkY:byzxh7d)*\n<!-- Sent from Reviewable.io -->\n"}}
{"actor":{"display_login":"knz"}}