Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit fc71411

Browse files
committed
function: correctly transform up explode nodes
Signed-off-by: Miguel Molina <[email protected]>
1 parent eaab179 commit fc71411

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

engine_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -2481,6 +2481,16 @@ var generatorQueries = []struct {
24812481
{int64(3), "f", "third"},
24822482
},
24832483
},
2484+
{
2485+
`SELECT EXPLODE(SPLIT(c, "")) FROM t LIMIT 5`,
2486+
[]sql.Row{
2487+
{"f"},
2488+
{"i"},
2489+
{"r"},
2490+
{"s"},
2491+
{"t"},
2492+
},
2493+
},
24842494
{
24852495
`SELECT a, EXPLODE(b) AS x, c FROM t WHERE x = 'e'`,
24862496
[]sql.Row{

sql/expression/function/explode.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (e *Generate) String() string {
8686

8787
// TransformUp implements the sql.Expression interface.
8888
func (e *Generate) TransformUp(f sql.TransformExprFunc) (sql.Expression, error) {
89-
c, err := f(e.Child)
89+
c, err := e.Child.TransformUp(f)
9090
if err != nil {
9191
return nil, err
9292
}

0 commit comments

Comments
 (0)