Ejemplo n.º 1
0
    def test_filter_to_none(self):
        typed_parts = OrderedDict({
            "fil-1":
            set([float(1.23), float(3.9), float(5.45)]),
            "fil-2":
            set([int(2), int(4)]),
            "fil-3":
            set(["str", "rng-str"])
        })

        filters = [{
            "partition": "fil-1",
            "comparison": ">",
            "values": [90]
        }, {
            "partition": "fil-2",
            "comparison": "==",
            "values": [23]
        }]

        fil_paths = []

        key = "fake-key"
        filters = filters

        filter_paths = fetch_parq._get_filtered_key_list(
            typed_parts=typed_parts, key=key, filters=filters)

        filter_paths.sort()
        fil_paths.sort()

        assert filter_paths == fil_paths
Ejemplo n.º 2
0
    def test_filter_some_parts(self):
        typed_parts = OrderedDict({
            "fil-1":
            set([float(1.23), float(3.9), float(5.45)]),
            "fil-2":
            set([int(2), int(4)]),
            "fil-3":
            set(["str", "rng-str", "str_rng", "99"])
        })

        filters = [{
            "partition": "fil-1",
            "comparison": ">",
            "values": [5]
        }, {
            "partition": "fil-2",
            "comparison": "==",
            "values": [2]
        }]

        fil_paths = [
            'fake-key/fil-1=5.45/fil-2=2/fil-3=99/',
            'fake-key/fil-1=5.45/fil-2=2/fil-3=str/',
            'fake-key/fil-1=5.45/fil-2=2/fil-3=rng-str/',
            'fake-key/fil-1=5.45/fil-2=2/fil-3=str_rng/'
        ]

        key = "fake-key/"
        filters = filters

        filter_paths = fetch_parq._get_filtered_key_list(
            typed_parts=typed_parts, key=key, filters=filters)

        assert list.sort(filter_paths) == list.sort(fil_paths)