Exemplo n.º 1
0
 def test_multi_attribute_with_predicate(self):
     attributes = self.map.project(
         multi_attribute("attr1", "attr2"),
         greater_or_equal("attr2", 3),
     )
     self.assertCountEqual([[4, 5]], attributes)
Exemplo n.º 2
0
        "MaxByAggregator": aggregator.max_by(_sql_string),
        "MinAggregator": aggregator.min_(_sql_string),
        "MinByAggregator": aggregator.min_by(_sql_string),
        "CountAggregator": aggregator.count(_sql_string),
        "NumberAverageAggregator": aggregator.number_avg(_sql_string),
        "IntegerAverageAggregator": aggregator.int_avg(_sql_string),
        "LongAverageAggregator": aggregator.long_avg(_sql_string),
        "DoubleAverageAggregator": aggregator.double_avg(_sql_string),
        "IntegerSumAggregator": aggregator.int_sum(_sql_string),
        "LongSumAggregator": aggregator.long_sum(_sql_string),
        "DoubleSumAggregator": aggregator.double_sum(_sql_string),
        "FixedSumAggregator": aggregator.fixed_point_sum(_sql_string),
        "FloatingPointSumAggregator": aggregator.floating_point_sum(_sql_string),
        "SingleAttributeProjection": projection.single_attribute(_sql_string),
        "MultiAttributeProjection": projection.multi_attribute(
            _sql_string, _sql_string, _sql_string
        ),
        "IdentityProjection": projection.identity(),
    }
)

_SKIP_ON_SERIALIZE = {
    "Character",
    "Float",
    "boolean[]",
    "char[]",
    "double[]",
    "short[]",
    "float[]",
    "int[]",
    "long[]",
Exemplo n.º 3
0
 def test_multi_attribute(self):
     attributes = self.map.project(multi_attribute("attr1", "attr2"))
     self.assertCountEqual([[1, 2], [4, 5]], attributes)
Exemplo n.º 4
0
    "DoubleAverageAggregator":
    aggregator.double_avg(_sql_string),
    "IntegerSumAggregator":
    aggregator.int_sum(_sql_string),
    "LongSumAggregator":
    aggregator.long_sum(_sql_string),
    "DoubleSumAggregator":
    aggregator.double_sum(_sql_string),
    "FixedSumAggregator":
    aggregator.fixed_point_sum(_sql_string),
    "FloatingPointSumAggregator":
    aggregator.floating_point_sum(_sql_string),
    "SingleAttributeProjection":
    projection.single_attribute(_sql_string),
    "MultiAttributeProjection":
    projection.multi_attribute(_sql_string, _sql_string, _sql_string),
    "IdentityProjection":
    projection.identity(),
})

_SKIP_ON_SERIALIZE = {
    "Character",
    "Float",
    "boolean[]",
    "char[]",
    "double[]",
    "short[]",
    "float[]",
    "int[]",
    "long[]",
    "String[]",
Exemplo n.º 5
0
 def test_multi_attribute_with_empty_path(self):
     with self.assertRaises(ValueError):
         multi_attribute("valid", "")
Exemplo n.º 6
0
 def test_multi_attribute_with_any_operator(self):
     with self.assertRaises(ValueError):
         multi_attribute("valid", "invalid[any]")
Exemplo n.º 7
0
 def test_multi_attribute_with_no_paths(self):
     with self.assertRaises(ValueError):
         multi_attribute()
Exemplo n.º 8
0
people.put_all({
    1: HazelcastJsonValue({
        "name": "Philip",
        "age": 46
    }),
    2: HazelcastJsonValue({
        "name": "Elizabeth",
        "age": 44
    }),
    3: HazelcastJsonValue({
        "name": "Henry",
        "age": 13
    }),
    4: HazelcastJsonValue({
        "name": "Paige",
        "age": 15
    }),
})

names = people.project(single_attribute("name"))
print("Names of the people are %s." % names)

children_names = people.project(single_attribute("name"),
                                less_or_equal("age", 18))
print("Names of the children are %s." % children_names)

names_and_ages = people.project(multi_attribute("name", "age"))
print("Names and ages of the people are %s." % names_and_ages)

client.shutdown()