# LogicTest: local

statement ok
CREATE PROCEDURE foo(x INT) LANGUAGE SQL AS $$
  SELECT 1;
  SELECT 2;
$$

query T
EXPLAIN CALL foo(0);
----
distribution: local
vectorized: true
·
• call
  estimated row count: 0
  procedure: foo(0)

query T
EXPLAIN (VERBOSE) CALL foo(1);
----
distribution: local
vectorized: true
·
• call
  columns: ()
  estimated row count: 0
  procedure: foo(1)

query T
EXPLAIN (OPT) CALL foo(3);
----
call
 └── procedure: foo
      ├── args
      │    └── 3
      ├── params: x
      └── body
           ├── values
           │    └── (1,)
           ├── values
           │    └── (2,)
           └── values
                └── (NULL,)

query T
EXPLAIN (OPT, VERBOSE) CALL foo(3);
----
call
 ├── cardinality: [0 - 0]
 ├── volatile
 ├── stats: [rows=0]
 ├── cost: 0.01
 ├── distribution: test
 └── procedure: foo
      ├── args
      │    └── 3
      ├── params: x:1
      └── body
           ├── values
           │    ├── columns: "?column?":2
           │    ├── cardinality: [1 - 1]
           │    ├── stats: [rows=1]
           │    ├── key: ()
           │    ├── fd: ()-->(2)
           │    └── (1,)
           ├── values
           │    ├── columns: "?column?":3
           │    ├── cardinality: [1 - 1]
           │    ├── stats: [rows=1]
           │    ├── key: ()
           │    ├── fd: ()-->(3)
           │    └── (2,)
           └── values
                ├── columns: column1:4
                ├── cardinality: [1 - 1]
                ├── stats: [rows=1]
                ├── key: ()
                ├── fd: ()-->(4)
                └── (NULL,)

query T
EXPLAIN (OPT, TYPES) CALL foo(3);
----
call
 ├── cardinality: [0 - 0]
 ├── volatile
 ├── stats: [rows=0]
 ├── cost: 0.01
 ├── distribution: test
 └── procedure: foo [type=void]
      ├── args
      │    └── const: 3 [type=int]
      ├── params: x:1(int)
      └── body
           ├── values
           │    ├── columns: "?column?":2(int!null)
           │    ├── cardinality: [1 - 1]
           │    ├── stats: [rows=1]
           │    ├── key: ()
           │    ├── fd: ()-->(2)
           │    └── tuple [type=tuple{int}]
           │         └── const: 1 [type=int]
           ├── values
           │    ├── columns: "?column?":3(int!null)
           │    ├── cardinality: [1 - 1]
           │    ├── stats: [rows=1]
           │    ├── key: ()
           │    ├── fd: ()-->(3)
           │    └── tuple [type=tuple{int}]
           │         └── const: 2 [type=int]
           └── values
                ├── columns: column1:4(unknown)
                ├── cardinality: [1 - 1]
                ├── stats: [rows=1]
                ├── key: ()
                ├── fd: ()-->(4)
                └── tuple [type=tuple{unknown}]
                     └── null [type=unknown]

query T
EXPLAIN (DISTSQL) CALL foo(3);
----
distribution: local
vectorized: true
·
• call
  estimated row count: 0
  procedure: foo(3)
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMj0FL-0AQxe__TxHeqYXt3wRveyvWQyDWansQJMi6mdbFbSbubKhS8t0liUURD53DwLx5M7-ZI-TNQ-P6YVXM82UyWeTrzfqumCZX86JImvbZO_t_yzy5nEKh5oqWZk8C_YgMpUIT2JIIh146Doa8eodOFVzdtLGXSwXLgaCPiC56goZna3xijfdJepFCoaJonB_cnQK38XtWotkRdPYDli-g006dz7snabgWOouU_iLNsq5UoGpH45PCbbC0CmwH71jeDosGoSKJYzcbi7w-tSQGMvvx_FJh6_nw5CpopF8x-yOdAv2A2Un_2PqFD8PazUfTn7U1XkjhxrzSgiKFvaudRGehY2ip6_59BgAA__9oSZu_

query T
EXPLAIN ANALYZE CALL foo(3);
----
planning time: 10µs
execution time: 100µs
distribution: <hidden>
vectorized: <hidden>
plan type: custom
maximum memory usage: <hidden>
network usage: <hidden>
regions: <hidden>
isolation level: serializable
priority: normal
quality of service: regular
·
• call
  sql nodes: <hidden>
  regions: <hidden>
  actual row count: 0
  estimated row count: 0
  procedure: foo(3)

query T
EXPLAIN ANALYZE (DISTSQL) CALL foo(3);
----
planning time: 10µs
execution time: 100µs
distribution: <hidden>
vectorized: <hidden>
plan type: custom
maximum memory usage: <hidden>
network usage: <hidden>
regions: <hidden>
isolation level: serializable
priority: normal
quality of service: regular
·
• call
  sql nodes: <hidden>
  regions: <hidden>
  actual row count: 0
  estimated row count: 0
  procedure: foo(3)
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMUMtq40AQvO9XiDrtwnhXYm9zW9YXg_MgyS2IMB617SEjtTLdwg5Gn5UfyJcFSTY4IYH0YaCqu6tq-gB5irD4_2-5zNpuFYP_vWb--fcXDBqu6NLVJLD3KFAatIk9iXAaqMM4sKj2sLlBaNpOB7o08JwI9gANGgkWkb2LmXcxZvmfHAYVqQtx1KU9-U4DN5mGmmyWv74IDFZO_ZYk407bTm02bCXenRNlbzCho62o2xBscZZzMYfNe_P9qDckLTdC70J-5ZR_cJoVfWlA1Yam-wh3ydN1Yj_OTvBqFBqJikSnbjGBRXNqiSZy9RS_NFhH3j2EChb5sWafPKfCsOA2Mnzsdsu7UfbuuR1irV0UMrhwjzQnpVSHJogGD6upo77_8RYAAP__9m6rjw==
