Skip to content

Commit

Permalink
Fix missing case in normalize
Browse files Browse the repository at this point in the history
The code did not cover the case where a select has a column, select and unionAll.
  • Loading branch information
johngrimes committed Jun 17, 2024
1 parent 48e88eb commit 2563bfe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sof-js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ function normalize(def) {
delete def.column
}

def.select = def.select.map((s) => normalize(s))
return def
} else if (def.column && def.select && def.unionAll) {
def.type = 'select'
def.select.unshift({ column: def.column })
def.select.unshift({ unionAll: def.unionAll })
delete def.column
delete def.unionAll

def.select = def.select.map((s) => normalize(s))
return def
} else if (def.unionAll && def.select) {
Expand Down Expand Up @@ -231,6 +240,7 @@ let fns = {
}

function do_eval(select_expr, node, def) {
console.log('do_eval', 'select_expr', select_expr, 'node', node, 'def', def)
let f = fns[select_expr.type] || fns['unknown']
return f(select_expr, node, def)
}
Expand Down

0 comments on commit 2563bfe

Please sign in to comment.