Beispiel #1
0
    def _get_having_obj(self, col, op, eq):
        cond = None
        if op == '==':
            if col in self.column_names:
                cond = DimSelector(dimension=col, value=eq)
            else:
                cond = Aggregation(col) == eq
        elif op == '>':
            cond = Aggregation(col) > eq
        elif op == '<':
            cond = Aggregation(col) < eq

        return cond
Beispiel #2
0
 def test_not_having(self):
     h1 = Aggregation("sum") > 1
     actual = Having.build_having(~h1)
     expected = {
         "type": "not",
         "havingSpec": {
             "type": "greaterThan",
             "aggregation": "sum",
             "value": 1
         },
     }
     assert actual == expected
Beispiel #3
0
 def test_or_having(self):
     h1 = Aggregation("sum1") > 1
     h2 = Aggregation("sum2") > 2
     actual = Having.build_having(h1 | h2)
     expected = {
         "type":
         "or",
         "havingSpecs": [
             {
                 "type": "greaterThan",
                 "aggregation": "sum1",
                 "value": 1
             },
             {
                 "type": "greaterThan",
                 "aggregation": "sum2",
                 "value": 2
             },
         ],
     }
     assert actual == expected
Beispiel #4
0
 def test_greaterThan_having_Aggregation(self):
     h1 = Aggregation("sum") > 1
     actual = Having.build_having(h1)
     expected = {"type": "greaterThan", "aggregation": "sum", "value": 1}
     assert actual == expected
Beispiel #5
0
 def test_equalTo_having_Aggregation(self):
     h1 = Aggregation("sum") == 1
     actual = Having.build_having(h1)
     expected = {"type": "equalTo", "aggregation": "sum", "value": 1}
     assert actual == expected