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

19234: Adds order_by to IFA, before offset call #126

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
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
8 changes: 4 additions & 4 deletions howso/utilities/feature_attributes/relational.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ def _get_random_value(self, feature_name: str, no_nulls: bool = False) -> Option
random_value = (
session.query(self.data.c[feature_name])
.filter(self.data.c[feature_name].is_not(None))
.offset(idx)
.order_by(feature_name) # 19234: using order_by here is necessary for MSSQL,
.first() # however, this should ultimately be re-written to
) # avoid the performance pentalty this imposes.
.offset(idx) # however, this should ultimately be re-written to
.first() # avoid the performance pentalty this imposes.
)
else:
random_value = (
session.query(self.data.c[feature_name])
.offset(idx)
.order_by(feature_name) # See above
.offset(idx)
.first()
)

Expand Down
Loading