Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaibbq committed May 20, 2024
1 parent 76d5330 commit 2c62d8d
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions internal/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,21 @@ type StmtActionFunc func() (StmtAction, error)

func (a *Analyzer) configureQueryParameters(options *zetasql.AnalyzerOptions) error {
parameters := a.PopQueryParameters()
if parameters != nil {
for _, parameter := range parameters {
parameterType, err := ZetaSQLTypeFromBigQueryType(parameter.ParameterType)
for _, parameter := range parameters {
parameterType, err := ZetaSQLTypeFromBigQueryType(parameter.ParameterType)
if err != nil {
return err
}

if parameter.Name == "" {
err = options.AddPositionalQueryParameter(parameterType)
if err != nil {
return err
}

if parameter.Name == "" {
options.AddPositionalQueryParameter(parameterType)
} else {
options.AddQueryParameter(parameter.Name, parameterType)
} else {
err = options.AddQueryParameter(parameter.Name, parameterType)
if err != nil {
return err
}
}
}
Expand Down Expand Up @@ -330,7 +334,7 @@ func ZetaSQLTypeFromBigQueryType(t *bigquery.QueryParameterType) (types.Type, er
case "INTERVAL":
zetasqlType = types.IntervalType()
default:
return nil, fmt.Errorf("unsupported query parameter type: %s", t)
return nil, fmt.Errorf("unsupported query parameter type: %s", t.Type)
}
return zetasqlType, nil

Expand Down

0 comments on commit 2c62d8d

Please sign in to comment.