From e98ab9de79a220fe302fe89b3d2835c7ed39c336 Mon Sep 17 00:00:00 2001 From: Dan Hansen Date: Fri, 16 Feb 2024 13:52:41 -0800 Subject: [PATCH] lint --- internal/context.go | 13 ------------- internal/formatter.go | 3 +-- internal/function_bind.go | 3 --- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/internal/context.go b/internal/context.go index a988562..247c88b 100644 --- a/internal/context.go +++ b/internal/context.go @@ -16,7 +16,6 @@ type ( funcMapKey struct{} analyticOrderColumnNamesKey struct{} analyticPartitionColumnNamesKey struct{} - analyticInputScanKey struct{} arraySubqueryColumnNameKey struct{} currentTimeKey struct{} tableNameToColumnListMapKey struct{} @@ -117,18 +116,6 @@ func analyticPartitionColumnNamesFromContext(ctx context.Context) []string { return value.([]string) } -func withAnalyticInputScan(ctx context.Context, input string) context.Context { - return context.WithValue(ctx, analyticInputScanKey{}, input) -} - -func analyticInputScanFromContext(ctx context.Context) string { - value := ctx.Value(analyticInputScanKey{}) - if value == nil { - return "" - } - return value.(string) -} - type arraySubqueryColumnNames struct { names []string } diff --git a/internal/formatter.go b/internal/formatter.go index 698afb6..e8396d0 100644 --- a/internal/formatter.go +++ b/internal/formatter.go @@ -474,7 +474,7 @@ func (n *AnalyticFunctionCallNode) getWindowBoundaryOptionFuncSQL(ctx context.Co case ast.FrameUnitRange: unit = "RANGE" default: - return "", fmt.Errorf("unexpected frame unit %s", node.FrameUnit()) + return "", fmt.Errorf("unexpected frame unit %d", node.FrameUnit()) } return fmt.Sprintf("%s BETWEEN %s AND %s", unit, sql[0], sql[1]), nil } @@ -1108,7 +1108,6 @@ func (n *AnalyticScanNode) FormatSQL(ctx context.Context) (string, error) { if err != nil { return "", err } - ctx = withAnalyticInputScan(ctx, formattedInput) orderColumnNames := analyticOrderColumnNamesFromContext(ctx) for _, group := range n.node.FunctionGroupList() { if group.PartitionBy() != nil { diff --git a/internal/function_bind.go b/internal/function_bind.go index 3808ccb..78ab4a7 100644 --- a/internal/function_bind.go +++ b/internal/function_bind.go @@ -3,8 +3,6 @@ package internal import ( "errors" "fmt" - "sync" - "github.com/goccy/go-json" ) @@ -125,7 +123,6 @@ type WindowAggregator struct { inverse func([]Value, *WindowFuncAggregatedStatus) error value func(*WindowFuncAggregatedStatus) (Value, error) done func(*WindowFuncAggregatedStatus) (Value, error) - once sync.Once } func (a *WindowAggregator) Step(stepArgs ...interface{}) error {