Skip to content
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

Fix evaluation order of named arguments #134

Merged
merged 2 commits into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/goccy/go-json v0.10.0
github.com/goccy/go-yaml v1.9.5
github.com/goccy/go-zetasql v0.5.1
github.com/goccy/go-zetasqlite v0.13.0
github.com/goccy/go-zetasqlite v0.13.2
github.com/google/go-cmp v0.5.9
github.com/googleapis/gax-go/v2 v2.7.0
github.com/gorilla/mux v1.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ github.com/goccy/go-yaml v1.9.5 h1:Eh/+3uk9kLxG4koCX6lRMAPS1OaMSAi+FJcya0INdB0=
github.com/goccy/go-yaml v1.9.5/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA=
github.com/goccy/go-zetasql v0.5.1 h1:vP9wgUH5gylw8yL+gwO0wF7uW/fW5Dr1AAAzi8Kgevg=
github.com/goccy/go-zetasql v0.5.1/go.mod h1:6W14CJVKh7crrSPyj6NPk4c49L2NWnxvyDLsRkOm4BI=
github.com/goccy/go-zetasqlite v0.13.0 h1:DbL77yOWDqvN62eJdmO1A3uCo4Mwwvg8kWhkvI53Lwc=
github.com/goccy/go-zetasqlite v0.13.0/go.mod h1:PqPtm1radU9ehuTlFwmuv96cC40shqsgxXkZEyXjK1o=
github.com/goccy/go-zetasqlite v0.13.2 h1:66txmR5jsPbKdTGCEYRJC8znnbPkxZKbij4EuZHrH5I=
github.com/goccy/go-zetasqlite v0.13.2/go.mod h1:PqPtm1radU9ehuTlFwmuv96cC40shqsgxXkZEyXjK1o=
github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
7 changes: 5 additions & 2 deletions internal/contentdata/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ func (r *Repository) Query(ctx context.Context, tx *connection.Tx, projectID, da

values := []interface{}{}
for _, param := range params {
// param.Name
values = append(values, param.ParameterValue.Value)
if param.Name != "" {
values = append(values, sql.Named(param.Name, param.ParameterValue.Value))
} else {
values = append(values, param.ParameterValue.Value)
}
}
fields := []*bigqueryv2.TableFieldSchema{}
logger.Logger(ctx).Info(
Expand Down
13 changes: 9 additions & 4 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1738,14 +1738,14 @@ WHERE
created_at > @someday - INTERVAL 1 DAY
ORDER BY qty DESC;`)
query.Parameters = []bigquery.QueryParameter{
{
Name: "someday",
Value: time.Date(2022, 9, 9, 0, 0, 0, 0, time.UTC),
},
{
Name: "min_qty",
Value: 100,
},
{
Name: "someday",
Value: time.Date(2022, 9, 9, 0, 0, 0, 0, time.UTC),
},
}

job, err := query.Run(ctx)
Expand All @@ -1763,6 +1763,7 @@ ORDER BY qty DESC;`)
if err != nil {
t.Fatal(err)
}
var rowCount int
for {
var row []bigquery.Value
if err := it.Next(&row); err != nil {
Expand All @@ -1773,6 +1774,10 @@ ORDER BY qty DESC;`)
t.Fatal(err)
}
}
rowCount++
fmt.Println(row)
}
if rowCount != 1 {
t.Fatal("failed to get result")
}
}