import file=tpch_schema
----

import file=tpch_stats
----

# --------------------------------------------------
# Q5
# Local Supplier Volume
# Lists the revenue volume done through local suppliers.
#
# Lists for each nation in a region the revenue volume that resulted from
# lineitem transactions in which the customer ordering parts and the supplier
# filling them were both within that nation. The query is run in order to
# determine whether to institute local distribution centers in a given region.
# The query considers only parts ordered in a given year. The query displays the
# nations and revenue volume in descending order by revenue. Revenue volume for
# all qualifying lineitems in a particular nation is defined as
# sum(l_extendedprice * (1 - l_discount)).
# --------------------------------------------------
stats-quality database=tpch set=save_tables_prefix=q5
SELECT
    n_name,
    sum(l_extendedprice * (1 - l_discount)) AS revenue
FROM
    customer,
    orders,
    lineitem,
    supplier,
    nation,
    region
WHERE
    c_custkey = o_custkey
    AND l_orderkey = o_orderkey
    AND l_suppkey = s_suppkey
    AND c_nationkey = s_nationkey
    AND s_nationkey = n_nationkey
    AND n_regionkey = r_regionkey
    AND r_name = 'ASIA'
    AND o_orderDATE >= DATE '1994-01-01'
    AND o_orderDATE < DATE '1994-01-01' + INTERVAL '1' YEAR
GROUP BY
    n_name
ORDER BY
    revenue DESC;
----
----
sort
 ├── save-table-name: q5_sort_1
 ├── columns: n_name:50(char!null) revenue:61(float!null)
 ├── immutable
 ├── stats: [rows=5, distinct(50)=5, null(50)=0, distinct(61)=5, null(61)=0]
 ├── key: (50)
 ├── fd: (50)-->(61)
 ├── ordering: -61
 └── group-by (hash)
      ├── save-table-name: q5_group_by_2
      ├── columns: n_name:50(char!null) sum:61(float!null)
      ├── grouping columns: n_name:50(char!null)
      ├── immutable
      ├── stats: [rows=5, distinct(50)=5, null(50)=0, distinct(61)=5, null(61)=0]
      ├── key: (50)
      ├── fd: (50)-->(61)
      ├── project
      │    ├── save-table-name: q5_project_3
      │    ├── columns: column60:60(float!null) n_name:50(char!null)
      │    ├── immutable
      │    ├── stats: [rows=12896.98, distinct(50)=5, null(50)=0, distinct(60)=12601.8, null(60)=0]
      │    ├── inner-join (hash)
      │    │    ├── save-table-name: q5_inner_join_4
      │    │    ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) o_orderkey:11(int!null) o_custkey:12(int!null) o_orderdate:15(date!null) l_orderkey:22(int!null) l_suppkey:24(int!null) l_extendedprice:27(float!null) l_discount:28(float!null) s_suppkey:40(int!null) s_nationkey:43(int!null) n_nationkey:49(int!null) n_name:50(char!null) n_regionkey:51(int!null) r_regionkey:55(int!null) r_name:56(char!null)
      │    │    ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more)
      │    │    ├── stats: [rows=12896.98, distinct(1)=12897, null(1)=0, distinct(4)=5, null(4)=0, distinct(11)=12527.8, null(11)=0, distinct(12)=12897, null(12)=0, distinct(15)=365, null(15)=0, distinct(22)=12527.8, null(22)=0, distinct(24)=1843.11, null(24)=0, distinct(27)=12576, null(27)=0, distinct(28)=11, null(28)=0, distinct(40)=1843.11, null(40)=0, distinct(43)=5, null(43)=0, distinct(49)=5, null(49)=0, distinct(50)=5, null(50)=0, distinct(51)=1, null(51)=0, distinct(55)=1, null(55)=0, distinct(56)=0.996222, null(56)=0, distinct(27,28)=12601.8, null(27,28)=0]
      │    │    ├── fd: ()-->(56), (1)-->(4), (11)-->(12,15), (40)-->(43), (49)-->(50,51), (51)==(55), (55)==(51), (4)==(43,49), (43)==(4,49), (49)==(4,43), (24)==(40), (40)==(24), (11)==(22), (22)==(11), (1)==(12), (12)==(1)
      │    │    ├── inner-join (lookup lineitem)
      │    │    │    ├── save-table-name: q5_lookup_join_5
      │    │    │    ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) o_orderkey:11(int!null) o_custkey:12(int!null) o_orderdate:15(date!null) l_orderkey:22(int!null) l_suppkey:24(int!null) l_extendedprice:27(float!null) l_discount:28(float!null) n_nationkey:49(int!null) n_name:50(char!null) n_regionkey:51(int!null) r_regionkey:55(int!null) r_name:56(char!null)
      │    │    │    ├── key columns: [11] = [22]
      │    │    │    ├── stats: [rows=287046.1, distinct(1)=27671.5, null(1)=0, distinct(4)=5, null(4)=0, distinct(11)=62202.5, null(11)=0, distinct(12)=27671.5, null(12)=0, distinct(15)=365, null(15)=0, distinct(22)=62202.5, null(22)=0, distinct(24)=9920, null(24)=0, distinct(27)=246816, null(27)=0, distinct(28)=11, null(28)=0, distinct(49)=5, null(49)=0, distinct(50)=5, null(50)=0, distinct(51)=1, null(51)=0, distinct(55)=1, null(55)=0, distinct(56)=0.996222, null(56)=0]
      │    │    │    ├── fd: ()-->(56), (11)-->(12,15), (1)-->(4), (49)-->(50,51), (51)==(55), (55)==(51), (4)==(49), (49)==(4), (1)==(12), (12)==(1), (11)==(22), (22)==(11)
      │    │    │    ├── inner-join (hash)
      │    │    │    │    ├── save-table-name: q5_inner_join_6
      │    │    │    │    ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) o_orderkey:11(int!null) o_custkey:12(int!null) o_orderdate:15(date!null) n_nationkey:49(int!null) n_name:50(char!null) n_regionkey:51(int!null) r_regionkey:55(int!null) r_name:56(char!null)
      │    │    │    │    ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more)
      │    │    │    │    ├── stats: [rows=73051.37, distinct(1)=27672.3, null(1)=0, distinct(4)=5, null(4)=0, distinct(11)=62202.5, null(11)=0, distinct(12)=27672.3, null(12)=0, distinct(15)=365, null(15)=0, distinct(49)=5, null(49)=0, distinct(50)=5, null(50)=0, distinct(51)=1, null(51)=0, distinct(55)=1, null(55)=0, distinct(56)=0.996222, null(56)=0]
      │    │    │    │    ├── key: (11)
      │    │    │    │    ├── fd: ()-->(56), (11)-->(12,15), (1)-->(4), (49)-->(50,51), (51)==(55), (55)==(51), (4)==(49), (49)==(4), (1)==(12), (12)==(1)
      │    │    │    │    ├── index-join orders
      │    │    │    │    │    ├── save-table-name: q5_index_join_7
      │    │    │    │    │    ├── columns: o_orderkey:11(int!null) o_custkey:12(int!null) o_orderdate:15(date!null)
      │    │    │    │    │    ├── stats: [rows=220934.3, distinct(11)=220934, null(11)=0, distinct(12)=90731.1, null(12)=0, distinct(15)=365, null(15)=0]
      │    │    │    │    │    │   histogram(15)=  0       0        1061.5      450       7200      600       6600      900       6900      750       5700      1800      6900      750       6300      1050      7050      900       7200      300       7050      450       6600      750       6450      1200      6900      600       7050      1050      7050      450       6600      750       7050      600       6450      900       7050      600       7200      900       6750      900       7200      750       7200      1050      6750      600       6900      600       6900      1050      7050      450       7050      750       6000      1350      4909.1     613.64
      │    │    │    │    │    │                 <--- '1993-12-31' -------- '1994-01-03' ------ '1994-01-15' ------ '1994-01-23' ------ '1994-02-04' ------ '1994-02-15' ------ '1994-02-27' ------ '1994-03-09' ------ '1994-03-19' ------ '1994-04-05' ------ '1994-04-16' ------ '1994-04-29' ------ '1994-05-10' ------ '1994-05-24' ------ '1994-06-04' ------ '1994-06-16' ------ '1994-06-30' ------ '1994-07-16' ------ '1994-07-31' ------ '1994-08-13' ------ '1994-08-27' ------ '1994-09-08' ------ '1994-09-23' ------ '1994-10-06' ------ '1994-10-17' ------ '1994-10-28' ------ '1994-11-11' ------ '1994-11-25' ------ '1994-12-11' ------ '1994-12-22' -------- '1994-12-31'
      │    │    │    │    │    ├── key: (11)
      │    │    │    │    │    ├── fd: (11)-->(12,15)
      │    │    │    │    │    └── scan orders@o_od
      │    │    │    │    │         ├── save-table-name: q5_scan_8
      │    │    │    │    │         ├── columns: o_orderkey:11(int!null) o_orderdate:15(date!null)
      │    │    │    │    │         ├── constraint: /15/11: [/'1994-01-01' - /'1994-12-31']
      │    │    │    │    │         ├── stats: [rows=220934.3, distinct(11)=220934, null(11)=0, distinct(15)=365, null(15)=0]
      │    │    │    │    │         │   histogram(11)=  0           0            0 0.14729 1091 0.14729 1079.3 0.14729 1141.3 0.14729 1094.9 0.14729  1182.7 0.14729  1070.2 0.14729  1095.8 0.14729  1152.4 0.14729  1108.6 0.14729  1112.6 0.14729  1093.9 0.14729  1103.3 0.14729  1118.8 0.14729  1108.8 0.14729  1125.4 0.14729  1118.5 0.14729  1087.7 0.14729  1136.2 0.14729  1091.4 0.14729  1067.8 0.14729  1107.5 0.14729  1095.1 0.14729  1115.8 0.14729  1100.5 0.14729  1075.6 0.14729  1047.2 0.14729  1126.3 0.14729  1122.3 0.14729  1116.4 0.14729  1103.2 0.14729  1091.4 0.14729  1122.3 0.14729  1149.7  0.14729  1092.7  0.14729  1098  0.14729  1127  0.14729  1091.1  0.14729  1072.1  0.14729  1090.4  0.14729  1086.4  0.14729  1086.4  0.14729  1107.3  0.14729  1123.4  0.14729  1130.6  0.14729  1100.4  0.14729  1083  0.14729  1119.1  0.14729  1126.7  0.14729  1106.1  0.14729  1078.3  0.14729  1073.4  0.14729  1084.9  0.14729  1087.3  0.14729  1101.6  0.14729  1108.6  0.14729  1065.5  0.14729  1130.7  0.14729  1090.1  0.14729  1140  0.14729  1125.1  0.14729  1107  0.14729  1062.2  0.14729  1065.2  0.14729  1059.7  0.14729  1058.7  0.14729  1161.5  0.14729  1084  0.14729  1075.5  0.14729  1103.8  0.14729  1109.1  0.14729  1113.3  0.14729  1053  0.14729  1095.5  0.14729  1080.8  0.14729  1075.2  0.14729  1131.8  0.14729  1094.5  0.14729  1068.3  0.14729  1096  0.14729  1099.9  0.14729  1133.4  0.14729  1108.9  0.14729  1096.1  0.14729  1133.4  0.14729  1139.7  0.14729  1108.2  0.14729  1090.1  0.14729  1108.2  0.14729  1134.3  0.14729  1054.1  0.14729  1083  0.14729  1084  0.14729  1080.4  0.14729  1096.6  0.14729  1144  0.14729  1130.6  0.14729  1106.4  0.14729  1121.9  0.14729  1076.5  0.14729  1118.5  0.14729  1074.8  0.14729  1113.2  0.14729  1092.4  0.14729  1121.4  0.14729  1093.2  0.14729  1078.6  0.14729  1117.2  0.14729  1138.1  0.14729  1104.1  0.14729  1095.1  0.14729  1080.8  0.14729  1097.4  0.14729  1116  0.14729  1067.2  0.14729  1123.2  0.14729  1141.3  0.14729  1092.6  0.14729  1134.4  0.14729  1095.5  0.14729  1082  0.14729  1107.3  0.14729  1122.6  0.14729  1084  0.14729  1089  0.14729  1124.2  0.14729  1136.5  0.14729  1113.3  0.14729  1082.7  0.14729  1113.2  0.14729  1090.1  0.14729  1074.9  0.14729  1160  0.14729  1084.8  0.14729  1080.1  0.14729  1098.6  0.14729  1100.5  0.14729  1114.2  0.14729  1108.2  0.14729  1070.9  0.14729  1076.7  0.14729  1092.7  0.14729  1172.4  0.14729  1087.4  0.14729  1105.8  0.14729  1108.3  0.14729  1114.5  0.14729  1135  0.14729  1155  0.14729  1102.3  0.14729  1132  0.14729  1120.3  0.14729  1130.9  0.14729  1126.5  0.14729  1176.2  0.14729  1157.7  0.14729  1130.3  0.14729  1139  0.14729  1104.9  0.14729  1104.5  0.14729  1118.9  0.14729  1115.4  0.14729  1156.1  0.14729  1114.7  0.14729  1112  0.14729  1103.8  0.14729  1159.2  0.14729  1106  0.14729  1123.4  0.14729  1145.2  0.14729  1164.9  0.14729  1104.9  0.14729  1155  0.14729  1111  0.14729  1122.9  0.14729  1108.2  0.14729  1111.9  0.14729  1175.1  0.14729  1115  0.14729  1166.1  0.14729  1121.4  0.14729  1161.2  0.14729  1116.4  0.14729  1189.6  0.14729  1134  0.14729  1124.7  0.14729  1109.2  0.14729  1107  0.14729  1130.3  0.14729  1146.2  0.14729  1134  0.14729  1102.2  0.14729  1149.7  0.14729  1145.2  0.14729  1127.9  0.14729  1127.6  0.14729  1116.4  0.14729  1105.7  0.14729  1139.6  0.14729  1117.2  0.14729  0           0
      │    │    │    │    │         │                 <--- -9223372036854775808 --- 1505 ------- 29025 -------- 54400 -------- 91106 -------- 119366 -------- 163554 -------- 187236 -------- 215651 -------- 254373 -------- 285123 -------- 316614 -------- 344678 -------- 374465 -------- 407078 -------- 437861 -------- 471683 -------- 504230 -------- 531168 -------- 566951 -------- 594561 -------- 617825 -------- 648358 -------- 676640 -------- 708706 -------- 737986 -------- 762690 -------- 782081 -------- 816064 -------- 849318 -------- 881511 -------- 911271 -------- 938885 -------- 972135 -------- 1010370 -------- 1038212 ------ 1067041 ------ 1101158 -------- 1128704 -------- 1152742 -------- 1180165 -------- 1206852 -------- 1233537 -------- 1264064 -------- 1297504 -------- 1332260 -------- 1361504 ------ 1387553 -------- 1420224 -------- 1454275 -------- 1484580 -------- 1509766 -------- 1534050 -------- 1560452 -------- 1587299 -------- 1616771 -------- 1647526 -------- 1670343 -------- 1705121 -------- 1732486 ------ 1768967 -------- 1802725 ------ 1833189 -------- 1855398 -------- 1878146 -------- 1899877 -------- 1921414 -------- 1961765 ------ 1988000 -------- 2012672 -------- 2042529 -------- 2073381 -------- 2104999 ------ 2125477 -------- 2153825 -------- 2179462 -------- 2204065 -------- 2239044 -------- 2267205 -------- 2290530 ------ 2318977 -------- 2348134 -------- 2383399 -------- 2414215 -------- 2442695 -------- 2477955 -------- 2514372 -------- 2545062 -------- 2572418 -------- 2603108 -------- 2638534 -------- 2659232 ------ 2685286 ------ 2711527 -------- 2737088 -------- 2765639 ------ 2802818 -------- 2837570 -------- 2867911 -------- 2901088 -------- 2925954 -------- 2958501 -------- 2983042 -------- 3014626 -------- 3042406 -------- 3075489 -------- 3103425 -------- 3128673 -------- 3160994 -------- 3197125 -------- 3227043 -------- 3255328 -------- 3280965 -------- 3309669 ------ 3341767 -------- 3364898 -------- 3398305 -------- 3435008 -------- 3462818 -------- 3498272 -------- 3526631 ------ 3552485 -------- 3583014 -------- 3616322 ------ 3642566 ------ 3669732 -------- 3703330 -------- 3739170 -------- 3770791 -------- 3796804 -------- 3828387 -------- 3855751 -------- 3880321 ------ 3920422 -------- 3946818 -------- 3972322 -------- 4001250 -------- 4030533 -------- 4062306 -------- 4092992 -------- 4116803 -------- 4141697 -------- 4169536 -------- 4211878 -------- 4238753 -------- 4268994 -------- 4299686 -------- 4331525 ------ 4367079 ------ 4406277 -------- 4435878 ------ 4470914 -------- 4500294 -------- 4531617 -------- 4562114 -------- 4601666 -------- 4637856 -------- 4669060 ------ 4701861 -------- 4728416 -------- 4754881 -------- 4784001 -------- 4812482 -------- 4848389 -------- 4876741 ------ 4904612 -------- 4930945 -------- 4967397 ------ 4994146 -------- 5024099 -------- 5058023 -------- 5095527 -------- 5122081 ------ 5157798 ------ 5185472 -------- 5215332 -------- 5242497 -------- 5270338 -------- 5309699 ------ 5338112 -------- 5375843 -------- 5405441 -------- 5442277 -------- 5470945 -------- 5512930 ------ 5544807 -------- 5574980 -------- 5602340 ------ 5629280 -------- 5660482 -------- 5694599 ------ 5726466 -------- 5752519 -------- 5787268 -------- 5821185 -------- 5851973 -------- 5882689 -------- 5911363 -------- 5938052 -------- 5970949 -------- 5999748 --- 9223372036854775807
      │    │    │    │    │         │   histogram(15)=  0       0        1061.5      450       7200      600       6600      900       6900      750       5700      1800      6900      750       6300      1050      7050      900       7200      300       7050      450       6600      750       6450      1200      6900      600       7050      1050      7050      450       6600      750       7050      600       6450      900       7050      600       7200      900       6750      900       7200      750       7200      1050      6750      600       6900      600       6900      1050      7050      450       7050      750       6000      1350      4909.1     613.64
      │    │    │    │    │         │                 <--- '1993-12-31' -------- '1994-01-03' ------ '1994-01-15' ------ '1994-01-23' ------ '1994-02-04' ------ '1994-02-15' ------ '1994-02-27' ------ '1994-03-09' ------ '1994-03-19' ------ '1994-04-05' ------ '1994-04-16' ------ '1994-04-29' ------ '1994-05-10' ------ '1994-05-24' ------ '1994-06-04' ------ '1994-06-16' ------ '1994-06-30' ------ '1994-07-16' ------ '1994-07-31' ------ '1994-08-13' ------ '1994-08-27' ------ '1994-09-08' ------ '1994-09-23' ------ '1994-10-06' ------ '1994-10-17' ------ '1994-10-28' ------ '1994-11-11' ------ '1994-11-25' ------ '1994-12-11' ------ '1994-12-22' -------- '1994-12-31'
      │    │    │    │    │         ├── key: (11)
      │    │    │    │    │         └── fd: (11)-->(15)
      │    │    │    │    ├── inner-join (lookup customer@c_nk)
      │    │    │    │    │    ├── save-table-name: q5_lookup_join_9
      │    │    │    │    │    ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) n_nationkey:49(int!null) n_name:50(char!null) n_regionkey:51(int!null) r_regionkey:55(int!null) r_name:56(char!null)
      │    │    │    │    │    ├── key columns: [49] = [4]
      │    │    │    │    │    ├── stats: [rows=30000, distinct(1)=27672.3, null(1)=0, distinct(4)=5, null(4)=0, distinct(49)=5, null(49)=0, distinct(50)=5, null(50)=0, distinct(51)=1, null(51)=0, distinct(55)=1, null(55)=0, distinct(56)=0.996222, null(56)=0, distinct(4,49)=25, null(4,49)=0]
      │    │    │    │    │    ├── key: (1)
      │    │    │    │    │    ├── fd: ()-->(56), (1)-->(4), (49)-->(50,51), (51)==(55), (55)==(51), (4)==(49), (49)==(4)
      │    │    │    │    │    ├── inner-join (hash)
      │    │    │    │    │    │    ├── save-table-name: q5_inner_join_10
      │    │    │    │    │    │    ├── columns: n_nationkey:49(int!null) n_name:50(char!null) n_regionkey:51(int!null) r_regionkey:55(int!null) r_name:56(char!null)
      │    │    │    │    │    │    ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more)
      │    │    │    │    │    │    ├── stats: [rows=5, distinct(49)=5, null(49)=0, distinct(50)=5, null(50)=0, distinct(51)=1, null(51)=0, distinct(55)=1, null(55)=0, distinct(56)=0.996222, null(56)=0]
      │    │    │    │    │    │    ├── key: (49)
      │    │    │    │    │    │    ├── fd: ()-->(56), (49)-->(50,51), (51)==(55), (55)==(51)
      │    │    │    │    │    │    ├── scan nation
      │    │    │    │    │    │    │    ├── save-table-name: q5_scan_11
      │    │    │    │    │    │    │    ├── columns: n_nationkey:49(int!null) n_name:50(char!null) n_regionkey:51(int!null)
      │    │    │    │    │    │    │    ├── stats: [rows=25, distinct(49)=25, null(49)=0, distinct(50)=25, null(50)=0, distinct(51)=5, null(51)=0]
      │    │    │    │    │    │    │    │   histogram(49)=  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1
      │    │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24
      │    │    │    │    │    │    │    │   histogram(50)=  0      1      23      1
      │    │    │    │    │    │    │    │                 <--- 'ALGERIA' ---- 'VIETNAM'
      │    │    │    │    │    │    │    │   histogram(51)=  0  5  0  5  0  5  0  5  0  5
      │    │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4
      │    │    │    │    │    │    │    ├── key: (49)
      │    │    │    │    │    │    │    └── fd: (49)-->(50,51)
      │    │    │    │    │    │    ├── select
      │    │    │    │    │    │    │    ├── save-table-name: q5_select_12
      │    │    │    │    │    │    │    ├── columns: r_regionkey:55(int!null) r_name:56(char!null)
      │    │    │    │    │    │    │    ├── stats: [rows=1, distinct(55)=1, null(55)=0, distinct(56)=1, null(56)=0]
      │    │    │    │    │    │    │    │   histogram(56)=  0    1
      │    │    │    │    │    │    │    │                 <--- 'ASIA'
      │    │    │    │    │    │    │    ├── key: (55)
      │    │    │    │    │    │    │    ├── fd: ()-->(56)
      │    │    │    │    │    │    │    ├── scan region
      │    │    │    │    │    │    │    │    ├── save-table-name: q5_scan_13
      │    │    │    │    │    │    │    │    ├── columns: r_regionkey:55(int!null) r_name:56(char!null)
      │    │    │    │    │    │    │    │    ├── stats: [rows=5, distinct(55)=5, null(55)=0, distinct(56)=5, null(56)=0]
      │    │    │    │    │    │    │    │    │   histogram(55)=  0  1  0  1  0  1  0  1  0  1
      │    │    │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4
      │    │    │    │    │    │    │    │    │   histogram(56)=  0     1      3        1
      │    │    │    │    │    │    │    │    │                 <--- 'AFRICA' --- 'MIDDLE EAST'
      │    │    │    │    │    │    │    │    ├── key: (55)
      │    │    │    │    │    │    │    │    └── fd: (55)-->(56)
      │    │    │    │    │    │    │    └── filters
      │    │    │    │    │    │    │         └── r_name:56 = 'ASIA' [type=bool, outer=(56), constraints=(/56: [/'ASIA' - /'ASIA']; tight), fd=()-->(56)]
      │    │    │    │    │    │    └── filters
      │    │    │    │    │    │         └── n_regionkey:51 = r_regionkey:55 [type=bool, outer=(51,55), constraints=(/51: (/NULL - ]; /55: (/NULL - ]), fd=(51)==(55), (55)==(51)]
      │    │    │    │    │    └── filters (true)
      │    │    │    │    └── filters
      │    │    │    │         └── c_custkey:1 = o_custkey:12 [type=bool, outer=(1,12), constraints=(/1: (/NULL - ]; /12: (/NULL - ]), fd=(1)==(12), (12)==(1)]
      │    │    │    └── filters (true)
      │    │    ├── scan supplier@s_nk
      │    │    │    ├── save-table-name: q5_scan_14
      │    │    │    ├── columns: s_suppkey:40(int!null) s_nationkey:43(int!null)
      │    │    │    ├── stats: [rows=10000, distinct(40)=9920, null(40)=0, distinct(43)=25, null(43)=0]
      │    │    │    │   histogram(40)=  0           0            0  1  49  1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50    1    0           0
      │    │    │    │                 <--- -9223372036854775808 --- 1 ---- 51 ---- 101 ---- 151 ---- 201 ---- 251 ---- 301 ---- 351 ---- 401 ---- 451 ---- 501 ---- 551 ---- 601 ---- 651 ---- 701 ---- 751 ---- 801 ---- 851 ---- 901 ---- 951 ---- 1001 ---- 1051 ---- 1101 ---- 1151 ---- 1201 ---- 1251 ---- 1301 ---- 1351 ---- 1401 ---- 1451 ---- 1501 ---- 1551 ---- 1601 ---- 1651 ---- 1701 ---- 1751 ---- 1801 ---- 1851 ---- 1901 ---- 1951 ---- 2001 ---- 2051 ---- 2101 ---- 2151 ---- 2201 ---- 2251 ---- 2301 ---- 2351 ---- 2401 ---- 2451 ---- 2501 ---- 2551 ---- 2601 ---- 2651 ---- 2701 ---- 2751 ---- 2801 ---- 2851 ---- 2901 ---- 2951 ---- 3001 ---- 3051 ---- 3101 ---- 3151 ---- 3201 ---- 3251 ---- 3301 ---- 3351 ---- 3401 ---- 3451 ---- 3501 ---- 3551 ---- 3601 ---- 3651 ---- 3701 ---- 3751 ---- 3801 ---- 3851 ---- 3901 ---- 3951 ---- 4001 ---- 4051 ---- 4101 ---- 4151 ---- 4201 ---- 4251 ---- 4301 ---- 4351 ---- 4401 ---- 4451 ---- 4501 ---- 4551 ---- 4601 ---- 4651 ---- 4701 ---- 4751 ---- 4801 ---- 4851 ---- 4901 ---- 4951 ---- 5001 ---- 5051 ---- 5101 ---- 5151 ---- 5201 ---- 5251 ---- 5301 ---- 5351 ---- 5401 ---- 5451 ---- 5501 ---- 5551 ---- 5601 ---- 5651 ---- 5701 ---- 5751 ---- 5801 ---- 5851 ---- 5901 ---- 5951 ---- 6001 ---- 6051 ---- 6101 ---- 6151 ---- 6201 ---- 6251 ---- 6301 ---- 6351 ---- 6401 ---- 6451 ---- 6501 ---- 6551 ---- 6601 ---- 6651 ---- 6701 ---- 6751 ---- 6801 ---- 6851 ---- 6901 ---- 6951 ---- 7001 ---- 7051 ---- 7101 ---- 7151 ---- 7201 ---- 7251 ---- 7301 ---- 7351 ---- 7401 ---- 7451 ---- 7501 ---- 7552 ---- 7603 ---- 7654 ---- 7705 ---- 7756 ---- 7807 ---- 7858 ---- 7909 ---- 7960 ---- 8011 ---- 8062 ---- 8113 ---- 8164 ---- 8215 ---- 8266 ---- 8317 ---- 8368 ---- 8419 ---- 8470 ---- 8521 ---- 8572 ---- 8623 ---- 8674 ---- 8725 ---- 8776 ---- 8827 ---- 8878 ---- 8929 ---- 8980 ---- 9031 ---- 9082 ---- 9133 ---- 9184 ---- 9235 ---- 9286 ---- 9337 ---- 9388 ---- 9439 ---- 9490 ---- 9541 ---- 9592 ---- 9643 ---- 9694 ---- 9745 ---- 9796 ---- 9847 ---- 9898 ---- 9949 ---- 10000 --- 9223372036854775807
      │    │    │    │   histogram(43)=  0 420 0 413 0 397 0 412 0 415 0 380 0 402 0 396 0 415 0 405 0 393  0 438  0 377  0 362  0 376  0 373  0 406  0 421  0 407  0 398  0 411  0 399  0 401  0 390  0 393
      │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24
      │    │    │    ├── key: (40)
      │    │    │    └── fd: (40)-->(43)
      │    │    └── filters
      │    │         ├── s_nationkey:43 = n_nationkey:49 [type=bool, outer=(43,49), constraints=(/43: (/NULL - ]; /49: (/NULL - ]), fd=(43)==(49), (49)==(43)]
      │    │         └── l_suppkey:24 = s_suppkey:40 [type=bool, outer=(24,40), constraints=(/24: (/NULL - ]; /40: (/NULL - ]), fd=(24)==(40), (40)==(24)]
      │    └── projections
      │         └── l_extendedprice:27 * (1.0 - l_discount:28) [as=column60:60, type=float, outer=(27,28), immutable]
      └── aggregations
           └── sum [as=sum:61, type=float, outer=(60)]
                └── column60:60 [type=float]

