This repository was archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Panic on query using EXPLODE #755
Copy link
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Adding it here because I think it's related to explode.
The query:
SELECT
EXPLODE(UAST_EXTRACT(UAST(f.blob_content, 'Go', '//uast:Import/Path'), 'Value'))
FROM files as f
WHERE f.file_path REGEXP('.*.go$')
AND f.file_path NOT REGEXP '^vendor.*'
AND NOT IS_BINARY(f.blob_content)
AND f.blob_size < 1000000
LIMIT 1;Causes this panic:
ERRO[0703] mysql_server caught panic:
unresolved column is a placeholder node, but IsNullable was called
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/expression/unresolved.go:41 (0x9e7148)
com/src-d/go-mysql-server/sql/expression.(*UnresolvedColumn).IsNullable: panic("unresolved column is a placeholder node, but IsNullable was called")
/home/juanjux/sourced/gitbase/internal/function/uast.go:68 (0xea4bb7)
com/src-d/gitbase/internal/function.(*uastFunc).IsNullable: return u.Blob.IsNullable() || u.Mode.IsNullable() ||
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/expression/common.go:55 (0x9dbc82)
com/src-d/go-mysql-server/sql/expression.(*BinaryExpression).IsNullable: return p.Left.IsNullable() || p.Right.IsNullable()
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/expression/function/explode.go:71 (0xcdd2a2)
com/src-d/go-mysql-server/sql/expression/function.(*Generate).IsNullable: func (e *Generate) IsNullable() bool { return e.Child.IsNullable() }
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/analyzer/resolve_generators.go:47 (0xd1e410)
com/src-d/go-mysql-server/sql/analyzer.resolveGenerators.func1: expression.NewGetField(g.idx, g.expr.Type(), name, g.expr.IsNullable()),
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/plan/project.go:78 (0xa08d89)
com/src-d/go-mysql-server/sql/plan.(*Project).TransformUp: return f(NewProject(p.Projections, child))
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/plan/limit.go:45 (0xa047e0)
com/src-d/go-mysql-server/sql/plan.(*Limit).TransformUp: child, err := l.Child.TransformUp(f)
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/analyzer/resolve_generators.go:17 (0xd0bf6c)
com/src-d/go-mysql-server/sql/analyzer.resolveGenerators: return n.TransformUp(func(n sql.Node) (sql.Node, error) {
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/analyzer/batch.go:67 (0xd01497)
com/src-d/go-mysql-server/sql/analyzer.(*Batch).evalOnce: result, err = rule.Apply(ctx, a, result)
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/analyzer/batch.go:38 (0xd0114e)
com/src-d/go-mysql-server/sql/analyzer.(*Batch).Eval: cur, err := b.evalOnce(ctx, a, n)
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/sql/analyzer/analyzer.go:171 (0xcf96b3)
com/src-d/go-mysql-server/sql/analyzer.(*Analyzer).Analyze: prev, err = batch.Eval(ctx, a, prev)
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/engine.go:143 (0xd3a00c)
com/src-d/go-mysql-server.(*Engine).Query: analyzed, err = e.Analyzer.Analyze(ctx, parsed)
/home/juanjux/go/pkg/mod/github.com/src-d/go-mysql-server@v0.4.1-0.20190619104848-eaab1795353a/server/handler.go:90 (0xd3bcc5)
com/src-d/go-mysql-server/server.(*Handler).ComQuery: schema, rows, err := h.e.Query(ctx, query)
/home/juanjux/go/pkg/mod/vitess.io/vitess@v3.0.0-rc.3.0.20190602171040-12bfde34629c+incompatible/go/mysql/conn.go:819 (0xc3b327)
io/vitess/go/mysql.(*Conn).execQuery: err := handler.ComQuery(c, query, func(qr *sqltypes.Result) error {
/home/juanjux/go/pkg/mod/vitess.io/vitess@v3.0.0-rc.3.0.20190602171040-12bfde34629c+incompatible/go/mysql/conn.go:749 (0xc3ad41)
io/vitess/go/mysql.(*Conn).handleNextCommand: if err := c.execQuery(sql, handler, more); err != nil {
/home/juanjux/go/pkg/mod/vitess.io/vitess@v3.0.0-rc.3.0.20190602171040-12bfde34629c+incompatible/go/mysql/server.go:441 (0xc4ba65)
io/vitess/go/mysql.(*Listener).handle: err := c.handleNextCommand(l.handler)
/usr/lib/go-1.12/src/runtime/asm_amd64.s:1337 (0x45a1c0)
goexit: BYTE $0x90 // NOP
Removing the EXPLODE makes it work, retuning an empty array.
Curiously I tried forcing an empty array with SELECT EXPLODE(SPLIT("", "")) (which inner SPLIT also returns an empty array) and then it works.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working