Skip to content

Commit

Permalink
Merge pull request #31 from uber/henry.wu/qid_regex_fix
Browse files Browse the repository at this point in the history
Use exact match for QID
  • Loading branch information
henrywu2019 authored Oct 14, 2020
2 parents feb4a0b + 037f073 commit 0c97c85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ var multiLineCommentPattern = regexp.MustCompile(`\/\*(.*)\*/\s*`)
var oneLineCommentPattern = regexp.MustCompile(`(^\-\-[^\n]+|\s--[^\n]+)`)
var getTableNamePattern = regexp.MustCompile(`(?i)\s+(?:from|join)\s+([\w.]+)`)
var dualPattern = regexp.MustCompile(`from dual`)
var qIDPattern = regexp.MustCompile(`[0-9a-f-]{36}`)
var qIDPattern = regexp.MustCompile(`^[0-9a-f-]{36}$`)

// GetTableNamesInQuery is a pessimistic function to return tables involved in query in format of DB.TABLE
// https://regoio.herokuapp.com/
Expand Down
1 change: 1 addition & 0 deletions go/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func TestUilts_GetCost(t *testing.T) {
}

func TestUtils_IsQID(t *testing.T) {
assert.False(t, IsQID(`select "a44f8e61-4cbb-429a-b7ab-bea2c4a5caed"`))
assert.True(t, IsQID("a44f8e61-4cbb-429a-b7ab-bea2c4a5caed"))
assert.False(t, IsQID("a44f8e61-4cbb-429a-b7ab-bea2c4a5caeD"))
assert.False(t, IsQID("a44f8e61"))
Expand Down

0 comments on commit 0c97c85

Please sign in to comment.