-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ES|QL] Ignore drop commands for date histogram in discover #171769
Conversation
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
@dej611 looks great. How easy is to not display the @timestamp column in the datatable? |
Fixed with c47ab3f . |
We lost the @timestamp column here and we dont want it. We want the @timestamp column to disappear when the user drops the @timestamp if possible not always. |
const timeFieldName = dataView.timeFieldName; | ||
|
||
if (isPlainRecord) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hides the @timestamp column all the time. We don't want that. We just want to hide it when the user is dropping the field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 78fae0a added also a full text coverage for the new utility function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, this works exactly as I am expecting 👏
Please excuse my naive and uninvited question, but we're also consumers of the unified histogram. 😇 Is this string manipulation safe without parsing the ES|QL AST? What happens to a query like |
return showTimeCol; | ||
} | ||
// flattened is the _source content in this case | ||
return rows.some((row) => timeFieldName in row.flattened); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterating through all results can be a long operation. Can we avoid it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, we could search in the returned ESQL fields. UnifiedDataTable accesses them via columnTypes
. So in your case it could be:
return Boolean(columnTypes[timeFieldName])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 4db4e3a
@@ -66,3 +66,8 @@ export function getIndexPatternFromESQLQuery(esql?: string): string { | |||
} | |||
return ''; | |||
} | |||
|
|||
export function cleanupESQLQuery(esql?: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to describe the purpose of the clean up. Or at least change the function name to something like cleanupESQLQueryForLensSuggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with fc4c37f
This is more a general issue and probably with #170071 will be possible to perform query manipulation like that. For now that ES|QL query will break as there's often the basic assumption that commands are separated by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Summary
Fixes #169907
This PR cleans the ES|QL statement from DROP commands before sending it over for the date histogram chart in Lens.
Checklist
Delete any items that are not applicable to this PR.