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

[discover] Support ES|QL statements without FROM clause #179020

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ export async function getDataViewByTextBasedQueryLang(
if ('esql' in query) {
indexPatternFromQuery = getIndexPatternFromESQLQuery(query.esql);
}
// we should find a better way to work with ESQL queries which dont need a dataview
if (!indexPatternFromQuery && currentDataView) return currentDataView;

if (
currentDataView?.isPersisted() ||
Expand Down
13 changes: 13 additions & 0 deletions test/functional/apps/discover/group4/_esql_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'machine.ram_range',
]);
});

it('should work without a FROM statement', async function () {
await PageObjects.discover.selectTextBaseLang();
const testQuery = `ROW a = 1, b = "two", c = null`;

await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
await PageObjects.header.waitUntilLoadingHasFinished();

await PageObjects.discover.dragFieldToTable('a');
const cell = await dataGrid.getCellElement(0, 2);
expect(await cell.getVisibleText()).to.be('1');
});
});

describe('errors', () => {
Expand Down