-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of #106679 * Copy the `ql` project into a different project _just for esql_, call it `esql-core`. * Make `esql` depend only on the latter. * Fix `EsqlNodeSubclassTests`; I'm confused why this didn't bite us earlier. * Update the warning regexes in some csv tests as the exceptions have other package names now. **Note to reviewers:** Exclude the first commit when viewing the diff, as that contains only the actual copying of `ql`. The remaining commits are the actually meaningful ones. _The `build.gradle` files probably require the most attention._
- Loading branch information
1 parent
06c27ec
commit 16a5d24
Showing
1,056 changed files
with
39,571 additions
and
3,058 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# ES|QL core | ||
|
||
This project originated as a copy of the `ql` x-pack plugin. | ||
It contains some fundamental classes used in `esql`, like `Node`, its subclasses `Expression`, `QueryPlan`, and the plan optimizer code. | ||
Originally, `ql` shared classes between ES|QL, SQL and EQL, but ES|QL diverged far enough to justify a split. | ||
|
||
## Warning | ||
|
||
- **Consider the contents of this project untested.** | ||
There may be some tests in `sql` and `eql` that may have indirectly covered the initial version of this (when it was copied from `ql`); | ||
but neither do these tests apply to `esql`, nor do they even run against this. | ||
- **Consider this project technical debt.** | ||
The contents of this project need to be consolidated with the `esql` plugin. | ||
In particular, there is a significant amount of code (or code paths) that are not used/executed at all in `esql`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apply plugin: 'elasticsearch.internal-es-plugin' | ||
apply plugin: 'elasticsearch.internal-test-artifact' | ||
|
||
esplugin { | ||
name 'x-pack-esql-core' | ||
description 'Elasticsearch infrastructure plugin for ESQL' | ||
classname 'org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin' | ||
extendedPlugins = ['x-pack-core'] | ||
} | ||
|
||
base { | ||
archivesName = 'x-pack-esql-core' | ||
} | ||
|
||
dependencies { | ||
api "org.antlr:antlr4-runtime:${versions.antlr4}" | ||
api project(path: xpackModule('mapper-version')) | ||
compileOnly project(path: xpackModule('core')) | ||
testApi(project(xpackModule('esql-core:test-fixtures'))) { | ||
exclude group: 'org.elasticsearch.plugin', module: 'esql-core' | ||
} | ||
testImplementation project(':test:framework') | ||
testImplementation(testArtifact(project(xpackModule('core')))) | ||
} |
26 changes: 26 additions & 0 deletions
26
x-pack/plugin/esql-core/licenses/antlr4-runtime-LICENSE.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[The "BSD license"] | ||
Copyright (c) 2015 Terence Parr, Sam Harwell | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. The name of the author may not be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Empty file.
27 changes: 27 additions & 0 deletions
27
...n/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/InvalidArgumentException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
package org.elasticsearch.xpack.esql.core; | ||
|
||
/** | ||
* Exception thrown when unable to continue processing client request, | ||
* in cases such as invalid query parameter or failure to apply requested processing to given data. | ||
* It's meant as a generic equivalent to QlIllegalArgumentException (that's a server exception). | ||
* TODO: reason for [E|S|ES]QL specializations of QlIllegalArgumentException? | ||
* TODO: the intended use of ql.ParsingException, vs its [E|S|ES]QL equivalents, subclassed from the respective XxxClientException? | ||
* Same for PlanningException. | ||
*/ | ||
public class InvalidArgumentException extends QlClientException { | ||
|
||
public InvalidArgumentException(String message, Object... args) { | ||
super(message, args); | ||
} | ||
|
||
public InvalidArgumentException(Throwable cause, String message, Object... args) { | ||
super(cause, message, args); | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
...ck/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/ParsingException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.core; | ||
|
||
import org.elasticsearch.xpack.esql.core.tree.Source; | ||
|
||
import static org.elasticsearch.common.logging.LoggerMessageFormat.format; | ||
|
||
public class ParsingException extends QlClientException { | ||
private final int line; | ||
private final int charPositionInLine; | ||
|
||
public ParsingException(String message, Exception cause, int line, int charPositionInLine) { | ||
super(message, cause); | ||
this.line = line; | ||
this.charPositionInLine = charPositionInLine; | ||
} | ||
|
||
public ParsingException(String message, Object... args) { | ||
this(Source.EMPTY, message, args); | ||
} | ||
|
||
public ParsingException(Source source, String message, Object... args) { | ||
super(message, args); | ||
this.line = source.source().getLineNumber(); | ||
this.charPositionInLine = source.source().getColumnNumber(); | ||
} | ||
|
||
public ParsingException(Exception cause, Source source, String message, Object... args) { | ||
super(cause, message, args); | ||
this.line = source.source().getLineNumber(); | ||
this.charPositionInLine = source.source().getColumnNumber(); | ||
} | ||
|
||
public int getLineNumber() { | ||
return line; | ||
} | ||
|
||
public int getColumnNumber() { | ||
return charPositionInLine + 1; | ||
} | ||
|
||
public String getErrorMessage() { | ||
return super.getMessage(); | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return format("line {}:{}: {}", getLineNumber(), getColumnNumber(), getErrorMessage()); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...k/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/QlClientException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
package org.elasticsearch.xpack.esql.core; | ||
|
||
import org.elasticsearch.rest.RestStatus; | ||
|
||
/** | ||
* Exception thrown by performing client (or user) code. | ||
* Typically it means the given action or query is incorrect and needs fixing. | ||
*/ | ||
public class QlClientException extends QlException { | ||
|
||
protected QlClientException(String message, Object... args) { | ||
super(message, args); | ||
} | ||
|
||
protected QlClientException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
protected QlClientException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
protected QlClientException(Throwable cause, String message, Object... args) { | ||
super(cause, message, args); | ||
} | ||
|
||
protected QlClientException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
@Override | ||
public RestStatus status() { | ||
return RestStatus.BAD_REQUEST; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/QlException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
package org.elasticsearch.xpack.esql.core; | ||
|
||
import org.elasticsearch.ElasticsearchException; | ||
|
||
/** | ||
* Base class for all QL exceptions. Useful as a catch-all. | ||
*/ | ||
public abstract class QlException extends ElasticsearchException { | ||
public QlException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
public QlException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public QlException(String message, Object... args) { | ||
super(message, args); | ||
} | ||
|
||
public QlException(Throwable cause, String message, Object... args) { | ||
super(message, cause, args); | ||
} | ||
|
||
public QlException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...esql-core/src/main/java/org/elasticsearch/xpack/esql/core/QlIllegalArgumentException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
package org.elasticsearch.xpack.esql.core; | ||
|
||
public class QlIllegalArgumentException extends QlServerException { | ||
public QlIllegalArgumentException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
public QlIllegalArgumentException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public QlIllegalArgumentException(String message, Object... args) { | ||
super(message, args); | ||
} | ||
|
||
public QlIllegalArgumentException(Throwable cause, String message, Object... args) { | ||
super(cause, message, args); | ||
} | ||
|
||
public QlIllegalArgumentException(String message) { | ||
super(message); | ||
} | ||
|
||
public QlIllegalArgumentException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...k/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/QlServerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
package org.elasticsearch.xpack.esql.core; | ||
|
||
/** | ||
* Exception triggered inside server-side code. | ||
* Typically a validation error or worse, a bug. | ||
*/ | ||
public abstract class QlServerException extends QlException { | ||
|
||
protected QlServerException(String message, Object... args) { | ||
super(message, args); | ||
} | ||
|
||
protected QlServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
protected QlServerException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
protected QlServerException(Throwable cause, String message, Object... args) { | ||
super(cause, message, args); | ||
} | ||
|
||
protected QlServerException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
Oops, something went wrong.