flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-27402] Fix unexpected boolean expression simplification for filter condition between varchar type and boolean values true/false

Open swuferhong opened this issue 1 year ago • 1 comments

What is the purpose of the change

For sql statement select * from c1 = 1 and c2 = true; , if c2 is varchar type, filter condition c2 = true will be incorrectly simplified to c2. After that, error Boolean expression type expected will be thrown. So, this pr is aims to fix this problem.
Because Flink now doesn't support implicate type conversion between varchar and boolean, the result returned by this sql statement may not be what the user wants (This problem can be solved after Flink supports implicit conversion).

Brief change log

  • Adding judgement in RexSimplify to restrict conversion of string type.
  • Adding plan test to verify plan.
  • Adding ITCase and TODO to mark the problem need to be resolved.

Verifying this change

  • Adding plan test to verify plan.
  • Adding ITCase and TODO to mark the problem need to be resolved.

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, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

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

swuferhong avatar Sep 07 '22 07:09 swuferhong

CI report:

  • 265511cf0c7401eb608ef3f619399c8877776b2f Azure: SUCCESS
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Sep 07 '22 07:09 flinkbot