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

[FLINK-7759][TableAPI & SQL] Fix Bug that fieldName with Boolean pref… #4829

Closed
wants to merge 1 commit into from

Conversation

Xpray
Copy link
Contributor

@Xpray Xpray commented Oct 16, 2017

Fix Bug that fieldName with Boolean prefix can't be parsed by ExpressionParser

What is the purpose of the change

Fix bug that field names with boolean prefix like "truex" or "FALSE_TARGET" can't be parsed by ExpressionParser

Brief change log

use ||| instead of | in atom parser, try to match as long as possible, and exchanging of positions of fieldReference parser and literalExpr parser is necessary, because boolean can be matched by both parsers, then it's captured by the latter one literalExpr .

Verifying this change

This change added tests and can be verified as follows:

StringExpressionTest.testFieldWithBooleanPrefix

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive):no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not documented

@fhueske
Copy link
Contributor

fhueske commented Oct 19, 2017

Thanks for the PR @Xpray.
This looks good. Will merge it.

import org.apache.flink.table.expressions.{ExpressionParser, Literal, UnresolvedFieldReference}
import org.junit.{Assert, Test}

class StringExpressionTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

I've converted the test into an expression test (extending ExpressionTestBase) and moved it to org.apache.flink.table.expressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's great, I should have done this.

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