Merge pull request #1814 from dolthub/andy/broken-ntc-queries

[no-release-notes] added broken queries
This commit is contained in:
AndyA
2021-06-14 10:04:19 -07:00
committed by GitHub
3 changed files with 72 additions and 7 deletions

View File

@@ -41,13 +41,19 @@ func TestSingleQuery(t *testing.T) {
var test enginetest.QueryTest
test = enginetest.QueryTest{
Query: "SELECT t1.c1,t2.c2 FROM one_pk t1, two_pk t2 WHERE pk1=1 AND pk2=1 ORDER BY 1,2",
Expected: []sql.Row{
{0, 31},
{10, 31},
{20, 31},
{30, 31},
},
Query: `SELECT
myTable.i,
(SELECT
dolt_commit_diff_mytable.diff_type
FROM
dolt_commit_diff_mytable
WHERE (
dolt_commit_diff_mytable.from_commit = 'abc' AND
dolt_commit_diff_mytable.to_commit = 'abc' AND
dolt_commit_diff_mytable.to_i = myTable.i -- extra filter clause
)) AS diff_type
FROM myTable`,
Expected: []sql.Row{},
}
harness := newDoltHarness(t)
@@ -521,3 +527,7 @@ func TestTransactions(t *testing.T) {
enginetest.TestTransactionScript(t, newDoltHarness(t).withTransactionsEnabled(true), script)
}
}
func TestSystemTableQueries(t *testing.T) {
enginetest.RunQueryTests(t, newDoltHarness(t), BrokenSystemTableQueries)
}

View File

@@ -74,6 +74,7 @@ var defaultSkippedQueries = []string{
"json_arrayagg", // TODO: aggregation ordering
"json_objectagg", // TODO: aggregation ordering
"typestable", // Bit type isn't working?
"dolt_commit_diff_", // see broken queries in `dolt_system_table_queries.go`
}
// WithParallelism returns a copy of the harness with parallelism set to the given number of threads. A value of 0 or

View File

@@ -0,0 +1,54 @@
// Copyright 2021 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package enginetest
import (
"github.com/dolthub/go-mysql-server/enginetest"
"github.com/dolthub/go-mysql-server/sql"
)
var BrokenSystemTableQueries = []enginetest.QueryTest{
{
Query: `SELECT
myTable.i,
(SELECT
U0.diff_type
FROM
dolt_commit_diff_mytable U0
WHERE (
U0.from_commit = 'abc' AND
U0.to_commit = 'abc'
)) AS diff_type
FROM myTable`,
Expected: []sql.Row{},
},
{
// extra filter clause breaks filter pushdown
// `dolt_commit_diff_*` relies on filter pushdown to function
Query: `SELECT
myTable.i,
(SELECT
dolt_commit_diff_mytable.diff_type
FROM
dolt_commit_diff_mytable
WHERE (
dolt_commit_diff_mytable.from_commit = 'abc' AND
dolt_commit_diff_mytable.to_commit = 'abc' AND
dolt_commit_diff_mytable.to_i = myTable.i -- extra filter clause
)) AS diff_type
FROM myTable`,
Expected: []sql.Row{},
},
}