id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
20,600 | araddon/qlbridge | rel/sql.go | ColumnPositions | func (m *SqlSource) ColumnPositions() map[string]int {
if len(m.colIndex) > 0 {
return m.colIndex
}
if m.Source == nil {
return nil
}
cols := make(map[string]int)
for idx, col := range m.Source.Columns {
left, right, ok := col.LeftRight()
//u.Debugf("aliasing: l:%v r:%v ok?%v", left, right, ok)
if ok {
... | go | func (m *SqlSource) ColumnPositions() map[string]int {
if len(m.colIndex) > 0 {
return m.colIndex
}
if m.Source == nil {
return nil
}
cols := make(map[string]int)
for idx, col := range m.Source.Columns {
left, right, ok := col.LeftRight()
//u.Debugf("aliasing: l:%v r:%v ok?%v", left, right, ok)
if ok {
... | [
"func",
"(",
"m",
"*",
"SqlSource",
")",
"ColumnPositions",
"(",
")",
"map",
"[",
"string",
"]",
"int",
"{",
"if",
"len",
"(",
"m",
".",
"colIndex",
")",
">",
"0",
"{",
"return",
"m",
".",
"colIndex",
"\n",
"}",
"\n",
"if",
"m",
".",
"Source",
... | // Get a list of Column names to position | [
"Get",
"a",
"list",
"of",
"Column",
"names",
"to",
"position"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L1478-L1497 |
20,601 | araddon/qlbridge | rel/sql.go | SqlFromPb | func SqlFromPb(pb []byte) (SqlStatement, error) {
s := &SqlStatementPb{}
if err := proto.Unmarshal(pb, s); err != nil {
return nil, err
}
return statementFromPb(s), nil
} | go | func SqlFromPb(pb []byte) (SqlStatement, error) {
s := &SqlStatementPb{}
if err := proto.Unmarshal(pb, s); err != nil {
return nil, err
}
return statementFromPb(s), nil
} | [
"func",
"SqlFromPb",
"(",
"pb",
"[",
"]",
"byte",
")",
"(",
"SqlStatement",
",",
"error",
")",
"{",
"s",
":=",
"&",
"SqlStatementPb",
"{",
"}",
"\n",
"if",
"err",
":=",
"proto",
".",
"Unmarshal",
"(",
"pb",
",",
"s",
")",
";",
"err",
"!=",
"nil",... | // SqlFromPb Create a sql statement from pb | [
"SqlFromPb",
"Create",
"a",
"sql",
"statement",
"from",
"pb"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L1985-L1991 |
20,602 | araddon/qlbridge | rel/sql.go | EqualWith | func EqualWith(l, r u.JsonHelper) bool {
if len(l) != len(r) {
return false
}
if len(l) == 0 && len(r) == 0 {
return true
}
for k, lv := range l {
rv, ok := r[k]
if !ok {
return false
}
switch lvt := lv.(type) {
case int, int64, int32, string, bool, float64:
if lv != rv {
return false
}
... | go | func EqualWith(l, r u.JsonHelper) bool {
if len(l) != len(r) {
return false
}
if len(l) == 0 && len(r) == 0 {
return true
}
for k, lv := range l {
rv, ok := r[k]
if !ok {
return false
}
switch lvt := lv.(type) {
case int, int64, int32, string, bool, float64:
if lv != rv {
return false
}
... | [
"func",
"EqualWith",
"(",
"l",
",",
"r",
"u",
".",
"JsonHelper",
")",
"bool",
"{",
"if",
"len",
"(",
"l",
")",
"!=",
"len",
"(",
"r",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"len",
"(",
"l",
")",
"==",
"0",
"&&",
"len",
"(",
"r"... | // EqualWith compare two with helpers for equality. | [
"EqualWith",
"compare",
"two",
"with",
"helpers",
"for",
"equality",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L2035-L2074 |
20,603 | araddon/qlbridge | exec/executor.go | NewExecutor | func NewExecutor(ctx *plan.Context, planner plan.Planner) *JobExecutor {
e := &JobExecutor{}
e.Executor = e
e.Planner = planner
e.Ctx = ctx
return e
} | go | func NewExecutor(ctx *plan.Context, planner plan.Planner) *JobExecutor {
e := &JobExecutor{}
e.Executor = e
e.Planner = planner
e.Ctx = ctx
return e
} | [
"func",
"NewExecutor",
"(",
"ctx",
"*",
"plan",
".",
"Context",
",",
"planner",
"plan",
".",
"Planner",
")",
"*",
"JobExecutor",
"{",
"e",
":=",
"&",
"JobExecutor",
"{",
"}",
"\n",
"e",
".",
"Executor",
"=",
"e",
"\n",
"e",
".",
"Planner",
"=",
"pl... | // NewExecutor creates a new Job Executor. | [
"NewExecutor",
"creates",
"a",
"new",
"Job",
"Executor",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L36-L42 |
20,604 | araddon/qlbridge | exec/executor.go | WalkPlan | func (m *JobExecutor) WalkPlan(p plan.Task) (Task, error) {
switch p := p.(type) {
case *plan.PreparedStatement:
return m.Executor.WalkPreparedStatement(p)
case *plan.Select:
if p.Ctx != nil && p.IsSchemaQuery() {
if p.Ctx.Schema != nil && p.Ctx.Schema.InfoSchema != nil {
p.Ctx.Schema = p.Ctx.Schema.InfoS... | go | func (m *JobExecutor) WalkPlan(p plan.Task) (Task, error) {
switch p := p.(type) {
case *plan.PreparedStatement:
return m.Executor.WalkPreparedStatement(p)
case *plan.Select:
if p.Ctx != nil && p.IsSchemaQuery() {
if p.Ctx.Schema != nil && p.Ctx.Schema.InfoSchema != nil {
p.Ctx.Schema = p.Ctx.Schema.InfoS... | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"WalkPlan",
"(",
"p",
"plan",
".",
"Task",
")",
"(",
"Task",
",",
"error",
")",
"{",
"switch",
"p",
":=",
"p",
".",
"(",
"type",
")",
"{",
"case",
"*",
"plan",
".",
"PreparedStatement",
":",
"return",
"m... | // WalkPlan Main Entry point to take a Plan, and convert into Execution DAG | [
"WalkPlan",
"Main",
"Entry",
"point",
"to",
"take",
"a",
"Plan",
"and",
"convert",
"into",
"Execution",
"DAG"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L109-L141 |
20,605 | araddon/qlbridge | exec/executor.go | WalkSelect | func (m *JobExecutor) WalkSelect(p *plan.Select) (Task, error) {
root := m.NewTask(p)
return root, m.WalkChildren(p, root)
} | go | func (m *JobExecutor) WalkSelect(p *plan.Select) (Task, error) {
root := m.NewTask(p)
return root, m.WalkChildren(p, root)
} | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"WalkSelect",
"(",
"p",
"*",
"plan",
".",
"Select",
")",
"(",
"Task",
",",
"error",
")",
"{",
"root",
":=",
"m",
".",
"NewTask",
"(",
"p",
")",
"\n",
"return",
"root",
",",
"m",
".",
"WalkChildren",
"(",... | // DML
// WalkSelect create dag of plan Select. | [
"DML",
"WalkSelect",
"create",
"dag",
"of",
"plan",
"Select",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L151-L154 |
20,606 | araddon/qlbridge | exec/executor.go | WalkCommand | func (m *JobExecutor) WalkCommand(p *plan.Command) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewCommand(m.Ctx, p))
} | go | func (m *JobExecutor) WalkCommand(p *plan.Command) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewCommand(m.Ctx, p))
} | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"WalkCommand",
"(",
"p",
"*",
"plan",
".",
"Command",
")",
"(",
"Task",
",",
"error",
")",
"{",
"root",
":=",
"m",
".",
"NewTask",
"(",
"p",
")",
"\n",
"return",
"root",
",",
"root",
".",
"Add",
"(",
"... | // Other Statements
// WalkCommand walk Commands such as SET. | [
"Other",
"Statements",
"WalkCommand",
"walk",
"Commands",
"such",
"as",
"SET",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L312-L315 |
20,607 | araddon/qlbridge | exec/executor.go | WalkCreate | func (m *JobExecutor) WalkCreate(p *plan.Create) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewCreate(m.Ctx, p))
} | go | func (m *JobExecutor) WalkCreate(p *plan.Create) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewCreate(m.Ctx, p))
} | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"WalkCreate",
"(",
"p",
"*",
"plan",
".",
"Create",
")",
"(",
"Task",
",",
"error",
")",
"{",
"root",
":=",
"m",
".",
"NewTask",
"(",
"p",
")",
"\n",
"return",
"root",
",",
"root",
".",
"Add",
"(",
"Ne... | // DDL Operations
// WalkCreate walks the Create plan. | [
"DDL",
"Operations",
"WalkCreate",
"walks",
"the",
"Create",
"plan",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L320-L323 |
20,608 | araddon/qlbridge | exec/executor.go | WalkDrop | func (m *JobExecutor) WalkDrop(p *plan.Drop) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewDrop(m.Ctx, p))
} | go | func (m *JobExecutor) WalkDrop(p *plan.Drop) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewDrop(m.Ctx, p))
} | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"WalkDrop",
"(",
"p",
"*",
"plan",
".",
"Drop",
")",
"(",
"Task",
",",
"error",
")",
"{",
"root",
":=",
"m",
".",
"NewTask",
"(",
"p",
")",
"\n",
"return",
"root",
",",
"root",
".",
"Add",
"(",
"NewDro... | // WalkDrop walks the Drop plan. | [
"WalkDrop",
"walks",
"the",
"Drop",
"plan",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L326-L329 |
20,609 | araddon/qlbridge | exec/executor.go | WalkAlter | func (m *JobExecutor) WalkAlter(p *plan.Alter) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewAlter(m.Ctx, p))
} | go | func (m *JobExecutor) WalkAlter(p *plan.Alter) (Task, error) {
root := m.NewTask(p)
return root, root.Add(NewAlter(m.Ctx, p))
} | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"WalkAlter",
"(",
"p",
"*",
"plan",
".",
"Alter",
")",
"(",
"Task",
",",
"error",
")",
"{",
"root",
":=",
"m",
".",
"NewTask",
"(",
"p",
")",
"\n",
"return",
"root",
",",
"root",
".",
"Add",
"(",
"NewA... | // WalkAlter walks the Alter plan. | [
"WalkAlter",
"walks",
"the",
"Alter",
"plan",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L332-L335 |
20,610 | araddon/qlbridge | exec/executor.go | WalkChildren | func (m *JobExecutor) WalkChildren(p plan.Task, root Task) error {
for _, t := range p.Children() {
//u.Debugf("parent: %T walk child %p %T %#v", p, t, t, p.Children())
et, err := m.WalkPlanTask(t)
if err != nil {
u.Errorf("could not create task %#v err=%v", t, err)
}
if len(t.Children()) == 0 {
err ... | go | func (m *JobExecutor) WalkChildren(p plan.Task, root Task) error {
for _, t := range p.Children() {
//u.Debugf("parent: %T walk child %p %T %#v", p, t, t, p.Children())
et, err := m.WalkPlanTask(t)
if err != nil {
u.Errorf("could not create task %#v err=%v", t, err)
}
if len(t.Children()) == 0 {
err ... | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"WalkChildren",
"(",
"p",
"plan",
".",
"Task",
",",
"root",
"Task",
")",
"error",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"p",
".",
"Children",
"(",
")",
"{",
"//u.Debugf(\"parent: %T walk child %p %T %#v\", p... | // WalkChildren walk dag of plan tasks creating execution tasks | [
"WalkChildren",
"walk",
"dag",
"of",
"plan",
"tasks",
"creating",
"execution",
"tasks"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L338-L374 |
20,611 | araddon/qlbridge | exec/executor.go | Setup | func (m *JobExecutor) Setup() error {
if m == nil {
return fmt.Errorf("JobExecutor is nil?")
}
if m.RootTask == nil {
return fmt.Errorf("No task exists for this job")
}
return m.RootTask.Setup(0)
} | go | func (m *JobExecutor) Setup() error {
if m == nil {
return fmt.Errorf("JobExecutor is nil?")
}
if m.RootTask == nil {
return fmt.Errorf("No task exists for this job")
}
return m.RootTask.Setup(0)
} | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"Setup",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"RootTask",
"==",
"nil",
"{",
"return",
"fmt",
".",
... | // Setup this dag of tasks | [
"Setup",
"this",
"dag",
"of",
"tasks"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L377-L385 |
20,612 | araddon/qlbridge | exec/executor.go | DrainChan | func (m *JobExecutor) DrainChan() MessageChan {
tasks := m.RootTask.Children()
return tasks[len(tasks)-1].(TaskRunner).MessageOut()
} | go | func (m *JobExecutor) DrainChan() MessageChan {
tasks := m.RootTask.Children()
return tasks[len(tasks)-1].(TaskRunner).MessageOut()
} | [
"func",
"(",
"m",
"*",
"JobExecutor",
")",
"DrainChan",
"(",
")",
"MessageChan",
"{",
"tasks",
":=",
"m",
".",
"RootTask",
".",
"Children",
"(",
")",
"\n",
"return",
"tasks",
"[",
"len",
"(",
"tasks",
")",
"-",
"1",
"]",
".",
"(",
"TaskRunner",
")"... | // The drain is the last out channel, on last task | [
"The",
"drain",
"is",
"the",
"last",
"out",
"channel",
"on",
"last",
"task"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/executor.go#L398-L401 |
20,613 | araddon/qlbridge | expr/builtins/url_email.go | UrlWithQueryEval | func UrlWithQueryEval(include []*regexp.Regexp) expr.EvaluatorFunc {
return func(ctx expr.EvalContext, args []value.Value) (value.Value, bool) {
val := ""
switch itemT := args[0].(type) {
case value.StringValue:
val = itemT.Val()
case value.Slice:
if itemT.Len() == 0 {
return value.EmptyStringValue,... | go | func UrlWithQueryEval(include []*regexp.Regexp) expr.EvaluatorFunc {
return func(ctx expr.EvalContext, args []value.Value) (value.Value, bool) {
val := ""
switch itemT := args[0].(type) {
case value.StringValue:
val = itemT.Val()
case value.Slice:
if itemT.Len() == 0 {
return value.EmptyStringValue,... | [
"func",
"UrlWithQueryEval",
"(",
"include",
"[",
"]",
"*",
"regexp",
".",
"Regexp",
")",
"expr",
".",
"EvaluatorFunc",
"{",
"return",
"func",
"(",
"ctx",
"expr",
".",
"EvalContext",
",",
"args",
"[",
"]",
"value",
".",
"Value",
")",
"(",
"value",
".",
... | // UrlWithQueryEval pass reg-expressions to match qs args.
// Must match one regexp or else the qs param is dropped. | [
"UrlWithQueryEval",
"pass",
"reg",
"-",
"expressions",
"to",
"match",
"qs",
"args",
".",
"Must",
"match",
"one",
"regexp",
"or",
"else",
"the",
"qs",
"param",
"is",
"dropped",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/builtins/url_email.go#L645-L690 |
20,614 | araddon/qlbridge | datasource/schemadb.go | SchemaDBStoreProvider | func SchemaDBStoreProvider(s *schema.Schema) schema.Source {
schemaDb := NewSchemaDb(s)
s.InfoSchema.DS = schemaDb
return schemaDb
} | go | func SchemaDBStoreProvider(s *schema.Schema) schema.Source {
schemaDb := NewSchemaDb(s)
s.InfoSchema.DS = schemaDb
return schemaDb
} | [
"func",
"SchemaDBStoreProvider",
"(",
"s",
"*",
"schema",
".",
"Schema",
")",
"schema",
".",
"Source",
"{",
"schemaDb",
":=",
"NewSchemaDb",
"(",
"s",
")",
"\n",
"s",
".",
"InfoSchema",
".",
"DS",
"=",
"schemaDb",
"\n",
"return",
"schemaDb",
"\n",
"}"
] | // SchemaDBStoreProvider create source for schemadb | [
"SchemaDBStoreProvider",
"create",
"source",
"for",
"schemadb"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/schemadb.go#L68-L72 |
20,615 | araddon/qlbridge | datasource/schemadb.go | NewSchemaDb | func NewSchemaDb(s *schema.Schema) *SchemaDb {
m := SchemaDb{
s: s,
tbls: defaultSchemaTables,
tableMap: make(map[string]*schema.Table),
}
return &m
} | go | func NewSchemaDb(s *schema.Schema) *SchemaDb {
m := SchemaDb{
s: s,
tbls: defaultSchemaTables,
tableMap: make(map[string]*schema.Table),
}
return &m
} | [
"func",
"NewSchemaDb",
"(",
"s",
"*",
"schema",
".",
"Schema",
")",
"*",
"SchemaDb",
"{",
"m",
":=",
"SchemaDb",
"{",
"s",
":",
"s",
",",
"tbls",
":",
"defaultSchemaTables",
",",
"tableMap",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"schema",... | // NewSchemaDb create new db for storing schema. | [
"NewSchemaDb",
"create",
"new",
"db",
"for",
"storing",
"schema",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/schemadb.go#L75-L82 |
20,616 | araddon/qlbridge | datasource/schemadb.go | Table | func (m *SchemaDb) Table(table string) (*schema.Table, error) {
switch table {
case "tables":
return m.tableForTables()
case "databases":
return m.tableForDatabases()
case "session_variables", "global_variables":
return m.tableForVariables(table)
case "procedures", "functions":
return m.tableForProcedures... | go | func (m *SchemaDb) Table(table string) (*schema.Table, error) {
switch table {
case "tables":
return m.tableForTables()
case "databases":
return m.tableForDatabases()
case "session_variables", "global_variables":
return m.tableForVariables(table)
case "procedures", "functions":
return m.tableForProcedures... | [
"func",
"(",
"m",
"*",
"SchemaDb",
")",
"Table",
"(",
"table",
"string",
")",
"(",
"*",
"schema",
".",
"Table",
",",
"error",
")",
"{",
"switch",
"table",
"{",
"case",
"\"",
"\"",
":",
"return",
"m",
".",
"tableForTables",
"(",
")",
"\n",
"case",
... | // Table get schema Table | [
"Table",
"get",
"schema",
"Table"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/schemadb.go#L99-L121 |
20,617 | araddon/qlbridge | datasource/schemadb.go | SetContext | func (m *SchemaSource) SetContext(ctx *plan.Context) {
m.ctx = ctx
if m.session {
m.rows = RowsForSession(ctx)
}
} | go | func (m *SchemaSource) SetContext(ctx *plan.Context) {
m.ctx = ctx
if m.session {
m.rows = RowsForSession(ctx)
}
} | [
"func",
"(",
"m",
"*",
"SchemaSource",
")",
"SetContext",
"(",
"ctx",
"*",
"plan",
".",
"Context",
")",
"{",
"m",
".",
"ctx",
"=",
"ctx",
"\n",
"if",
"m",
".",
"session",
"{",
"m",
".",
"rows",
"=",
"RowsForSession",
"(",
"ctx",
")",
"\n",
"}",
... | // SetContext set the plan context | [
"SetContext",
"set",
"the",
"plan",
"context"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/schemadb.go#L143-L148 |
20,618 | araddon/qlbridge | datasource/schemadb.go | Table | func (m *mysqlWriter) Table(tbl *schema.Table) string {
w := &bytes.Buffer{}
//u.Infof("%s tbl=%p fields? %#v fields?%v", tbl.Name, tbl, tbl.FieldMap, len(tbl.Fields))
fmt.Fprintf(w, "CREATE TABLE `%s` (", tbl.Name)
for i, fld := range tbl.Fields {
if i != 0 {
w.WriteByte(',')
}
fmt.Fprint(w, "\n ")
... | go | func (m *mysqlWriter) Table(tbl *schema.Table) string {
w := &bytes.Buffer{}
//u.Infof("%s tbl=%p fields? %#v fields?%v", tbl.Name, tbl, tbl.FieldMap, len(tbl.Fields))
fmt.Fprintf(w, "CREATE TABLE `%s` (", tbl.Name)
for i, fld := range tbl.Fields {
if i != 0 {
w.WriteByte(',')
}
fmt.Fprint(w, "\n ")
... | [
"func",
"(",
"m",
"*",
"mysqlWriter",
")",
"Table",
"(",
"tbl",
"*",
"schema",
".",
"Table",
")",
"string",
"{",
"w",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"//u.Infof(\"%s tbl=%p fields? %#v fields?%v\", tbl.Name, tbl, tbl.FieldMap, len(tbl.Fields))",
... | // Table Implement Dialect Specific Writers
// ie, mysql, postgres, cassandra all have different dialects
// so the Create statements are quite different
// Table output a CREATE TABLE statement using mysql dialect. | [
"Table",
"Implement",
"Dialect",
"Specific",
"Writers",
"ie",
"mysql",
"postgres",
"cassandra",
"all",
"have",
"different",
"dialects",
"so",
"the",
"Create",
"statements",
"are",
"quite",
"different",
"Table",
"output",
"a",
"CREATE",
"TABLE",
"statement",
"using... | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/schemadb.go#L406-L422 |
20,619 | araddon/qlbridge | plan/planner.go | NewPlanner | func NewPlanner(ctx *Context) *PlannerDefault {
p := &PlannerDefault{
Ctx: ctx,
children: make([]Task, 0),
}
p.Planner = p
return p
} | go | func NewPlanner(ctx *Context) *PlannerDefault {
p := &PlannerDefault{
Ctx: ctx,
children: make([]Task, 0),
}
p.Planner = p
return p
} | [
"func",
"NewPlanner",
"(",
"ctx",
"*",
"Context",
")",
"*",
"PlannerDefault",
"{",
"p",
":=",
"&",
"PlannerDefault",
"{",
"Ctx",
":",
"ctx",
",",
"children",
":",
"make",
"(",
"[",
"]",
"Task",
",",
"0",
")",
",",
"}",
"\n",
"p",
".",
"Planner",
... | // NewPlanner creates a new default planner with context. | [
"NewPlanner",
"creates",
"a",
"new",
"default",
"planner",
"with",
"context",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner.go#L27-L34 |
20,620 | araddon/qlbridge | plan/planner.go | WalkCommand | func (m *PlannerDefault) WalkCommand(p *Command) error {
u.Debugf("WalkCommand %+v", p.Stmt)
return nil
} | go | func (m *PlannerDefault) WalkCommand(p *Command) error {
u.Debugf("WalkCommand %+v", p.Stmt)
return nil
} | [
"func",
"(",
"m",
"*",
"PlannerDefault",
")",
"WalkCommand",
"(",
"p",
"*",
"Command",
")",
"error",
"{",
"u",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"p",
".",
"Stmt",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // WalkCommand walks the command statement | [
"WalkCommand",
"walks",
"the",
"command",
"statement"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner.go#L43-L46 |
20,621 | araddon/qlbridge | plan/planner.go | WalkDrop | func (m *PlannerDefault) WalkDrop(p *Drop) error {
u.Debugf("WalkDrop %+v", p.Stmt)
return nil
} | go | func (m *PlannerDefault) WalkDrop(p *Drop) error {
u.Debugf("WalkDrop %+v", p.Stmt)
return nil
} | [
"func",
"(",
"m",
"*",
"PlannerDefault",
")",
"WalkDrop",
"(",
"p",
"*",
"Drop",
")",
"error",
"{",
"u",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"p",
".",
"Stmt",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // WalkDrop walks the draop statement | [
"WalkDrop",
"walks",
"the",
"draop",
"statement"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner.go#L49-L52 |
20,622 | araddon/qlbridge | plan/planner.go | WalkCreate | func (m *PlannerDefault) WalkCreate(p *Create) error {
u.Debugf("WalkCreate %#v", p)
if len(p.Stmt.With) == 0 {
return fmt.Errorf("CREATE {SCHEMA|SOURCE|DATABASE}")
}
return nil
} | go | func (m *PlannerDefault) WalkCreate(p *Create) error {
u.Debugf("WalkCreate %#v", p)
if len(p.Stmt.With) == 0 {
return fmt.Errorf("CREATE {SCHEMA|SOURCE|DATABASE}")
}
return nil
} | [
"func",
"(",
"m",
"*",
"PlannerDefault",
")",
"WalkCreate",
"(",
"p",
"*",
"Create",
")",
"error",
"{",
"u",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"if",
"len",
"(",
"p",
".",
"Stmt",
".",
"With",
")",
"==",
"0",
"{",
"return",
... | // WalkCreate walk a Create Plan to create the dag of tasks for Create. | [
"WalkCreate",
"walk",
"a",
"Create",
"Plan",
"to",
"create",
"the",
"dag",
"of",
"tasks",
"for",
"Create",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner.go#L55-L61 |
20,623 | araddon/qlbridge | plan/planner.go | WalkAlter | func (m *PlannerDefault) WalkAlter(p *Alter) error {
u.Debugf("WalkAlter %#v", p)
return nil
} | go | func (m *PlannerDefault) WalkAlter(p *Alter) error {
u.Debugf("WalkAlter %#v", p)
return nil
} | [
"func",
"(",
"m",
"*",
"PlannerDefault",
")",
"WalkAlter",
"(",
"p",
"*",
"Alter",
")",
"error",
"{",
"u",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // WalkAlter walk a ALTER Plan to create the dag of tasks forAlter. | [
"WalkAlter",
"walk",
"a",
"ALTER",
"Plan",
"to",
"create",
"the",
"dag",
"of",
"tasks",
"forAlter",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner.go#L64-L67 |
20,624 | araddon/qlbridge | lex/token.go | String | func (t Token) String() string {
return fmt.Sprintf(`Token{ %s Type:"%v" Line:%d Col:%d Q:%s Pos:%d}`,
t.V, t.T.String(), t.Line, t.Column, string(t.Quote), t.Pos)
} | go | func (t Token) String() string {
return fmt.Sprintf(`Token{ %s Type:"%v" Line:%d Col:%d Q:%s Pos:%d}`,
t.V, t.T.String(), t.Line, t.Column, string(t.Quote), t.Pos)
} | [
"func",
"(",
"t",
"Token",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"`Token{ %s Type:\"%v\" Line:%d Col:%d Q:%s Pos:%d}`",
",",
"t",
".",
"V",
",",
"t",
".",
"T",
".",
"String",
"(",
")",
",",
"t",
".",
"Line",
",",... | // convert to human readable string | [
"convert",
"to",
"human",
"readable",
"string"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/token.go#L31-L34 |
20,625 | araddon/qlbridge | lex/token.go | LoadTokenInfo | func LoadTokenInfo() {
for tok, ti := range TokenNameMap {
ti.T = tok
if ti.Kw == "" {
ti.Kw = ti.Description
}
TokenToOp[ti.Kw] = tok
if strings.Contains(ti.Kw, " ") {
parts := strings.Split(ti.Kw, " ")
ti.firstWord = parts[0]
ti.HasSpaces = true
}
}
} | go | func LoadTokenInfo() {
for tok, ti := range TokenNameMap {
ti.T = tok
if ti.Kw == "" {
ti.Kw = ti.Description
}
TokenToOp[ti.Kw] = tok
if strings.Contains(ti.Kw, " ") {
parts := strings.Split(ti.Kw, " ")
ti.firstWord = parts[0]
ti.HasSpaces = true
}
}
} | [
"func",
"LoadTokenInfo",
"(",
")",
"{",
"for",
"tok",
",",
"ti",
":=",
"range",
"TokenNameMap",
"{",
"ti",
".",
"T",
"=",
"tok",
"\n",
"if",
"ti",
".",
"Kw",
"==",
"\"",
"\"",
"{",
"ti",
".",
"Kw",
"=",
"ti",
".",
"Description",
"\n",
"}",
"\n"... | // LoadTokenInfo load the token info into global map | [
"LoadTokenInfo",
"load",
"the",
"token",
"info",
"into",
"global",
"map"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/token.go#L443-L456 |
20,626 | araddon/qlbridge | lex/token.go | TokenFromOp | func TokenFromOp(op string) Token {
tt, ok := TokenToOp[op]
if ok {
return Token{T: tt, V: op}
}
return Token{T: TokenNil}
} | go | func TokenFromOp(op string) Token {
tt, ok := TokenToOp[op]
if ok {
return Token{T: tt, V: op}
}
return Token{T: TokenNil}
} | [
"func",
"TokenFromOp",
"(",
"op",
"string",
")",
"Token",
"{",
"tt",
",",
"ok",
":=",
"TokenToOp",
"[",
"op",
"]",
"\n",
"if",
"ok",
"{",
"return",
"Token",
"{",
"T",
":",
"tt",
",",
"V",
":",
"op",
"}",
"\n",
"}",
"\n",
"return",
"Token",
"{",... | // TokenFromOp get token from operation string | [
"TokenFromOp",
"get",
"token",
"from",
"operation",
"string"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/token.go#L459-L465 |
20,627 | araddon/qlbridge | lex/token.go | String | func (typ TokenType) String() string {
s, ok := TokenNameMap[typ]
if ok {
return s.Kw
}
return "not implemented"
} | go | func (typ TokenType) String() string {
s, ok := TokenNameMap[typ]
if ok {
return s.Kw
}
return "not implemented"
} | [
"func",
"(",
"typ",
"TokenType",
")",
"String",
"(",
")",
"string",
"{",
"s",
",",
"ok",
":=",
"TokenNameMap",
"[",
"typ",
"]",
"\n",
"if",
"ok",
"{",
"return",
"s",
".",
"Kw",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // String convert to human readable string | [
"String",
"convert",
"to",
"human",
"readable",
"string"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/token.go#L468-L474 |
20,628 | araddon/qlbridge | lex/token.go | MatchString | func (typ TokenType) MatchString() string {
tokInfo, ok := TokenNameMap[typ]
//u.Debugf("matchstring: '%v' '%v' '%v'", tokInfo.T, tokInfo.Kw, tokInfo.Description)
if ok {
if tokInfo.HasSpaces {
return tokInfo.firstWord
}
return tokInfo.Kw
}
return "not implemented"
} | go | func (typ TokenType) MatchString() string {
tokInfo, ok := TokenNameMap[typ]
//u.Debugf("matchstring: '%v' '%v' '%v'", tokInfo.T, tokInfo.Kw, tokInfo.Description)
if ok {
if tokInfo.HasSpaces {
return tokInfo.firstWord
}
return tokInfo.Kw
}
return "not implemented"
} | [
"func",
"(",
"typ",
"TokenType",
")",
"MatchString",
"(",
")",
"string",
"{",
"tokInfo",
",",
"ok",
":=",
"TokenNameMap",
"[",
"typ",
"]",
"\n",
"//u.Debugf(\"matchstring: '%v' '%v' '%v'\", tokInfo.T, tokInfo.Kw, tokInfo.Description)",
"if",
"ok",
"{",
"if",
"tokInfo... | // MatchString which keyword should we look for, either full keyword
// OR in case of spaces such as "group by" look for group | [
"MatchString",
"which",
"keyword",
"should",
"we",
"look",
"for",
"either",
"full",
"keyword",
"OR",
"in",
"case",
"of",
"spaces",
"such",
"as",
"group",
"by",
"look",
"for",
"group"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/token.go#L478-L488 |
20,629 | araddon/qlbridge | lex/token.go | MultiWord | func (typ TokenType) MultiWord() bool {
tokInfo, ok := TokenNameMap[typ]
if ok {
return tokInfo.HasSpaces
}
return false
} | go | func (typ TokenType) MultiWord() bool {
tokInfo, ok := TokenNameMap[typ]
if ok {
return tokInfo.HasSpaces
}
return false
} | [
"func",
"(",
"typ",
"TokenType",
")",
"MultiWord",
"(",
")",
"bool",
"{",
"tokInfo",
",",
"ok",
":=",
"TokenNameMap",
"[",
"typ",
"]",
"\n",
"if",
"ok",
"{",
"return",
"tokInfo",
".",
"HasSpaces",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // MultiWord is this a word such as "Group by" with multiple words? | [
"MultiWord",
"is",
"this",
"a",
"word",
"such",
"as",
"Group",
"by",
"with",
"multiple",
"words?"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/token.go#L491-L497 |
20,630 | araddon/qlbridge | schema/registry.go | OpenConn | func OpenConn(schemaName, table string) (Conn, error) {
registry.mu.Lock()
defer registry.mu.Unlock()
schema, ok := registry.schemas[strings.ToLower(schemaName)]
if !ok {
return nil, fmt.Errorf("unknown schema %q", schemaName)
}
return schema.OpenConn(table)
} | go | func OpenConn(schemaName, table string) (Conn, error) {
registry.mu.Lock()
defer registry.mu.Unlock()
schema, ok := registry.schemas[strings.ToLower(schemaName)]
if !ok {
return nil, fmt.Errorf("unknown schema %q", schemaName)
}
return schema.OpenConn(table)
} | [
"func",
"OpenConn",
"(",
"schemaName",
",",
"table",
"string",
")",
"(",
"Conn",
",",
"error",
")",
"{",
"registry",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"registry",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"schema",
",",
"ok",
":=",
... | // OpenConn a schema-source Connection, Global open connection function using
// default schema registry. | [
"OpenConn",
"a",
"schema",
"-",
"source",
"Connection",
"Global",
"open",
"connection",
"function",
"using",
"default",
"schema",
"registry",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L47-L55 |
20,631 | araddon/qlbridge | schema/registry.go | RegisterSourceType | func RegisterSourceType(sourceType string, source Source) {
registryMu.Lock()
defer registryMu.Unlock()
registry.addSourceType(sourceType, source)
} | go | func RegisterSourceType(sourceType string, source Source) {
registryMu.Lock()
defer registryMu.Unlock()
registry.addSourceType(sourceType, source)
} | [
"func",
"RegisterSourceType",
"(",
"sourceType",
"string",
",",
"source",
"Source",
")",
"{",
"registryMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"registryMu",
".",
"Unlock",
"(",
")",
"\n",
"registry",
".",
"addSourceType",
"(",
"sourceType",
",",
"source",... | // RegisterSourceType makes a datasource type available by the provided @sourceType
// If Register is called twice with the same name or if source is nil, it panics.
//
// Sources are specific schemas of type csv, elasticsearch, etc containing
// multiple tables. | [
"RegisterSourceType",
"makes",
"a",
"datasource",
"type",
"available",
"by",
"the",
"provided"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L62-L66 |
20,632 | araddon/qlbridge | schema/registry.go | RegisterSourceAsSchema | func RegisterSourceAsSchema(name string, source Source) error {
// Since registry is a global, lets first lock that.
registryMu.Lock()
defer registryMu.Unlock()
s := NewSchemaSource(name, source)
source.Init()
source.Setup(s)
if err := registry.SchemaAdd(s); err != nil {
return err
}
return discoverSchemaF... | go | func RegisterSourceAsSchema(name string, source Source) error {
// Since registry is a global, lets first lock that.
registryMu.Lock()
defer registryMu.Unlock()
s := NewSchemaSource(name, source)
source.Init()
source.Setup(s)
if err := registry.SchemaAdd(s); err != nil {
return err
}
return discoverSchemaF... | [
"func",
"RegisterSourceAsSchema",
"(",
"name",
"string",
",",
"source",
"Source",
")",
"error",
"{",
"// Since registry is a global, lets first lock that.",
"registryMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"registryMu",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
":=... | // RegisterSourceAsSchema means you have a datasource, that is going to act
// as a named schema. ie, this will not be a nested schema with sub-schemas
// and the source will not be re-useable as a source-type. | [
"RegisterSourceAsSchema",
"means",
"you",
"have",
"a",
"datasource",
"that",
"is",
"going",
"to",
"act",
"as",
"a",
"named",
"schema",
".",
"ie",
"this",
"will",
"not",
"be",
"a",
"nested",
"schema",
"with",
"sub",
"-",
"schemas",
"and",
"the",
"source",
... | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L71-L84 |
20,633 | araddon/qlbridge | schema/registry.go | RegisterSchema | func RegisterSchema(schema *Schema) error {
registryMu.Lock()
defer registryMu.Unlock()
return registry.SchemaAdd(schema)
} | go | func RegisterSchema(schema *Schema) error {
registryMu.Lock()
defer registryMu.Unlock()
return registry.SchemaAdd(schema)
} | [
"func",
"RegisterSchema",
"(",
"schema",
"*",
"Schema",
")",
"error",
"{",
"registryMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"registryMu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"registry",
".",
"SchemaAdd",
"(",
"schema",
")",
"\n",
"}"
] | // RegisterSchema makes a named schema available by the provided @name
// If Register is called twice with the same name or if source is nil, it panics.
//
// Sources are specific schemas of type csv, elasticsearch, etc containing
// multiple tables. | [
"RegisterSchema",
"makes",
"a",
"named",
"schema",
"available",
"by",
"the",
"provided"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L91-L95 |
20,634 | araddon/qlbridge | schema/registry.go | NewRegistry | func NewRegistry(applyer Applyer) *Registry {
return &Registry{
applyer: applyer,
sources: make(map[string]Source),
schemas: make(map[string]*Schema),
schemaNames: make([]string, 0),
}
} | go | func NewRegistry(applyer Applyer) *Registry {
return &Registry{
applyer: applyer,
sources: make(map[string]Source),
schemas: make(map[string]*Schema),
schemaNames: make([]string, 0),
}
} | [
"func",
"NewRegistry",
"(",
"applyer",
"Applyer",
")",
"*",
"Registry",
"{",
"return",
"&",
"Registry",
"{",
"applyer",
":",
"applyer",
",",
"sources",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"Source",
")",
",",
"schemas",
":",
"make",
"(",
"map",... | // NewRegistry create schema registry. | [
"NewRegistry",
"create",
"schema",
"registry",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L104-L111 |
20,635 | araddon/qlbridge | schema/registry.go | SchemaDrop | func (m *Registry) SchemaDrop(schema, name string, objectType lex.TokenType) error {
name = strings.ToLower(name)
switch objectType {
case lex.TokenSchema, lex.TokenSource:
m.mu.RLock()
s, ok := m.schemas[name]
m.mu.RUnlock()
if !ok {
return ErrNotFound
}
return m.applyer.Drop(s, s)
case lex.TokenTab... | go | func (m *Registry) SchemaDrop(schema, name string, objectType lex.TokenType) error {
name = strings.ToLower(name)
switch objectType {
case lex.TokenSchema, lex.TokenSource:
m.mu.RLock()
s, ok := m.schemas[name]
m.mu.RUnlock()
if !ok {
return ErrNotFound
}
return m.applyer.Drop(s, s)
case lex.TokenTab... | [
"func",
"(",
"m",
"*",
"Registry",
")",
"SchemaDrop",
"(",
"schema",
",",
"name",
"string",
",",
"objectType",
"lex",
".",
"TokenType",
")",
"error",
"{",
"name",
"=",
"strings",
".",
"ToLower",
"(",
"name",
")",
"\n",
"switch",
"objectType",
"{",
"cas... | // SchemaDrop removes a schema | [
"SchemaDrop",
"removes",
"a",
"schema"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L129-L154 |
20,636 | araddon/qlbridge | schema/registry.go | SchemaRefresh | func (m *Registry) SchemaRefresh(name string) error {
m.mu.RLock()
s, ok := m.schemas[name]
m.mu.RUnlock()
if !ok {
return ErrNotFound
}
return m.applyer.AddOrUpdateOnSchema(s, s)
} | go | func (m *Registry) SchemaRefresh(name string) error {
m.mu.RLock()
s, ok := m.schemas[name]
m.mu.RUnlock()
if !ok {
return ErrNotFound
}
return m.applyer.AddOrUpdateOnSchema(s, s)
} | [
"func",
"(",
"m",
"*",
"Registry",
")",
"SchemaRefresh",
"(",
"name",
"string",
")",
"error",
"{",
"m",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"s",
",",
"ok",
":=",
"m",
".",
"schemas",
"[",
"name",
"]",
"\n",
"m",
".",
"mu",
".",
"RUnlock",
... | // SchemaRefresh means reload the schema from underlying store. Possibly
// requires introspection. | [
"SchemaRefresh",
"means",
"reload",
"the",
"schema",
"from",
"underlying",
"store",
".",
"Possibly",
"requires",
"introspection",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L158-L166 |
20,637 | araddon/qlbridge | schema/registry.go | SchemaAddFromConfig | func (m *Registry) SchemaAddFromConfig(conf *ConfigSource) error {
source, err := m.GetSource(conf.SourceType)
if err != nil {
u.Warnf("could not find source type %q \nregistry: %s", conf.SourceType, m.String())
return err
}
s := NewSchema(conf.Name)
s.Conf = conf
s.DS = source
if err := s.DS.Setup(s); er... | go | func (m *Registry) SchemaAddFromConfig(conf *ConfigSource) error {
source, err := m.GetSource(conf.SourceType)
if err != nil {
u.Warnf("could not find source type %q \nregistry: %s", conf.SourceType, m.String())
return err
}
s := NewSchema(conf.Name)
s.Conf = conf
s.DS = source
if err := s.DS.Setup(s); er... | [
"func",
"(",
"m",
"*",
"Registry",
")",
"SchemaAddFromConfig",
"(",
"conf",
"*",
"ConfigSource",
")",
"error",
"{",
"source",
",",
"err",
":=",
"m",
".",
"GetSource",
"(",
"conf",
".",
"SourceType",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"u",
".",... | // SchemaAddFromConfig means you have a Schema-Source you want to add | [
"SchemaAddFromConfig",
"means",
"you",
"have",
"a",
"Schema",
"-",
"Source",
"you",
"want",
"to",
"add"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L177-L211 |
20,638 | araddon/qlbridge | schema/registry.go | Schema | func (m *Registry) Schema(schemaName string) (*Schema, bool) {
m.mu.RLock()
defer m.mu.RUnlock()
s, ok := m.schemas[schemaName]
return s, ok
} | go | func (m *Registry) Schema(schemaName string) (*Schema, bool) {
m.mu.RLock()
defer m.mu.RUnlock()
s, ok := m.schemas[schemaName]
return s, ok
} | [
"func",
"(",
"m",
"*",
"Registry",
")",
"Schema",
"(",
"schemaName",
"string",
")",
"(",
"*",
"Schema",
",",
"bool",
")",
"{",
"m",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"s",
",",
"o... | // Schema Get schema for given name. | [
"Schema",
"Get",
"schema",
"for",
"given",
"name",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L214-L219 |
20,639 | araddon/qlbridge | schema/registry.go | SchemaAdd | func (m *Registry) SchemaAdd(s *Schema) error {
s.Name = strings.ToLower(s.Name)
m.mu.RLock()
_, ok := m.schemas[s.Name]
m.mu.RUnlock()
if ok {
if s.Name != "server_schema" {
u.Warnf("Can't add duplicate schema %q", s.Name)
}
return fmt.Errorf("Cannot add duplicate schema %q", s.Name)
}
if s.InfoSchem... | go | func (m *Registry) SchemaAdd(s *Schema) error {
s.Name = strings.ToLower(s.Name)
m.mu.RLock()
_, ok := m.schemas[s.Name]
m.mu.RUnlock()
if ok {
if s.Name != "server_schema" {
u.Warnf("Can't add duplicate schema %q", s.Name)
}
return fmt.Errorf("Cannot add duplicate schema %q", s.Name)
}
if s.InfoSchem... | [
"func",
"(",
"m",
"*",
"Registry",
")",
"SchemaAdd",
"(",
"s",
"*",
"Schema",
")",
"error",
"{",
"s",
".",
"Name",
"=",
"strings",
".",
"ToLower",
"(",
"s",
".",
"Name",
")",
"\n",
"m",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"_",
",",
"ok",... | // SchemaAdd Add a new Schema | [
"SchemaAdd",
"Add",
"a",
"new",
"Schema"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L222-L240 |
20,640 | araddon/qlbridge | schema/registry.go | SchemaAddChild | func (m *Registry) SchemaAddChild(name string, child *Schema) error {
name = strings.ToLower(name)
m.mu.RLock()
parent, ok := m.schemas[name]
m.mu.RUnlock()
if !ok {
return fmt.Errorf("Cannot find schema %q to add child", name)
}
m.applyer.AddOrUpdateOnSchema(parent, child)
return nil
} | go | func (m *Registry) SchemaAddChild(name string, child *Schema) error {
name = strings.ToLower(name)
m.mu.RLock()
parent, ok := m.schemas[name]
m.mu.RUnlock()
if !ok {
return fmt.Errorf("Cannot find schema %q to add child", name)
}
m.applyer.AddOrUpdateOnSchema(parent, child)
return nil
} | [
"func",
"(",
"m",
"*",
"Registry",
")",
"SchemaAddChild",
"(",
"name",
"string",
",",
"child",
"*",
"Schema",
")",
"error",
"{",
"name",
"=",
"strings",
".",
"ToLower",
"(",
"name",
")",
"\n",
"m",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"parent",... | // SchemaAddChild Add a new Child Schema | [
"SchemaAddChild",
"Add",
"a",
"new",
"Child",
"Schema"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L243-L253 |
20,641 | araddon/qlbridge | schema/registry.go | GetSource | func (m *Registry) GetSource(sourceType string) (Source, error) {
return m.getDepth(0, sourceType)
} | go | func (m *Registry) GetSource(sourceType string) (Source, error) {
return m.getDepth(0, sourceType)
} | [
"func",
"(",
"m",
"*",
"Registry",
")",
"GetSource",
"(",
"sourceType",
"string",
")",
"(",
"Source",
",",
"error",
")",
"{",
"return",
"m",
".",
"getDepth",
"(",
"0",
",",
"sourceType",
")",
"\n",
"}"
] | // GetSource Find a DataSource by SourceType | [
"GetSource",
"Find",
"a",
"DataSource",
"by",
"SourceType"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L261-L263 |
20,642 | araddon/qlbridge | schema/registry.go | String | func (m *Registry) String() string {
m.mu.RLock()
defer m.mu.RUnlock()
sourceNames := make([]string, 0, len(m.sources))
for source := range m.sources {
sourceNames = append(sourceNames, source)
}
schemas := make([]string, 0, len(m.schemas))
for _, sch := range m.schemas {
schemas = append(schemas, sch.Name)
... | go | func (m *Registry) String() string {
m.mu.RLock()
defer m.mu.RUnlock()
sourceNames := make([]string, 0, len(m.sources))
for source := range m.sources {
sourceNames = append(sourceNames, source)
}
schemas := make([]string, 0, len(m.schemas))
for _, sch := range m.schemas {
schemas = append(schemas, sch.Name)
... | [
"func",
"(",
"m",
"*",
"Registry",
")",
"String",
"(",
")",
"string",
"{",
"m",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"sourceNames",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
... | // String describe contents of registry. | [
"String",
"describe",
"contents",
"of",
"registry",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L280-L292 |
20,643 | araddon/qlbridge | schema/registry.go | discoverSchemaFromSource | func discoverSchemaFromSource(s *Schema, applyer Applyer) error {
if s.DS == nil {
return fmt.Errorf("Missing datasource for schema %q", s.Name)
}
if s.InfoSchema == nil {
return fmt.Errorf("Missing InfoSchema for schema %q", s.Name)
}
if err := s.DS.Setup(s); err != nil {
u.Errorf("Error setting up %v %v... | go | func discoverSchemaFromSource(s *Schema, applyer Applyer) error {
if s.DS == nil {
return fmt.Errorf("Missing datasource for schema %q", s.Name)
}
if s.InfoSchema == nil {
return fmt.Errorf("Missing InfoSchema for schema %q", s.Name)
}
if err := s.DS.Setup(s); err != nil {
u.Errorf("Error setting up %v %v... | [
"func",
"discoverSchemaFromSource",
"(",
"s",
"*",
"Schema",
",",
"applyer",
"Applyer",
")",
"error",
"{",
"if",
"s",
".",
"DS",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
... | // Create a schema from given named source
// we will find Source for that name and introspect | [
"Create",
"a",
"schema",
"from",
"given",
"named",
"source",
"we",
"will",
"find",
"Source",
"for",
"that",
"name",
"and",
"introspect"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/registry.go#L296-L321 |
20,644 | araddon/qlbridge | rel/filter.go | String | func (m *FilterStatement) String() string {
if m == nil {
return ""
}
w := expr.NewJSONDialectWriter()
m.WriteDialect(w)
return w.String()
} | go | func (m *FilterStatement) String() string {
if m == nil {
return ""
}
w := expr.NewJSONDialectWriter()
m.WriteDialect(w)
return w.String()
} | [
"func",
"(",
"m",
"*",
"FilterStatement",
")",
"String",
"(",
")",
"string",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"w",
":=",
"expr",
".",
"NewJSONDialectWriter",
"(",
")",
"\n",
"m",
".",
"WriteDialect",
"(",
"w"... | // String representation of FilterStatement | [
"String",
"representation",
"of",
"FilterStatement"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/filter.go#L86-L93 |
20,645 | araddon/qlbridge | rel/filter.go | Includes | func (m *FilterStatement) Includes() []string {
if !m.checkedIncludes {
m.includes = expr.FindIncludes(m.Filter)
m.checkedIncludes = true
}
return m.includes
} | go | func (m *FilterStatement) Includes() []string {
if !m.checkedIncludes {
m.includes = expr.FindIncludes(m.Filter)
m.checkedIncludes = true
}
return m.includes
} | [
"func",
"(",
"m",
"*",
"FilterStatement",
")",
"Includes",
"(",
")",
"[",
"]",
"string",
"{",
"if",
"!",
"m",
".",
"checkedIncludes",
"{",
"m",
".",
"includes",
"=",
"expr",
".",
"FindIncludes",
"(",
"m",
".",
"Filter",
")",
"\n",
"m",
".",
"checke... | // Includes Recurse this statement and find all includes | [
"Includes",
"Recurse",
"this",
"statement",
"and",
"find",
"all",
"includes"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/filter.go#L105-L111 |
20,646 | araddon/qlbridge | rel/filter.go | String | func (m *FilterSelect) String() string {
if m == nil {
return ""
}
w := expr.NewDefaultWriter()
m.WriteDialect(w)
return w.String()
} | go | func (m *FilterSelect) String() string {
if m == nil {
return ""
}
w := expr.NewDefaultWriter()
m.WriteDialect(w)
return w.String()
} | [
"func",
"(",
"m",
"*",
"FilterSelect",
")",
"String",
"(",
")",
"string",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"w",
":=",
"expr",
".",
"NewDefaultWriter",
"(",
")",
"\n",
"m",
".",
"WriteDialect",
"(",
"w",
")"... | // String representation of FilterSelect | [
"String",
"representation",
"of",
"FilterSelect"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/filter.go#L189-L196 |
20,647 | araddon/qlbridge | rel/filter.go | Equal | func (m *FilterSelect) Equal(s *FilterSelect) bool {
if m == nil && s == nil {
return true
}
if m == nil && s != nil {
return false
}
if m != nil && s == nil {
return false
}
if !m.Columns.Equal(s.Columns) {
return false
}
mfs := m.FilterStatement
if mfs != nil {
sfs := s.FilterStatement
if !mfs.E... | go | func (m *FilterSelect) Equal(s *FilterSelect) bool {
if m == nil && s == nil {
return true
}
if m == nil && s != nil {
return false
}
if m != nil && s == nil {
return false
}
if !m.Columns.Equal(s.Columns) {
return false
}
mfs := m.FilterStatement
if mfs != nil {
sfs := s.FilterStatement
if !mfs.E... | [
"func",
"(",
"m",
"*",
"FilterSelect",
")",
"Equal",
"(",
"s",
"*",
"FilterSelect",
")",
"bool",
"{",
"if",
"m",
"==",
"nil",
"&&",
"s",
"==",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"m",
"==",
"nil",
"&&",
"s",
"!=",
"nil",
"{",
... | // Equal Checks for deep equality | [
"Equal",
"Checks",
"for",
"deep",
"equality"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/filter.go#L208-L229 |
20,648 | araddon/qlbridge | datasource/sqlite/conn.go | Close | func (m *qryconn) Close() error {
defer m.source.mu.Unlock()
delete(m.source.qryconns, m.tbl.Name)
if m.rows != nil {
if err := m.rows.Close(); err != nil {
return err
}
}
return nil
} | go | func (m *qryconn) Close() error {
defer m.source.mu.Unlock()
delete(m.source.qryconns, m.tbl.Name)
if m.rows != nil {
if err := m.rows.Close(); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"qryconn",
")",
"Close",
"(",
")",
"error",
"{",
"defer",
"m",
".",
"source",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"delete",
"(",
"m",
".",
"source",
".",
"qryconns",
",",
"m",
".",
"tbl",
".",
"Name",
")",
"\n",
"... | // Close the qryconn. Since sqlite is a NON-threadsafe db, this is very important
// as we actually hold a lock per-table during scans to prevent conflict. | [
"Close",
"the",
"qryconn",
".",
"Since",
"sqlite",
"is",
"a",
"NON",
"-",
"threadsafe",
"db",
"this",
"is",
"very",
"important",
"as",
"we",
"actually",
"hold",
"a",
"lock",
"per",
"-",
"table",
"during",
"scans",
"to",
"prevent",
"conflict",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/sqlite/conn.go#L81-L90 |
20,649 | araddon/qlbridge | datasource/sqlite/conn.go | Get | func (m *qryconn) Get(key driver.Value) (schema.Message, error) {
row := m.source.db.QueryRow(fmt.Sprintf("SELECT * FROM %v WHERE %s = $1", m.tbl.Name, m.cols[0]), key)
vals := make([]driver.Value, len(m.cols))
if err := row.Scan(&vals); err != nil {
return nil, err
}
return datasource.NewSqlDriverMessageMap(0,... | go | func (m *qryconn) Get(key driver.Value) (schema.Message, error) {
row := m.source.db.QueryRow(fmt.Sprintf("SELECT * FROM %v WHERE %s = $1", m.tbl.Name, m.cols[0]), key)
vals := make([]driver.Value, len(m.cols))
if err := row.Scan(&vals); err != nil {
return nil, err
}
return datasource.NewSqlDriverMessageMap(0,... | [
"func",
"(",
"m",
"*",
"qryconn",
")",
"Get",
"(",
"key",
"driver",
".",
"Value",
")",
"(",
"schema",
".",
"Message",
",",
"error",
")",
"{",
"row",
":=",
"m",
".",
"source",
".",
"db",
".",
"QueryRow",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\... | // Get a single row by key. | [
"Get",
"a",
"single",
"row",
"by",
"key",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/sqlite/conn.go#L216-L224 |
20,650 | araddon/qlbridge | datasource/sqlite/conn.go | Delete | func (m *qryconn) Delete(key driver.Value) (int, error) {
return -1, schema.ErrNotImplemented
} | go | func (m *qryconn) Delete(key driver.Value) (int, error) {
return -1, schema.ErrNotImplemented
} | [
"func",
"(",
"m",
"*",
"qryconn",
")",
"Delete",
"(",
"key",
"driver",
".",
"Value",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"-",
"1",
",",
"schema",
".",
"ErrNotImplemented",
"\n",
"}"
] | // Delete deletes a single row by key | [
"Delete",
"deletes",
"a",
"single",
"row",
"by",
"key"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/sqlite/conn.go#L227-L229 |
20,651 | araddon/qlbridge | datasource/sqlite/conn.go | WalkSourceSelect | func (m *qryconn) WalkSourceSelect(planner plan.Planner, p *plan.Source) (plan.Task, error) {
sqlSelect := p.Stmt.Source
u.Infof("original %s", sqlSelect.String())
p.Stmt.Source = nil
p.Stmt.Rewrite(sqlSelect)
sqlSelect = p.Stmt.Source
u.Infof("original after From(source) rewrite %s", sqlSelect.String())
sqlSel... | go | func (m *qryconn) WalkSourceSelect(planner plan.Planner, p *plan.Source) (plan.Task, error) {
sqlSelect := p.Stmt.Source
u.Infof("original %s", sqlSelect.String())
p.Stmt.Source = nil
p.Stmt.Rewrite(sqlSelect)
sqlSelect = p.Stmt.Source
u.Infof("original after From(source) rewrite %s", sqlSelect.String())
sqlSel... | [
"func",
"(",
"m",
"*",
"qryconn",
")",
"WalkSourceSelect",
"(",
"planner",
"plan",
".",
"Planner",
",",
"p",
"*",
"plan",
".",
"Source",
")",
"(",
"plan",
".",
"Task",
",",
"error",
")",
"{",
"sqlSelect",
":=",
"p",
".",
"Stmt",
".",
"Source",
"\n"... | // WalkSourceSelect An interface implemented by this connection allowing the planner
// to push down as much sql logic down to sqlite. | [
"WalkSourceSelect",
"An",
"interface",
"implemented",
"by",
"this",
"connection",
"allowing",
"the",
"planner",
"to",
"push",
"down",
"as",
"much",
"sql",
"logic",
"down",
"to",
"sqlite",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/sqlite/conn.go#L233-L261 |
20,652 | araddon/qlbridge | exec/projection.go | Close | func (m *Projection) Close() error {
//u.Debugf("Projection Close alreadyclosed?%v", m.closed)
m.Lock()
if m.closed {
m.Unlock()
return nil
}
m.closed = true
m.Unlock()
go m.drain()
//return m.TaskBase.Close()
return nil
} | go | func (m *Projection) Close() error {
//u.Debugf("Projection Close alreadyclosed?%v", m.closed)
m.Lock()
if m.closed {
m.Unlock()
return nil
}
m.closed = true
m.Unlock()
go m.drain()
//return m.TaskBase.Close()
return nil
} | [
"func",
"(",
"m",
"*",
"Projection",
")",
"Close",
"(",
")",
"error",
"{",
"//u.Debugf(\"Projection Close alreadyclosed?%v\", m.closed)",
"m",
".",
"Lock",
"(",
")",
"\n",
"if",
"m",
".",
"closed",
"{",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",... | // Close cleans up and closes channels | [
"Close",
"cleans",
"up",
"and",
"closes",
"channels"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/projection.go#L84-L98 |
20,653 | araddon/qlbridge | exec/projection.go | CloseFinal | func (m *Projection) CloseFinal() error {
//u.Debugf("Projection CloseFinal alreadyclosed?%v", m.closed)
defer func() {
if r := recover(); r != nil {
u.Warnf("error on close %v", r)
}
}()
//return nil
return m.TaskBase.Close()
} | go | func (m *Projection) CloseFinal() error {
//u.Debugf("Projection CloseFinal alreadyclosed?%v", m.closed)
defer func() {
if r := recover(); r != nil {
u.Warnf("error on close %v", r)
}
}()
//return nil
return m.TaskBase.Close()
} | [
"func",
"(",
"m",
"*",
"Projection",
")",
"CloseFinal",
"(",
")",
"error",
"{",
"//u.Debugf(\"Projection CloseFinal alreadyclosed?%v\", m.closed)",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"u",
".",
... | // CloseFinal after exit, cleanup some more | [
"CloseFinal",
"after",
"exit",
"cleanup",
"some",
"more"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/projection.go#L101-L110 |
20,654 | araddon/qlbridge | exec/projection.go | limitEvaluator | func (m *Projection) limitEvaluator() MessageHandler {
out := m.MessageOut()
limit := m.p.Stmt.Limit
if limit == 0 {
limit = math.MaxInt32
}
rowCt := 0
return func(ctx *plan.Context, msg schema.Message) bool {
select {
case <-m.SigChan():
u.Debugf("%p closed, returning", m)
return false
default:
... | go | func (m *Projection) limitEvaluator() MessageHandler {
out := m.MessageOut()
limit := m.p.Stmt.Limit
if limit == 0 {
limit = math.MaxInt32
}
rowCt := 0
return func(ctx *plan.Context, msg schema.Message) bool {
select {
case <-m.SigChan():
u.Debugf("%p closed, returning", m)
return false
default:
... | [
"func",
"(",
"m",
"*",
"Projection",
")",
"limitEvaluator",
"(",
")",
"MessageHandler",
"{",
"out",
":=",
"m",
".",
"MessageOut",
"(",
")",
"\n",
"limit",
":=",
"m",
".",
"p",
".",
"Stmt",
".",
"Limit",
"\n",
"if",
"limit",
"==",
"0",
"{",
"limit",... | // Limit only evaluator | [
"Limit",
"only",
"evaluator"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/projection.go#L315-L353 |
20,655 | araddon/qlbridge | schema/schema.go | NewInfoSchema | func NewInfoSchema(schemaName string, s *Schema) *Schema {
is := NewSchemaSource(schemaName, nil)
is.InfoSchema = is
is.SchemaRef = s
return is
} | go | func NewInfoSchema(schemaName string, s *Schema) *Schema {
is := NewSchemaSource(schemaName, nil)
is.InfoSchema = is
is.SchemaRef = s
return is
} | [
"func",
"NewInfoSchema",
"(",
"schemaName",
"string",
",",
"s",
"*",
"Schema",
")",
"*",
"Schema",
"{",
"is",
":=",
"NewSchemaSource",
"(",
"schemaName",
",",
"nil",
")",
"\n",
"is",
".",
"InfoSchema",
"=",
"is",
"\n",
"is",
".",
"SchemaRef",
"=",
"s",... | // NewInfoSchema create a new empty schema with given name. | [
"NewInfoSchema",
"create",
"a",
"new",
"empty",
"schema",
"with",
"given",
"name",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L172-L177 |
20,656 | araddon/qlbridge | schema/schema.go | NewSchemaSource | func NewSchemaSource(schemaName string, ds Source) *Schema {
m := &Schema{
Name: strings.ToLower(schemaName),
schemas: make(map[string]*Schema),
tableMap: make(map[string]*Table),
tableSchemas: make(map[string]*Schema),
tableNames: make([]string, 0),
DS: ds,
}
return m
} | go | func NewSchemaSource(schemaName string, ds Source) *Schema {
m := &Schema{
Name: strings.ToLower(schemaName),
schemas: make(map[string]*Schema),
tableMap: make(map[string]*Table),
tableSchemas: make(map[string]*Schema),
tableNames: make([]string, 0),
DS: ds,
}
return m
} | [
"func",
"NewSchemaSource",
"(",
"schemaName",
"string",
",",
"ds",
"Source",
")",
"*",
"Schema",
"{",
"m",
":=",
"&",
"Schema",
"{",
"Name",
":",
"strings",
".",
"ToLower",
"(",
"schemaName",
")",
",",
"schemas",
":",
"make",
"(",
"map",
"[",
"string",... | // NewSchemaSource create a new empty schema with given name and source. | [
"NewSchemaSource",
"create",
"a",
"new",
"empty",
"schema",
"with",
"given",
"name",
"and",
"source",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L180-L190 |
20,657 | araddon/qlbridge | schema/schema.go | Since | func (m *Schema) Since(dur time.Duration) bool {
if m.lastRefreshed.IsZero() {
return false
}
if m.lastRefreshed.After(time.Now().Add(dur)) {
return true
}
return false
} | go | func (m *Schema) Since(dur time.Duration) bool {
if m.lastRefreshed.IsZero() {
return false
}
if m.lastRefreshed.After(time.Now().Add(dur)) {
return true
}
return false
} | [
"func",
"(",
"m",
"*",
"Schema",
")",
"Since",
"(",
"dur",
"time",
".",
"Duration",
")",
"bool",
"{",
"if",
"m",
".",
"lastRefreshed",
".",
"IsZero",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"m",
".",
"lastRefreshed",
".",
"After",
... | // Since Is this schema object been refreshed within time window described by @dur time ago ? | [
"Since",
"Is",
"this",
"schema",
"object",
"been",
"refreshed",
"within",
"time",
"window",
"described",
"by"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L193-L201 |
20,658 | araddon/qlbridge | schema/schema.go | Table | func (m *Schema) Table(tableIn string) (*Table, error) {
tableName := strings.ToLower(tableIn)
m.mu.RLock()
defer m.mu.RUnlock()
// u.Debugf("%p looking up %q", m, tableName)
tbl, ok := m.tableMap[tableName]
if ok && tbl != nil {
return tbl, nil
}
// Lets see if it is `schema`.`table` format
_, tableN... | go | func (m *Schema) Table(tableIn string) (*Table, error) {
tableName := strings.ToLower(tableIn)
m.mu.RLock()
defer m.mu.RUnlock()
// u.Debugf("%p looking up %q", m, tableName)
tbl, ok := m.tableMap[tableName]
if ok && tbl != nil {
return tbl, nil
}
// Lets see if it is `schema`.`table` format
_, tableN... | [
"func",
"(",
"m",
"*",
"Schema",
")",
"Table",
"(",
"tableIn",
"string",
")",
"(",
"*",
"Table",
",",
"error",
")",
"{",
"tableName",
":=",
"strings",
".",
"ToLower",
"(",
"tableIn",
")",
"\n\n",
"m",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"def... | // Table gets Table definition for given table name | [
"Table",
"gets",
"Table",
"definition",
"for",
"given",
"table",
"name"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L210-L237 |
20,659 | araddon/qlbridge | schema/schema.go | OpenConn | func (m *Schema) OpenConn(tableName string) (Conn, error) {
tableName = strings.ToLower(tableName)
m.mu.RLock()
defer m.mu.RUnlock()
sch, ok := m.tableSchemas[tableName]
if !ok || sch == nil || sch.DS == nil {
return nil, fmt.Errorf("Could not find a DataSource for that table %q", tableName)
}
conn, err := sc... | go | func (m *Schema) OpenConn(tableName string) (Conn, error) {
tableName = strings.ToLower(tableName)
m.mu.RLock()
defer m.mu.RUnlock()
sch, ok := m.tableSchemas[tableName]
if !ok || sch == nil || sch.DS == nil {
return nil, fmt.Errorf("Could not find a DataSource for that table %q", tableName)
}
conn, err := sc... | [
"func",
"(",
"m",
"*",
"Schema",
")",
"OpenConn",
"(",
"tableName",
"string",
")",
"(",
"Conn",
",",
"error",
")",
"{",
"tableName",
"=",
"strings",
".",
"ToLower",
"(",
"tableName",
")",
"\n",
"m",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",... | // OpenConn get a connection from this schema by table name. | [
"OpenConn",
"get",
"a",
"connection",
"from",
"this",
"schema",
"by",
"table",
"name",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L240-L257 |
20,660 | araddon/qlbridge | schema/schema.go | Schema | func (m *Schema) Schema(schemaName string) (*Schema, error) {
// We always lower-case schema names
schemaName = strings.ToLower(schemaName)
m.mu.RLock()
defer m.mu.RUnlock()
child, ok := m.schemas[schemaName]
if ok && child != nil && child.DS != nil {
return child, nil
}
return nil, fmt.Errorf("Could not find... | go | func (m *Schema) Schema(schemaName string) (*Schema, error) {
// We always lower-case schema names
schemaName = strings.ToLower(schemaName)
m.mu.RLock()
defer m.mu.RUnlock()
child, ok := m.schemas[schemaName]
if ok && child != nil && child.DS != nil {
return child, nil
}
return nil, fmt.Errorf("Could not find... | [
"func",
"(",
"m",
"*",
"Schema",
")",
"Schema",
"(",
"schemaName",
"string",
")",
"(",
"*",
"Schema",
",",
"error",
")",
"{",
"// We always lower-case schema names",
"schemaName",
"=",
"strings",
".",
"ToLower",
"(",
"schemaName",
")",
"\n",
"m",
".",
"mu"... | // Schema Find a child Schema for given schema name, | [
"Schema",
"Find",
"a",
"child",
"Schema",
"for",
"given",
"schema",
"name"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L260-L270 |
20,661 | araddon/qlbridge | schema/schema.go | SchemaForTable | func (m *Schema) SchemaForTable(tableName string) (*Schema, error) {
// We always lower-case table names
tableName = strings.ToLower(tableName)
if m.Name == "schema" {
return m, nil
}
m.mu.RLock()
ss, ok := m.tableSchemas[tableName]
m.mu.RUnlock()
if ok && ss != nil && ss.DS != nil {
return ss, nil
}
... | go | func (m *Schema) SchemaForTable(tableName string) (*Schema, error) {
// We always lower-case table names
tableName = strings.ToLower(tableName)
if m.Name == "schema" {
return m, nil
}
m.mu.RLock()
ss, ok := m.tableSchemas[tableName]
m.mu.RUnlock()
if ok && ss != nil && ss.DS != nil {
return ss, nil
}
... | [
"func",
"(",
"m",
"*",
"Schema",
")",
"SchemaForTable",
"(",
"tableName",
"string",
")",
"(",
"*",
"Schema",
",",
"error",
")",
"{",
"// We always lower-case table names",
"tableName",
"=",
"strings",
".",
"ToLower",
"(",
"tableName",
")",
"\n\n",
"if",
"m",... | // SchemaForTable Find a Schema for given Table | [
"SchemaForTable",
"Find",
"a",
"Schema",
"for",
"given",
"Table"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L273-L292 |
20,662 | araddon/qlbridge | schema/schema.go | addChildSchema | func (m *Schema) addChildSchema(child *Schema) {
m.mu.Lock()
defer m.mu.Unlock()
m.schemas[child.Name] = child
child.parent = m
child.mu.RLock()
defer child.mu.RUnlock()
for tableName, tbl := range child.tableMap {
m.tableSchemas[tableName] = child
m.tableMap[tableName] = tbl
}
} | go | func (m *Schema) addChildSchema(child *Schema) {
m.mu.Lock()
defer m.mu.Unlock()
m.schemas[child.Name] = child
child.parent = m
child.mu.RLock()
defer child.mu.RUnlock()
for tableName, tbl := range child.tableMap {
m.tableSchemas[tableName] = child
m.tableMap[tableName] = tbl
}
} | [
"func",
"(",
"m",
"*",
"Schema",
")",
"addChildSchema",
"(",
"child",
"*",
"Schema",
")",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"m",
".",
"schemas",
"[",
"child",
".",
"Name",
... | // addChildSchema add a child schema to this one. Schemas can be tree-in-nature
// with schema of multiple backend datasources being combined into parent Schema, but each
// child has their own unique defined schema. | [
"addChildSchema",
"add",
"a",
"child",
"schema",
"to",
"this",
"one",
".",
"Schemas",
"can",
"be",
"tree",
"-",
"in",
"-",
"nature",
"with",
"schema",
"of",
"multiple",
"backend",
"datasources",
"being",
"combined",
"into",
"parent",
"Schema",
"but",
"each",... | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L297-L308 |
20,663 | araddon/qlbridge | schema/schema.go | NewTable | func NewTable(table string) *Table {
tpb := TablePb{
Name: strings.ToLower(table),
NameOriginal: table,
}
t := &Table{
TablePb: tpb,
Fields: make([]*Field, 0),
FieldMap: make(map[string]*Field),
}
t.init(nil)
return t
} | go | func NewTable(table string) *Table {
tpb := TablePb{
Name: strings.ToLower(table),
NameOriginal: table,
}
t := &Table{
TablePb: tpb,
Fields: make([]*Field, 0),
FieldMap: make(map[string]*Field),
}
t.init(nil)
return t
} | [
"func",
"NewTable",
"(",
"table",
"string",
")",
"*",
"Table",
"{",
"tpb",
":=",
"TablePb",
"{",
"Name",
":",
"strings",
".",
"ToLower",
"(",
"table",
")",
",",
"NameOriginal",
":",
"table",
",",
"}",
"\n",
"t",
":=",
"&",
"Table",
"{",
"TablePb",
... | // NewTable create a new table for a schema. | [
"NewTable",
"create",
"a",
"new",
"table",
"for",
"a",
"schema",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L473-L485 |
20,664 | araddon/qlbridge | schema/schema.go | FieldsAsMessages | func (m *Table) FieldsAsMessages() []Message {
msgs := make([]Message, len(m.Fields))
for i, f := range m.Fields {
msgs[i] = f
}
return msgs
} | go | func (m *Table) FieldsAsMessages() []Message {
msgs := make([]Message, len(m.Fields))
for i, f := range m.Fields {
msgs[i] = f
}
return msgs
} | [
"func",
"(",
"m",
"*",
"Table",
")",
"FieldsAsMessages",
"(",
")",
"[",
"]",
"Message",
"{",
"msgs",
":=",
"make",
"(",
"[",
"]",
"Message",
",",
"len",
"(",
"m",
".",
"Fields",
")",
")",
"\n",
"for",
"i",
",",
"f",
":=",
"range",
"m",
".",
"... | // FieldsAsMessages get list of all fields as interface Message
// used in schema as sql "describe table" | [
"FieldsAsMessages",
"get",
"list",
"of",
"all",
"fields",
"as",
"interface",
"Message",
"used",
"in",
"schema",
"as",
"sql",
"describe",
"table"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L500-L506 |
20,665 | araddon/qlbridge | schema/schema.go | AddField | func (m *Table) AddField(fld *Field) {
found := false
for i, curFld := range m.Fields {
if curFld.Name == fld.Name {
found = true
m.Fields[i] = fld
break
}
}
if !found {
fld.idx = uint64(len(m.Fields))
m.Fields = append(m.Fields, fld)
}
m.FieldMap[fld.Name] = fld
} | go | func (m *Table) AddField(fld *Field) {
found := false
for i, curFld := range m.Fields {
if curFld.Name == fld.Name {
found = true
m.Fields[i] = fld
break
}
}
if !found {
fld.idx = uint64(len(m.Fields))
m.Fields = append(m.Fields, fld)
}
m.FieldMap[fld.Name] = fld
} | [
"func",
"(",
"m",
"*",
"Table",
")",
"AddField",
"(",
"fld",
"*",
"Field",
")",
"{",
"found",
":=",
"false",
"\n",
"for",
"i",
",",
"curFld",
":=",
"range",
"m",
".",
"Fields",
"{",
"if",
"curFld",
".",
"Name",
"==",
"fld",
".",
"Name",
"{",
"f... | // AddField register a new field | [
"AddField",
"register",
"a",
"new",
"field"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L515-L529 |
20,666 | araddon/qlbridge | schema/schema.go | AddFieldType | func (m *Table) AddFieldType(name string, valType value.ValueType) {
m.AddField(&Field{FieldPb: FieldPb{Type: uint32(valType), Name: name}})
} | go | func (m *Table) AddFieldType(name string, valType value.ValueType) {
m.AddField(&Field{FieldPb: FieldPb{Type: uint32(valType), Name: name}})
} | [
"func",
"(",
"m",
"*",
"Table",
")",
"AddFieldType",
"(",
"name",
"string",
",",
"valType",
"value",
".",
"ValueType",
")",
"{",
"m",
".",
"AddField",
"(",
"&",
"Field",
"{",
"FieldPb",
":",
"FieldPb",
"{",
"Type",
":",
"uint32",
"(",
"valType",
")",... | // AddFieldType describe and register a new column | [
"AddFieldType",
"describe",
"and",
"register",
"a",
"new",
"column"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L532-L534 |
20,667 | araddon/qlbridge | schema/schema.go | Column | func (m *Table) Column(col string) (value.ValueType, bool) {
f, ok := m.FieldMap[col]
if ok {
return f.ValueType(), true
}
f, ok = m.FieldMap[strings.ToLower(col)]
if ok {
return f.ValueType(), true
}
return value.UnknownType, false
} | go | func (m *Table) Column(col string) (value.ValueType, bool) {
f, ok := m.FieldMap[col]
if ok {
return f.ValueType(), true
}
f, ok = m.FieldMap[strings.ToLower(col)]
if ok {
return f.ValueType(), true
}
return value.UnknownType, false
} | [
"func",
"(",
"m",
"*",
"Table",
")",
"Column",
"(",
"col",
"string",
")",
"(",
"value",
".",
"ValueType",
",",
"bool",
")",
"{",
"f",
",",
"ok",
":=",
"m",
".",
"FieldMap",
"[",
"col",
"]",
"\n",
"if",
"ok",
"{",
"return",
"f",
".",
"ValueType"... | // Column get the Underlying data type. | [
"Column",
"get",
"the",
"Underlying",
"data",
"type",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L537-L547 |
20,668 | araddon/qlbridge | schema/schema.go | SetColumns | func (m *Table) SetColumns(cols []string) {
m.FieldPositions = make(map[string]int, len(cols))
for idx, col := range cols {
//col = strings.ToLower(col)
m.FieldPositions[col] = idx
cols[idx] = col
}
m.cols = cols
} | go | func (m *Table) SetColumns(cols []string) {
m.FieldPositions = make(map[string]int, len(cols))
for idx, col := range cols {
//col = strings.ToLower(col)
m.FieldPositions[col] = idx
cols[idx] = col
}
m.cols = cols
} | [
"func",
"(",
"m",
"*",
"Table",
")",
"SetColumns",
"(",
"cols",
"[",
"]",
"string",
")",
"{",
"m",
".",
"FieldPositions",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"len",
"(",
"cols",
")",
")",
"\n",
"for",
"idx",
",",
"col",
":=... | // SetColumns Explicityly set column names. | [
"SetColumns",
"Explicityly",
"set",
"column",
"names",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L550-L558 |
20,669 | araddon/qlbridge | schema/schema.go | SetColumnsFromFields | func (m *Table) SetColumnsFromFields() {
m.FieldPositions = make(map[string]int, len(m.Fields))
cols := make([]string, len(m.Fields))
for idx, f := range m.Fields {
col := strings.ToLower(f.Name)
m.FieldPositions[col] = idx
cols[idx] = col
}
m.cols = cols
} | go | func (m *Table) SetColumnsFromFields() {
m.FieldPositions = make(map[string]int, len(m.Fields))
cols := make([]string, len(m.Fields))
for idx, f := range m.Fields {
col := strings.ToLower(f.Name)
m.FieldPositions[col] = idx
cols[idx] = col
}
m.cols = cols
} | [
"func",
"(",
"m",
"*",
"Table",
")",
"SetColumnsFromFields",
"(",
")",
"{",
"m",
".",
"FieldPositions",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"len",
"(",
"m",
".",
"Fields",
")",
")",
"\n",
"cols",
":=",
"make",
"(",
"[",
"]",
... | // SetColumnsFromFields Explicityly set column names from fields. | [
"SetColumnsFromFields",
"Explicityly",
"set",
"column",
"names",
"from",
"fields",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/schema/schema.go#L561-L570 |
20,670 | araddon/qlbridge | datasource/mockcsv/mockcsv.go | Schema | func Schema() *schema.Schema {
if sch != nil {
return sch
}
if err := schema.RegisterSourceAsSchema(SchemaName, CsvGlobal); err != nil {
u.Errorf("Could not read schema %v", err)
return nil
}
sch, _ = schema.DefaultRegistry().Schema(SchemaName)
return sch
} | go | func Schema() *schema.Schema {
if sch != nil {
return sch
}
if err := schema.RegisterSourceAsSchema(SchemaName, CsvGlobal); err != nil {
u.Errorf("Could not read schema %v", err)
return nil
}
sch, _ = schema.DefaultRegistry().Schema(SchemaName)
return sch
} | [
"func",
"Schema",
"(",
")",
"*",
"schema",
".",
"Schema",
"{",
"if",
"sch",
"!=",
"nil",
"{",
"return",
"sch",
"\n",
"}",
"\n",
"if",
"err",
":=",
"schema",
".",
"RegisterSourceAsSchema",
"(",
"SchemaName",
",",
"CsvGlobal",
")",
";",
"err",
"!=",
"n... | // Schema global accessor to the mockcsv schema | [
"Schema",
"global",
"accessor",
"to",
"the",
"mockcsv",
"schema"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/mockcsv/mockcsv.go#L37-L47 |
20,671 | araddon/qlbridge | datasource/mockcsv/mockcsv.go | LoadTable | func LoadTable(schemaName, name, csvRaw string) {
CsvGlobal.CreateTable(name, csvRaw)
schema.DefaultRegistry().SchemaRefresh(SchemaName)
} | go | func LoadTable(schemaName, name, csvRaw string) {
CsvGlobal.CreateTable(name, csvRaw)
schema.DefaultRegistry().SchemaRefresh(SchemaName)
} | [
"func",
"LoadTable",
"(",
"schemaName",
",",
"name",
",",
"csvRaw",
"string",
")",
"{",
"CsvGlobal",
".",
"CreateTable",
"(",
"name",
",",
"csvRaw",
")",
"\n",
"schema",
".",
"DefaultRegistry",
"(",
")",
".",
"SchemaRefresh",
"(",
"SchemaName",
")",
"\n",
... | // LoadTable MockCsv is used for mocking so has a global data source we can load data into | [
"LoadTable",
"MockCsv",
"is",
"used",
"for",
"mocking",
"so",
"has",
"a",
"global",
"data",
"source",
"we",
"can",
"load",
"data",
"into"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/mockcsv/mockcsv.go#L50-L53 |
20,672 | araddon/qlbridge | datasource/mockcsv/mockcsv.go | New | func New() *Source {
return &Source{
tablenamelist: make([]string, 0),
raw: make(map[string]string),
tables: make(map[string]*membtree.StaticDataSource),
}
} | go | func New() *Source {
return &Source{
tablenamelist: make([]string, 0),
raw: make(map[string]string),
tables: make(map[string]*membtree.StaticDataSource),
}
} | [
"func",
"New",
"(",
")",
"*",
"Source",
"{",
"return",
"&",
"Source",
"{",
"tablenamelist",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"raw",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"tables",
":",
"make",
... | // New create csv mock source. | [
"New",
"create",
"csv",
"mock",
"source",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/mockcsv/mockcsv.go#L70-L76 |
20,673 | araddon/qlbridge | datasource/mockcsv/mockcsv.go | Setup | func (m *Source) Setup(s *schema.Schema) error {
m.s = s
return nil
} | go | func (m *Source) Setup(s *schema.Schema) error {
m.s = s
return nil
} | [
"func",
"(",
"m",
"*",
"Source",
")",
"Setup",
"(",
"s",
"*",
"schema",
".",
"Schema",
")",
"error",
"{",
"m",
".",
"s",
"=",
"s",
"\n",
"return",
"nil",
"\n",
"}"
] | // Setup accept schema | [
"Setup",
"accept",
"schema"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/mockcsv/mockcsv.go#L82-L85 |
20,674 | araddon/qlbridge | datasource/mockcsv/mockcsv.go | DropTable | func (m *Source) DropTable(t string) error {
delete(m.raw, t)
delete(m.tables, t)
names := make([]string, 0, len(m.tables))
for tableName, _ := range m.raw {
names = append(names, tableName)
}
m.tablenamelist = names
return nil
} | go | func (m *Source) DropTable(t string) error {
delete(m.raw, t)
delete(m.tables, t)
names := make([]string, 0, len(m.tables))
for tableName, _ := range m.raw {
names = append(names, tableName)
}
m.tablenamelist = names
return nil
} | [
"func",
"(",
"m",
"*",
"Source",
")",
"DropTable",
"(",
"t",
"string",
")",
"error",
"{",
"delete",
"(",
"m",
".",
"raw",
",",
"t",
")",
"\n",
"delete",
"(",
"m",
".",
"tables",
",",
"t",
")",
"\n",
"names",
":=",
"make",
"(",
"[",
"]",
"stri... | // DropTable Drop table schema | [
"DropTable",
"Drop",
"table",
"schema"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/mockcsv/mockcsv.go#L88-L97 |
20,675 | araddon/qlbridge | datasource/mockcsv/mockcsv.go | Open | func (m *Source) Open(tableName string) (schema.Conn, error) {
tableName = strings.ToLower(tableName)
if ds, ok := m.tables[tableName]; ok {
return &Table{StaticDataSource: ds}, nil
}
err := m.loadTable(tableName)
if err != nil {
u.Errorf("could not load table %q err=%v", tableName, err)
return nil, err
}... | go | func (m *Source) Open(tableName string) (schema.Conn, error) {
tableName = strings.ToLower(tableName)
if ds, ok := m.tables[tableName]; ok {
return &Table{StaticDataSource: ds}, nil
}
err := m.loadTable(tableName)
if err != nil {
u.Errorf("could not load table %q err=%v", tableName, err)
return nil, err
}... | [
"func",
"(",
"m",
"*",
"Source",
")",
"Open",
"(",
"tableName",
"string",
")",
"(",
"schema",
".",
"Conn",
",",
"error",
")",
"{",
"tableName",
"=",
"strings",
".",
"ToLower",
"(",
"tableName",
")",
"\n",
"if",
"ds",
",",
"ok",
":=",
"m",
".",
"t... | // Open connection to given tablename. | [
"Open",
"connection",
"to",
"given",
"tablename",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/mockcsv/mockcsv.go#L100-L113 |
20,676 | araddon/qlbridge | datasource/mockcsv/mockcsv.go | CreateTable | func (m *Source) CreateTable(tableName, csvRaw string) {
if _, exists := m.raw[tableName]; !exists {
m.tablenamelist = append(m.tablenamelist, tableName)
}
m.raw[tableName] = csvRaw
m.loadTable(tableName)
} | go | func (m *Source) CreateTable(tableName, csvRaw string) {
if _, exists := m.raw[tableName]; !exists {
m.tablenamelist = append(m.tablenamelist, tableName)
}
m.raw[tableName] = csvRaw
m.loadTable(tableName)
} | [
"func",
"(",
"m",
"*",
"Source",
")",
"CreateTable",
"(",
"tableName",
",",
"csvRaw",
"string",
")",
"{",
"if",
"_",
",",
"exists",
":=",
"m",
".",
"raw",
"[",
"tableName",
"]",
";",
"!",
"exists",
"{",
"m",
".",
"tablenamelist",
"=",
"append",
"("... | // CreateTable create a csv table in this source. | [
"CreateTable",
"create",
"a",
"csv",
"table",
"in",
"this",
"source",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/mockcsv/mockcsv.go#L187-L193 |
20,677 | araddon/qlbridge | datasource/files/filesource.go | Setup | func (m *FileSource) Setup(ss *schema.Schema) error {
m.ss = ss
if err := m.init(); err != nil {
return err
}
if m.lastLoad.Before(time.Now().Add(-schemaRefreshInterval)) {
m.lastLoad = time.Now()
}
m.partitionCt = uint64(m.ss.Conf.PartitionCt)
m.partitionFunc = SipPartitioner
return nil
} | go | func (m *FileSource) Setup(ss *schema.Schema) error {
m.ss = ss
if err := m.init(); err != nil {
return err
}
if m.lastLoad.Before(time.Now().Add(-schemaRefreshInterval)) {
m.lastLoad = time.Now()
}
m.partitionCt = uint64(m.ss.Conf.PartitionCt)
m.partitionFunc = SipPartitioner
return nil
} | [
"func",
"(",
"m",
"*",
"FileSource",
")",
"Setup",
"(",
"ss",
"*",
"schema",
".",
"Schema",
")",
"error",
"{",
"m",
".",
"ss",
"=",
"ss",
"\n",
"if",
"err",
":=",
"m",
".",
"init",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n"... | // Setup the filesource with schema info | [
"Setup",
"the",
"filesource",
"with",
"schema",
"info"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filesource.go#L99-L111 |
20,678 | araddon/qlbridge | datasource/files/filesource.go | Open | func (m *FileSource) Open(tableName string) (schema.Conn, error) {
//u.Debugf("Open(%q)", tableName)
if tableName == m.filesTable {
return m.fdb.Open(tableName)
}
pg, err := m.createPager(tableName, 0, 0)
if err != nil {
u.Errorf("could not get pager: %v", err)
return nil, err
}
return pg, nil
} | go | func (m *FileSource) Open(tableName string) (schema.Conn, error) {
//u.Debugf("Open(%q)", tableName)
if tableName == m.filesTable {
return m.fdb.Open(tableName)
}
pg, err := m.createPager(tableName, 0, 0)
if err != nil {
u.Errorf("could not get pager: %v", err)
return nil, err
}
return pg, nil
} | [
"func",
"(",
"m",
"*",
"FileSource",
")",
"Open",
"(",
"tableName",
"string",
")",
"(",
"schema",
".",
"Conn",
",",
"error",
")",
"{",
"//u.Debugf(\"Open(%q)\", tableName)",
"if",
"tableName",
"==",
"m",
".",
"filesTable",
"{",
"return",
"m",
".",
"fdb",
... | // Open a connection to given table, partition of Source interface | [
"Open",
"a",
"connection",
"to",
"given",
"table",
"partition",
"of",
"Source",
"interface"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filesource.go#L114-L125 |
20,679 | araddon/qlbridge | datasource/files/filesource.go | Table | func (m *FileSource) Table(tableName string) (*schema.Table, error) {
//u.Debugf("Table(%q) path:%v %#v", tableName, m.path, m.ss.Conf)
// We have a special table that is the list of all files
if m.filesTable == tableName {
return m.fdb.Table(tableName)
}
// Check cache for this table
t, ok := m.tableSchemas... | go | func (m *FileSource) Table(tableName string) (*schema.Table, error) {
//u.Debugf("Table(%q) path:%v %#v", tableName, m.path, m.ss.Conf)
// We have a special table that is the list of all files
if m.filesTable == tableName {
return m.fdb.Table(tableName)
}
// Check cache for this table
t, ok := m.tableSchemas... | [
"func",
"(",
"m",
"*",
"FileSource",
")",
"Table",
"(",
"tableName",
"string",
")",
"(",
"*",
"schema",
".",
"Table",
",",
"error",
")",
"{",
"//u.Debugf(\"Table(%q) path:%v %#v\", tableName, m.path, m.ss.Conf)",
"// We have a special table that is the list of all files",
... | // Table satisfys SourceSchema interface to get table schema for given table | [
"Table",
"satisfys",
"SourceSchema",
"interface",
"to",
"get",
"table",
"schema",
"for",
"given",
"table"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filesource.go#L289-L330 |
20,680 | araddon/qlbridge | datasource/key.go | KeyFromWhere | func KeyFromWhere(wh interface{}) schema.Key {
switch n := wh.(type) {
case *rel.SqlWhere:
return KeyFromWhere(n.Expr)
case *expr.BinaryNode:
if len(n.Args) != 2 {
u.Warnf("need more args? %#v", n.Args)
return nil
}
in, ok := n.Args[0].(*expr.IdentityNode)
if !ok {
u.Warnf("not identity? %T", n.Ar... | go | func KeyFromWhere(wh interface{}) schema.Key {
switch n := wh.(type) {
case *rel.SqlWhere:
return KeyFromWhere(n.Expr)
case *expr.BinaryNode:
if len(n.Args) != 2 {
u.Warnf("need more args? %#v", n.Args)
return nil
}
in, ok := n.Args[0].(*expr.IdentityNode)
if !ok {
u.Warnf("not identity? %T", n.Ar... | [
"func",
"KeyFromWhere",
"(",
"wh",
"interface",
"{",
"}",
")",
"schema",
".",
"Key",
"{",
"switch",
"n",
":=",
"wh",
".",
"(",
"type",
")",
"{",
"case",
"*",
"rel",
".",
"SqlWhere",
":",
"return",
"KeyFromWhere",
"(",
"n",
".",
"Expr",
")",
"\n",
... | // Given a Where expression, lets try to create a key which
// requires form `idenity = "value"`
// | [
"Given",
"a",
"Where",
"expression",
"lets",
"try",
"to",
"create",
"a",
"key",
"which",
"requires",
"form",
"idenity",
"=",
"value"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/key.go#L47-L77 |
20,681 | araddon/qlbridge | vm/_archive/vm_sql.go | NewSqlVm | func NewSqlVm(sqlText string) (*SqlVm, error) {
stmt, err := expr.ParseSqlVm(sqlText)
if err != nil {
return nil, err
}
m := &SqlVm{
Statement: stmt,
}
switch v := stmt.(type) {
case *expr.SqlSelect:
m.Keyword = lex.TokenSelect
m.sel = v
case *expr.SqlInsert:
m.Keyword = lex.TokenInsert
m.ins = v
... | go | func NewSqlVm(sqlText string) (*SqlVm, error) {
stmt, err := expr.ParseSqlVm(sqlText)
if err != nil {
return nil, err
}
m := &SqlVm{
Statement: stmt,
}
switch v := stmt.(type) {
case *expr.SqlSelect:
m.Keyword = lex.TokenSelect
m.sel = v
case *expr.SqlInsert:
m.Keyword = lex.TokenInsert
m.ins = v
... | [
"func",
"NewSqlVm",
"(",
"sqlText",
"string",
")",
"(",
"*",
"SqlVm",
",",
"error",
")",
"{",
"stmt",
",",
"err",
":=",
"expr",
".",
"ParseSqlVm",
"(",
"sqlText",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"... | // SqlVm parsers a sql query into columns, where guards, etc
// | [
"SqlVm",
"parsers",
"a",
"sql",
"query",
"into",
"columns",
"where",
"guards",
"etc"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/vm/_archive/vm_sql.go#L30-L51 |
20,682 | araddon/qlbridge | vm/_archive/vm_sql.go | Execute | func (m *SqlVm) Execute(writeContext datasource.ContextWriter, readContext datasource.ContextReader) (err error) {
switch m.Keyword {
case lex.TokenSelect:
return m.ExecuteSelect(writeContext, readContext)
case lex.TokenInsert:
if rowWriter, ok := writeContext.(datasource.RowWriter); ok {
return m.ExecuteIns... | go | func (m *SqlVm) Execute(writeContext datasource.ContextWriter, readContext datasource.ContextReader) (err error) {
switch m.Keyword {
case lex.TokenSelect:
return m.ExecuteSelect(writeContext, readContext)
case lex.TokenInsert:
if rowWriter, ok := writeContext.(datasource.RowWriter); ok {
return m.ExecuteIns... | [
"func",
"(",
"m",
"*",
"SqlVm",
")",
"Execute",
"(",
"writeContext",
"datasource",
".",
"ContextWriter",
",",
"readContext",
"datasource",
".",
"ContextReader",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"m",
".",
"Keyword",
"{",
"case",
"lex",
".",
"... | // Execute applies a parse expression to the specified context's
//
// writeContext in the case of sql query is similar to a recordset for selects,
// or for delete, insert, update it is like the storage layer
// | [
"Execute",
"applies",
"a",
"parse",
"expression",
"to",
"the",
"specified",
"context",
"s",
"writeContext",
"in",
"the",
"case",
"of",
"sql",
"query",
"is",
"similar",
"to",
"a",
"recordset",
"for",
"selects",
"or",
"for",
"delete",
"insert",
"update",
"it",... | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/vm/_archive/vm_sql.go#L58-L76 |
20,683 | araddon/qlbridge | vm/_archive/vm_sql.go | ExecuteSelect | func (m *SqlVm) ExecuteSelect(writeContext datasource.ContextWriter, readContext datasource.ContextReader) (err error) {
//defer errRecover(&err)
s := &State{
ExprVm: m,
ContextReader: readContext,
}
s.rv = reflect.ValueOf(s)
// Check and see if we are where Guarded
if m.sel.Where != nil {
//u.Debug... | go | func (m *SqlVm) ExecuteSelect(writeContext datasource.ContextWriter, readContext datasource.ContextReader) (err error) {
//defer errRecover(&err)
s := &State{
ExprVm: m,
ContextReader: readContext,
}
s.rv = reflect.ValueOf(s)
// Check and see if we are where Guarded
if m.sel.Where != nil {
//u.Debug... | [
"func",
"(",
"m",
"*",
"SqlVm",
")",
"ExecuteSelect",
"(",
"writeContext",
"datasource",
".",
"ContextWriter",
",",
"readContext",
"datasource",
".",
"ContextReader",
")",
"(",
"err",
"error",
")",
"{",
"//defer errRecover(&err)",
"s",
":=",
"&",
"State",
"{",... | // Execute applies a dml sql select expression to the specified context's
//
// writeContext in the case of sql query is similar to a recordset for selects,
// or for delete, insert, update it is like the storage layer
// | [
"Execute",
"applies",
"a",
"dml",
"sql",
"select",
"expression",
"to",
"the",
"specified",
"context",
"s",
"writeContext",
"in",
"the",
"case",
"of",
"sql",
"query",
"is",
"similar",
"to",
"a",
"recordset",
"for",
"selects",
"or",
"for",
"delete",
"insert",
... | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/vm/_archive/vm_sql.go#L83-L127 |
20,684 | araddon/qlbridge | exec/order.go | NewOrder | func NewOrder(ctx *plan.Context, p *plan.Order) *Order {
o := &Order{
TaskBase: NewTaskBase(ctx),
p: p,
complete: make(chan bool),
}
return o
} | go | func NewOrder(ctx *plan.Context, p *plan.Order) *Order {
o := &Order{
TaskBase: NewTaskBase(ctx),
p: p,
complete: make(chan bool),
}
return o
} | [
"func",
"NewOrder",
"(",
"ctx",
"*",
"plan",
".",
"Context",
",",
"p",
"*",
"plan",
".",
"Order",
")",
"*",
"Order",
"{",
"o",
":=",
"&",
"Order",
"{",
"TaskBase",
":",
"NewTaskBase",
"(",
"ctx",
")",
",",
"p",
":",
"p",
",",
"complete",
":",
"... | // NewORder create new order by exec task | [
"NewORder",
"create",
"new",
"order",
"by",
"exec",
"task"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/order.go#L26-L33 |
20,685 | araddon/qlbridge | dialects/_influxql/dialect.go | LexInfluxName | func LexInfluxName(l *lex.Lexer) lex.StateFn {
l.SkipWhiteSpaces()
firstChar := l.Peek()
u.Debugf("LexInfluxName: %v", string(firstChar))
switch firstChar {
case '"':
return lex.LexValue(l)
case '/':
// a regex
return lex.LexRegex(l)
}
return lex.LexIdentifier
} | go | func LexInfluxName(l *lex.Lexer) lex.StateFn {
l.SkipWhiteSpaces()
firstChar := l.Peek()
u.Debugf("LexInfluxName: %v", string(firstChar))
switch firstChar {
case '"':
return lex.LexValue(l)
case '/':
// a regex
return lex.LexRegex(l)
}
return lex.LexIdentifier
} | [
"func",
"LexInfluxName",
"(",
"l",
"*",
"lex",
".",
"Lexer",
")",
"lex",
".",
"StateFn",
"{",
"l",
".",
"SkipWhiteSpaces",
"(",
")",
"\n",
"firstChar",
":=",
"l",
".",
"Peek",
"(",
")",
"\n",
"u",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"string",
"(... | // lex value
//
// SIMPLE_NAME_VALUE | TABLE_NAME_VALUE | REGEX_VALUE | [
"lex",
"value",
"SIMPLE_NAME_VALUE",
"|",
"TABLE_NAME_VALUE",
"|",
"REGEX_VALUE"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/dialects/_influxql/dialect.go#L98-L112 |
20,686 | araddon/qlbridge | datasource/files/filestore.go | FileStoreLoader | func FileStoreLoader(ss *schema.Schema) (cloudstorage.StoreReader, error) {
if ss == nil || ss.Conf == nil {
return nil, fmt.Errorf("No config info for files source for %v", ss)
}
//u.Debugf("json conf:\n%s", ss.Conf.Settings.PrettyJson())
storeType := ss.Conf.Settings.String("type")
if storeType == "" {
retu... | go | func FileStoreLoader(ss *schema.Schema) (cloudstorage.StoreReader, error) {
if ss == nil || ss.Conf == nil {
return nil, fmt.Errorf("No config info for files source for %v", ss)
}
//u.Debugf("json conf:\n%s", ss.Conf.Settings.PrettyJson())
storeType := ss.Conf.Settings.String("type")
if storeType == "" {
retu... | [
"func",
"FileStoreLoader",
"(",
"ss",
"*",
"schema",
".",
"Schema",
")",
"(",
"cloudstorage",
".",
"StoreReader",
",",
"error",
")",
"{",
"if",
"ss",
"==",
"nil",
"||",
"ss",
".",
"Conf",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
... | // FileStoreLoader defines the interface for loading files | [
"FileStoreLoader",
"defines",
"the",
"interface",
"for",
"loading",
"files"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filestore.go#L47-L68 |
20,687 | araddon/qlbridge | datasource/files/filestore.go | RegisterFileStore | func RegisterFileStore(storeType string, fs FileStoreCreator) {
if fs == nil {
panic("FileStore must not be nil")
}
storeType = strings.ToLower(storeType)
u.Debugf("global FileStore register: %v %T FileStore:%p", storeType, fs, fs)
fileStoreMu.Lock()
defer fileStoreMu.Unlock()
if _, dupe := fileStores[storeTyp... | go | func RegisterFileStore(storeType string, fs FileStoreCreator) {
if fs == nil {
panic("FileStore must not be nil")
}
storeType = strings.ToLower(storeType)
u.Debugf("global FileStore register: %v %T FileStore:%p", storeType, fs, fs)
fileStoreMu.Lock()
defer fileStoreMu.Unlock()
if _, dupe := fileStores[storeTyp... | [
"func",
"RegisterFileStore",
"(",
"storeType",
"string",
",",
"fs",
"FileStoreCreator",
")",
"{",
"if",
"fs",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"storeType",
"=",
"strings",
".",
"ToLower",
"(",
"storeType",
")",
"\n",
"u... | // RegisterFileStore global registry for Registering
// implementations of FileStore factories of the provided @storeType | [
"RegisterFileStore",
"global",
"registry",
"for",
"Registering",
"implementations",
"of",
"FileStore",
"factories",
"of",
"the",
"provided"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filestore.go#L87-L99 |
20,688 | araddon/qlbridge | datasource/introspect.go | IntrospectSchema | func IntrospectSchema(s *schema.Schema, name string, iter schema.Iterator) error {
tbl, err := s.Table(name)
if err != nil {
u.Errorf("Could not find table %q", name)
return err
}
return IntrospectTable(tbl, iter)
} | go | func IntrospectSchema(s *schema.Schema, name string, iter schema.Iterator) error {
tbl, err := s.Table(name)
if err != nil {
u.Errorf("Could not find table %q", name)
return err
}
return IntrospectTable(tbl, iter)
} | [
"func",
"IntrospectSchema",
"(",
"s",
"*",
"schema",
".",
"Schema",
",",
"name",
"string",
",",
"iter",
"schema",
".",
"Iterator",
")",
"error",
"{",
"tbl",
",",
"err",
":=",
"s",
".",
"Table",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // IntrospectSchema discover schema from contents of row introspection. | [
"IntrospectSchema",
"discover",
"schema",
"from",
"contents",
"of",
"row",
"introspection",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/introspect.go#L21-L28 |
20,689 | araddon/qlbridge | rel/parse_sql.go | ParseSqlSelectResolver | func ParseSqlSelectResolver(sqlQuery string, fr expr.FuncResolver) (*SqlSelect, error) {
stmt, err := parseSqlResolver(sqlQuery, fr)
if err != nil {
return nil, err
}
sel, ok := stmt.(*SqlSelect)
if !ok {
return nil, fmt.Errorf("Expected SqlSelect but got %T", stmt)
}
return sel, nil
} | go | func ParseSqlSelectResolver(sqlQuery string, fr expr.FuncResolver) (*SqlSelect, error) {
stmt, err := parseSqlResolver(sqlQuery, fr)
if err != nil {
return nil, err
}
sel, ok := stmt.(*SqlSelect)
if !ok {
return nil, fmt.Errorf("Expected SqlSelect but got %T", stmt)
}
return sel, nil
} | [
"func",
"ParseSqlSelectResolver",
"(",
"sqlQuery",
"string",
",",
"fr",
"expr",
".",
"FuncResolver",
")",
"(",
"*",
"SqlSelect",
",",
"error",
")",
"{",
"stmt",
",",
"err",
":=",
"parseSqlResolver",
"(",
"sqlQuery",
",",
"fr",
")",
"\n",
"if",
"err",
"!=... | // ParseSqlSelectResolver parse as SELECT using function resolver. | [
"ParseSqlSelectResolver",
"parse",
"as",
"SELECT",
"using",
"function",
"resolver",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L56-L66 |
20,690 | araddon/qlbridge | rel/parse_sql.go | ParseSqlStatements | func ParseSqlStatements(sqlQuery string) ([]SqlStatement, error) {
l := lex.NewSqlLexer(sqlQuery)
m := Sqlbridge{l: l, SqlTokenPager: NewSqlTokenPager(l)}
stmts := make([]SqlStatement, 0)
for {
stmt, err := m.parse()
if err != nil {
return nil, &ParseError{err}
}
stmts = append(stmts, stmt)
sqlRemainin... | go | func ParseSqlStatements(sqlQuery string) ([]SqlStatement, error) {
l := lex.NewSqlLexer(sqlQuery)
m := Sqlbridge{l: l, SqlTokenPager: NewSqlTokenPager(l)}
stmts := make([]SqlStatement, 0)
for {
stmt, err := m.parse()
if err != nil {
return nil, &ParseError{err}
}
stmts = append(stmts, stmt)
sqlRemainin... | [
"func",
"ParseSqlStatements",
"(",
"sqlQuery",
"string",
")",
"(",
"[",
"]",
"SqlStatement",
",",
"error",
")",
"{",
"l",
":=",
"lex",
".",
"NewSqlLexer",
"(",
"sqlQuery",
")",
"\n",
"m",
":=",
"Sqlbridge",
"{",
"l",
":",
"l",
",",
"SqlTokenPager",
":"... | // ParseSqlStatements into array of SQL Statements | [
"ParseSqlStatements",
"into",
"array",
"of",
"SQL",
"Statements"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L69-L87 |
20,691 | araddon/qlbridge | rel/parse_sql.go | parseSqlInsert | func (m *Sqlbridge) parseSqlInsert() (*SqlInsert, error) {
// insert into mytable (id, str) values (0, "a")
req := NewSqlInsert()
req.kw = m.Cur().T
m.Next() // Consume Insert or Replace
// INTO
if m.Cur().T != lex.TokenInto {
return nil, fmt.Errorf("expected INTO but got: %v", m.Cur())
}
m.Next() // Consum... | go | func (m *Sqlbridge) parseSqlInsert() (*SqlInsert, error) {
// insert into mytable (id, str) values (0, "a")
req := NewSqlInsert()
req.kw = m.Cur().T
m.Next() // Consume Insert or Replace
// INTO
if m.Cur().T != lex.TokenInto {
return nil, fmt.Errorf("expected INTO but got: %v", m.Cur())
}
m.Next() // Consum... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parseSqlInsert",
"(",
")",
"(",
"*",
"SqlInsert",
",",
"error",
")",
"{",
"// insert into mytable (id, str) values (0, \"a\")",
"req",
":=",
"NewSqlInsert",
"(",
")",
"\n",
"req",
".",
"kw",
"=",
"m",
".",
"Cur",
"... | // First keyword was INSERT, REPLACE | [
"First",
"keyword",
"was",
"INSERT",
"REPLACE"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L281-L334 |
20,692 | araddon/qlbridge | rel/parse_sql.go | parseSqlUpdate | func (m *Sqlbridge) parseSqlUpdate() (*SqlUpdate, error) {
req := NewSqlUpdate()
m.Next() // Consume UPDATE token
//u.Debugf("token: %v", m.Cur())
switch m.Cur().T {
case lex.TokenTable, lex.TokenIdentity:
req.Table = m.Cur().V
default:
return nil, fmt.Errorf("expected table name but got : %v", m.Cur().V)
... | go | func (m *Sqlbridge) parseSqlUpdate() (*SqlUpdate, error) {
req := NewSqlUpdate()
m.Next() // Consume UPDATE token
//u.Debugf("token: %v", m.Cur())
switch m.Cur().T {
case lex.TokenTable, lex.TokenIdentity:
req.Table = m.Cur().V
default:
return nil, fmt.Errorf("expected table name but got : %v", m.Cur().V)
... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parseSqlUpdate",
"(",
")",
"(",
"*",
"SqlUpdate",
",",
"error",
")",
"{",
"req",
":=",
"NewSqlUpdate",
"(",
")",
"\n",
"m",
".",
"Next",
"(",
")",
"// Consume UPDATE token",
"\n\n",
"//u.Debugf(\"token: %v\", m.Cur(... | // First keyword was UPDATE | [
"First",
"keyword",
"was",
"UPDATE"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L337-L370 |
20,693 | araddon/qlbridge | rel/parse_sql.go | parseSqlUpsert | func (m *Sqlbridge) parseSqlUpsert() (*SqlUpsert, error) {
var err error
req := NewSqlUpsert()
m.Next() // Consume UPSERT token
if m.Cur().T == lex.TokenInto {
m.Next() // consume Into
}
switch m.Cur().T {
case lex.TokenTable, lex.TokenIdentity:
req.Table = m.Cur().V
m.Next()
default:
return nil, fmt... | go | func (m *Sqlbridge) parseSqlUpsert() (*SqlUpsert, error) {
var err error
req := NewSqlUpsert()
m.Next() // Consume UPSERT token
if m.Cur().T == lex.TokenInto {
m.Next() // consume Into
}
switch m.Cur().T {
case lex.TokenTable, lex.TokenIdentity:
req.Table = m.Cur().V
m.Next()
default:
return nil, fmt... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parseSqlUpsert",
"(",
")",
"(",
"*",
"SqlUpsert",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"req",
":=",
"NewSqlUpsert",
"(",
")",
"\n",
"m",
".",
"Next",
"(",
")",
"// Consume UPSERT token",
"\n\n",... | // First keyword was UPSERT | [
"First",
"keyword",
"was",
"UPSERT"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L373-L437 |
20,694 | araddon/qlbridge | rel/parse_sql.go | parseSqlDelete | func (m *Sqlbridge) parseSqlDelete() (*SqlDelete, error) {
req := NewSqlDelete()
m.Next() // Consume Delete
// from
//u.Debugf("token: %v", m.Cur())
if m.Cur().T != lex.TokenFrom {
return nil, m.ErrMsg("expected FROM")
} else {
// table name
m.Next()
//u.Debugf("found table? %v", m.Cur())
switch m.C... | go | func (m *Sqlbridge) parseSqlDelete() (*SqlDelete, error) {
req := NewSqlDelete()
m.Next() // Consume Delete
// from
//u.Debugf("token: %v", m.Cur())
if m.Cur().T != lex.TokenFrom {
return nil, m.ErrMsg("expected FROM")
} else {
// table name
m.Next()
//u.Debugf("found table? %v", m.Cur())
switch m.C... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parseSqlDelete",
"(",
")",
"(",
"*",
"SqlDelete",
",",
"error",
")",
"{",
"req",
":=",
"NewSqlDelete",
"(",
")",
"\n",
"m",
".",
"Next",
"(",
")",
"// Consume Delete",
"\n\n",
"// from",
"//u.Debugf(\"token: %v\",... | // First keyword was DELETE | [
"First",
"keyword",
"was",
"DELETE"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L440-L468 |
20,695 | araddon/qlbridge | rel/parse_sql.go | parsePrepare | func (m *Sqlbridge) parsePrepare() (*PreparedStatement, error) {
req := NewPreparedStatement()
m.Next() // Consume Prepare
// statement name/alias
//u.Debugf("found table? %v", m.Cur())
switch m.Cur().T {
case lex.TokenTable, lex.TokenIdentity:
req.Alias = m.Cur().V
default:
return nil, m.ErrMsg("expected... | go | func (m *Sqlbridge) parsePrepare() (*PreparedStatement, error) {
req := NewPreparedStatement()
m.Next() // Consume Prepare
// statement name/alias
//u.Debugf("found table? %v", m.Cur())
switch m.Cur().T {
case lex.TokenTable, lex.TokenIdentity:
req.Alias = m.Cur().V
default:
return nil, m.ErrMsg("expected... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parsePrepare",
"(",
")",
"(",
"*",
"PreparedStatement",
",",
"error",
")",
"{",
"req",
":=",
"NewPreparedStatement",
"(",
")",
"\n",
"m",
".",
"Next",
"(",
")",
"// Consume Prepare",
"\n\n",
"// statement name/alias"... | // First keyword was PREPARE | [
"First",
"keyword",
"was",
"PREPARE"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L471-L503 |
20,696 | araddon/qlbridge | rel/parse_sql.go | parseDescribe | func (m *Sqlbridge) parseDescribe() (SqlStatement, error) {
req := &SqlDescribe{Raw: m.l.RawInput()}
req.Tok = m.Cur()
m.Next() // Consume Describe
//u.Debugf("token: %v", m.Cur())
switch nextWord := strings.ToLower(m.Cur().V); nextWord {
case "select":
// TODO: make the lexer handle this
sqlText := strin... | go | func (m *Sqlbridge) parseDescribe() (SqlStatement, error) {
req := &SqlDescribe{Raw: m.l.RawInput()}
req.Tok = m.Cur()
m.Next() // Consume Describe
//u.Debugf("token: %v", m.Cur())
switch nextWord := strings.ToLower(m.Cur().V); nextWord {
case "select":
// TODO: make the lexer handle this
sqlText := strin... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parseDescribe",
"(",
")",
"(",
"SqlStatement",
",",
"error",
")",
"{",
"req",
":=",
"&",
"SqlDescribe",
"{",
"Raw",
":",
"m",
".",
"l",
".",
"RawInput",
"(",
")",
"}",
"\n",
"req",
".",
"Tok",
"=",
"m",
... | // First keyword was DESCRIBE | [
"First",
"keyword",
"was",
"DESCRIBE"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L506-L542 |
20,697 | araddon/qlbridge | rel/parse_sql.go | parseCommand | func (m *Sqlbridge) parseCommand() (*SqlCommand, error) {
/*
- SET CHARACTER SET utf8
- SET NAMES utf8
*/
req := &SqlCommand{Columns: make(CommandColumns, 0)}
req.kw = m.Next().T // USE, SET
// USE `baseball`;
if req.kw == lex.TokenUse {
req.Identity = m.Next().V
return req, nil
}
cur := m.Cur()
pee... | go | func (m *Sqlbridge) parseCommand() (*SqlCommand, error) {
/*
- SET CHARACTER SET utf8
- SET NAMES utf8
*/
req := &SqlCommand{Columns: make(CommandColumns, 0)}
req.kw = m.Next().T // USE, SET
// USE `baseball`;
if req.kw == lex.TokenUse {
req.Identity = m.Next().V
return req, nil
}
cur := m.Cur()
pee... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parseCommand",
"(",
")",
"(",
"*",
"SqlCommand",
",",
"error",
")",
"{",
"/*\n\t\t- SET CHARACTER SET utf8\n\t\t- SET NAMES utf8\n\t*/",
"req",
":=",
"&",
"SqlCommand",
"{",
"Columns",
":",
"make",
"(",
"CommandColumns",
... | // First keyword was SET, USE | [
"First",
"keyword",
"was",
"SET",
"USE"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L670-L703 |
20,698 | araddon/qlbridge | rel/parse_sql.go | parseDrop | func (m *Sqlbridge) parseDrop() (*SqlDrop, error) {
req := NewSqlDrop()
m.Next() // Consume DROP token
req.Raw = m.l.RawInput()
// DROP TEMPORARY TABLE x
if m.Cur().T == lex.TokenTemp {
m.Next()
req.Temp = true
}
// DROP (TABLE|VIEW|SOURCE|CONTINUOUSVIEW) <identity>
switch m.Cur().T {
case lex.TokenTabl... | go | func (m *Sqlbridge) parseDrop() (*SqlDrop, error) {
req := NewSqlDrop()
m.Next() // Consume DROP token
req.Raw = m.l.RawInput()
// DROP TEMPORARY TABLE x
if m.Cur().T == lex.TokenTemp {
m.Next()
req.Temp = true
}
// DROP (TABLE|VIEW|SOURCE|CONTINUOUSVIEW) <identity>
switch m.Cur().T {
case lex.TokenTabl... | [
"func",
"(",
"m",
"*",
"Sqlbridge",
")",
"parseDrop",
"(",
")",
"(",
"*",
"SqlDrop",
",",
"error",
")",
"{",
"req",
":=",
"NewSqlDrop",
"(",
")",
"\n",
"m",
".",
"Next",
"(",
")",
"// Consume DROP token",
"\n",
"req",
".",
"Raw",
"=",
"m",
".",
"... | // First keyword was DROP | [
"First",
"keyword",
"was",
"DROP"
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_sql.go#L815-L865 |
20,699 | araddon/qlbridge | datasource/context.go | MessageConversion | func MessageConversion(vals []interface{}) []schema.Message {
msgs := make([]schema.Message, len(vals))
for i, v := range vals {
msgs[i] = v.(schema.Message)
}
return msgs
} | go | func MessageConversion(vals []interface{}) []schema.Message {
msgs := make([]schema.Message, len(vals))
for i, v := range vals {
msgs[i] = v.(schema.Message)
}
return msgs
} | [
"func",
"MessageConversion",
"(",
"vals",
"[",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"schema",
".",
"Message",
"{",
"msgs",
":=",
"make",
"(",
"[",
"]",
"schema",
".",
"Message",
",",
"len",
"(",
"vals",
")",
")",
"\n",
"for",
"i",
",",
"v",... | // MessageConversion convert values of type schema.Message. | [
"MessageConversion",
"convert",
"values",
"of",
"type",
"schema",
".",
"Message",
"."
] | 23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac | https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/context.go#L30-L36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.