From 5b1cce56bc859ec84ada44318ebae071711fbc02 Mon Sep 17 00:00:00 2001 From: generatedunixname537391475639613 Date: Wed, 14 Jan 2026 08:53:26 -0800 Subject: [PATCH] Fix for T251460511 ("Your diff, D90498281, broke one test") Reviewed By: sgrigory Differential Revision: D90649493 fbshipit-source-id: 2a77c45ec8e6e5aa0a20437a765fbb9f0b566406 --- pytorch3d/implicitron/dataset/sql_dataset.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pytorch3d/implicitron/dataset/sql_dataset.py b/pytorch3d/implicitron/dataset/sql_dataset.py index 98b81283..7e78004a 100644 --- a/pytorch3d/implicitron/dataset/sql_dataset.py +++ b/pytorch3d/implicitron/dataset/sql_dataset.py @@ -483,9 +483,10 @@ class SqlIndexDataset(DatasetBase, ReplaceableBase): *self._get_pick_filters(), *self._get_exclude_filters(), ] - if self.pick_sequences_sql_clause: + if pick_sequences_sql_clause := self.pick_sequences_sql_clause: print("Applying the custom SQL clause.") - where_conditions.append(sa.text(self.pick_sequences_sql_clause)) + # pyre-ignore[6]: TextClause is compatible with where conditions + where_conditions.append(sa.text(pick_sequences_sql_clause)) def add_where(stmt): return stmt.where(*where_conditions) if where_conditions else stmt @@ -505,6 +506,7 @@ class SqlIndexDataset(DatasetBase, ReplaceableBase): subquery = add_where(subquery).subquery() stmt = sa.select(subquery.c.sequence_name).where( + # pyre-ignore[6]: SQLAlchemy column comparison returns ColumnElement, not bool subquery.c.row_number <= self.limit_sequences_per_category_to ) @@ -633,9 +635,10 @@ class SqlIndexDataset(DatasetBase, ReplaceableBase): ) ) - if self.pick_frames_sql_clause: + if pick_frames_sql_clause := self.pick_frames_sql_clause: logger.info("Applying the custom SQL clause.") - pick_frames_criteria.append(sa.text(self.pick_frames_sql_clause)) + # pyre-ignore[6]: TextClause is compatible with where conditions + pick_frames_criteria.append(sa.text(pick_frames_sql_clause)) if pick_frames_criteria: index = self._pick_frames_by_criteria(index, pick_frames_criteria) @@ -698,9 +701,10 @@ class SqlIndexDataset(DatasetBase, ReplaceableBase): ) ) - if self.pick_frames_sql_clause: + if pick_frames_sql_clause := self.pick_frames_sql_clause: logger.info(" applying custom SQL clause") - where_conditions.append(sa.text(self.pick_frames_sql_clause)) + # pyre-ignore[6]: TextClause is compatible with where conditions + where_conditions.append(sa.text(pick_frames_sql_clause)) if where_conditions: stmt = stmt.where(*where_conditions)