Skip to content

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 Mar 27, 2024
@TrevorBergeron TrevorBergeron marked this pull request as ready for review March 27, 2024 20:15
@TrevorBergeron TrevorBergeron requested review from a team as code owners March 27, 2024 20:15


@dataclasses.dataclass
class Fixed(OpTypeRule):
out_type: ExpressionType
class Numeric(BinaryTypeSignature):
Copy link
Contributor

Choose a reason for hiding this comment

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

BinaryNumeric? Why we have both this and BinaryRealNumeric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The difference is whether integer inputs result in integer output for a float output. Some operations, such as logarithm, will produce float result even if input is an integer eg log(3) ~= 0.47712. Other operations, such as abs, preserve int type eg abs(-2) == 2

pa_result_type = pa_struct_t[self.name_or_index].type
input_type = input_types[0]
if not isinstance(input_type, pd.ArrowDtype):
raise TypeError("field accessor input must be a struct type")
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is for structs

Copy link
Contributor

@chelsea-lin chelsea-lin left a comment

Choose a reason for hiding this comment

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

LGTM overall. If the change grows after fixing the presubmit tests, I can take another look.

@TrevorBergeron TrevorBergeron merged commit ae4ff8d into main Mar 28, 2024
@TrevorBergeron TrevorBergeron deleted the op_constraints branch March 28, 2024 19:50
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