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

[Expressions] columns. Fixes Bugs caused by using name instead of ID. #118470

Merged
merged 5 commits into from
Nov 16, 2021

Conversation

Kuznietsov
Copy link
Contributor

Summary

Fixes bugs from this issue, related to columns expression.

New behavior:

Added support of IDs. If exclude or include contains ids and names, the expression first compares an id and then a name.

Expression:

esaggs index={indexPatternLoad id="90943e30-9a47-11e8-b64d-95841ca0b247"} 
  aggs={aggHistogram id="a" enabled=true schema="segment" field="bytes" maxBars=34 interval="auto" has_extended_bounds=false min_doc_count=false}
  aggs={aggSum id="b" enabled=true schema="metric" field="bytes"} metricsAtAllLevels=false partialRows=false
| head 1
| columns include="col-0-a" exclude="Sum of bytes"

Output of the head:

{
  "type": "datatable",
  "columns": [
    {
      "id": "col-0-a",
      "name": "bytes",
      "meta": {
        "type": "number",
        "field": "bytes",
        "index": "kibana_sample_data_logs",
        "params": {
          "id": "number"
        },
        "source": "esaggs",
      }
    },
    {
      "id": "col-1-b",
      "name": "Sum of bytes",
      "meta": {
        "type": "number",
        "field": "bytes",
        "index": "kibana_sample_data_logs",
        "params": {
          "id": "number"
        },
        "source": "esaggs",
      }
    }
  ],
  "rows": [
    {
      "col-0-a": 0,
      "col-1-b": 442647
    }
  ]
}

Result of the columns expression:

{
  "type": "datatable",
  "columns": [
    {
      "id": "col-0-a",
      "name": "bytes",
      "meta": {
        "type": "number",
        "field": "bytes",
        "index": "kibana_sample_data_logs",
        "params": {
          "id": "number"
        },
        "source": "esaggs",
      }
    },
  ],
  "rows": [
    {
      "col-0-a": 0,
    }
  ]
}

@Kuznietsov Kuznietsov added release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) loe:small Small Level of Effort impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. backport:skip This commit does not require backporting Feature:Canvas v8.1.0 labels Nov 12, 2021
@Kuznietsov Kuznietsov requested a review from a team as a code owner November 12, 2021 15:04
@Kuznietsov Kuznietsov self-assigned this Nov 12, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

saveOther: boolean = false
) =>
cols.reduce<{ matched: DatatableColumn[]; other: DatatableColumn[] }>(
(splitedColumns, col) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: splitColumns is a more proper name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@crob611 crob611 left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@Kuznietsov Kuznietsov enabled auto-merge (squash) November 16, 2021 10:17
@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1015.0KB 1015.3KB +300.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @Kunzetsov

@Kuznietsov Kuznietsov merged commit f7344ef into elastic:main Nov 16, 2021
dmlemeshko pushed a commit that referenced this pull request Nov 29, 2021
…D. (#118470)

* Fixed behavior of the columns function.

* updated tests to check for `id` matching in addition to the `name`.

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Canvas Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants