Skip to content

[BUG] Errors & unexpected behaviour for fields names which are reserved keywords. #1589

Closed

Description

@dnx-aiven

What is the bug?

tl;dr, reserved keywords cause PPL search issues & UI bugs when a field is of these names.

I have various fields, which I can utilise in DQL searches. However, in Observability (I'm working in Event Analytics section), the fields display in UI, but the values for these are not populated, and when querying with PPL there are errors.

I have tested this on OS 2.4.1, which is my install. I tried the latest in the playground, but that wasn't working well for me at all.
The sample commerce data has a field named type so this is a good one to use for testing.

The bugs are not present in my 1.3.8 install.

There is a workaround for PPL, which is that field names which are reserved keywords need to be backticked. If I use quotes there isn't an error, but there aren't any results either.

For the UI, there's some bug which needs addressing.

Reserved keywords are not documented anywhere that I can see. I know type and ip. What are others?

Needing to use backticks for some field names is not documented. I feel like this is a workaround rather than a fix.

Error messages are not very helpful. Could be more accurate as to the specific issue.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Go to Event Analytics
  2. Search a source where the index has a field of the same name as a restricted keyword.
    3 Observe no values populated for the field
    4 Add a search such as | where type = "value"
    5 Observe error.

What is the expected behavior?
UI to populate field values.
PPL to not need backticks, or for this to be documented.
Documentation coverage.

What is your host/environment?

  • OS: Fedora. Also tried via docker-compose.
  • Version 2.4.1
  • Plugins: Just stock plugins.

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
image

image

image

Do you have any additional context?

As discussed with @anirudha & others from the team.

There is a previous Issue raised for this with a field named ip opensearch-project/observability#1148
IMHO it was closed with too little information, due to restricted fields not being documented and the unhelpful error messages.

Activity

  1. added
    bug
    on Apr 27, 2023
  2. pinned this issue on Apr 27, 2023
  3. unpinned this issue on Apr 27, 2023
  4. Yury-Fridlyand commented on May 2, 2023

    @Yury-Fridlyand
    Collaborator

    We should extend keywordsCanBeId list in grammar file (it was partially done in #1319).
    As a workaround you can escape identified with backticks `, e.g. ... | where `type` = "value"

  5. dnx-aiven commented on Aug 17, 2023

    @dnx-aiven
    Author

    I've tried again today to use Observability and getting errors such as this. I presume it's from the same bug, as type field exists in this index. I'd like to update all our index fields. Is a list of all reserved keywords available anywhere?

    image
  6. Yury-Fridlyand commented on Aug 17, 2023

    @Yury-Fridlyand
    Collaborator

    All PPL keywords are listed here: https://github.com/opensearch-project/sql/blob/main/ppl/src/main/antlr/OpenSearchPPLLexer.g4, but ones are not in keywordsCanBeId list should be wrapped by backticks to avoid issues.

    keywordsCanBeId
    : D // OD SQL and ODBC special
    | timespanUnit | SPAN
    | evalFunctionName
    | relevanceArgName
    | intervalUnit
    | dateTimeFunctionName
    | textFunctionName
    | mathematicalFunctionName
    | positionFunctionName
    // commands
    | SEARCH | DESCRIBE | SHOW | FROM | WHERE | FIELDS | RENAME | STATS | DEDUP | SORT | EVAL | HEAD | TOP | RARE
    | PARSE | METHOD | REGEX | PUNCT | GROK | PATTERN | PATTERNS | NEW_FIELD | KMEANS | AD | ML
    // commands assist keywords
    | SOURCE | INDEX | DESC | DATASOURCES
    // CLAUSEKEYWORDS
    | SORTBY
    // FIELDKEYWORDSAUTO
    | STR | IP | NUM
    // ARGUMENT KEYWORDS
    | KEEPEMPTY | CONSECUTIVE | DEDUP_SPLITVALUES | PARTITIONS | ALLNUM | DELIM | CENTROIDS | ITERATIONS | DISTANCE_TYPE
    | NUMBER_OF_TREES | SHINGLE_SIZE | SAMPLE_SIZE | OUTPUT_AFTER | TIME_DECAY | ANOMALY_RATE | CATEGORY_FIELD
    | TIME_FIELD | TIME_ZONE | TRAINING_DATA_SIZE | ANOMALY_SCORE_THRESHOLD
    // AGGREGATIONS
    | AVG | COUNT | DISTINCT_COUNT | ESTDC | ESTDC_ERROR | MAX | MEAN | MEDIAN | MIN | MODE | RANGE | STDEV | STDEVP
    | SUM | SUMSQ | VAR_SAMP | VAR_POP | STDDEV_SAMP | STDDEV_POP | PERCENTILE | TAKE | FIRST | LAST | LIST | VALUES
    | EARLIEST | EARLIEST_TIME | LATEST | LATEST_TIME | PER_DAY | PER_HOUR | PER_MINUTE | PER_SECOND | RATE | SPARKLINE
    | C | DC
    ;

  7. dnx-aiven commented on Aug 17, 2023

    @dnx-aiven
    Author

    Thank you @Yury-Fridlyand . backticks help with search, but they do not help with the UI issues encountered with those fields.

  8. Yury-Fridlyand commented on Aug 17, 2023

    @Yury-Fridlyand
    Collaborator

    Query workbench is responsible for the UI part. It looks like there are two bugs. Please, feel free to open a bug for workbench.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions