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-2563] Add integration test for math operators #3569

Closed
wants to merge 4 commits into from

Conversation

mingmxu
Copy link

@mingmxu mingmxu commented Jul 16, 2017

Add integration test for built-in MATH functions,

Misc:

  1. no SQRT in Calcite, converted to POWER;
  2. add DECIMAL in BeamSqlDslBase;
  3. fix error in BeamSqlRoundExpression;
  4. fix error in BeamSqlSignExpression;
  5. wire on COS with BeamSqlCosExpression;

@mingmxu
Copy link
Author

mingmxu commented Jul 16, 2017

R: @xumingming @jbonofre @takidau

@@ -280,6 +283,7 @@ static BeamSqlExpression buildExpression(RexNode rexNode) {
case "SIGN":
ret = new BeamSqlSignExpression(subExps);
break;
case "SQRT": //SQRT is converted as POWER(i, 0.5)
Copy link
Contributor

Choose a reason for hiding this comment

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

if SQRT is converted to POWER, then we don't even need the case statement, right?

Copy link
Author

Choose a reason for hiding this comment

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

right, it's not necessary here.

@@ -37,7 +37,13 @@ public BeamSqlSignExpression(List<BeamSqlExpression> operands) {
BeamSqlPrimitive result = null;
switch (op.getOutputType()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's specify the outputType for BeamSqlSignExpression in the constructor:

  public BeamSqlSignExpression(List<BeamSqlExpression> operands) {
    super(operands);
  }

to

  public BeamSqlSignExpression(List<BeamSqlExpression> operands) {
    super(operands, op(0).getOutputType());
  }

Copy link
Author

@mingmxu mingmxu Jul 17, 2017

Choose a reason for hiding this comment

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

sound right, need to rewrite the constructors for all built-in MATH functions, otherwise it fails with nested methods like SIGN(ABS($1)).

@mingmxu
Copy link
Author

mingmxu commented Jul 17, 2017

retest this please

@xumingming
Copy link
Contributor

Retest this please

1 similar comment
@xumingming
Copy link
Contributor

Retest this please

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a4c26ac on XuMingmin:BEAM-2563 into ** on apache:DSL_SQL**.

Copy link
Contributor

@xumingming xumingming left a comment

Choose a reason for hiding this comment

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

LGTM

@JingsongLi
Copy link
Contributor

R + @JingsongLi, I'll take a quick look.

@mingmxu
Copy link
Author

mingmxu commented Jul 18, 2017

@JingsongLi There's another blocked PR #3552, not sue if you can take it, or need to wait for Tyler?

@JingsongLi
Copy link
Contributor

It is best to wait for Tyler to look at your fix after his review.

mingmxu added 4 commits July 18, 2017 19:59
Misc:
1. no SQRT in Calcite, converted to POWER;
2. add DECIMAL in BeamSqlDslBase;
3. fix error in BeamSqlRoundExpression;
4. fix error in BeamSqlSignExpression;
@mingmxu
Copy link
Author

mingmxu commented Jul 19, 2017

@JingsongLi the tests are all here, please review it when you've time.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling bc0a932 on XuMingmin:BEAM-2563 into ** on apache:DSL_SQL**.

@mingmxu
Copy link
Author

mingmxu commented Jul 19, 2017

retest this please

@JingsongLi
Copy link
Contributor

LGTM once Travis gives the green.

@JingsongLi
Copy link
Contributor

retest this please

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling bc0a932 on XuMingmin:BEAM-2563 into ** on apache:DSL_SQL**.

asfgit pushed a commit that referenced this pull request Jul 19, 2017
@JingsongLi
Copy link
Contributor

Merged, feel free to close.

@mingmxu
Copy link
Author

mingmxu commented Jul 19, 2017

Thank you @xumingming @JingsongLi

@mingmxu mingmxu closed this Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants