Skip to content

[ES|QL] Support replacement range#190465

Merged
drewdaemon merged 9 commits intoelastic:mainfrom
drewdaemon:support-replacement-range
Aug 19, 2024
Merged

[ES|QL] Support replacement range#190465
drewdaemon merged 9 commits intoelastic:mainfrom
drewdaemon:support-replacement-range

Conversation

@drewdaemon
Copy link
Copy Markdown
Contributor

@drewdaemon drewdaemon commented Aug 13, 2024

Summary

Fix #187184

Field names

Before

Screen.Recording.2024-08-15.at.12.18.38.PM.mov

After

Screen.Recording.2024-08-15.at.12.18.47.PM.mov

Functions with spaces

Before

Screen.Recording.2024-08-15.at.12.20.51.PM.mov

After

Screen.Recording.2024-08-15.at.12.20.14.PM.mov

Checklist

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon drewdaemon added release_note:fix Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana t// labels Aug 15, 2024
@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon
Copy link
Copy Markdown
Contributor Author

/ci

@drewdaemon drewdaemon marked this pull request as ready for review August 16, 2024 00:42
@drewdaemon drewdaemon requested a review from a team as a code owner August 16, 2024 00:42
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@drewdaemon
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.3MB 3.3MB +678.0B
Unknown metric groups

API count

id before after diff
@kbn/esql-validation-autocomplete 194 195 +1

History

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

);

/**
* @TODO — this string manipulation is crude and can't support all cases
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we make an issue for this todo to keep track or is that already existing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. There is no issue. But, using the AST more is a key tenant of my vision for a re-architecture of this code. In other words, I am tracking this but I think an RFC/architecture document is the best first step here. From that, we can create more specific issues.

testSuggestions('FROM a | WHERE doubleField IS N/', [
{ text: 'IS NOT NULL', rangeToReplace: { start: 28, end: 31 } },
{ text: 'IS NULL', rangeToReplace: { start: 28, end: 31 } },
{ text: '!= $0', rangeToReplace: { start: 31, end: 31 } },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not seeing this behavior in the editor with from kibana_sample_data_flights | where AvgTicketPrice is n. Makes sense that it suggests IS NOT NULL and IS NULL where the cursor is but why the rest?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had a choice: make it so that the range only gets added for IS NOT NULL and IS NULL or just add it in a generic way for all.

I opted for the latter because

  • including an empty range is valid and does no harm
  • it saves us adding a special case
    • if new operators with spaces are ever added, it will work automatically

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That makes sense. Thanks for the context!

Copy link
Copy Markdown
Member

@qn895 qn895 left a comment

Choose a reason for hiding this comment

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

Tested and LGTM

@drewdaemon drewdaemon merged commit 452fd88 into elastic:main Aug 19, 2024
@kibanamachine kibanamachine added v8.16.0 backport:skip This PR does not require backporting labels Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana release_note:fix Team:ESQL ES|QL related features in Kibana t// v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ES|QL Autocomplete duplicates string in some cases

5 participants