-
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
Gen4: Filter primitive and planning #9017
Conversation
c33f548
to
40b6e2b
Compare
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.
Nice stuff
1309eb0
to
af16294
Compare
return 0, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "cannot compare a date with a numeric value") | ||
|
||
default: | ||
// Quoting MySQL Docs: |
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.
❤️
094e9a1
to
e5ef8a3
Compare
00ebb2c
to
ec94419
Compare
…rther error analisis Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
…mports Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
…nbuilder package instead of ints Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
…on to an evalengine.expression Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
248aa2f
to
1268684
Compare
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.
Looks great. Just two minor comments that we could address in a future PR as well
I will address the two comments via #9097 |
"d|null|1", | ||
"d|1|2", |
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.
I see that you added a test row d|1|1
due to which you changed the test expectation from d|null|1
to d|1|2
, any reason for doing this change in the test?
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.
we wanted to test more cases
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.
I agree with @harshit-gangal, naming is now confusing, in the test input we are saying // Single null
even though we have two rows with only one of them being null
. I'll fix the naming and add another row to test single null
behavior.
now := time.Now() | ||
// setting the date to today's date, because we use AddDate on t | ||
// which is "0000-01-01 xx:xx:xx", we do minus one on the month | ||
// and day to take into account the 01 in both month and day of t | ||
t = t.AddDate(now.Year(), int(now.Month()-1), now.Day()-1) | ||
} |
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.
do you have a test case for this? looks like there can be corner cases with timezone (set on MySQL vs VTGate instance)
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.
what type of tests do you feel would be helpful here?
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.
this is just an internal behavior of Golang where time.Time
s with no date have their dates set by default to 0000-01-01
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.
filtering on column with time column on left and date column on right.
not sure if evalengine supports that, that would lead the test to come to this code path.
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.
the EvalEngine supports it thanks to this code snippet you highlighted. we also have tests for it:
vitess/go/vt/vtgate/evalengine/comparisons_test.go
Lines 804 to 815 in 1152ecc
{ | |
name: "date equal time", | |
v1: NewColumn(0, defaultCollation), v2: NewColumn(1, defaultCollation), | |
out: &T, op: &EqualOp{}, | |
row: []sqltypes.Value{sqltypes.NewDate(time.Now().Format("2006-01-02")), sqltypes.NewTime("00:00:00")}, | |
}, | |
{ | |
name: "date not equal time", | |
v1: NewColumn(0, defaultCollation), v2: NewColumn(1, defaultCollation), | |
out: &T, op: &NotEqualOp{}, | |
row: []sqltypes.Value{sqltypes.NewDate(time.Now().Format("2006-01-02")), sqltypes.NewTime("12:00:00")}, | |
}, |
Description
This pull request adds the
Filter
engine primitive along with thefilter
logical plan. A basic version of theComparisonExpr
(implementation of EvalEngine'sExpr
) is added through this pull request too.ComparisonExpr
supports basic operations (=
,!=
,<
,<=
,>
,>=
) on values that can be transformed to numerical values, i.e support for type coercion will come in the following pull request.Related Issue(s)
Checklist