forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce reusable QL plugin for SQL and EQL (elastic#50815)
Extract reusable functionality from SQL into its own dedicated project QL. Implemented as a plugin, it provides common components across SQL and the upcoming EQL. While this commit is fairly large, for the most part it's just a big file move from sql package to the newly introduced ql.
- Loading branch information
1 parent
8cec7b1
commit c63d440
Showing
671 changed files
with
6,144 additions
and
4,739 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
evaluationDependsOn(xpackModule('core')) | ||
|
||
apply plugin: 'elasticsearch.esplugin' | ||
esplugin { | ||
name 'x-pack-ql' | ||
description 'Elasticsearch infrastructure plugin for EQL and SQL for Elasticsearch' | ||
classname 'org.elasticsearch.xpack.ql.plugin.QlPlugin' | ||
extendedPlugins = ['x-pack-core'] | ||
} | ||
|
||
archivesBaseName = 'x-pack-ql' | ||
|
||
dependencies { | ||
compileOnly project(path: xpackModule('core'), configuration: 'default') | ||
testCompile project(':test:framework') | ||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') | ||
} | ||
|
||
configurations { | ||
testArtifacts.extendsFrom testRuntime | ||
} | ||
|
||
task testJar(type: Jar) { | ||
appendix 'test' | ||
from sourceSets.test.output | ||
} | ||
|
||
artifacts { | ||
// normal es plugins do not publish the jar but we need to since users need it for extensions | ||
archives jar | ||
testArtifacts testJar | ||
} | ||
|
||
|
||
// disable integration tests for now | ||
integTest.enabled = false |
61 changes: 61 additions & 0 deletions
61
x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/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,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.ql; | ||
|
||
import org.elasticsearch.rest.RestStatus; | ||
import org.elasticsearch.xpack.ql.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 RestStatus status() { | ||
return RestStatus.BAD_REQUEST; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return format("line {}:{}: {}", getLineNumber(), getColumnNumber(), getErrorMessage()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ql; | ||
|
||
public abstract 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); | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/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,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ql; | ||
|
||
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); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ql; | ||
|
||
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); | ||
} | ||
} |
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
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
Oops, something went wrong.