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

Subscriptions expressions: Ability to check whether a property exists #219

Open
1 task done
mlongob opened this issue Mar 18, 2024 · 1 comment
Open
1 task done
Assignees
Labels
A-Broker Area: C++ Broker enhancement New feature or request

Comments

@mlongob
Copy link
Contributor

mlongob commented Mar 18, 2024

Is there an existing proposal for this?

  • I have searched the existing proposals

Is your feature request related to a problem?

The expression language currently does not provide a clear way to check for the existence of a property.

Let's assume I have a queue with two types of messages.

Messages of type A have the following properties:

radius = 34
color = "blue"

Messages of type B have the following properties:

height: 53
width: 100
color = "red"

If I want to filter for messages that contain a radius field in a subscription, I can currently recur to the following workaround expressions:

radius == radius
radius >= 0 || radius < 0

however my intent to check for existence is not clear.

Describe the solution you'd like

I would love if the expression language allowed me to check for existence of fields explicitly. This can be done by either checking if a field:

!= NULL

for the existence check.

and

== NULL

for the missing property check.

Alternatively an operator for exists() can be introduced. This alternative would require a unary negation operator.

Alternatives you considered

No response

@mlongob mlongob added enhancement New feature or request A-Broker Area: C++ Broker labels Mar 18, 2024
@jll63
Copy link
Collaborator

jll63 commented Mar 18, 2024

I prefer exists, because we might introduce new types for which NULL is a possible value. We may want to distinguish between the existence of a property, and its value being NULL. For example, in Python, these are different: { "question": None, answer: 42 } and { answer: 42 }.

@jll63 jll63 self-assigned this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Broker Area: C++ Broker enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants