-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
evalEngine: Implement ELT and FIELD #15249
Changes from 1 commit
0ef3fa2
8147e88
55eb73a
d09872d
f15f677
14944a2
660d5c5
67d898b
baf6e3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ var Cases = []TestCase{ | |
{Run: TupleComparisons}, | ||
{Run: Comparisons}, | ||
{Run: InStatement}, | ||
{Run: FnElt}, | ||
{Run: FnInsert}, | ||
{Run: FnLower}, | ||
{Run: FnUpper}, | ||
|
@@ -1315,6 +1316,56 @@ var JSONExtract_Schema = []*querypb.Field{ | |
}, | ||
} | ||
|
||
func FnElt(yield Query) { | ||
for _, s1 := range inputStrings { | ||
for _, n := range inputBitwise { | ||
yield(fmt.Sprintf("ELT(%s, %s)", n, s1), nil) | ||
} | ||
} | ||
|
||
for _, s1 := range inputStrings { | ||
for _, s2 := range inputStrings { | ||
for _, n := range inputBitwise { | ||
yield(fmt.Sprintf("ELT(%s, %s, %s)", n, s1, s2), nil) | ||
} | ||
} | ||
} | ||
|
||
for _, s1 := range inputStrings { | ||
for _, s2 := range inputStrings { | ||
for _, s3 := range inputStrings { | ||
for _, n := range inputBitwise { | ||
yield(fmt.Sprintf("ELT(%s, %s, %s, %s)", n, s1, s2, s3), nil) | ||
} | ||
} | ||
} | ||
} | ||
|
||
validIndex := []string{ | ||
"1", | ||
"2", | ||
"3", | ||
} | ||
for _, s1 := range inputStrings { | ||
for _, s2 := range inputStrings { | ||
for _, s3 := range inputStrings { | ||
for _, n := range validIndex { | ||
yield(fmt.Sprintf("ELT(%s, %s, %s, %s)", n, s1, s2, s3), nil) | ||
} | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thing to look at with stuff like this, is how much test runtime we're adding. It might be too much with all these permutations? How long does it take to run these tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. about 24 sec, in the comparison test. total There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should reduce this then, that's a lot of time for a single subtest here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the test for 4 inputs. Total test time reduced to 6 sec, total |
||
|
||
mysqlDocSamples := []string{ | ||
"ELT(1, 'Aa', 'Bb', 'Cc', 'Dd')", | ||
"ELT(4, 'Aa', 'Bb', 'Cc', 'Dd')", | ||
} | ||
|
||
for _, q := range mysqlDocSamples { | ||
yield(q, nil) | ||
} | ||
} | ||
|
||
func FnInsert(yield Query) { | ||
for _, s := range insertStrings { | ||
for _, ns := range insertStrings { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we create a common function for this? We are now using the same logic in 3 functions.