Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding min() and max() aggregations #5029

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
explain method
brimoor committed Nov 5, 2024
commit f4190b97b1ea56057dc1c382c378221065b78082
14 changes: 14 additions & 0 deletions fiftyone/core/collections.py
Original file line number Diff line number Diff line change
@@ -659,6 +659,20 @@ def _max(self, path):
return self._get_extremum(path, -1)

def _get_extremum(self, path, order):
brimoor marked this conversation as resolved.
Show resolved Hide resolved
#
# This method exists in addition to `min()` and `max()` aggregations
# for two reasons:
#
# 1. `$sort + $limit 1` is more efficient than `$group _id: None` when
# the field is indexed
#
# 2. When `path` is a frame-level field, these methods are optimized to
# directly aggregate on the frames collection, which is something
# that the Aggregation classes do not yet support. In other words,
# `dataset._max("frames.last_modified_at")` is currently more
# performant than `dataset.max("frames.last_modified_at")`
#

path, is_frame_field = self._handle_frame_field(path)
path = self._handle_db_field(path, frames=is_frame_field)


Unchanged files with check annotations Beta

import { test as base, expect } from "src/oss/fixtures";

Check failure on line 1 in e2e-pw/src/oss/specs/grid-tagging.spec.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/grid-tagging.spec.ts:42:1 › grid tagging

