Skip to content

Example vtable_eponymous_only misses start value assignment to cursor #1316

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

Open
philippfriese opened this issue Feb 13, 2025 · 0 comments
Open

Comments

@philippfriese
Copy link

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.

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

No branches or pull requests

1 participant