Skip to content

fix: Fix issue with invalid sql generated by ml distance functions #865

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

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

TrevorBergeron
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jul 26, 2024
@TrevorBergeron TrevorBergeron marked this pull request as ready for review July 26, 2024 23:39
@TrevorBergeron TrevorBergeron requested review from a team as code owners July 26, 2024 23:39
@TrevorBergeron TrevorBergeron requested a review from GarrettWu July 26, 2024 23:39
self.model_name
)

def _predict_sql(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the naming? It isn't only used for "predict".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to suggestions, previous name was very generic. Seems that the class of methods is tvfs that take a tables and add a new transform/prediction/classifiction result column from values in the input table.

Copy link
Contributor

@GarrettWu GarrettWu Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it does is actually executing an ML TVF function and return output as a dataframe. Maybe _exec_ml_tvf? predict is misleading.

@@ -170,12 +170,11 @@ def ml_distance(
col_x: str,
col_y: str,
type: Literal["EUCLIDEAN", "MANHATTAN", "COSINE"],
source_df: bpd.DataFrame,
source_sql: str,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed to make this change?

If possible I would rather to let SQL generations stay in sql.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, want to invert the dependency between domain objects and sql. Will need to further factor things into a common sql generation module anyways (ml and core bigframes have separate sql modules)

@TrevorBergeron TrevorBergeron requested a review from GarrettWu July 31, 2024 20:33
@TrevorBergeron TrevorBergeron enabled auto-merge (squash) August 1, 2024 22:52
@TrevorBergeron TrevorBergeron merged commit 9959fc8 into main Aug 1, 2024
22 of 23 checks passed
@TrevorBergeron TrevorBergeron deleted the neo_bqml branch August 1, 2024 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants