Skip to content

refactor: define scalar expression structs #309

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
Jan 11, 2024
Merged

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 Jan 9, 2024
@TrevorBergeron TrevorBergeron marked this pull request as ready for review January 9, 2024 19:30
@TrevorBergeron TrevorBergeron requested review from a team as code owners January 9, 2024 19:30
@TrevorBergeron TrevorBergeron requested review from shobsi and GarrettWu and removed request for shobsi January 9, 2024 19:30
Copy link
Contributor

@GarrettWu GarrettWu left a comment

Choose a reason for hiding this comment

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

What's the purpose of the change? What goal do we want to achieve in this PR and the big picture? Is related to go/bigframes-expression-trees?

Plz add some contexts.

@@ -21,6 +21,9 @@

import bigframes.dtypes as dtypes

if typing.TYPE_CHECKING:
Copy link
Contributor

Choose a reason for hiding this comment

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

Conditional import is discouraged. If have to do so, plz add a reason. go/pystyle#typing-conditional-imports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed to avoid op->expression->op circular import. Generally op shouldn't depend on expression, but it is convenient to have a helper method to convert op to expression concisely. Added code comment explaining conditional is to avoid circular import

# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations
Copy link
Contributor

Choose a reason for hiding this comment

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

plz add docs for the file and for each of the classes. Abstractions are hard to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some docstrings



@dataclasses.dataclass(frozen=True)
class UnboundVariableExpression(Expression):
Copy link
Contributor

Choose a reason for hiding this comment

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

What does unbound mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Means its a "free" variable. For instance, in the expression "x + y + 3/x", the variables "x" and "y" are unbound.

output_column_id: typing.Optional[str] = None,
) -> T:
"""Creates a new expression based on this expression with unary operation applied to one column."""
):
Copy link
Contributor

Choose a reason for hiding this comment

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

Docstring and type hint are omited?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@TrevorBergeron TrevorBergeron added the automerge Merge the pull request once unit tests and other checks pass. label Jan 11, 2024
@gcf-merge-on-green gcf-merge-on-green bot merged commit 8922e5e into main Jan 11, 2024
@gcf-merge-on-green gcf-merge-on-green bot deleted the scalarexpr branch January 11, 2024 08:06
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jan 11, 2024
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy