Skip to content

Commit 28ff1d2

Browse files
committed
add skip flag for rules
1 parent 6cc583a commit 28ff1d2

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

tools/greenplum-to-pg-tests/cmd/extraxtSessions.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,6 @@ func checkQueries(rules Rules, stats *QueryStats, pgSchema *internal.PgSchema, d
241241
percent := float64(queryIndex) / float64(totalQueries) * 100
242242
log.Printf("Checking query %8d/%v (%v)", queryIndex, totalQueries, percent)
243243
}
244-
//if checked[pgQuery.Text] {
245-
// continue
246-
//}
247-
//checked[pgQuery.Text] = true
248244

249245
reason, checkResult := checkQuery(stats, rules, db, pgQuery.Text)
250246
if !reasonFilter.MatchString(reason) {
@@ -317,13 +313,15 @@ func checkQuery(stat *QueryStats, rules Rules, db *ydb.Driver, queryText string)
317313

318314
issues := internal.ExtractIssues(err)
319315

320-
if reason = rules.FindKnownIssue(queryText, issues); reason != "" {
316+
if issueReason, ok := rules.FindKnownIssue(queryText, issues); ok {
321317
stat.CountAsKnown(reason, queryText)
322-
return reason, checkResultErrKnown
318+
return issueReason.Name, checkResultErrKnown
323319
}
324320

325321
reason = fmt.Sprintf("%v (%v): %#v", ydbErr.Name(), ydbErr.Code(), issues)
322+
if len(issues) == 0 {
326323

324+
}
327325
stat.CountAsUnknown(issues, queryText)
328326
return reason, checkResultErrUnknown
329327
}

tools/greenplum-to-pg-tests/cmd/issue_rules.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,19 @@ func (r *Rules) WriteToFile(path string) error {
7474
return nil
7575
}
7676

77-
func (r *Rules) FindKnownIssue(queryText string, ydbIssues []internal.YdbIssue) string {
77+
func (r *Rules) FindKnownIssue(queryText string, ydbIssues []internal.YdbIssue) (_ PgIssueRules, ok bool) {
7878
for _, ydbIssue := range ydbIssues {
7979
for _, item := range r.Issues {
8080
if item.IsMatched(queryText, ydbIssue) {
81-
return item.Name
81+
if item.Skip {
82+
continue
83+
}
84+
return item, true
8285
}
8386
}
8487
}
8588

86-
return ""
89+
return PgIssueRules{}, false
8790
}
8891

8992
func (r *Rules) UpdateFromStats(stats QueryStats, sortByCount bool) {
@@ -116,6 +119,7 @@ type PgIssueRules struct {
116119
QueryRegexp OneOrSliceString `yaml:"query_regexp,omitempty"`
117120
Example string `yaml:"example,omitempty"`
118121
Comment string `yaml:"comment,omitempty"`
122+
Skip bool `yaml:"skip"` // skip the issue on check query step
119123

120124
issuesRegexpCompiled []*regexp.Regexp
121125
queryRegexpCompiled []*regexp.Regexp

tools/greenplum-to-pg-tests/issues.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ stat:
33
total_ok: 15
44
ok_percent: 65.21739130434783
55
issues:
6-
- name: Skip unknown tables
7-
count: 11
8-
tag:
9-
- skip
6+
- name: general parsing errors
107
issue_regexp:
11-
- Cannot find table
8+
- "^Error while parsing query.$"
9+
skip: true
1210
- name: drop external table
1311
count: 2
1412
tag:
@@ -39,14 +37,12 @@ issues:
3937
- 'No such proc: '
4038
- name: Rollback in query service (OK)
4139
count: 1
42-
tag:
43-
- skip
40+
skip: true
4441
issue_regexp:
4542
- ROLLBACK not supported inside YDB query
4643
- name: Commit in query service (OK)
4744
count: 1
48-
tag:
49-
- skip
45+
skip: true
5046
issue_regexp:
5147
- COMMIT not supported inside YDB query
5248
- name: Not supported set greenplum var
@@ -57,8 +53,7 @@ issues:
5753
- ^SET gp_
5854
- name: Partial request
5955
count: 1
60-
tag:
61-
- skip
56+
skip: true
6257
issue_regexp:
6358
- 'ERROR: syntax error at end of input'
6459
- name: 'YQL: Expected type cast node as is_local arg, but got node with tag'

0 commit comments

Comments
 (0)