mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
* implemented distinct
* implemented distinct
* uses first cut of a buffer pool, and extendible hashing with thresholded spill to disk
* tests
* cleaned up some stuff around query plan output to make developing tooling easier
* added optimization to call PQL Distinct()
* fixed test
* fix for passing wrong index name in orchestrator
* back out change to DistinctTimestamp
* fix other instance of wrong table name being passed
* use full index name instead of abbreviated one for translation. sigh.
* removed some unused code
Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
(cherry picked from commit f030d58d95)
77 lines
2 KiB
Go
77 lines
2 KiB
Go
// Copyright 2022 Molecula Corp. All rights reserved.
|
|
|
|
package planner
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/featurebasedb/featurebase/v3/sql3"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/parser"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/planner/types"
|
|
)
|
|
|
|
// PlanOpTableValuedFunction is an operator for a subquery
|
|
type PlanOpTableValuedFunction struct {
|
|
planner *ExecutionPlanner
|
|
callExpr types.PlanExpression
|
|
warnings []string
|
|
}
|
|
|
|
func NewPlanOpTableValuedFunction(p *ExecutionPlanner, callExpr types.PlanExpression) *PlanOpTableValuedFunction {
|
|
return &PlanOpTableValuedFunction{
|
|
planner: p,
|
|
callExpr: callExpr,
|
|
warnings: make([]string, 0),
|
|
}
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) Schema() types.Schema {
|
|
result := make(types.Schema, 0)
|
|
tvfResultType, ok := p.callExpr.Type().(*parser.DataTypeSubtable)
|
|
if !ok {
|
|
return result
|
|
}
|
|
for _, member := range tvfResultType.Columns {
|
|
result = append(result, &types.PlannerColumn{
|
|
ColumnName: member.Name,
|
|
RelationName: "",
|
|
Type: member.DataType,
|
|
})
|
|
}
|
|
return result
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) Iterator(ctx context.Context, row types.Row) (types.RowIterator, error) {
|
|
return nil, sql3.NewErrInternalf("table valued functions are not yet implemented")
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) Children() []types.PlanOperator {
|
|
return []types.PlanOperator{}
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) WithChildren(children ...types.PlanOperator) (types.PlanOperator, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) Plan() map[string]interface{} {
|
|
result := make(map[string]interface{})
|
|
result["_op"] = fmt.Sprintf("%T", p)
|
|
result["_schema"] = p.Schema().Plan()
|
|
return result
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) String() string {
|
|
return ""
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) AddWarning(warning string) {
|
|
p.warnings = append(p.warnings, warning)
|
|
}
|
|
|
|
func (p *PlanOpTableValuedFunction) Warnings() []string {
|
|
var w []string
|
|
w = append(w, p.warnings...)
|
|
return w
|
|
|
|
}
|