Skip to content

Conversation

@jycor
Copy link
Contributor

@jycor jycor commented Oct 2, 2025

sql.ValueRow is the reincarnation of sql.Row2.
This is an optimization to the sqlengine that eliminates interface boxing by never placing variables into a []interface.

sql.ValueRowIter is implemented by:

  • TransactionCommittingIter
  • TrackedRowIter
  • TableRowIter
  • FilterIter

Comparison should only use CompareValue when left and right are both NumericType, so Integers, Floats, Decimal, Bit64, and Year types.

@jycor jycor force-pushed the james/row2 branch 3 times, most recently from f23af30 to d5d79ec Compare October 17, 2025 00:07
@jycor jycor force-pushed the james/row2 branch 2 times, most recently from 6138ab3 to 8079228 Compare October 22, 2025 06:59
@jycor jycor changed the title row2 Implement sql.ValueRow Oct 22, 2025
Copy link
Member

@zachmu zachmu left a 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.

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) {
Copy link
Member

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

@jycor jycor force-pushed the james/row2 branch 2 times, most recently from 4b69425 to 646cfd3 Compare October 30, 2025 19:36
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

require.NoError(t, err)
return v
func TestValueComparison(t *testing.T) {
// TODO
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comment

}

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename

@jycor jycor merged commit a231fb5 into main Nov 3, 2025
7 of 8 checks passed
@jycor jycor deleted the james/row2 branch November 3, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants