Skip to content

Example vtable_eponymous_only misses start value assignment to cursor #1316

Open
@philippfriese

Description

@philippfriese

The vtable_eponymous_only example is missing a start value assignment to the vtable cursor in one of the four variants of the Filter call

For calls with zero to two parameters (none, start, and start+stop), the vtable cursor value is assigned to the table start field.
The call with parameters start+stop+step is missing this assignment.

Code excerpt of Filter:

func (vc *seriesCursor) Filter(idxNum int, idxStr string, vals []any) error {
	switch {
	case len(vals) < 1:
		vc.seriesTable.start = 0
		vc.seriesTable.stop = 1000
		vc.value = vc.seriesTable.start
	case len(vals) < 2:
		vc.seriesTable.start = vals[0].(int64)
		vc.seriesTable.stop = 1000
		vc.value = vc.seriesTable.start
	case len(vals) < 3:
		vc.seriesTable.start = vals[0].(int64)
		vc.seriesTable.stop = vals[1].(int64)
		vc.value = vc.seriesTable.start
	case len(vals) < 4:
		vc.seriesTable.start = vals[0].(int64)
		vc.seriesTable.stop = vals[1].(int64)
		vc.seriesTable.step = vals[2].(int64)
	        // < - missing vc.value assignment - >
	}
	return nil
}

This leads to inconsistent behaviour where the returned values of select * from series($start, $stop, $step) do not start at the provided $start value, but at the default start value 0.

Checked for commit 7658c06.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions