Skip to content

Commit

Permalink
use new variable name; dont use :=
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaibbq committed Feb 27, 2024
1 parent 133a789 commit c6871d9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ func (n *ArrayScanNode) FormatSQL(ctx context.Context) (string, error) {
}

array := fmt.Sprintf("json_each(zetasqlite_decode_array(%s))", arrayExpr)
var joinExpr string
var arrayJoinExpr string
if n.node.JoinExpr() != nil {
joinExpr, err := newNode(n.node.JoinExpr()).FormatSQL(ctx)
arrayJoinExpr, err = newNode(n.node.JoinExpr()).FormatSQL(ctx)
if err != nil {
return "", err
}
Expand All @@ -683,21 +683,21 @@ func (n *ArrayScanNode) FormatSQL(ctx context.Context) (string, error) {
} else {
joinMode = "LEFT INNER JOIN"
}
joinExpr = fmt.Sprintf("%s %s ON %s",
arrayJoinExpr = fmt.Sprintf("%s %s ON %s",
joinMode,
array,
joinExpr,
arrayJoinExpr,
)
} else {
// If there is no join expression, use a CROSS JOIN
joinExpr = fmt.Sprintf(", %s", array)
arrayJoinExpr = fmt.Sprintf(", %s", array)
}

return fmt.Sprintf(
"SELECT *, json_each.value AS `%s` %s %s",
colName,
formattedInput,
joinExpr,
arrayJoinExpr,
), nil
}
return fmt.Sprintf(
Expand Down

0 comments on commit c6871d9

Please sign in to comment.