-
Notifications
You must be signed in to change notification settings - Fork 48
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
Conversation
4fd854c
to
d9f34c9
Compare
There was a problem hiding this 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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does unbound mean?
There was a problem hiding this comment.
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.
bigframes/core/compile/compiled.py
Outdated
output_column_id: typing.Optional[str] = None, | ||
) -> T: | ||
"""Creates a new expression based on this expression with unary operation applied to one column.""" | ||
): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
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:
Fixes #<issue_number_goes_here> 🦕