mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
implements an fb_exec_requests system table. The purpose of this table is to allow access to internal state to see what queries are running and have been run.
Co-authored-by: Travis Turner <travis@molecula.com>
(cherry picked from commit 47d8be26f5)
27 lines
915 B
Go
27 lines
915 B
Go
// Copyright 2021 Molecula Corp. All rights reserved.
|
|
|
|
package planner
|
|
|
|
import (
|
|
"context"
|
|
|
|
pilosa "github.com/featurebasedb/featurebase/v3"
|
|
"github.com/featurebasedb/featurebase/v3/sql3"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/parser"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/planner/types"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// compileDropTableStatement compiles a DROP TABLE statement into a
|
|
// PlanOperator.
|
|
func (p *ExecutionPlanner) compileDropTableStatement(stmt *parser.DropTableStatement) (_ types.PlanOperator, err error) {
|
|
tableName := parser.IdentName(stmt.Name)
|
|
index, err := p.schemaAPI.IndexInfo(context.Background(), tableName)
|
|
if err != nil {
|
|
if errors.Is(err, pilosa.ErrIndexNotFound) {
|
|
return nil, sql3.NewErrTableNotFound(stmt.Name.NamePos.Line, stmt.Name.NamePos.Column, tableName)
|
|
}
|
|
return nil, err
|
|
}
|
|
return NewPlanOpQuery(p, NewPlanOpDropTable(p, index), p.sql), nil
|
|
}
|