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

Search filter does not work for value equal to null #630

Open
4 tasks done
BaoKhanhFontAriel opened this issue Oct 24, 2024 · 6 comments · May be fixed by #658
Open
4 tasks done

Search filter does not work for value equal to null #630

BaoKhanhFontAriel opened this issue Oct 24, 2024 · 6 comments · May be fixed by #658
Labels
area/messages scope/backend Related to backend changes status/confirmed A bug that is a confirmed one. Applicable only for the bug label. status/triage/completed Automatic triage completed type/bug Something isn't working

Comments

@BaoKhanhFontAriel
Copy link

Issue submitter TODO list

  • I've looked up my issue in FAQ
  • I've searched for an already existing issues here
  • I've tried running main-labeled docker image and the issue still persists there
  • I'm running a supported version of the application which is listed here

Describe the bug (actual behavior)

I add filter record.value.name == null to search all values that have name equal to null but it shows no message found

Expected behavior

There should be 1 message found with name == null

Your installation details

Version is kafbat-ui-v1.0.0.jar, I run it with jar file

Steps to reproduce

  1. Produce 2 message {"name":"Sam", "age": 25} and {"name": null, "age": 24}
  2. Add filter record.value.name == null
  3. Result shows no message found

Screenshots

image
image
image

Logs

No response

Additional context

No response

@BaoKhanhFontAriel BaoKhanhFontAriel added status/triage Issues pending maintainers triage type/bug Something isn't working labels Oct 24, 2024
@kapybro kapybro bot added status/triage/manual Manual triage in progress status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Oct 24, 2024
Copy link

Hi BaoKhanhFontAriel! 👋

Welcome, and thank you for opening your first issue in the repo!

Please wait for triaging by our maintainers.

As development is carried out in our spare time, you can support us by sponsoring our activities or even funding the development of specific issues.
Sponsorship link

If you plan to raise a PR for this issue, please take a look at our contributing guide.

@Haarolean Haarolean added scope/backend Related to backend changes status/confirmed A bug that is a confirmed one. Applicable only for the bug label. area/messages and removed status/triage/manual Manual triage in progress labels Oct 24, 2024
@sixdouglas
Copy link
Contributor

Hi, I'd be happy to work on this issue

@sixdouglas
Copy link
Contributor

I've played a little around this issue. I can reproduce the behaviour in a unit simple test, using just the plain CEL library.

I found this in the CEL lib documentation ( here ):

The null value is written null. It is used in conversion to and from protocol buffer and JSON data, but otherwise has no built-in meaning in CEL. In particular, null has its own type (null_type) and is not necessarily allowed where a value of some other type is expected.

I didn't manage to compare anything (the name key in the example below) to null. Using an expression like record.value.name == null to validate on a map like this :

Map<String, Object> objectKeys = new HashMap<>();
objectKeys.put("name", null);
objectKeys.put("age", 24);
Map<String, Object> valueKeys = new HashMap<>();
valueKeys.put("value", objectKeys);
Map<String, Map<String, Object>> recordKeys = new HashMap<>();
recordKeys.put("record", valueKeys);

Gives me an output result like this:

unknown {
  exprs: 3
}

Do you know a specific way to do this kind of comparison using this library?

@yeikel
Copy link
Contributor

yeikel commented Nov 10, 2024

Can you send a draft PR with your progress so far? I'd like to try/experiment what the change looks like along with you

@Haarolean
Copy link
Member

I didn't manage to compare anything

yeah me neither, I've tried typeof and some other things, nothing worked (which worked fine here: https://playcel.undistro.io/ ). Most likely, our CEL env requires adjustments (see MessageFilters#createCompiler and MessageFilters#createRuntime).

@sixdouglas sixdouglas linked a pull request Nov 11, 2024 that will close this issue
13 tasks
@sixdouglas
Copy link
Contributor

Hi,
Here is my PR.
It is just a draft, since it doesn't work ;)
I've added multiple tests, one using the CEL as it is setup in the app. And two others completely outside the app, to see if there was something special in the setup.
Testing String and Number equality and builtin functions works but not number inequality nor null checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/messages scope/backend Related to backend changes status/confirmed A bug that is a confirmed one. Applicable only for the bug label. status/triage/completed Automatic triage completed type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants