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

v2 extending base processor api #1204

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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 quesma/processors/base_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (p *BaseProcessor) Handle(metadata map[string]interface{}, messages ...any)
// Execute the queries
var results [][]QueryResultRow
for _, query := range queries {
result, _ := p.executeQuery(query.Query)
result, _ := p.executeQuery(query.SelectCommand.String())
results = append(results, result)
}
// Transform the results
Expand Down
41 changes: 40 additions & 1 deletion quesma/processors/query_transformation_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,57 @@

package processors

import (
"github.com/QuesmaOrg/quesma/quesma/model"
"github.com/QuesmaOrg/quesma/quesma/schema"
"time"
)

// Query This is placeholder
// Concrete definition will be taken
// from `quesma/model/query.go`
type Query struct {
Query string
Query string
SelectCommand model.SelectCommand // The representation of SELECT query

OptimizeHints *model.QueryOptimizeHints // it can be optional
TransformationHistory model.TransformationHistory // it can be optional

Type model.QueryType
TableName string // TODO delete this and use Indexes instead

Indexes []string // list of indexes we're going to use for this query

// this is schema for current query, this schema should be used in pipeline processing
Schema schema.Schema

Highlighter model.Highlighter
SearchAfter any // Value of query's "search_after" param. Used for pagination of hits. SearchAfterEmpty means no pagination

RuntimeMappings map[string]model.RuntimeMapping

// dictionary to add as 'meta' field in the response.
// WARNING: it's probably not passed everywhere where it's needed, just in one place.
// But it works for the test + our dashboards, so let's fix it later if necessary.
// NoMetadataField (nil) is a valid option and means no meta field in the response.
Metadata model.JsonMap
}

// ExecutionPlan This is placeholder
// Concrete definition will be taken
// from `quesma/model/query.go`
type ExecutionPlan struct {
Name string

IndexPattern string

Queries []*Query

QueryRowsTransformers []model.QueryRowsTransformer

// add more fields here
// JSON renderers
StartTime time.Time
}

// QueryResultTransformer This is a copy of the
Expand Down
Loading