----Stats for q5_sort_1----
column_names  row_count  distinct_count  null_count
{n_name}      5          5               0
{revenue}     5          5               0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_name}      5.00           1.00           5.00                1.00                0.00            1.00
{revenue}     5.00           1.00           5.00                1.00                0.00            1.00

----Stats for q5_group_by_2----
column_names  row_count  distinct_count  null_count
{n_name}      5          5               0
{sum}         5          5               0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_name}      5.00           1.00           5.00                1.00                0.00            1.00
{sum}         5.00           1.00           5.00                1.00                0.00            1.00

----Stats for q5_project_3----
column_names  row_count  distinct_count  null_count
{column60}    7243       7243            0
{n_name}      7243       5               0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{column60}    12897.00       1.78           12602.00            1.74                0.00            1.00
{n_name}      12897.00       1.78           5.00                1.00                0.00            1.00

----Stats for q5_inner_join_4----
column_names       row_count  distinct_count  null_count
{c_custkey}        7243       5557            0
{c_nationkey}      7243       5               0
{l_discount}       7243       11              0
{l_extendedprice}  7243       7208            0
{l_orderkey}       7243       6640            0
{l_suppkey}        7243       1944            0
{n_name}           7243       5               0
{n_nationkey}      7243       5               0
{n_regionkey}      7243       1               0
{o_custkey}        7243       5557            0
{o_orderdate}      7243       365             0
{o_orderkey}       7243       6640            0
{r_name}           7243       1               0
{r_regionkey}      7243       1               0
{s_nationkey}      7243       5               0
{s_suppkey}        7243       1944            0
~~~~
column_names       row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}        12897.00       1.78           12897.00            2.32 <==            0.00            1.00
{c_nationkey}      12897.00       1.78           5.00                1.00                0.00            1.00
{l_discount}       12897.00       1.78           11.00               1.00                0.00            1.00
{l_extendedprice}  12897.00       1.78           12576.00            1.74                0.00            1.00
{l_orderkey}       12897.00       1.78           12528.00            1.89                0.00            1.00
{l_suppkey}        12897.00       1.78           1843.00             1.05                0.00            1.00
{n_name}           12897.00       1.78           5.00                1.00                0.00            1.00
{n_nationkey}      12897.00       1.78           5.00                1.00                0.00            1.00
{n_regionkey}      12897.00       1.78           1.00                1.00                0.00            1.00
{o_custkey}        12897.00       1.78           12897.00            2.32 <==            0.00            1.00
{o_orderdate}      12897.00       1.78           365.00              1.00                0.00            1.00
{o_orderkey}       12897.00       1.78           12528.00            1.89                0.00            1.00
{r_name}           12897.00       1.78           1.00                1.00                0.00            1.00
{r_regionkey}      12897.00       1.78           1.00                1.00                0.00            1.00
{s_nationkey}      12897.00       1.78           5.00                1.00                0.00            1.00
{s_suppkey}        12897.00       1.78           1843.00             1.05                0.00            1.00

