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

[BEAM-10438] Update SupportedZetaSqlBuiltinFunctions and support math functions #12643

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

robinyqiu
Copy link
Contributor

  1. Sync with builtin_function.proto in ZetaSQL 2020.08.1 release
  2. Turn on all scalar math functions supported by ZetaSQL evaluator and add unit tests for them
  3. Move all existing unit tests for math functions to ZetaSqlMathFunctionsTest
  4. Some minor style change

r: @apilloud

Post-Commit Tests Status (on master branch)

Lang SDK Dataflow Flink Samza Spark Twister2
Go Build Status --- Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status --- Build Status --- Build Status ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests

See CI.md for more information about GitHub Actions CI.

@apilloud
Copy link
Member

There are tests failing due to this change.

@robinyqiu
Copy link
Contributor Author

Yes I realized that. The one on Jenkins is due to double comparison. There is also compliance failures that got revealed from this change. I am working on the fix now. You can hold on the review. Thanks!

@robinyqiu
Copy link
Contributor Author

OK now the tests all pass and the blocking bug is fixed.

@apilloud
Copy link
Member

Sorry I haven't gotten to this yet. My schedule is busy (performance reviews and on call rotations) through September 16th, so it might be a little while before I have time to fit in a large review. I can LGTM the first commit immediately. If there is anything else you can break into a smaller piece that might help.

@robinyqiu
Copy link
Contributor Author

That's totally fine for me. Please take your time for the review.

I don't think the first commit is urgent. Let's wait until you find time to review both. Also, I have other works to do so I am not blocked on this.

Copy link
Member

@apilloud apilloud left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in getting to this, LGTM

public static final String DOUBLE_NEGATIVE_INF_FUNCTION = "double_negative_inf";
public static final String DOUBLE_NAN_FUNCTION = "double_nan";
private static final Map<String, String> DOUBLE_FUNCTIONS =
public static final String DOUBLE_POSITIVE_INF_WRAPPER = "double_positive_inf";
Copy link
Member

Choose a reason for hiding this comment

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

nit: Renames like this are probably a net negative when you take into account the total cost of a change (time authoring and reviewing, increased diffs when debugging future issues, potential upgrade friction for customers). It is hard to know exactly where the line is so feel free to push forward with these as much of the work is already done. In the future I would suggest avoiding non-functional changes, particularly if they are something that would be at most a nit on a code review. (These went in recently and didn't even get a nit comment.)

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 agree. I will let this change get in and avoid similar changes in the future. Sorry for the inconvenience.

// FunctionSignatureId.FN_ABS_INT64, // abs
// FunctionSignatureId.FN_ABS_DOUBLE, // abs
// FunctionSignatureId.FN_ABS_NUMERIC, // abs
FunctionSignatureId.FN_ABS_INT64, // abs
Copy link
Member

Choose a reason for hiding this comment

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

nit: This PR has a interesting mix of minor refactors and addition of new functionality. These should probably be separate changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense. I will remember to separate different categories of changes in the future. Thanks for the suggestion!

@@ -475,17 +512,22 @@

// FunctionSignatureId.FN_RANGE_BUCKET, // range_bucket(T, array<T>) -> int64

// FunctionSignatureId.FN_RAND, // rand() -> double
FunctionSignatureId.FN_RAND // rand() -> double
Copy link
Member

Choose a reason for hiding this comment

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

This one scares me just a little. In particular, I'm worried that we might accidentally optimize such that we end up with a constant. Is that something we need to test? https://xkcd.com/221/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this! I will disable this for now, and enable it later once we have a thorough test.

@@ -24,6 +24,11 @@
@Internal
public class ZetaSqlTypesUtils {

public static final BigDecimal NUMERIC_MAX_VALUE =
Copy link
Member

Choose a reason for hiding this comment

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

nit: these constants are only used in ZetaSqlMathFunctionsTest.java, do they belong there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants