From 79610ab8f5570096027d9f67d428f082fb172900 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Thu, 18 Jun 2020 16:59:15 +0200 Subject: [PATCH] More of the same --- relational/optimizations.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/relational/optimizations.py b/relational/optimizations.py index 00f91c0..67e69ec 100644 --- a/relational/optimizations.py +++ b/relational/optimizations.py @@ -126,7 +126,9 @@ def futile_union_intersection_subtraction(n: parser.Node) -> Tuple[parser.Node, n.right.child), 1 # Subtraction of the same thing or with selection on the left child - elif n.name == DIFFERENCE and (n.left == n.right or (n.left.name == SELECTION and n.left.child == n.right)): + elif n.name == DIFFERENCE and \ + isinstance(n, Binary) and \ + (n.left == n.right or (n.left.name == SELECTION and n.left.child == n.right)): return Unary( SELECTION, 'False', @@ -329,7 +331,7 @@ def swap_rename_projection(n: parser.Node) -> Tuple[parser.Node, int]: del renames[i] child = Unary(PROJECTION,'' , n.child.child) - child.set_projection_prop(projections) + child.set_projection_prop(list(projections)) n = Unary(RENAME, '', child) n.set_rename_prop(renames) return n, 1