• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

georgia-tech-db / eva / d32fa926-274f-4de7-bc28-556f7bc3ee90

pending completion
d32fa926-274f-4de7-bc28-556f7bc3ee90

Pull #814

circle-ci

jiashenC
wip: time info
Pull Request #814: feat: benchmark question answering v1

42 of 42 new or added lines in 2 files covered. (100.0%)

10095 of 10421 relevant lines covered (96.87%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/eva/executor/limit_executor.py
1
# coding=utf-8
2
# Copyright 2018-2023 EVA
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
from typing import Iterator
1✔
16

17
from eva.executor.abstract_executor import AbstractExecutor
1✔
18
from eva.models.storage.batch import Batch
1✔
19
from eva.plan_nodes.limit_plan import LimitPlan
1✔
20

21

22
class LimitExecutor(AbstractExecutor):
1✔
23
    """
24
    Limits the number of rows returned
25

26
    Arguments:
27
        node (AbstractPlan): The Limit Plan
28

29
    """
30

31
    def __init__(self, node: LimitPlan):
1✔
32
        super().__init__(node)
1✔
33
        self._limit_count = node.limit_value
1✔
34

35
    def exec(self, *args, **kwargs) -> Iterator[Batch]:
1✔
36
        child_executor = self.children[0]
1✔
37
        remaining_tuples = self._limit_count
1✔
38
        # aggregates the batches into one large batch
39
        for batch in child_executor.exec(**kwargs):
1✔
40
            if len(batch) > remaining_tuples:
1✔
41
                yield batch[:remaining_tuples]
1✔
42
                return
1✔
43

44
            remaining_tuples -= len(batch)
1✔
45
            yield batch
1✔
46

47
            if remaining_tuples <= 0:
1✔
48
                assert remaining_tuples == 0
×
49
                return
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc