Skip to content

Conversation

@ramkrish86
Copy link
Contributor

Updated PR against branch after the deletion of tableOnCalcite. It was suggested over in the old PR an d in JIRA to create a new PR as the old one was closed automatically.
@fhueske and @tillrohrmann - Pls review.

@ramkrish86
Copy link
Contributor Author

@fhueske - Not sure how to check the failed test cases. Any chance of a review here? Thank you.

@fhueske
Copy link
Contributor

fhueske commented Mar 22, 2016

Hi @ramkrish86, I haven't touched the part of the code yet. Need some time to become familiar with the ExpressionParser.

@vasia
Copy link
Contributor

vasia commented Mar 22, 2016

@ramkrish86 it doesn't look like tests are failing. It's a checkstyle violation in RexNodeTranslator.

@ramkrish86
Copy link
Contributor Author

@vasia
Thanks for the info. Let me check that and update the PR.

@ramkrish86
Copy link
Contributor Author

Updated PR. RexNodeTranslator had > 100 character line. That is now corrected.

…579_new

Conflicts:
	flink-libraries/flink-table/src/test/java/org/apache/flink/api/java/table/test/StringExpressionsITCase.java
@ramkrish86
Copy link
Contributor Author

@tillrohrmann - Ping for reviews!!!

Literal(str.toInt)
} else if (str.endsWith("f") | str.endsWith("F")) {
Literal(str.toFloat)
} else if (str.endsWith(".")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it valid SQL standard to have a format like 1.? What happens to .1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the 'cast()' function parsing is accepting '.' as '.cast()' we need to do this way. Else the parser does not know that '.' is specific to that operation of 'cast'. But I am not so well versed with this parser so suggestions welcome.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems a little bit like a hack to me. Ideally, you should design your grammar such that you won't see the token 1. if it is not a valid number expression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So in that sense what is the valid number expression? I cannot say 1.CAST(STRING) then?
If that is not valid then 1.abs() is also not vaild right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course both are valid expressions but 1. is simply not a valid number literal. Instead 1 would be valid. I guess you should change your grammar such that 1.abs() will parsed into something like functionApplication(NumberLiteral(1), abs) and the . indicates the function application but is not part of the number literal token.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tillrohrmann
This '.' related change I think I need more time to understand how this parser works. So for this PR can i only handle the string concat part. I have ensured that 42+a+b or a + b + 42 works fine.

@tillrohrmann
Copy link
Contributor

As far as I can tell the changes look good. I had some inline comments where I'm not sure whether the implementation is exhaustive.

@ramkrish86
Copy link
Contributor Author

Sorry for the wrong observation.
I can see that 'a + 42l.abs().cast(STRING)' works fine.
But 'a + 42.3.abs().cast(STRING)' does not work.
It fails here
case DOUBLE => val decimal = BigDecimal(value.asInstanceOf[java.math.BigDecimal]) if (decimal.isValidDouble) { generateNonNullLiteral(resultType, decimal.doubleValue().toString) } else { throw new CodeGenException("Decimal can not be converted to double.") }

@ramkrish86
Copy link
Contributor Author

I have done the changes only to support the String concat operation. The cast() and abs() grammar change looks more complex and I need to understand things better in parser to support it. Suggest we do it in a seperate JIRA? Is that fine @tillrohrmann ?

@tillrohrmann
Copy link
Contributor

Thanks for updating the PR @ramkrish86. Your proposed approach (creating a new PR for the parser changes) would be fine with me.

@ramkrish86
Copy link
Contributor Author

Thank you @tillrohrmann . Let me if the changes in the updated PR is fine with you.

@ramkrish86
Copy link
Contributor Author

@tillrohrmann - Ping to review the PR.
https://issues.apache.org/jira/browse/FLINK-3086 is already available for the support of CAST and abs() with ints.

@tillrohrmann
Copy link
Contributor

Changes look good to me :-) Good work @ramkrish86!

@ramkrish86
Copy link
Contributor Author

There is 1 failing check.
SavepointCoordinatorTest.testAbortOnCheckpointTimeout:517 expected:<0> but was:<1>
Seems unrelated to this change.
Thanks for all the reviews @tillrohrmann . Should be good to merge then. Thank you.

@vasia
Copy link
Contributor

vasia commented Apr 11, 2016

I'm merging this.

@asfgit asfgit closed this in 9e05439 Apr 11, 2016
fijolekProjects pushed a commit to fijolekProjects/flink that referenced this pull request May 1, 2016
hequn8128 pushed a commit to hequn8128/flink that referenced this pull request Jun 22, 2017
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.

7 participants