Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
trzysiek committed Dec 26, 2024
1 parent 22ed55b commit e010e6d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions quesma/model/expr_string_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package model

import (
"context"
"fmt"
"quesma/logger"
"quesma/quesma/types"
Expand Down Expand Up @@ -77,12 +76,12 @@ func (v *renderer) VisitTuple(t TupleExpr) interface{} {
}
switch len(exprs) {
case 0:
logger.WarnWithCtxAndThrottling(context.Background(), "visit", "tuple", "tuple with 0 length") // hacky way to log this
logger.WarnWithThrottling("visitTuple", "tupleExpr with no expressions") // hacky way to log this
return "tuple()"
case 1:
return exprs[0]
return t.Exprs[0]
default:
return fmt.Sprintf("tuple(%s)", strings.Join(exprs, ", "))
return fmt.Sprintf("tuple(%s)", strings.Join(exprs, ", ")) // can omit "tuple", but I think SQL's more readable with it
}
}

Expand Down
2 changes: 1 addition & 1 deletion quesma/queryparser/query_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestMakeResponseSearchQuery(t *testing.T) {
t.Run(tt.queryType.String(), func(t *testing.T) {
hitQuery := query_util.BuildHitsQuery(
context.Background(), "test", []string{"*"},
&model.SimpleQuery{}, model.WeNeedUnlimitedCount, nil,
&model.SimpleQuery{}, model.WeNeedUnlimitedCount, model.SearchAfterEmpty,
)
highlighter := NewEmptyHighlighter()
queryType := typical_queries.NewHits(cw.Ctx, cw.Table, &highlighter, hitQuery.SelectCommand.OrderByFieldNames(), true, false, false, []string{cw.Table.Name})
Expand Down
6 changes: 3 additions & 3 deletions quesma/quesma/schema_transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ type SchemaCheckPass struct {
searchAfterStrategy searchAfterStrategy
}

func NewSchemaCheckPass(cfg *config.QuesmaConfiguration, tableDiscovery clickhouse.TableDiscovery, searchAfterStrategy searchAfterStrategyType) *SchemaCheckPass {
func NewSchemaCheckPass(cfg *config.QuesmaConfiguration, tableDiscovery clickhouse.TableDiscovery, strategyType searchAfterStrategyType) *SchemaCheckPass {
return &SchemaCheckPass{
cfg: cfg,
tableDiscovery: tableDiscovery,
searchAfterStrategy: searchAfterStrategyFactory(searchAfterStrategy),
searchAfterStrategy: searchAfterStrategyFactory(strategyType),
}
}

Expand Down Expand Up @@ -890,6 +890,7 @@ func (s *SchemaCheckPass) applyAliasColumns(indexSchema schema.Schema, query *mo
}

func (s *SchemaCheckPass) Transform(queries []*model.Query) ([]*model.Query, error) {

transformationChain := []struct {
TransformationName string
Transformation func(schema.Schema, *model.Query) (*model.Query, error)
Expand Down Expand Up @@ -941,7 +942,6 @@ func (s *SchemaCheckPass) Transform(queries []*model.Query) ([]*model.Query, err

query, err = transformation.Transformation(query.Schema, query)
if err != nil {
fmt.Println("SchemaCheckPass.Transform", err)
return nil, err
}

Expand Down

0 comments on commit e010e6d

Please sign in to comment.