Skip to content

add orderBy: computed test #2486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ create table c.edge_case (
alter table c.edge_case drop column drop_me;

create function c.edge_case_computed(edge_case c.edge_case) returns text as $$ select 'hello world'::text $$ language sql stable;
comment on function c.edge_case_computed is E'@sortable';

create domain a.an_int as integer;
create domain b.another_int as a.an_int;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
allEdgeCases: {
nodes: [
{
computed: "hello world",
wontCastEasy: 20,
rowId: 1,
},
{
computed: "hello world",
wontCastEasy: null,
rowId: 2,
},
{
computed: "hello world",
wontCastEasy: -512,
rowId: 3,
},
{
computed: "hello world",
wontCastEasy: null,
rowId: 4,
},
],
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
classDef path fill:#eee,stroke:#000,color:#000
classDef plan fill:#fff,stroke-width:1px,color:#000
classDef itemplan fill:#fff,stroke-width:2px,color:#000
classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left


%% plan dependencies
Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
Access9 & Access10 --> Object11
__Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
__Value2 --> Access9
__Value2 --> Access10
__Value4["__Value[4∈0] ➊<br />ᐸrootValueᐳ"]:::plan
Connection12{{"Connection[12∈0] ➊<br />ᐸ8ᐳ"}}:::plan
PgSelect14[["PgSelect[14∈1] ➊<br />ᐸedge_caseᐳ"]]:::plan
Object11 & Connection12 --> PgSelect14
PgSelectRows15[["PgSelectRows[15∈1] ➊"]]:::plan
PgSelect14 --> PgSelectRows15
__Item16[/"__Item[16∈2]<br />ᐸ15ᐳ"\]:::itemplan
PgSelectRows15 ==> __Item16
PgSelectSingle17{{"PgSelectSingle[17∈2]<br />ᐸedge_caseᐳ"}}:::plan
__Item16 --> PgSelectSingle17
PgClassExpression19{{"PgClassExpression[19∈3]<br />ᐸ”c”.”edge_...ge_case__)ᐳ"}}:::plan
PgSelectSingle17 --> PgClassExpression19
PgClassExpression20{{"PgClassExpression[20∈3]<br />ᐸ__edge_cas...cast_easy”ᐳ"}}:::plan
PgSelectSingle17 --> PgClassExpression20
PgClassExpression21{{"PgClassExpression[21∈3]<br />ᐸ__edge_case__.”row_id”ᐳ"}}:::plan
PgSelectSingle17 --> PgClassExpression21

%% define steps

subgraph "Buckets for queries/v4/orderby-computed"
Bucket0("Bucket 0 (root)"):::bucket
classDef bucket0 stroke:#696969
class Bucket0,__Value2,__Value4,Access9,Access10,Object11,Connection12 bucket0
Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 11, 12<br /><br />ROOT Connectionᐸ8ᐳ[12]<br />1: PgSelect[14]<br />2: PgSelectRows[15]"):::bucket
classDef bucket1 stroke:#00bfff
class Bucket1,PgSelect14,PgSelectRows15 bucket1
Bucket2("Bucket 2 (listItem)<br /><br />ROOT __Item{2}ᐸ15ᐳ[16]"):::bucket
classDef bucket2 stroke:#7f007f
class Bucket2,__Item16,PgSelectSingle17 bucket2
Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 17<br /><br />ROOT PgSelectSingle{2}ᐸedge_caseᐳ[17]"):::bucket
classDef bucket3 stroke:#ffa500
class Bucket3,PgClassExpression19,PgClassExpression20,PgClassExpression21 bucket3
Bucket0 --> Bucket1
Bucket1 --> Bucket2
Bucket2 --> Bucket3
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
select
"c"."edge_case_computed"(__edge_case__) as "0",
__edge_case__."wont_cast_easy"::text as "1",
__edge_case__."row_id"::text as "2",
__edge_case__."not_null_has_default"::text as "3"
from "c"."edge_case" as __edge_case__
order by "c"."edge_case_computed"(__edge_case__) asc;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## expect(errors).toBeFalsy();
#> schema: ["a", "b", "c"]
{
allEdgeCases(orderBy: COMPUTED_ASC) {
nodes {
computed
wontCastEasy
rowId
}
}
}
Loading