Skip to content

Commit

Permalink
sql: This commit adds the disable_hoist_projection_in_join_limitation…
Browse files Browse the repository at this point in the history
… session flag.

Release note: none

opttester: support session settings in opt tests

This commit adds the `set` opttest flag which can be used to set
session flags via "set=flagname=value".

Release note: none

opttester: This commit removes session setting flags from OptTester.Flags

Release note: none

Release justification: Low risk fix for forwards compatibility of session flag which is
being backported.
  • Loading branch information
Mark Sirek committed Aug 23, 2022
1 parent 8888295 commit 1e5b2ba
Show file tree
Hide file tree
Showing 44 changed files with 216 additions and 183 deletions.
4 changes: 4 additions & 0 deletions pkg/sql/exec_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3336,6 +3336,10 @@ func (m *sessionDataMutator) SetUnconstrainedNonCoveringIndexScanEnabled(val boo
m.data.UnconstrainedNonCoveringIndexScanEnabled = val
}

func (m *sessionDataMutator) SetDisableHoistProjectionInJoinLimitation(val bool) {
m.data.DisableHoistProjectionInJoinLimitation = val
}

func (m *sessionDataMutator) SetTroubleshootingModeEnabled(val bool) {
m.data.TroubleshootingMode = val
}
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/logictest/testdata/logic_test/information_schema
Original file line number Diff line number Diff line change
Expand Up @@ -4690,6 +4690,7 @@ default_transaction_quality_of_service regular
default_transaction_read_only off
default_transaction_use_follower_reads off
default_with_oids off
disable_hoist_projection_in_join_limitation off
disable_partially_distributed_plans off
disable_plan_gists off
disallow_full_table_scans off
Expand Down
3 changes: 3 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/pg_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -4173,6 +4173,7 @@ default_transaction_quality_of_service regular NULL
default_transaction_read_only off NULL NULL NULL string
default_transaction_use_follower_reads off NULL NULL NULL string
default_with_oids off NULL NULL NULL string
disable_hoist_projection_in_join_limitation off NULL NULL NULL string
disable_partially_distributed_plans off NULL NULL NULL string
disable_plan_gists off NULL NULL NULL string
disallow_full_table_scans off NULL NULL NULL string
Expand Down Expand Up @@ -4299,6 +4300,7 @@ default_transaction_quality_of_service regular NULL
default_transaction_read_only off NULL user NULL off off
default_transaction_use_follower_reads off NULL user NULL off off
default_with_oids off NULL user NULL off off
disable_hoist_projection_in_join_limitation off NULL user NULL off off
disable_partially_distributed_plans off NULL user NULL off off
disable_plan_gists off NULL user NULL off off
disallow_full_table_scans off NULL user NULL off off
Expand Down Expand Up @@ -4421,6 +4423,7 @@ default_transaction_quality_of_service NULL NULL NULL
default_transaction_read_only NULL NULL NULL NULL NULL
default_transaction_use_follower_reads NULL NULL NULL NULL NULL
default_with_oids NULL NULL NULL NULL NULL
disable_hoist_projection_in_join_limitation NULL NULL NULL NULL NULL
disable_partially_distributed_plans NULL NULL NULL NULL NULL
disable_plan_gists NULL NULL NULL NULL NULL
disallow_full_table_scans NULL NULL NULL NULL NULL
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/logictest/testdata/logic_test/show_source
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ default_transaction_quality_of_service regular
default_transaction_read_only off
default_transaction_use_follower_reads off
default_with_oids off
disable_hoist_projection_in_join_limitation off
disable_partially_distributed_plans off
disable_plan_gists off
disallow_full_table_scans off
Expand Down
50 changes: 25 additions & 25 deletions pkg/sql/opt/memo/testdata/stats_quality/tpcc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import file=tpcc_stats_w10
# reflect on-line database activity as typically found in production
# environments.
# --------------------------------------------------
stats-quality format=hide-qual database=tpcc stats-quality-prefix=new_order_01 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=new_order_01 ignore-tables=1
SELECT w_tax FROM warehouse WHERE w_id = 1
----
----
Expand Down Expand Up @@ -46,7 +46,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=new_order_02 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=new_order_02 ignore-tables=1
SELECT c_discount, c_last, c_credit
FROM customer
WHERE c_w_id = 1 AND c_d_id = 1 AND c_id = 50
Expand Down Expand Up @@ -87,7 +87,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=new_order_03
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=new_order_03
SELECT i_price, i_name, i_data
FROM item
WHERE i_id IN (125, 150, 175, 200, 25, 50, 75, 100, 225, 250, 275, 300)
Expand Down Expand Up @@ -131,7 +131,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=new_order_04 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=new_order_04 ignore-tables=1
SELECT s_quantity, s_ytd, s_order_cnt, s_remote_cnt, s_data, s_dist_05
FROM stock
WHERE (s_i_id, s_w_id) IN ((1000, 4), (900, 4), (1100, 4), (1500, 4), (1400, 4))
Expand Down Expand Up @@ -193,7 +193,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count
# stringent response time requirements to satisfy on-line users. In addition,
# this transaction includes non-primary key access to the CUSTOMER table.
# --------------------------------------------------
stats-quality format=hide-qual database=tpcc stats-quality-prefix=payment_01 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=payment_01 ignore-tables=1
SELECT c_id
FROM customer
WHERE c_w_id = 1 AND c_d_id = 1 AND c_last = 'ANTIABLEABLE'
Expand Down Expand Up @@ -248,7 +248,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
# users. In addition, this table includes non-primary key access to the
# CUSTOMER table.
# --------------------------------------------------
stats-quality format=hide-qual database=tpcc stats-quality-prefix=order_status_01 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=order_status_01 ignore-tables=1
SELECT c_balance, c_first, c_middle, c_last
FROM customer
WHERE c_w_id = 1 AND c_d_id = 1 AND c_id = 50
Expand Down Expand Up @@ -291,7 +291,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=order_status_02 ignore-tables=(1,3)
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=order_status_02 ignore-tables=(1,3)
SELECT c_id, c_balance, c_first, c_middle
FROM customer
WHERE c_w_id = 2 AND c_d_id = 2 AND c_last = 'ANTIBARESE'
Expand Down Expand Up @@ -358,7 +358,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=order_status_03 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=order_status_03 ignore-tables=1
SELECT o_id, o_entry_d, o_carrier_id
FROM "order"
WHERE o_w_id = 4 AND o_d_id = 3 AND o_c_id = 10
Expand Down Expand Up @@ -401,7 +401,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=order_status_04 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=order_status_04 ignore-tables=1
SELECT ol_i_id, ol_supply_w_id, ol_quantity, ol_amount, ol_delivery_d
FROM order_line
WHERE ol_w_id = 1 AND ol_d_id = 1 AND ol_o_id = 1000
Expand Down Expand Up @@ -463,7 +463,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_cou
# indicating transaction completion. The result of the deferred execution is
# recorded into a result file.
# --------------------------------------------------
stats-quality format=hide-qual database=tpcc stats-quality-prefix=delivery_01 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=delivery_01 ignore-tables=1
SELECT no_o_id
FROM new_order
WHERE no_w_id = 7 AND no_d_id = 6
Expand Down Expand Up @@ -500,7 +500,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=delivery_02
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=delivery_02
SELECT sum(ol_amount)
FROM order_line
WHERE ol_w_id = 8 AND ol_d_id = 6 AND ol_o_id = 1000
Expand Down Expand Up @@ -559,7 +559,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
# heavy read-only database transaction with a low frequency of execution, a
# relaxed response time requirement, and relaxed consistency requirements.
# --------------------------------------------------
stats-quality format=hide-qual database=tpcc stats-quality-prefix=stock_level_01 ignore-tables=1
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=stock_level_01 ignore-tables=1
SELECT d_next_o_id
FROM district
WHERE d_w_id = 4 AND d_id = 9
Expand Down Expand Up @@ -594,7 +594,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=stock_level_02
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=stock_level_02
SELECT count(DISTINCT s_i_id)
FROM order_line
JOIN stock
Expand Down Expand Up @@ -697,7 +697,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
# These queries run after TPCC in order to check database consistency.
# They are not part of the benchmark itself.
# --------------------------------------------------
stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_01
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_01
SELECT count(*)
FROM warehouse
FULL OUTER JOIN
Expand Down Expand Up @@ -812,7 +812,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_02
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_02
SELECT d_next_o_id
FROM district
ORDER BY d_w_id, d_id
Expand Down Expand Up @@ -845,7 +845,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_03
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_03
SELECT max(no_o_id)
FROM new_order
GROUP BY no_d_id, no_w_id
Expand Down Expand Up @@ -900,7 +900,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_04
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_04
SELECT max(o_id)
FROM "order"
GROUP BY o_d_id, o_w_id
Expand Down Expand Up @@ -955,7 +955,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_05
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_05
SELECT count(*)
FROM
(
Expand Down Expand Up @@ -1062,7 +1062,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_06
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_06
SELECT sum(o_ol_cnt)
FROM "order"
GROUP BY o_w_id, o_d_id
Expand Down Expand Up @@ -1116,7 +1116,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_07
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_07
SELECT count(*)
FROM order_line
GROUP BY ol_w_id, ol_d_id
Expand Down Expand Up @@ -1165,7 +1165,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_08
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_08
(SELECT no_w_id, no_d_id, no_o_id FROM new_order)
EXCEPT ALL
(SELECT o_w_id, o_d_id, o_id FROM "order" WHERE o_carrier_id IS NULL)
Expand Down Expand Up @@ -1280,7 +1280,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_09
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_09
(SELECT o_w_id, o_d_id, o_id FROM "order" WHERE o_carrier_id IS NULL)
EXCEPT ALL
(SELECT no_w_id, no_d_id, no_o_id FROM new_order)
Expand Down Expand Up @@ -1395,7 +1395,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_10
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_10
(
SELECT o_w_id, o_d_id, o_id, o_ol_cnt
FROM "order"
Expand Down Expand Up @@ -1508,7 +1508,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality format=hide-qual database=tpcc stats-quality-prefix=consistency_11
stats-quality format=hide-qual database=tpcc set=save_tables_prefix=consistency_11
(
SELECT ol_w_id, ol_d_id, ol_o_id, count(*)
FROM order_line
Expand Down Expand Up @@ -1621,7 +1621,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e
----
----

stats-quality database=tpcc stats-quality-prefix=consistency_12
stats-quality database=tpcc set=save_tables_prefix=consistency_12
SELECT count(*)
FROM
(
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q01
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import file=tpch_stats
# LINESTATUS, and listed in ascending order of RETURNFLAG and LINESTATUS. A
# count of the number of lineitems in each group is included.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q1
stats-quality database=tpch set=save_tables_prefix=q1
SELECT
l_returnflag,
l_linestatus,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q02
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import file=tpch_stats
# 1. Allow Select to be pushed below Ordinality used to add key column
# 2. Add decorrelation rule for Ordinality/RowKey
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q2
stats-quality database=tpch set=save_tables_prefix=q2
SELECT
s_acctbal,
s_name,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q03
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import file=tpch_stats
# decreasing order of revenue. If more than 10 unshipped orders exist, only the
# 10 orders with the largest revenue are listed.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q3
stats-quality database=tpch set=save_tables_prefix=q3
SELECT
l_orderkey,
sum(l_extendedprice * (1 - l_discount)) AS revenue,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q04
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import file=tpch_stats
# committed date. The query lists the count of such orders for each order
# priority sorted in ascending priority order.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q4
stats-quality database=tpch set=save_tables_prefix=q4
SELECT
o_orderpriority,
count(*) AS order_count
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q05
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import file=tpch_stats
# all qualifying lineitems in a particular nation is defined as
# sum(l_extendedprice * (1 - l_discount)).
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q5
stats-quality database=tpch set=save_tables_prefix=q5
SELECT
n_name,
sum(l_extendedprice * (1 - l_discount)) AS revenue
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q06
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import file=tpch_stats
# increase is equal to the sum of [l_extendedprice * l_discount] for all
# lineitems with discounts and quantities in the qualifying range.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q6
stats-quality database=tpch set=save_tables_prefix=q6
SELECT
sum(l_extendedprice * l_discount) AS revenue
FROM
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q07
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import file=tpch_stats
# that took place in that year. The query orders the answer by Supplier nation,
# Customer nation, and year (all ascending).
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q7
stats-quality database=tpch set=save_tables_prefix=q7
SELECT
supp_nation,
cust_nation,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q08
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import file=tpch_stats
# from the given nation. The query determines this for the years 1995 and 1996
# presented in this order.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q8
stats-quality database=tpch set=save_tables_prefix=q8
SELECT
o_year,
sum(CASE
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q09
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import file=tpch_stats
# nations in ascending alphabetical order and, for each nation, the year and
# profit in descending order by year (most recent first).
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q9
stats-quality database=tpch set=save_tables_prefix=q9
SELECT
nation,
o_year,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q10
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import file=tpch_stats
# Revenue lost is defined as sum(l_extendedprice*(1-l_discount)) for all
# qualifying lineitems.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q10
stats-quality database=tpch set=save_tables_prefix=q10
SELECT
c_custkey,
c_name,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q11
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import file=tpch_stats
# available parts. The query displays the part number and the value of those
# parts in descending order of value.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q11
stats-quality database=tpch set=save_tables_prefix=q11
SELECT
ps_partkey,
sum(ps_supplycost * ps_availqty::float) AS value
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q12
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import file=tpch_stats
# The late lineitems are partitioned into two groups, those with priority URGENT
# or HIGH, and those with a priority other than URGENT or HIGH.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q12
stats-quality database=tpch set=save_tables_prefix=q12
SELECT
l_shipmode,
sum(CASE
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/memo/testdata/stats_quality/tpch/q13
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import file=tpch_stats
# several special categories of orders. Special categories are identified in the
# order comment column by looking for a particular pattern.
# --------------------------------------------------
stats-quality database=tpch stats-quality-prefix=q13
stats-quality database=tpch set=save_tables_prefix=q13
SELECT
c_count, count(*) AS custdist
FROM (
Expand Down
Loading

0 comments on commit 1e5b2ba

Please sign in to comment.