Skip to content

[Feature] Support boolean literals equals and notEquals#9322

Closed
61yao wants to merge 2 commits intoapache:masterfrom
61yao:boolean_literals
Closed

[Feature] Support boolean literals equals and notEquals#9322
61yao wants to merge 2 commits intoapache:masterfrom
61yao:boolean_literals

Conversation

@61yao
Copy link
Contributor

@61yao 61yao commented Sep 1, 2022

Support boolean literal evaluation, eg. true = true, (true = true) != false

  1. Save literal value as an object
  2. Register scalar function with func names and argument types. If a function cannot be found via function function names and argument types, look for functions through func names and # of params by default.
  3. Currently, we only support equal and notEqual type matching for boolean and double.

Copy link
Contributor

@walterddr walterddr left a comment

Choose a reason for hiding this comment

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

This might not be the best way to support literal equations
let's first straighten out the target:

do we want to support this on transform or predicate

I think let's focus on transform functions.
in this case I think the missing piece is to add literal handling to binaryoperatortransformfunction on both side

do we want to do typed equal / not-equal check

let's only do non-typed check. b/c typed solution will be very complex: see
#8596

with the basic solution in we can focus on #8596 to actually make the literals typed.

@61yao
Copy link
Contributor Author

61yao commented Sep 6, 2022

This might not be the best way to support literal equations let's first straighten out the target:

do we want to support this on transform or predicate

I think let's focus on transform functions. in this case I think the missing piece is to add literal handling to binaryoperatortransformfunction on both side

do we want to do typed equal / not-equal check

let's only do non-typed check. b/c typed solution will be very complex: see #8596

with the basic solution in we can focus on #8596 to actually make the literals typed.

I am not sure if I fully understand about your point on literal support for binaryTransform. Shouldn't two literal eval fall into scalar function by default?

Or you meant expressions like SELECT <BOOL_EXPR> = TRUE ? this is already supported.

I am not against using proposal #8596 depending on the priority. This PR is hacky and expensive. but I feel it is not worse than the implementation we already have right now.

@61yao
Copy link
Contributor Author

61yao commented Sep 10, 2022

Discussed offline. Since this is not urgent, I'll do some refactoring first and then fix function registration with parameter types.

@61yao 61yao closed this Nov 19, 2022
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.

2 participants