-
-
Notifications
You must be signed in to change notification settings - Fork 239
Implement sql.ValueRow
#3248
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
Implement sql.ValueRow
#3248
Conversation
f23af30 to
d5d79ec
Compare
6138ab3 to
8079228
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.
Overall this looks good but see comments.
- Renamings are incomplete
- Need to hide these checks behind a feature flag to avoid doing unnecessary work in the interim.
I think the next phase of this plan is to augment the benchmark runners so that we can see the difference in perf for each of these implementation options when we run benchmarks. Ditto the sql correctness suites, we want to be very sure of this before we enable it by default anywhere.
server/handler.go
Outdated
| r, err = resultForEmptyIter(sqlCtx, rowIter, resultFields) | ||
| } else if analyzer.FlagIsSet(qFlags, sql.QFlagMax1Row) { | ||
| r, err = resultForMax1RowIter(sqlCtx, schema, rowIter, resultFields, buf) | ||
| } else if vr, ok := rowIter.(sql.ValueRowIter); ok && vr.CanSupport(sqlCtx) { |
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 want to put this iteration option behind an environment variable or similar until we know it's ready to start handing production traffic
4b69425 to
646cfd3
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.
LGTM
sql/expression/comparison_test.go
Outdated
| require.NoError(t, err) | ||
| return v | ||
| func TestValueComparison(t *testing.T) { | ||
| // TODO |
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.
Prefer a skip in these cases
sql/memory.go
Outdated
| // will return an error and erase all the content of the cache. | ||
| Add2(Row2) error | ||
| AddValueRow(ValueRow) error | ||
| // Get2 gets all rows. |
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.
Update comment
sql/plan/indexed_table_access.go
Outdated
| } | ||
|
|
||
| func (i *IndexedTableAccess) getLookup2(ctx *sql.Context, row sql.Row2) (sql.IndexLookup, error) { | ||
| func (i *IndexedTableAccess) getLookup2(ctx *sql.Context, row sql.ValueRow) (sql.IndexLookup, error) { |
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.
Rename
sql.ValueRowis the reincarnation ofsql.Row2.This is an optimization to the sqlengine that eliminates interface boxing by never placing variables into a
[]interface.sql.ValueRowIteris implemented by:Comparison should only use CompareValue when left and right are both NumericType, so Integers, Floats, Decimal, Bit64, and Year types.