Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
46881: colexec: run logic test of batch size 1 r=yuzefovich a=Azhng

Previously, we run logic test of vectorize engine with default
batch size. This is difficult to expose bugs that caused by
improper batch reuse.
By reducing the batch size to 1 in logic test simulates large
input size for vectorize engine.

Closes cockroachdb#46185

Release note: None


47089: ui: Remove Statements tab from Table details page r=dhartunian a=koorosh

Resolves: cockroachdb#47079

Initially it was supposed to show Statements tab on Table
details page to show all statements which belong to
particular table. Due to existing limitations (Admin UI
API doesn't provide enough information about statements
to distinguish which statements are relevant to particular
table.
That's why to avoid misleading or incomplete data representation
it is was decided to remove this tab.

Now, Table details page has only two tabs, and Statements tab
is removed.

Release note (admin ui change): Statements tab is removed from
Databases > Table Details page

Release justification: bug fixes and low-risk updates to new functionality

Before:
<img width="1022" alt="Screenshot 2020-04-06 at 22 53 36" src="https://user-images.githubusercontent.com/3106437/78599271-86f75500-7859-11ea-9a0d-9f3a5e2bb99a.png">

After:
<img width="1014" alt="Screenshot 2020-04-06 at 22 53 16" src="https://user-images.githubusercontent.com/3106437/78599283-8c549f80-7859-11ea-88f7-c09edd862d64.png">


Co-authored-by: Archer Zhang <[email protected]>
Co-authored-by: Andrii Vorobiov <[email protected]>
  • Loading branch information
3 people committed Apr 6, 2020
3 parents 8db0d8c + e2e5b79 + f9cddfa commit 1c60dc7
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 47 deletions.
1 change: 1 addition & 0 deletions pkg/sql/colflow/vectorized_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ func finishVectorizedStatsCollectors(
vsc.VectorizedStats.Time = 0
vsc.MaxAllocatedMem = 0
vsc.MaxAllocatedDisk = 0
vsc.NumBatches = 0
}
if vsc.ID < 0 {
// Ignore stats collectors not associated with a processor.
Expand Down
38 changes: 33 additions & 5 deletions pkg/sql/logictest/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"unicode/utf8"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/col/coldata"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/security"
Expand Down Expand Up @@ -981,6 +982,12 @@ type logicTest struct {

curPath string
curLineNo int

// randomizedVectorizedBatchSize stores the randomized batch size for
// vectorized engine if it is not turned off. The batch size will randomly be
// set to 1 with 25% probability, {2, 3} with 25% probability or default batch
// size with 50% probability.
randomizedVectorizedBatchSize int
}

func (t *logicTest) t() *testing.T {
Expand Down Expand Up @@ -1258,7 +1265,15 @@ func (t *logicTest) setup(cfg testClusterConfig) {
); err != nil {
t.Fatal(err)
}

}
if strings.Compare(cfg.overrideVectorize, "off") != 0 {
if _, err := t.cluster.ServerConn(0).Exec(
fmt.Sprintf("SET CLUSTER SETTING sql.testing.vectorize.batch_size to %d",
t.randomizedVectorizedBatchSize),
); err != nil {
t.Fatal(err)
}
t.t().Log(fmt.Sprintf("randomize batchSize to %d\n", t.randomizedVectorizedBatchSize))
}

if cfg.overrideAutoStats != "" {
Expand Down Expand Up @@ -2478,6 +2493,18 @@ func RunLogicTest(t *testing.T, globs ...string) {
}
}

// Determining whether or not to randomize vectorize batch size.
rng, _ := randutil.NewPseudoRand()
randVal := rng.Float64()
randomizedVectorizedBatchSize := coldata.BatchSize()
if randVal < 0.25 {
randomizedVectorizedBatchSize = 1
} else if randVal < 0.375 {
randomizedVectorizedBatchSize = 2
} else if randVal < 0.5 {
randomizedVectorizedBatchSize = 3
}

// The tests below are likely to run concurrently; `log` is shared
// between all the goroutines and thus all tests, so it doesn't make
// sense to try to use separate `log.Scope` instances for each test.
Expand Down Expand Up @@ -2520,10 +2547,11 @@ func RunLogicTest(t *testing.T, globs ...string) {
}
rng, _ := randutil.NewPseudoRand()
lt := logicTest{
rootT: t,
verbose: verbose,
perErrorSummary: make(map[string][]string),
rng: rng,
rootT: t,
verbose: verbose,
perErrorSummary: make(map[string][]string),
rng: rng,
randomizedVectorizedBatchSize: randomizedVectorizedBatchSize,
}
if *printErrorSummary {
defer lt.printErrorSummary()
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/dist_vectorize
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ NULL /1 {5} 5
query T
SELECT url FROM [EXPLAIN ANALYZE SELECT count(*) FROM kv]
----
https://cockroachdb.github.io/distsqlplan/decode.html#eJzMld9r4k4Uxd-_f8Vwn_TLuPmptXmqdF0QbOway_4ooUyTixsaM9mZibSI__uSpLAadicBYfUxM3M85_C5eHcgf6bgQTCdT29XpBAp-bRc3JHH6df7-WTmk4k_mX_7PiW9j7NgFXye98n704gXmer936_fv2xDoJDxGH22QQneI1hAwQYKDlBwgcIQQgq54BFKyUX5ZFcJZvEreCaFJMsLVR6HFCIuELwdqESlCB6s2HOKS2QxCsMECjEqlqSVTS6SDRNvNy9boBDkLJMeGRil8aJQHvF5hkDhmanoB0rCC5WXx2U4VeRp40hiipFKtol684j5wSy9pGJpSlSyQY-YEsI9hVrynlUqtkbwrD3t3meyXgtcM8WFMTyuc7t48FdPy8WXoNc_LTe-YlSohGft2e2_Zv8duci4iFFgfJQ33OvbWQ1awcPd08xf9W6sf9fOOWpndZ80q33SDHtgOGeetZZGBzRGFzdrdncadgcazsBwz0yjpdEBjauLo-F0p-F0oOEOqn-3c9JoaXRAY3xxNNzuNNwONIaDM7No6XPA4vriWLTs8yXKnGcSG7vxz79sljsT4zXWC1byQkR4L3hU2dSfi0pXHcQoVX1r1R-zrL4qAx6KLa3YPhJbTbGtd26xdrRqVy92T8k91IpHeufRKc5XWvFY7zw-xflaz8psGRP9kDW9w_1_vwIAAP__n7n0ow==
https://cockroachdb.github.io/distsqlplan/decode.html#eJzMld9r4k4Uxd-_f8Vwn_TLuPmptXmqdF0QbOway_4ooUyTixsaM9mZibSI__uSpLBRdicBYfUxkzk55_C55O5A_kzBg2A6n96uSCFS8mm5uCOP06_388nMJxN_Mv_2fUp6H2fBKvg875P3qxEvMtX7v1_ff9mGQCHjMfpsgxK8R7CAgg0UHKDgAoUhhBRywSOUkovyyq4SzOJX8EwKSZYXqjwOKURcIHg7UIlKETxYsecUl8hiFIYJFGJULEkrm1wkGybebl62QCHIWSY9MjBK40WhPOLzDIHCM1PRD5SEFyovj8uPqCJPG0dlXokpRirZJurNI-YHs7wmFUtTopINesSUEO4p1JL3rFKxNYJn7Wn3PpP1WuCaKS6M4WGd28WDv3paLr4Evf5pufEVo0IlPGvPbv81--_IRcZFjALjg7zhXt_OOqIVPNw9zfxV78b6d-2cg3ZW90mz2ifNsAeGc-ZZa2nUoDG6uFmzu9OwO9BwBoZ7ZhotjRo0ri6OhtOdhtOBhjuo_m7npNHSqEFjfHE03O403A40hoMzs2jp02BxfXEsWvb5EmXOM4lHu_HPXzbLnYnxGusFK3khIrwXPKps6sdFpasOYpSqfmvVD7OsflUGbIotrdg-EFvHYlvv3GLtaNWuXuyeknuoFY_0zqNTnK-04rHeeXyK87WeldkyJvohO_YO9__9CgAA__9P_PSY

query T
SELECT url FROM [EXPLAIN ANALYZE SELECT * FROM kv JOIN kw ON kv.k = kw.k]
----
https://cockroachdb.github.io/distsqlplan/decode.html#eJzUl99P6kgUx9_3r5icJ10H2-kPlCYmmF02wSC44sPuGh4qnYWG2nbbKWoM__um9N54KTCnZXJJeZN2PjPne_xMcvoJ6X8BODDuDXq_PZEsCcgfj6N78tz762Fw2x-S2-Ht4O9_euTs9_74afzn4Jx8W_prsXCxJHej_pAs3shoSBbLywW5IYu3y8UEKISRx4fuK0_BeQYGFAygYAIFCyjYMKEQJ9GUp2mU5Es-10DfewdHp-CHcSbyxxMK0yjh4HyC8EXAwYEn9yXgj9z1eKLpQMHjwvWD9TFx4r-6yUd3sQQK49gNU4e0tPzgF1dM5zwlUSbiTDgkL0hkcVB6lPKAT4W_9MWHQ_RLPd8_FW4QEOG_cofoKUxWFAqkKPt7WS8fZO6m882Cugwmq8l6jxkHh63oYTnbe3K-feXUWJOSGnuTfu0TJR5PuFfe5yI_uNKqHU2758mM30V-yBONlewI-L_irMsuzm8SfzYv_gQKo7wlXUa7Bu2atGup9ZC_82km_Cjc18evHpkVepSFu_LvjD6MWlGsMXszdDmKvR3FVo9ibURh1cVm-AXWjJZmNkZsdmjSqwpXuFFJjb1Jj3iF2SldYaO6DUYF782Wppjkp3lfI-l1Be8bldTYm_SI3hun5L1Z3QazgvdWS7MbYwM7NGmngveNSmrsTXpE781T8t6qboNVwXu71RgX2KE5bdz6lsaIG3qEkUjMedKYzMbezEf03zol_5EP2EeexlGY8tKny-6d9bw13JvxouFplCVT_pBE0_Uxxc_RmlvPoh5PRfHWKH70w-JVXmB1uK0Cd1RgplQ3s-U0q9Eyox7cVoE7KjBTqrvUsi3aKNP6j7Qp77cphdlmz_QybakILocRweUwIrgcxgRHaERwW0VwOYwILocRweUwJjhCI4K3VQS_UlFUDiOKymFEUTmMKYrQiKLXKorKYURROYwoKocxRREaUbSjoihTmhMQGpEUoRFLERrTFMOxWUFtWFCbFtTGBcV5QW1gYEoTA9saGWrZKqcxW-U0ZqucRm1FcMzWOsPS9v-szrRUl8ZsrTUv1cYxW7eGB6mtk9Uv_wcAAP__2fbfeA==
https://cockroachdb.github.io/distsqlplan/decode.html#eJzUl11P4zgUhu_3V1jnChaXxPkoNBJS0W5XKiotS7mYGdSL0HjaqCHJJE4Bof73UZoZQb98klpTpXc08WOf9_BYOnmH9EcADgw7vc4_DyRLAvLf_eCWPHa-3PWuu31y3b_uff3WISf_docPw_97p-TX0r-LhbM5uRl0-2T2QgZ9Mpufz8gVmb2cz0ZAIYw83nefeQrOIzCgYAAFEyhYQMGGEYU4icY8TaMkX_K-BLreKzg6BT-MM5E_HlEYRwkH5x2ELwIODjy4TwG_567HE00HCh4Xrh8sj4kT_9lN3tqzOVAYxm6YOqSh5Qc_uWI85SmJMhFnwiE5KLI4-PQorzHlAR8Lf-6LN4fo53q-LBVuEBDhP3OH6CmMFhQKpCj7d1lPb2TqptPVgtoMRovRco8JB4ct6H45mztyvnzk1Fidkho7k37sEyUeT7i3vs9ZfnCpVVuadsuTCb-J_JAnGluzI-DfxUmbnZ1eJf5kWvwJFAZ5S9qMtg3aNmnbUushf-XjTPhRuKuPHz0yS_QoC7fl3xq9HzWiWGP2augSUWz1KNZKFFZebIZfYM1oaGZtxGb7Jr0ocYVrldTYmfSAV5gd0xU2yttglPDebGiKSf6Y9xWSXpbwvlZJjZ1JD-i9cUzem-VtMEt4bzU0uzY2sH2Ttkp4X6ukxs6kB_TePCbvrfI2WCW8txu1cYHtm9PGrW9ojLihRxiJxJQntcls7Mx8QP-tY_If-YC952kchSlf-3TZvrOet4Z7E140PI2yZMzvkmi8PKb4OVhyy1nU46ko3hrFj25YvMoLLA83VeCWCsyU6ma2nGYVWmZUg5sqcEsFZkp1r7VsgzbWaf0zbcr7bUphttozfZ22VASXw4jgchgRXA5jgiM0IritIrgcRgSXw4jgchgTHKERwZsqgl-oKCqHEUXlMKKoHMYURWhE0UsVReUwoqgcRhSVw5iiCI0o2lJRlCnNCQiNSIrQiKUIjWmK4disoDYsqE0LauOC4rygNjAwpYmBbYwMlWyV05itchqzVU6jtiI4ZmuVYWnzf1ZlWqpKY7ZWmpcq45itG8OD1NbR4q-fAQAA__8UIt9k

# Verify execution.
statement ok
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/logictest/testdata/logic_test/event_log
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ WHERE "eventType" = 'set_cluster_setting'
AND info NOT LIKE '%version%' AND info NOT LIKE '%sql.defaults.distsql%' AND info NOT LIKE '%cluster.secret%'
AND info NOT LIKE '%sql.stats.automatic_collection.enabled%'
AND info NOT LIKE '%sql.defaults.vectorize%'
AND info NOT LIKE '%sql.testing.vectorize.batch_size%'
ORDER BY "timestamp"
----
0 1 {"SettingName":"diagnostics.reporting.enabled","Value":"true","User":"root"}
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/merge_join_192
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ INSERT INTO t VALUES (1), (2), (3)
query T
SELECT url FROM [EXPLAIN ANALYZE SELECT t1.k FROM t AS t1, t AS t2 WHERE t1.k = t2.k]
----
https://cockroachdb.github.io/distsqlplan/decode.html#eJzMkk9r20AQxe_9FMOcErp1tPJtIWDTqtTFsVPL0D9Bh400dZasteruqCQYffciraFxSBvcXnLbnXm_0byn3WH4YVFhns2zt2tovYX3q-UFXGVfLufT2QKmi-n867cMTt7N8nX-aX4KeynL0W3UMkxzYCn2hxQ-f8hWWRScA6ej2wIF1q6ihd5SQHWFEguBjXclheB8X9oNgll1hyoRaOqm5b5cCCydJ1Q7ZMOWUOFaX1taka7InyUosCLWxg5jG2-22t9PGAXmja6Dgjco8FpzeUMBXMtNywokCuS2sQ9KYxQYyFLJ5qfhewXJKOmHB9bWApstKUgCFp3AiOyXC6w3hEp24t8MyBdiIP2jgd97t7XzFXmqDnYuevI5yRMpXJDf0EdnavJn6WEKlr7zyUS-Pj33ZnMTjyhw2fucyP_Lg-6obNm4-vlMxsf81BWFxtWBHmfz5OSkD4SqDcWAg2t9SZfelcNn4nU5cEOhosCxm8bLrB5aw6t7CMsj4PQxnP4VHh_ASVd0r34FAAD___kkXuQ=
https://cockroachdb.github.io/distsqlplan/decode.html#eJzMkl9r2zAUxd_3KS73qWVaajtvgkLC5rGMNOniwP4UP6j2XSqqWJ50NVqCv_uwFVhTupVsL32Tjs5PvudYO_Q_DEos8nn-dg3BGXi_Wl7AVf7lcj6dLWC6mM6_fsvh5N2sWBef5qewt3I6uo1ehmkBnIr9IoPPH_JVHg3nwNnotkSBja1pobbkUV5hiqXA1tmKvLeul3aDYVbfoUwE6qYN3MulwMo6QrlD1mwIJa7VtaEVqZrcWYICa2KlzXBt6_RWufsJo8CiVY2X8AYFXiuubsiDDdwGltBTHFrzQBqjQE-GKtY_Nd9LSEZJb_OsjAHWW5KQeCw7gRHZD-dZbQhl2ol_C5C-kADZHwP8njs01tXkqD6YuezJ5yxPtHBBbkMfrW7InWWHLRj6zieT9PXpudObm7hEgcs-5yT9vz7ojqrA2jbPdzI-5qeuyLe28fS4mydvTvpCqN5QLNjb4Cq6dLYaPhO3y4EbhJo8x9MsbmbNcDS8uodwegScPYazv8LjAzjpyu7VrwAAAP__8eFe4Q==

statement ok
RESET vectorize; RESET vectorize_row_count_threshold
4 changes: 3 additions & 1 deletion pkg/sql/logictest/testdata/logic_test/system
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ FROM system.settings
WHERE name != 'sql.defaults.distsql'
AND name != 'sql.stats.automatic_collection.enabled'
AND name NOT LIKE '%sql.defaults.vectorize%'
AND name NOT LIKE '%sql.testing.vectorize.batch_size%'
ORDER BY name
----
cluster.secret
Expand All @@ -549,7 +550,8 @@ SELECT name, value
FROM system.settings
WHERE name NOT IN ('version', 'sql.defaults.distsql', 'cluster.secret',
'sql.stats.automatic_collection.enabled', 'sql.defaults.vectorize',
'sql.defaults.vectorize_row_count_threshold')
'sql.defaults.vectorize_row_count_threshold',
'sql.testing.vectorize.batch_size')
ORDER BY name
----
diagnostics.reporting.enabled true
Expand Down
6 changes: 3 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/vectorize_local
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ SET vectorize_row_count_threshold = 0
query T
SELECT url FROM [EXPLAIN ANALYZE SELECT a FROM a]
----
https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkMFO4zAQhu_7FNZ_2pW8kHACn1pBkCKFtjQ9AFUObjIqkdzY2BNEVeXdUeIe4IDEcb75Zux_TghvBgplVmS3G9F7I-7XywexzZ5WxTxfiPliXjy_ZOLvXV5uysfinzirOoq6gkRnG1roAwWoLVJUEs7bmkKwfkSnScibD6hEou1czyOuJGrrCeoEbtkQFDZ6Z2hNuiF_mUCiIdatmdY63x60P840JEqnu6DEf0gse1ZilkJip7l-pSBsz26EV5Dg3pmvKElGM5Chmtv3lo9KJBc31yNjbYzg9kBKJAHVIBGnzj8NrPcElQ7y92nWFJztAn0L8tPmZKgkqNlTvFiwva9p5W09PRPL5TQ3gYYCx24ai7yLraEa_nwGAAD__86elhA=
https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkLFOwzAQhneewvonkAw4jJ5aQZAihbY0HYAqg5ucSiQ3DvYFUVV5d5S4AwxIjPfd9599d0L4sNAo0jy934jeW_G4Xj6JbfqyyufZQswX8_z1LRWXD1mxKZ7zK3FWTRRNCYnW1bQwBwrQWyQoJTrvKgrB-RGdJiGrv6CVRNN2PY-4lKicJ-gTuGFL0NiYnaU1mZr8rYJETWwaO43tfHMw_jgzkCg60wYtriGx7FmLWQKJneHqnYJwPXcjHPPcd_YHulNqNANZqrj5bPiohbpRoxnYWCu4OZAWKqAcJGLq_NPAZk_QySD_v82aQufaQL8W-WuyGkoJqvcULxZc7ytaeVdNz8RyOeUmUFPg2E1ikbWxNZTDxXcAAAD__76-lf0=

query T
SELECT url FROM [EXPLAIN ANALYZE SELECT c.a FROM c JOIN d ON d.b = c.b]
----
https://cockroachdb.github.io/distsqlplan/decode.html#eJykkk-P0zAQxe98itGcQDIl6dESUisoUlYhWdoegFUOrj1aDK4dPA50VeW7o_wRtEigRRz95r2Z-Y18Rv7qUOJuU25e7aGLDt5s67dwt3l_W66LCtbVuvzwcQNPXxe7_e5d-Qxmq16oyarhpi4qMFBXYBYHeAl6cWhQoA-GKnUkRnmHOTYC2xg0MYc4SOfRUJgTykyg9W2XBrkRqEMklGdMNjlCiXt1cLQlZSi-yFCgoaSsG9sy6ZVGgbtWeZbwHAXWXZKwysVqiQIPKulPxBC61A56jgJT17oLabAxOdLJfrPpQUK2yIYpnJRzkOyRJGSMTS9wisxbclL3hDLvxeNJboL1M0h-DdJGe1TxYWVQYBnCl66Fz8F6CF7CSDJj_R8TnUh3yQb_i0tgDN8ZIikz5665ByBDJ7hw5T_FR95o-S832hK3wTNd3edPnbO-EUjmnqYfxaGLmm5j0OOY6VmPuVEwxGmq5tOj8FNpWPAynP81vPwt3PRPfgQAAP__vR0M5w==
https://cockroachdb.github.io/distsqlplan/decode.html#eJykkk-P0zAQxe98itGcQDIl6dESUisoUlYhWdoegFUOrj1aDK4dPA50VeW7o_wRtEigRRznzXvj-Y18Rv7qUOJuU25e7aGLDt5s67dwt3l_W66LCtbVuvzwcQNPXxe7_e5d-Qxmq16oyarhpi4qMFBXYBYHeAl6cWhQoA-GKnUkRnmHOTYC2xg0MYc4SOfRUJgTykyg9W2XBrkRqEMklGdMNjlCiXt1cLQlZSi-yFCgoaSsG8cy6ZVGgbtWeZbwHAXWXZKwysVqiQIPKulPxBC61A76EE9d6y6kwcbkSCf7zaYHCdkiG2yclHOQ7JEkZIxNL3CKzFtyUveEMu_F40lugvUzSH4N0kZ7VPFhZVBgGcKXroXPwXoIXsJIMmP9HxOdSHfJBv-LS2AM3xkiKTPnrrkHIEMnuHDlP8VH3mj5LzfaErfBM13d50-Ts74RSOaeph_FoYuabmPQ4zNTWY-5UTDEaermU1H4qTUseBnO_xpe_hZu-ic_AgAA__-5Pwzl

query T
SELECT url FROM [EXPLAIN ANALYZE SELECT c.a FROM c INNER MERGE JOIN d ON c.a = d.b]
----
https://cockroachdb.github.io/distsqlplan/decode.html#eJy8klFr2zAUhd_3Ky73qWVaartvgkLC5g2XxO6cPGwrflCku1SgWJ4kj5aQ_z4sF9aUbCVj9M06Op-kc6536H8Y5LjM5_n7FfTOwMe6WsBt_uVmPitKmJWz-ddvOZx9KJar5ef5OTxa5USMVglFWeY1LPL6Uw7XVVGCgqqMhitQk3WDDFurqBRb8shvMcWGYeesJO-tG6RdNBTqHnnCULddHwa5YSitI-Q7DDoYQo4rsTZUk1DkLhJkqCgIbeKxndNb4R6mEhkuO9F6Du-QYdUHDtMUGa5FkHfkwfahG8RBC31nnkgZMvRkSAb9U4cHDskkGa7xQRgDQW-JQ-Kx2TMckcdn-iA2hDzds3-Lkh6Poo5FyV4lSvbHKL8T9K11ihypg9c3A_mS5UgfC3Ibura6JXeRHfZh6Hs4m6Zvz6-c3tyNn_9rtHRPsg_ati93cnnKeGvynW09Pe_m6MnJUAipDY0Fe9s7STfOynjNuKwiFwVFPoy72bgo2rgV_7-ncHoCnD2Hs7_Clwdwsm_2b34FAAD__9y3YyI=
https://cockroachdb.github.io/distsqlplan/decode.html#eJy8klFr2zAUhd_3Ky73qWVaartvgkLC5g2XxO6cPGwrflCku1SgWJ4kj5aQ_z4sF9aUbCVj9M06Op-sc6526H8Y5LjM5_n7FfTOwMe6WsBt_uVmPitKmJWz-ddvOZx9KJar5ef5OTxa5USMVglFWeY1LPL6Uw7XVVGCgqqMhitQk3WDDFurqBRb8shvMcWGYeesJO-tG6RdNBTqHnnCULddHwa5YSitI-Q7DDoYQo4rsTZUk1DkLhJkqCgIbeKxndNb4R6mEhkuO9F6Du-QYdUHDtMUGa5FkHfkwfahG8SBD31nnkgZMvRkSAb9U4cHDskkGWw-CGMg6C1xSDw2e4Yj8nhNH8SGkKd79m9R0uNR1LEo2atEyf4Y5XeCvrVOkSN1cPtmIF-yHOljQW5D11a35C6ywz4MfQ9n0_Tt-ZXTm7vx83-Nlu5J9kHb9uVOLk8Zb02-s62n590cPTkZCiG1obFgb3sn6cZZGX8zLqvIRUGRD-NuNi6KNm7F9_cUTk-As-dw9lf48gBO9s3-za8AAAD__9VqYx8=

statement ok
RESET vectorize; RESET distsql; RESET vectorize_row_count_threshold
Expand Down
42 changes: 7 additions & 35 deletions pkg/ui/src/views/databases/containers/tableDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
// licenses/APL.txt.

import { Col, Row, Tabs } from "antd";
import { Highlight } from "oss/src/views/shared/components/sql/highlight";
import { SummaryCard } from "oss/src/views/shared/components/summaryCard";
import { selectStatements } from "oss/src/views/statements/statementsPage";
import { AggregateStatistics, makeStatementsColumns, StatementsSortedTable } from "oss/src/views/statements/statementsTable";
import { Highlight } from "src/views/shared/components/sql/highlight";
import { SummaryCard } from "src/views/shared/components/summaryCard";
import React from "react";
import { Helmet } from "react-helmet";
import { connect } from "react-redux";
import { RouteComponentProps, withRouter } from "react-router-dom";
import * as protos from "src/js/protos";
import { generateTableID, refreshStatements, refreshTableDetails, refreshTableStats, refreshDatabaseDetails } from "src/redux/apiReducers";
import { generateTableID, refreshTableDetails, refreshTableStats, refreshDatabaseDetails } from "src/redux/apiReducers";
import { LocalSetting } from "src/redux/localsettings";
import { AdminUIState } from "src/redux/state";
import { appAttr, databaseNameAttr, tableNameAttr } from "src/util/constants";
import { databaseNameAttr, tableNameAttr } from "src/util/constants";
import { Bytes } from "src/util/format";
import { TableInfo } from "src/views/databases/data/tableInfo";
import { SortSetting } from "src/views/shared/components/sortabletable";
Expand All @@ -30,7 +28,7 @@ import "./styles.styl";
const { TabPane } = Tabs;
import { getMatchParamByName } from "src/util/query";
import { databaseDetails } from "../databaseSummary";
import { Button, BackIcon } from "oss/src/components/button";
import { Button, BackIcon } from "src/components/button";

class GrantsSortedTable extends SortedTable<protos.cockroach.server.serverpb.TableDetailsResponse.IGrant> {}

Expand All @@ -45,7 +43,6 @@ const databaseTableGrantsSortSetting = new LocalSetting<AdminUIState, SortSettin
interface TableMainData {
tableInfo: TableInfo;
grantsSortSetting: SortSetting;
statements: AggregateStatistics[];
}

/**
Expand All @@ -56,7 +53,6 @@ interface TableMainActions {
// Refresh the table data
refreshTableDetails: typeof refreshTableDetails;
refreshTableStats: typeof refreshTableStats;
refreshStatements: typeof refreshStatements;
refreshDatabaseDetails: typeof refreshDatabaseDetails;
setSort: typeof databaseTableGrantsSortSetting.set;
dbResponse: protos.cockroach.server.serverpb.DatabaseDetailsResponse;
Expand Down Expand Up @@ -85,28 +81,14 @@ export class TableMain extends React.Component<TableMainProps, {}> {
database,
table,
}));
this.props.refreshStatements();
}

prevPage = () => this.props.history.goBack();

getStatementsTableData = () => {
const { statements, match } = this.props;
const database = getMatchParamByName(match, databaseNameAttr);
const table = getMatchParamByName(match, tableNameAttr);
const title = `${database}.${table}`;

if (statements) {
return statements.filter((statement: AggregateStatistics) => statement.label.indexOf(title) !== -1);
}
return;
}

render() {
const { tableInfo, grantsSortSetting, statements, match, dbResponse } = this.props;
const { tableInfo, grantsSortSetting, match, dbResponse } = this.props;
const database = getMatchParamByName(match, databaseNameAttr);
const table = getMatchParamByName(match, tableNameAttr);
const selectedApp = getMatchParamByName(match, appAttr);

const title = `${database}.${table}`;
if (tableInfo) {
Expand Down Expand Up @@ -161,15 +143,7 @@ export class TableMain extends React.Component<TableMainProps, {}> {
</Col>
</Row>
</TabPane>
<TabPane tab="Statements" key="2">
<SummaryCard>
<StatementsSortedTable
data={this.getStatementsTableData()}
columns={statements && makeStatementsColumns(statements, selectedApp)}
/>
</SummaryCard>
</TabPane>
<TabPane tab="Grants" key="3">
<TabPane tab="Grants" key="2">
<SummaryCard>
<GrantsSortedTable
data={tableInfo.grants}
Expand Down Expand Up @@ -213,15 +187,13 @@ export function selectTableInfo(state: AdminUIState, props: RouteComponentProps)
const mapStateToProps = (state: AdminUIState, ownProps: RouteComponentProps) => ({
tableInfo: selectTableInfo(state, ownProps),
grantsSortSetting: databaseTableGrantsSortSetting.selector(state),
statements: selectStatements(state, ownProps),
dbResponse: databaseDetails(state)[getMatchParamByName(ownProps.match, databaseNameAttr)] && databaseDetails(state)[getMatchParamByName(ownProps.match, databaseNameAttr)].data,
});

const mapDispatchToProps = {
setSort: databaseTableGrantsSortSetting.set,
refreshTableDetails,
refreshTableStats,
refreshStatements,
refreshDatabaseDetails,
};

Expand Down

0 comments on commit 1c60dc7

Please sign in to comment.