1) [chromium] › oss/specs/grid-tagging.spec.ts:42:1 › grid tagging ─────────────────────────────── Test timeout of 60000ms exceeded.
import { GridPom } from "src/oss/poms/grid";
import { ModalPom } from "src/oss/poms/modal";
import { getUniqueDatasetNameWithPrefix } from "src/oss/utils";
}
async openNthSample(n: number) {
await this.getNthLooker(n).click({ position: { x: 10, y: 80 } });

Check failure on line 55 in e2e-pw/src/oss/poms/grid/index.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › pcd dynamic group pagination bar

2) [chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › pcd dynamic group pagination bar ── Error: locator.click: Test timeout of 60000ms exceeded. Call log: - waiting for getByTestId('fo-grid').getByTestId('looker').first() - locator resolved to <div tabindex="-1" data-cy="looker" class="_looker_1i9j2_16"></div> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <canvas width="914" height="569" canvas-loaded="true" data-engine="three.js r169"></canvas> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #1 - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #2 - waiting 20ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #3 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #4 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #5 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #6 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #7 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #8 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker3d" class="_loading_1wcd9_1">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #9 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-

Check failure on line 55 in e2e-pw/src/oss/poms/grid/index.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › png dynamic group pagination bar

3) [chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › png dynamic group pagination bar ── Error: locator.click: Test timeout of 60000ms exceeded. Call log: - waiting for getByTestId('fo-grid').getByTestId('looker').first() - locator resolved to <div tabindex="-1" data-cy="looker" title="Click to expand" class="_looker_1i9j2_16">…</div> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div class="sc-bmuA-DX gsCbGP"></div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #1 - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div class="sc-bmuA-DX gsCbGP"></div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #2 - waiting 20ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div class="sc-bmuA-DX gsCbGP"></div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #3 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker-error-info" class="_lookerErrorPage_sfdgp_5">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #4 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker-error-info" class="_lookerErrorPage_sfdgp_5">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #5 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker-error-info" class="_lookerErrorPage_sfdgp_5">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #6 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker-error-info" class="_lookerErrorPage_sfdgp_5">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #7 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker-error-info" class="_lookerErrorPage_sfdgp_5">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #8 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <div data-cy="looker-error-info" class="_lookerErrorPage_sfdgp_5">…</div> from <div id="modal" class="modalon">…</div> subtree intercepts pointer events - retrying click action, attempt #9 - waiting 500ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed -
}
async openFirstSample() {
return this.getForwardSection()
.locator("div")
.last()
.scrollIntoViewIfNeeded();

Check failure on line 70 in e2e-pw/src/oss/poms/grid/index.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/grid-tagging.spec.ts:42:1 › grid tagging

1) [chromium] › oss/specs/grid-tagging.spec.ts:42:1 › grid tagging ─────────────────────────────── Error: locator.scrollIntoViewIfNeeded: Test timeout of 60000ms exceeded. Call log: - attempting scroll into view action - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #1 - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #2 - waiting 20ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #3 - waiting 100ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #4 - waiting 100ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #5 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #6 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #7 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #8 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #9 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #10 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #11 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #12 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #13 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #14 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #15 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #16 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #17 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #18 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #19 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #20 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #21 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #22 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #23 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #24 - waiting 500ms - waiting for element to be stable - element is not visible - retrying scroll into view action, attempt #25 - waiting 500ms - waiting for element to be stable
}
async scrollTop() {
}
async isEntryCountTextEqualTo(text: string) {
return this.gridPom.page.waitForFunction(

Check failure on line 149 in e2e-pw/src/oss/poms/grid/index.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/groups/sparse-groups.spec.ts:96:3 › mp4 second slice

5) [chromium] › oss/specs/groups/sparse-groups.spec.ts:96:3 › mp4 second slice ─────────────────── TimeoutError: page.waitForFunction: Timeout 2000ms exceeded. at oss/poms/grid/index.ts:149 147 | 148 | async isEntryCountTextEqualTo(text: string) { > 149 | return this.gridPom.page.waitForFunction( | ^ 150 | (text_) => { 151 | return ( 152 | document.querySelector("[data-cy='entry-counts']").textContent === at GridAsserter.isEntryCountTextEqualTo (/home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/poms/grid/index.ts:149:30) at /home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/specs/groups/sparse-groups.spec.ts:103:23

Check failure on line 149 in e2e-pw/src/oss/poms/grid/index.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/groups/sparse-groups.spec.ts:96:3 › png second slice

6) [chromium] › oss/specs/groups/sparse-groups.spec.ts:96:3 › png second slice ─────────────────── TimeoutError: page.waitForFunction: Timeout 2000ms exceeded. at oss/poms/grid/index.ts:149 147 | 148 | async isEntryCountTextEqualTo(text: string) { > 149 | return this.gridPom.page.waitForFunction( | ^ 150 | (text_) => { 151 | return ( 152 | document.querySelector("[data-cy='entry-counts']").textContent === at GridAsserter.isEntryCountTextEqualTo (/home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/poms/grid/index.ts:149:30) at /home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/specs/groups/sparse-groups.spec.ts:103:23
(text_) => {
return (
document.querySelector("[data-cy='entry-counts']").textContent ===
import { test as base } from "src/oss/fixtures";

Check failure on line 1 in e2e-pw/src/oss/specs/groups/dynamic-groups.spec.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › pcd dynamic group pagination bar

2) [chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › pcd dynamic group pagination bar ── Test timeout of 60000ms exceeded.

Check failure on line 1 in e2e-pw/src/oss/specs/groups/dynamic-groups.spec.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › png dynamic group pagination bar

3) [chromium] › oss/specs/groups/dynamic-groups.spec.ts:70:3 › png dynamic group pagination bar ── Test timeout of 60000ms exceeded.
import { GridPom } from "src/oss/poms/grid";
import { ModalPom } from "src/oss/poms/modal";
import { getUniqueDatasetNameWithPrefix } from "src/oss/utils";
async verifySidebarEntryText(key: string, value: string) {
const text = await this.modalSidebarPom.getSidebarEntryText(key);
expect(text).toBe(value);

Check failure on line 88 in e2e-pw/src/oss/poms/modal/modal-sidebar.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/groups/nested-dynamic-groups.spec.ts:116:1 › dynamic groups of groups works

4) [chromium] › oss/specs/groups/nested-dynamic-groups.spec.ts:116:1 › dynamic groups of groups works Error: expect(received).toBe(expected) // Object.is equality Expected: "2" Received: "1" at oss/poms/modal/modal-sidebar.ts:88 86 | async verifySidebarEntryText(key: string, value: string) { 87 | const text = await this.modalSidebarPom.getSidebarEntryText(key); > 88 | expect(text).toBe(value); | ^ 89 | } 90 | 91 | async waitUntilSidebarEntryTextEquals(key: string, value: string) { at SidebarAsserter.verifySidebarEntryText (/home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/poms/modal/modal-sidebar.ts:88:18) at SidebarAsserter.verifySidebarEntryTexts (/home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/poms/modal/modal-sidebar.ts:105:5) at /home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/specs/groups/nested-dynamic-groups.spec.ts:157:3
}
async waitUntilSidebarEntryTextEquals(key: string, value: string) {
) {
const actualTitle = await this.modalPom.modalSamplePluginTitle;
const expectedTitle = pinned ? `📌 ${title}` : title;
expect(actualTitle).toBe(expectedTitle);

Check failure on line 314 in e2e-pw/src/oss/poms/modal/index.ts

GitHub Actions / e2e / test-e2e

[chromium] › oss/specs/regression-tests/group-video/group-video-label.spec.ts:87:3 › groups video labels › video plays with correct label for each slice

7) [chromium] › oss/specs/regression-tests/group-video/group-video-label.spec.ts:87:3 › groups video labels › video plays with correct label for each slice Error: expect(received).toBe(expected) // Object.is equality Expected: "📌 v1" Received: "📌 v2" at oss/poms/modal/index.ts:314 312 | const actualTitle = await this.modalPom.modalSamplePluginTitle; 313 | const expectedTitle = pinned ? `📌 ${title}` : title; > 314 | expect(actualTitle).toBe(expectedTitle); | ^ 315 | } 316 | } 317 | at ModalAsserter.verifyModalSamplePluginTitle (/home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/poms/modal/index.ts:314:25) at checkVideo (/home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/specs/regression-tests/group-video/group-video-label.spec.ts:98:7) at /home/runner/work/fiftyone/fiftyone/e2e-pw/src/oss/specs/regression-tests/group-video/group-video-label.spec.ts:121:5
}
}
});
test("modal media field", async ({ grid, fiftyoneLoader, modal, page }) => {
test.skip(

Check warning on line 78 in e2e-pw/src/oss/specs/regression-tests/media-field.spec.ts

GitHub Actions / e2e / test-e2e

Unexpected use of the `.skip()` annotation
true,
"TODO: FIX ME. MODAL SCREENSHOT COMPARISON IS OFF BY ONE-PIXEL"
);
test("change date field visibility works", async ({
eventUtils,
grid,

Check failure on line 74 in e2e-pw/src/oss/specs/regression-tests/sidebar/sidebar-datetime.spec.ts

GitHub Actions / e2e / test-e2e

'grid' is defined but never used
page,
sidebar,
}) => {
clearUseKeyStores(panelId);
trackEvent("close_panel", { panel: panelName });
});
}, []);

Check warning on line 40 in app/packages/operators/src/CustomPanel.tsx

GitHub Actions / lint / eslint

React Hook useEffect has missing dependencies: 'panelId', 'panelName', 'setPanelCloseEffect', and 'trackEvent'. Either include them or remove the dependency array
useEffect(() => {
setLoading(count > 0);
useEffect(() => {
dimensions?.refresh();
}, []);

Check warning on line 104 in app/packages/operators/src/CustomPanel.tsx

GitHub Actions / lint / eslint

React Hook useEffect has a missing dependency: 'dimensions'. Either include it or remove the dependency array
return children;
}
unlisted: true,
});
}
useHooks(ctx: ExecutionContext): {} {

Check warning on line 815 in app/packages/operators/src/built-in-operators.ts

GitHub Actions / lint / eslint

'ctx' is defined but never used. Allowed unused args must match /^_/u
return { updatePanelState: useUpdatePanelStatePartial() };
}
async execute(ctx: ExecutionContext): Promise<void> {