----Stats for q5_lookup_join_5----
column_names       row_count  distinct_count  null_count
{c_custkey}        184082     17300           0
{c_nationkey}      184082     5               0
{l_discount}       184082     11              0
{l_extendedprice}  184082     165216          0
{l_orderkey}       184082     45968           0
{l_suppkey}        184082     9920            0
{n_name}           184082     5               0
{n_nationkey}      184082     5               0
{n_regionkey}      184082     1               0
{o_custkey}        184082     17300           0
{o_orderdate}      184082     365             0
{o_orderkey}       184082     45968           0
{r_name}           184082     1               0
{r_regionkey}      184082     1               0
~~~~
column_names       row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}        287046.00      1.56           27671.00            1.60                0.00            1.00
{c_nationkey}      287046.00      1.56           5.00                1.00                0.00            1.00
{l_discount}       287046.00      1.56           11.00               1.00                0.00            1.00
{l_extendedprice}  287046.00      1.56           246816.00           1.49                0.00            1.00
{l_orderkey}       287046.00      1.56           62202.00            1.35                0.00            1.00
{l_suppkey}        287046.00      1.56           9920.00             1.00                0.00            1.00
{n_name}           287046.00      1.56           5.00                1.00                0.00            1.00
{n_nationkey}      287046.00      1.56           5.00                1.00                0.00            1.00
{n_regionkey}      287046.00      1.56           1.00                1.00                0.00            1.00
{o_custkey}        287046.00      1.56           27671.00            1.60                0.00            1.00
{o_orderdate}      287046.00      1.56           365.00              1.00                0.00            1.00
{o_orderkey}       287046.00      1.56           62202.00            1.35                0.00            1.00
{r_name}           287046.00      1.56           1.00                1.00                0.00            1.00
{r_regionkey}      287046.00      1.56           1.00                1.00                0.00            1.00

----Stats for q5_inner_join_6----
column_names   row_count  distinct_count  null_count
{c_custkey}    46008      17300           0
{c_nationkey}  46008      5               0
{n_name}       46008      5               0
{n_nationkey}  46008      5               0
{n_regionkey}  46008      1               0
{o_custkey}    46008      17300           0
{o_orderdate}  46008      365             0
{o_orderkey}   46008      45968           0
{r_name}       46008      1               0
{r_regionkey}  46008      1               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}    73051.00       1.59           27672.00            1.60                0.00            1.00
{c_nationkey}  73051.00       1.59           5.00                1.00                0.00            1.00
{n_name}       73051.00       1.59           5.00                1.00                0.00            1.00
{n_nationkey}  73051.00       1.59           5.00                1.00                0.00            1.00
{n_regionkey}  73051.00       1.59           1.00                1.00                0.00            1.00
{o_custkey}    73051.00       1.59           27672.00            1.60                0.00            1.00
{o_orderdate}  73051.00       1.59           365.00              1.00                0.00            1.00
{o_orderkey}   73051.00       1.59           62202.00            1.35                0.00            1.00
{r_name}       73051.00       1.59           1.00                1.00                0.00            1.00
{r_regionkey}  73051.00       1.59           1.00                1.00                0.00            1.00

----Stats for q5_index_join_7----
column_names   row_count  distinct_count  null_count
{o_custkey}    227597     86427           0
{o_orderdate}  227597     365             0
{o_orderkey}   227597     227597          0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{o_custkey}    220934.00      1.03           90731.00            1.05                0.00            1.00
{o_orderdate}  220934.00      1.03           365.00              1.00                0.00            1.00
{o_orderkey}   220934.00      1.03           220934.00           1.03                0.00            1.00

----Stats for q5_scan_8----
column_names   row_count  distinct_count  null_count
{o_orderdate}  227597     365             0
{o_orderkey}   227597     227597          0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{o_orderdate}  220934.00      1.03           365.00              1.00                0.00            1.00
{o_orderkey}   220934.00      1.03           220934.00           1.03                0.00            1.00

----Stats for q5_lookup_join_9----
column_names   row_count  distinct_count  null_count
{c_custkey}    30183      29993           0
{c_nationkey}  30183      5               0
{n_name}       30183      5               0
{n_nationkey}  30183      5               0
{n_regionkey}  30183      1               0
{r_name}       30183      1               0
{r_regionkey}  30183      1               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}    30000.00       1.01           27672.00            1.08                0.00            1.00
{c_nationkey}  30000.00       1.01           5.00                1.00                0.00            1.00
{n_name}       30000.00       1.01           5.00                1.00                0.00            1.00
{n_nationkey}  30000.00       1.01           5.00                1.00                0.00            1.00
{n_regionkey}  30000.00       1.01           1.00                1.00                0.00            1.00
{r_name}       30000.00       1.01           1.00                1.00                0.00            1.00
{r_regionkey}  30000.00       1.01           1.00                1.00                0.00            1.00

----Stats for q5_inner_join_10----
column_names   row_count  distinct_count  null_count
{n_name}       5          5               0
{n_nationkey}  5          5               0
{n_regionkey}  5          1               0
{r_name}       5          1               0
{r_regionkey}  5          1               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_name}       5.00           1.00           5.00                1.00                0.00            1.00
{n_nationkey}  5.00           1.00           5.00                1.00                0.00            1.00
{n_regionkey}  5.00           1.00           1.00                1.00                0.00            1.00
{r_name}       5.00           1.00           1.00                1.00                0.00            1.00
{r_regionkey}  5.00           1.00           1.00                1.00                0.00            1.00

----Stats for q5_scan_11----
column_names   row_count  distinct_count  null_count
{n_name}       25         25              0
{n_nationkey}  25         25              0
{n_regionkey}  25         5               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_name}       25.00          1.00           25.00               1.00                0.00            1.00
{n_nationkey}  25.00          1.00           25.00               1.00                0.00            1.00
{n_regionkey}  25.00          1.00           5.00                1.00                0.00            1.00

----Stats for q5_select_12----
column_names   row_count  distinct_count  null_count
{r_name}       1          1               0
{r_regionkey}  1          1               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{r_name}       1.00           1.00           1.00                1.00                0.00            1.00
{r_regionkey}  1.00           1.00           1.00                1.00                0.00            1.00

----Stats for q5_scan_13----
column_names   row_count  distinct_count  null_count
{r_name}       5          5               0
{r_regionkey}  5          5               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{r_name}       5.00           1.00           5.00                1.00                0.00            1.00
{r_regionkey}  5.00           1.00           5.00                1.00                0.00            1.00

----Stats for q5_scan_14----
column_names   row_count  distinct_count  null_count
{s_nationkey}  10000      25              0
{s_suppkey}    10000      9920            0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{s_nationkey}  10000.00       1.00           25.00               1.00                0.00            1.00
{s_suppkey}    10000.00       1.00           9920.00             1.00                0.00            1.00
----
----
