mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-08 20:07:51 +00:00
docker fix not really related to anything
This commit is contained in:
parent
c56fd33924
commit
9c8538ec5a
3 changed files with 35 additions and 15 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
"github.com/molecula/featurebase/v2/pql"
|
||||
"github.com/molecula/featurebase/v2/sql2"
|
||||
"github.com/molecula/featurebase/v2/vprint"
|
||||
)
|
||||
|
||||
type Planner struct {
|
||||
|
|
@ -645,6 +646,10 @@ func (rs *StmtRows) Columns() []*StmtColumn {
|
|||
return rs.node.Columns()
|
||||
}
|
||||
|
||||
func (rs *StmtRows) Row() int64 {
|
||||
return rs.node.Row()[0].(int64)
|
||||
}
|
||||
|
||||
func (rs *StmtRows) Next() bool {
|
||||
if rs.err != nil {
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import (
|
|||
"github.com/molecula/featurebase/v2/stats"
|
||||
"github.com/molecula/featurebase/v2/storage"
|
||||
"github.com/molecula/featurebase/v2/topology"
|
||||
"github.com/molecula/featurebase/v2/vprint"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
|
|
@ -1354,6 +1355,7 @@ func (s *Server) PlanSQL(ctx context.Context, q string) (*Stmt, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
vprint.VV("PLanning SQL: (%v)", q)
|
||||
return NewPlanner(s.executor).PlanStatement(ctx, st)
|
||||
}
|
||||
|
||||
|
|
|
|||
43
server/pg.go
43
server/pg.go
|
|
@ -28,6 +28,7 @@ import (
|
|||
pilosa "github.com/molecula/featurebase/v2"
|
||||
"github.com/molecula/featurebase/v2/logger"
|
||||
"github.com/molecula/featurebase/v2/pg"
|
||||
"github.com/molecula/featurebase/v2/vprint"
|
||||
|
||||
//"github.com/molecula/featurebase/v2/pg"
|
||||
"github.com/molecula/featurebase/v2/pql"
|
||||
|
|
@ -330,22 +331,32 @@ func pgWriteGroupCount(w pg.QueryResultWriter, counts *pilosa.GroupCounts) error
|
|||
|
||||
func pgWriteStmtRows(w pg.QueryResultWriter, rows *pilosa.StmtRows) error {
|
||||
//TODO(twg) writeHeader
|
||||
columns := rows.Columns()
|
||||
//TODO (twg) types:=rows.Types()
|
||||
headers := make([]pg.ColumnInfo, len(columns))
|
||||
for i, column := range columns {
|
||||
headers[i] = pg.ColumnInfo{
|
||||
Name: column,
|
||||
Type: pg.TypeCharoid, //TODO(twg) types[i]
|
||||
}
|
||||
}
|
||||
err := w.WriteHeader(headers...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//TODO(twg) writeColumns
|
||||
data := make([]string, len(headers))
|
||||
first := true
|
||||
var data []string
|
||||
var err error
|
||||
for rows.Next() {
|
||||
if first {
|
||||
columns := rows.Columns()
|
||||
vprint.VV("ROW=> %#v", rows.Row())
|
||||
//TODO (twg) types:=rows.Types()
|
||||
headers := make([]pg.ColumnInfo, len(columns))
|
||||
vprint.VV("got columns %v", columns)
|
||||
for i, column := range columns {
|
||||
headers[i] = pg.ColumnInfo{
|
||||
Name: column,
|
||||
Type: pg.TypeCharoid, //TODO(twg) types[i]
|
||||
}
|
||||
}
|
||||
err := w.WriteHeader(headers...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
data = make([]string, len(headers))
|
||||
first = false
|
||||
}
|
||||
vprint.VV("got row")
|
||||
result := make([]interface{}, len(rows.Columns()))
|
||||
// Create list of scan destination pointers.
|
||||
dsts := make([]interface{}, len(result))
|
||||
|
|
@ -372,6 +383,8 @@ func pgWriteStmtRows(w pg.QueryResultWriter, rows *pilosa.StmtRows) error {
|
|||
v = "null"
|
||||
//
|
||||
//v = strconv.FormatUint(col.Uint64Val, 10)
|
||||
case *interface{}:
|
||||
v = fmt.Sprintf("%v", *col)
|
||||
default:
|
||||
return errors.Errorf("unable to process value of type %T", col)
|
||||
}
|
||||
|
|
@ -536,7 +549,7 @@ func (pqh *PilosaQueryHandler) HandleQuery(ctx context.Context, w pg.QueryResult
|
|||
return errors.Wrap(pgWriteResult(w, resp.Results[0]), "writing query result")
|
||||
|
||||
case pg.SimpleQuery:
|
||||
sql2 := false
|
||||
sql2 := true
|
||||
if sql2 {
|
||||
stmt, err := pqh.Api.Plan(ctx, string(q))
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue