Exemplo n.º 1
0
 def test_join_three_separate_relations(self):
     instring = 'alpha \\theta_join_{a1 = b1} beta ' \
                '\\theta_join_{a1 = b1} gamma;'
     forest = self.build(instring)
     left = RelationNode('alpha', self.schema)
     middle = RelationNode('beta', self.schema)
     right = RelationNode('gamma', self.schema)
     intermediate = ThetaJoinNode(left, middle, 'a1 = b1')
     expected = ThetaJoinNode(intermediate, right, 'a1 = b1')
     self.assertEqual(expected, forest[0])
Exemplo n.º 2
0
 def test_join_two_separate_relations(self):
     instring = 'alpha \\theta_join_{a1 = b1} beta;'
     forest = self.build(instring)
     left = RelationNode('alpha', self.schema)
     right = RelationNode('beta', self.schema)
     expected = ThetaJoinNode(left, right, 'a1 = b1')
     self.assertEqual(expected, forest[0])
Exemplo n.º 3
0
 def test_theta_join_with_join(self):
     instring = 'alpha \\theta_join_{a1 = b1} beta \\join gamma;'
     forest = self.build(instring)
     left = RelationNode('alpha', self.schema)
     middle = RelationNode('beta', self.schema)
     right = RelationNode('gamma', self.schema)
     intermediate = ThetaJoinNode(left, middle, 'a1 = b1')
     expected = CrossJoinNode(intermediate, right)
     self.assertEqual(expected, forest[0])
Exemplo n.º 4
0
 def test_condition_when_multiple_conditions_with_prefix(self):
     condition = 'alpha.a1>41 and beta.b1<43'
     actual = ThetaJoinNode(self.alpha, self.beta, condition).conditions
     self.assertEqual(condition, actual)
Exemplo n.º 5
0
 def test_condition_when_init_has_condition(self):
     condition = 'a1 = b1'
     actual = ThetaJoinNode(self.alpha, self.beta, condition).conditions
     self.assertEqual(condition, actual)
Exemplo n.º 6
0
 def test_attributes_on_init(self):
     node = ThetaJoinNode(self.alpha, self.beta, 'a1 = b1')
     expected = (get_attributes('alpha', self.schema, use_prefix=True) +
                 get_attributes('beta', self.schema, use_prefix=True))
     self.assertEqual(expected, node.attributes.to_list())
Exemplo n.º 7
0
 def test_children_on_init(self):
     node = ThetaJoinNode(self.alpha, self.beta, 'a1 = b1')
     self.assertEqual(self.alpha, node.left)
     self.assertEqual(self.beta, node.right)
Exemplo n.º 8
0
 def test_operator_on_init(self):
     node = ThetaJoinNode(self.alpha, self.beta, 'a1 = b1')
     self.assertEqual(Operator.theta_join, node.operator)