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

Top command doesn't parse multiple fields #47

Open
51-code opened this issue Jul 30, 2024 · 0 comments
Open

Top command doesn't parse multiple fields #47

51-code opened this issue Jul 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@51-code
Copy link
Contributor

51-code commented Jul 30, 2024

Describe the bug

There is a test case for a query:
| top 1 showperc=F countfield=zzz ddd, ddd

Which results in the following error:

line 46:37 mismatched input ',' expecting {PIPE, COMMA, GET_FIELD_SINGLE_QUOTED, GET_FIELD_DOUBLE_QUOTED, GET_FIELD_STRING, COMMAND_TOP_MODE_BY}

This means that it doesn't recognize the comma, even though it is expecting one. The parsing is stopped when reaching the comma.

Looking at the parse tree, the comma is parsed as <COMMAND_TOP_MODE_COMMA>, and the grammar rule is waiting for a "COMMA". The parser is probably in the wrong mode when it's parsing the comma.

A workaround is to not use the comma in between, as it is optional.

Expected behavior

Should parse with the comma in between fields as well.

How to reproduce

Test the query above.

Screenshots

Software version

6.1.0

Desktop (please complete the following information if relevant):

  • OS:
  • Browser:
  • Version:

Additional context

There were two test payloads with multiple fields, one of which (top2.txt) has been changed to not use a comma in between the fields to see if that works.

topSyntaxParseTest in TopSyntaxTests.java has been disabled because of this issue in PR #52.

@51-code 51-code added the bug Something isn't working label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant