Skip to content

Commit

Permalink
Do not remove facet nodes without children in optimization so that we…
Browse files Browse the repository at this point in the history
… can still get the row and column domains.
  • Loading branch information
domoritz committed Jan 21, 2018
1 parent 38cd7cf commit 7e3732a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/compile/data/optimizers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {hasIntersection, keys} from '../../util';
import {DataFlowNode, OutputNode} from './dataflow';
import {FacetNode} from './facet';
import {ParseNode} from './formatparse';
import {SourceNode} from './source';
import {TimeUnitNode} from './timeunit';
Expand Down Expand Up @@ -58,11 +59,12 @@ export function moveParseUp(node: DataFlowNode) {
}

/**
* Repeatedly remove leaf nodes that are not output nodes.
* Repeatedly remove leaf nodes that are not output or facet nodes.
* The reason is that we don't need subtrees that don't have any output nodes.
* Facet nodes are needed for the row or column domains.
*/
export function removeUnusedSubtrees(node: DataFlowNode) {
if (node instanceof OutputNode || node.numChildren() > 0) {
if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {
// no need to continue with parent because it is output node or will have children (there was a fork)
return false;
} else {
Expand Down

0 comments on commit 7e3732a

Please sign in to comment.