Commit Graph

484 Commits

Author SHA1 Message Date
Andrei Stefan 659326fdd6
SQL: Add protocol tests and remove jdbc_type from drivers response () 2019-01-16 16:28:46 +02:00
Costin Leau 023bb2f1e4
SQL: Remove slightly used meta commands ()
Remove SYS CATALOGS and SYS TABLE TYPES as they are a subset of SYS
TABLES (and thus somewhat redundant) and used only by JDBC.

Close 
2019-01-16 12:36:35 +02:00
Marios Trivyzas b594e81c86
SQL: Fix issue with field names containing "." ()
Adjust FieldExtractor to handle fields which contain `.` in their
name, regardless where they fall in, in the document hierarchy. E.g.:

```
{
  "a.b": "Elastic Search"
}

{
  "a": {
    "b.c": "Elastic Search"
  }
}

{
  "a.b": {
    "c": {
      "d.e" : "Elastic Search"
    }
  }
}
```

Fixes: 
2019-01-15 09:41:41 +02:00
Julie Tibshirani 36a3b84fc9
Update the default for include_type_name to false. ()
* Default include_type_name to false for get and put mappings.

* Default include_type_name to false for get field mappings.

* Add a constant for the default include_type_name value.

* Default include_type_name to false for get and put index templates.

* Default include_type_name to false for create index.

* Update create index calls in REST documentation to use include_type_name=true.

* Some minor clean-ups around the get index API.

* In REST tests, use include_type_name=true by default for index creation.

* Make sure to use 'expression == false'.

* Clarify the different IndexTemplateMetaData toXContent methods.

* Fix FullClusterRestartIT#testSnapshotRestore.

* Fix the ml_anomalies_default_mappings test.

* Fix GetFieldMappingsResponseTests and GetIndexTemplateResponseTests.

We make sure to specify include_type_name=true during xContent parsing,
so we continue to test the legacy typed responses. XContent generation
for the typeless responses is currently only covered by REST tests,
but we will be adding unit test coverage for these as we implement
each typeless API in the Java HLRC.

This commit also refactors GetMappingsResponse to follow the same appraoch
as the other mappings-related responses, where we read include_type_name
out of the xContent params, instead of creating a second toXContent method.
This gives better consistency in the response parsing code.

* Fix more REST tests.

* Improve some wording in the create index documentation.

* Add a note about types removal in the create index docs.

* Fix SmokeTestMonitoringWithSecurityIT#testHTTPExporterWithSSL.

* Make sure to mention include_type_name in the REST docs for affected APIs.

* Make sure to use 'expression == false' in FullClusterRestartIT.

* Mention include_type_name in the REST templates docs.
2019-01-14 13:08:01 -08:00
Jay Modi f3edbe2911
Security: remove SSL settings fallback ()
This commit removes the fallback for SSL settings. While this may be
seen as a non user friendly change, the intention behind this change
is to simplify the reasoning needed to understand what is actually
being used for a given SSL configuration. Each configuration now needs
to be explicitly specified as there is no global configuration or
fallback to some other configuration.

Closes 
2019-01-14 14:06:22 -07:00
Costin Leau a4339ec7e9
SQL: Use declared source for error messages ()
Improve error messages by returning the original SQL statement
declaration instead of trying to reproduce it as the casing and
whitespaces are not preserved accurately leading to small 
differences.

Close 
2019-01-13 01:40:22 +02:00
Marios Trivyzas 359222c55c
SQL: Make `FULL` non-reserved keyword in the grammar ()
Since `full` can be common as a field name or part of a field name
(e.g.: `full.name` or `name.full`), it's nice if it's not a reserved
keyword of the grammar so a user can use it without resorting to quotes.

Fixes: 
2019-01-11 23:08:00 +02:00
Marios Trivyzas 85531f0285
SQL: [Tests] Fix and enable internalClusterTests ()
SqlPlugin cannot have more than one public constructor, so for the testing
purposes the `getLicenseState()` should be overriden.

Fixes: 

Co-authored-by: Michael Basnight <mbasnight@gmail.com>
2019-01-11 22:43:17 +02:00
markharwood 434430506b
Type removal - added deprecation warnings to _bulk apis ()
Added warnings checks to existing tests
Added “defaultTypeIfNull” to DocWriteRequest interface so that Bulk requests can override a null choice of document type with any global custom choice.
Related to 
2019-01-10 21:35:19 +00:00
Costin Leau 83f7423cd6
SQL: Fix bug regarding alias fields with dots ()
Field of types aliases that have dots in name are returned without a
hierarchy by field_caps, as oppose to the mapping api or field with
concrete types, which in turn breaks IndexResolver.
This commit fixes this by creating the backing hierarchy similar to the
mapping api.

Close 
2019-01-10 22:18:53 +02:00
Andrei Stefan 4a92de214a
SQL: Proper handling of COUNT(field_name) and COUNT(DISTINCT field_name) ()
* provide overriden `hashCode` and toString methods to account for `DISTINCT`
* change the analyzer for scenarios where `COUNT <field_name>` and `COUNT DISTINCT` have different paths
* defined a new `filter` aggregation encapsulating an `exists` query to filter out null or missing values
2019-01-10 09:51:51 +02:00
Marios Trivyzas 5f2fbedd8c
SQL: Replace String.format() with LoggerMessageFormat.format() ()
Fixes: 
2019-01-08 23:56:00 +02:00
Alpar Torok 6344e9a3ce
Testing conventions: add support for checking base classes () 2019-01-08 13:39:03 +02:00
Andrei Stefan 3fad9d25f6
SQL: fix COUNT DISTINCT filtering ()
* Use `_count` aggregation value only for not-DISTINCT COUNT function calls
* COUNT DISTINCT will use the _exact_ version of a field (the `keyword` sub-field for example), if there is one
2019-01-08 08:47:35 +02:00
Alpar Torok a7c3d5842a
Split third party audit exclusions by type () 2019-01-07 17:24:19 +02:00
Armin Braun 31c33fdb9b
MINOR: Remove some Deadcode in Gradle () 2019-01-07 09:21:25 +01:00
Andrei Stefan 39a072389c
SQL: add sub-selects to the Limitations page () 2019-01-07 10:08:51 +02:00
Marios Trivyzas e778abaac5
SQL: Improve error message when unable to translate to ES query DSL ()
Improve error message returned to the client when an SQL statement
cannot be translated to a ES query DSL. Cases:

1. WHERE clause evaluates to FALSE => No results returned
1. Missing FROM clause => Local execution, e.g.: SELECT SIN(PI())
3. Special SQL command => Only valid of SQL iface, e.g.: SHOW TABLES

Fixes: 
2019-01-07 09:21:23 +02:00
Marios Trivyzas da3d8fb5b7
SQL: Fix issue with wrong NULL optimization ()
Logical operators OR and AND as well as conditional functions
(COALESCE, LEAST, GREATEST, etc.) cannot be folded to NULL if one
of their children is NULL as is the case for most of the functions.
Therefore, their nullable() implementation cannot return true. On
the other hand they cannot return false as if they're wrapped within
an IS NULL or IS NOT NULL expression, the expression will be folded
to false and true respectively leading to wrong results.

Change the signature of nullable() method and add a third value UKNOWN
to handle these cases.

Fixes: 
2019-01-06 18:29:34 +02:00
Andrei Stefan 3578e69669
SQL: Handle the bwc Joda ZonedDateTime scripting class in Painless ()
* Handle the bwc Joda ZonedDateTime scripting class in Painless

* Integrated the types checking in the already existent method
2019-01-04 09:19:24 +02:00
Costin Leau 40a30c6f5f
SQL: Preserve original source for each expression ()
Improve parsing to save the source for each token alongside the location 
 of each Node/Expression for accurate reproducibility of an expression
 name and source

Fix 
2019-01-04 00:57:50 +02:00
Marios Trivyzas 33137907cf
SQL: Enhance message for PERCENTILE[_RANK] with field as 2nd arg ()
Enhance error message for the case that the 2nd argument of PERCENTILE
and PERCENTILE_RANK is not a foldable, as it doesn't make sense to have
a dynamic value coming from a field.

Fixes: 
2019-01-03 13:55:09 +02:00
Nick Knize b2aa655f46
Upgrade master to lucene-8.0.0-snapshot-a1c6e642aa ()
Updates the master branch to the latest snapshot of Lucene 8.0.
2019-01-02 20:18:19 -06:00
Josh Soref 02aa9f51ee Spelling: correct wrong spellings of similar () 2019-01-02 17:38:43 +01:00
Josh Soref c04d5c5468 Spelling: correct wrong spellings of "input" () 2019-01-02 17:34:37 +01:00
Josh Soref 1df66d21fe Spelling: replace uknown with unknown () 2019-01-02 17:33:02 +01:00
Josh Soref 51cb63f934 Spelling: replace substract with subtract () 2019-01-02 14:15:21 +01:00
Andrei Stefan 9a6c61015c
Use the same format when comparing the error messages containing date fields ()
Test fix: make sure the format in which we check the date is the same as the one we used to format the initial JDBC date field.
2018-12-31 13:41:54 +02:00
Andrei Stefan 09fa827adc
SQL: documentation improvements and updates ()
* Added Limitations page
* Made the aggregations page follow the common template for functions
* Modified all tables to have the first row's cells content centered
* Polishing in other various sections
2018-12-21 23:25:54 +02:00
Costin Leau ac032a0b9d
SQL: Fix bug regarding histograms usage in scripting ()
Allow scripts to correctly reference grouping functions
Fix bug in translation of date/time functions mixed with histograms.
Enhance Verifier to prevent histograms being nested inside other
 functions inside GROUP BY (as it implies double grouping)
Extend Histogram docs
2018-12-20 23:11:56 +02:00
Andrei Stefan 1236461e3e
SQL: Make sure now() always uses milliseconds precision ()
* This change is to account for different system clock implementations
or different Java versions (for Java 8, milliseconds precision is used;
for Java 9+ a system specific clock implementation is used which can
have greater precision than what we need here).
2018-12-20 13:39:55 +02:00
Ryan Ernst cfc0a47232
Core: Deprecate negative epoch timestamps ()
Negative timestamps are currently supported in joda time. These are
dates before epoch. However, it doesn't really make sense to have a
negative timestamp, since this is a modern format. Any dates before
epoch can be represented with normal date formats, like ISO8601.
Additionally, implementing negative epoch timestamp parsing in java time
has an edge case which would more than double the code required. This
commit deprecates use of negative epoch timestamps.
2018-12-20 00:17:06 -08:00
Marios Trivyzas 6221d6be49
SQL: Fix issue with always false filter involving functions ()
When a filter is evaluated to false then it becomes a LocalRelation
with an EmptyExecutable. The LocalRelation in turn, becomes a
LocalExec and the the SkipQueryIfFoldingProjection was wrongly
converting it to a SingletonExecutable. Moreover made a change, so
that the queries without FROM clause, which are supposed to return a
single row, to become a LocalRelation with a SingletonExecutable
instead of EmptyExecutable to avoid mixing up with the ones operating
on a table but with a filter that evaluates to false.

Fixes: 
2018-12-20 09:56:07 +02:00
Julie Tibshirani 5185d61ad1
Make sure to use _doc for the type in SQL REST tests. () 2018-12-19 11:25:45 -08:00
Costin Leau 9584adf9d9
SQL: Enhance Verifier to prevent aggregate or grouping functions from ()
Improve Verifier to prevent aggregate or grouping functions from
 being used in a WHERE clause.

Fix 
2018-12-19 17:14:01 +02:00
Andrei Stefan d31eaf7313
SQL: protocol returns ISO 8601 String formatted dates instead of Long for JDBC/ODBC requests ()
* Change the way the protocol returns date fields from Long values in case
of JDBC/ODBC, to ISO 8601 with millis String.
2018-12-19 16:36:16 +02:00
Alpar Torok e9ef5bdce8
Converting randomized testing to create a separate unitTest task instead of replacing the builtin test task ()
- Create a separate unitTest task instead of Gradle's built in 
- convert all configuration to use the new task 
- the  built in task is now disabled
2018-12-19 08:25:20 +02:00
Nick Knize 20b58f0b0f
[GEO] Fork Lucene's LatLonShape Classes to local lucene package ()
Lucene 7.6 uses a smaller encoding for LatLonShape. This commit forks the LatLonShape classes to Elasticsearch's local lucene package. These classes will be removed on the release of Lucene 7.6.
2018-12-18 16:48:30 -06:00
Marios Trivyzas 74502d7f4b
SQL: Fix wrong appliance of StackOverflow limit for IN ()
Fix grammar so that each element inside the list of values for IN
is a valueExpression and not a more generic expression. Introduce a
mapping for context names as some rules in the grammar are exited with
a different rule from the one they entered.This helps so that the decrement
of depth counts in the Parser's CircuitBreakerListener works correctly.

For the list of values for IN, don't count the
PrimaryExpressionContext as this is not visited on exitRule() due to
the peculiarity in our gramamr with the predicate and predicated.

Fixes: 
2018-12-18 17:07:27 +02:00
Mayya Sharipova f884b2b1cd
Deprecate types in index API ()
* Deprecate types in index API

- deprecate type-based constructors of IndexRequest
- update tests to use typeless IndexRequest constructors
- no yaml tests as they have been already added in 

Relates to 
2018-12-18 08:53:49 -05:00
Andrei Stefan 4bc9bffb4d
SQL: Extend the ODBC metric by differentiating between 32 and 64bit platforms ()
* The "overall" ODBC metric will now track a total of requests between 32bit and 64bit ODBC metrics, being calculated passively, upon request.
2018-12-18 13:29:49 +02:00
Andrei Stefan 1f80c80b3a Add back one line removed by mistake regarding java version check and
COMPAT jvm parameter existence
2018-12-17 19:06:23 +02:00
Costin Leau 6d9d5e397b
SQL: Fix translation of LIKE/RLIKE keywords ()
* SQL: Fix translation of LIKE/RLIKE keywords

Refactor Like/RLike functions to simplify internals and improve query
 translation when chained or within a script context.

Fix 
Fix 
2018-12-17 18:58:06 +02:00
Andrei Stefan 2ed6ab9648
SQL: Concat should be always not nullable () 2018-12-17 14:00:56 +02:00
Costin Leau b376edf269
SQL: Move internals from TimeZone to ZoneId ()
As the internals have moved to java.time, the usage of TimeZone itself
 should be minimized as it creates issues when being converted to ZoneId
Protocol wise the two are mostly identical so consumer should not see
 any difference.
Note that terminology wise, inside the docs, the public API and inside
 the protocol timeZone will continue to be used as it's more widely
 understood as oppose to zoneId which is an implementation detail
 specific to the JVM

Fix 
2018-12-17 13:55:44 +02:00
Costin Leau 3f128a89bc SQL: Disable integration test due to TZ issues
Due to the difference in TZ between H2 and SQL, disable minute test for
 NOW()

Fix 
2018-12-17 13:40:50 +02:00
Andrei Stefan b15f27f6a6
SQL: Scripting support for casting functions CAST and CONVERT () 2018-12-17 13:36:48 +02:00
Marios Trivyzas c0866393ee
SQL: Fix issue with complex HAVING and GROUP BY ordinal ()
When trying to analyse a HAVING condition, we crate a temp Aggregate
Plan which wasn't created correctly (missing the expressions from the
SELECT clause) and as a result the ordinal (1, 2, etc) in the GROUP BY
couldn't be resolved correctly.

Also after successfully analysing the HAVING condition, still the
original plan was returned.

Fixes: 
2018-12-17 11:05:52 +02:00
Alan Woodward c7ac9ef826
Upgrade to lucene snapshot 774e9aefbc ()
Includes LUCENE-8607: improvement to MatchAllDocsQuery
2018-12-14 20:30:07 +00:00
Costin Leau 6ee6bb55e2
SQL: Introduce HISTOGRAM grouping function ()
Introduce Histogram grouping function for bucketing/grouping data based
 on a given range. Both date and numeric histograms are supported using
 the appropriate range declaration (numbers vs intervals).

SELECT HISTOGRAM(number, 50) AS h FROM index GROUP BY h
SELECT HISTOGRAM(date, INTERVAL 1 YEAR) AS h FROM index GROUP BY h

In addition add multiply operator for Intervals
Add docs for intervals and histogram

Fix 
2018-12-14 18:20:37 +02:00
Costin Leau f502ca53d4
SQL: Introduce NOW/CURRENT_TIMESTAMP function ()
Add CURRENT_TIMESTAMP as keyword as well function alongside NOW() 
 These return the current date/time for the  given query, computed when
 the statement reaches the server. For completeness, CURRENT_TIMESTAMP
 also accepts precision as an optional parameter.

Fix 
2018-12-14 15:42:36 +02:00
Marios Trivyzas db8f07c665
SQL: Fix translation to painless for conditionals ()
Add missing `formatTemplate()` for conditional functions which
resulted in incomplete painless script. Moreover the specific
return type of Object in the painless signatures resulted in
casting exceptions when conditional functions are used in the
ORDER BY.

Fixes: 
2018-12-14 14:51:12 +02:00
Marios Trivyzas 730b154c93
SQL: Fix MOD() for long and integer arguments ()
Previously, Math.floorMod was used for integers and longs
which has different logic for negative numbers. Also, the
priority of data types check was wrong as if one of the args
is double the evaluation should be with doubles, then for floats,
then longs and finally integers.

Fixes: 
2018-12-14 00:59:42 +02:00
Andrei Stefan 1270d85ae1
SQL: be lenient for tests involving comparison to H2 but strict for csv spec tests ()
* Add a lenient parameter for floating point numbers and mark csv-spec
tests as not lenient vs. sql-spec tests to be lenient.
2018-12-13 23:29:32 +02:00
Christoph Büscher b33ff16d62
Remove deprecated `useDisMax` from MultiMatchQuery ()
The getters and setters for useDisMax() have been deprecated since at least 6.0,
also there hasn't been any reference to the query parameter in the
documentation. Removing it from the builder and tests and replacing it with
`tieBreaker(1.0f)` where necessary.
2018-12-13 20:13:16 +01:00
Andrei Stefan 347468e916
SQL: do not ignore all fields whose names start with underscore ()
* Do not ignore fields whose names start with underscore, unless they are
meta fields.
* Filter out _size field.
2018-12-13 14:05:16 +02:00
Alan Woodward 9ac7359643
Update lucene to snapshot-7e4555a2fd ()
Includes the following:

* Reversion of doc-values changes in LUCENE-8374; we are interested in seeing if this 
  has an effect on benchmarks for node-stats and index-stats
* More improvements to docvalues updates
2018-12-12 20:18:32 +00:00
Nhat Nguyen 3fb5a12b30 Upgrade to Lucene-8.0.0-snapshot-61e448666d ()
Includes:
- LUCENE-8602: Share TermsEnum if possible while applying DV updates
2018-12-12 06:47:40 +01:00
Andrei Stefan de373060fb
SQL: non ISO 8601 versions of DAY_OF_WEEK and WEEK_OF_YEAR functions ()
* Renamed DAY_OF_WEEK and WEEK_OF_YEAR functions to their ISO version and
added the same functions with different functionality.
* Rewritten the datetime functions documentation to follow the format of the other
functions documentation pages.
2018-12-12 02:29:02 +02:00
Andrei Stefan eead8a144b
SQL: move requests' parameters to requests JSON body () 2018-12-11 19:17:51 +02:00
Ioannis Kakavas d7c5d8049a
Deprecate /_xpack/security/* in favor of /_security/* ()
* This commit is part of our plan to deprecate and ultimately remove the use of _xpack in the REST APIs.

- REST API docs
- HLRC docs and doc tests
- Handle REST actions with deprecation warnings
- Changed endpoints in rest-api-spec and relevant file names
2018-12-11 11:13:10 +02:00
Nhat Nguyen 2a7edca59f
Upgrade to Lucene-8.0.0-snapshot-ef61b547b1 ()
Includes:

- LUCENE-8598: Improve field updates packed values
- LUCENE-8599: Use sparse bitset to store docs in SingleValueDocValuesFieldUpdates
2018-12-10 16:33:49 -05:00
Marios Trivyzas c3dd0d393d
SQL: Simplify function registration and resolution ()
Previously, we used a CamelCase to CAMEL_CASE transformation to get the
primary name of a function from its class name which led to some issues
since there are functions that we don't want to be registered this way
(e.g.: IFNULL). To simplify the logic and avoid and "magic"
transformations in the FunctionRegistry a primary name must be provided
explicitely for each function.

The same change is applied for the function resolution (when a function
is used in an SQL statement). There is no CamelCase to CAMEL_CASE
transformation but only upper-casing is applied (fuNcTiOn -> FUNCTION).
2018-12-10 18:52:09 +02:00
Nhat Nguyen 10feb75eb7
Upgrade to Lucene-8.0.0-snapshot-aaa64d70159 ()
Includes:

LUCENE-8594: DV update are broken for updates on new field
LUCENE-8590: Optimize DocValues update datastructures
LUCENE-8593: Specialize single value numeric DV updates

Relates 
2018-12-06 20:33:25 -05:00
Jim Ferenczi 18866c4c0b
Make hits.total an object in the search response ()
This commit changes the format of the `hits.total` in the search response to be an object with
a `value` and a `relation`. The `value` indicates the number of hits that match the query and the
`relation` indicates whether the number is accurate (in which case the relation is equals to `eq`)
or a lower bound of the total (in which case it is equals to `gte`).
This change also adds a parameter called `rest_total_hits_as_int` that can be used in the
search APIs to opt out from this change (retrieve the total hits as a number in the rest response).
Note that currently all search responses are accurate (`track_total_hits: true`) or they don't contain
`hits.total` (`track_total_hits: true`). We'll add a way to get a lower bound of the total hits in a
follow up (to allow numbers to be passed to `track_total_hits`).

Relates 
2018-12-05 19:49:06 +01:00
Adrien Grand 46209591fe
Propagate a doc-value `format` with inner hits. ()
While sql passes a doc-value `format` when asking for doc-value fields, it
doesn't do it when asking for fields via inner hits.
2018-12-05 14:06:32 +01:00
Alan Woodward 73ceaad03a
Update to lucene-8.0.0-snapshot-c78429a554 ()
Includes:

* A fix for a bug in Intervals.or() (https://issues.apache.org/jira/browse/LUCENE-8586)
* The ability to disable offset mangling in WordDelimiterGraphFilter
        (https://issues.apache.org/jira/browse/LUCENE-8509)
* BM25Similarity no longer multiplies scores by k1 + 1
2018-12-05 12:43:56 +00:00
Andy Bristol a6ff9f7f66
[test] generate unique user names () 2018-12-03 15:08:00 -08:00
Ryan Ernst 95d9cefea7
Build: Fix jdbc jar pom to not include deps ()
This commit adds back the exclusion of dependencies from the pom file
for the jdbc jar, which was accidentally lost in 
2018-11-29 09:39:17 -08:00
Costin Leau 1d458e3f60
SQL: Make INTERVAL millis optional ()
Fractions of the second are not mandatory anymore inside INTERVAL
 declarations

Fix 
2018-11-29 18:52:47 +02:00
Andrei Stefan 525c3b044a
Leftover from https://github.com/elastic/elasticsearch/pull/35964 () 2018-11-29 14:06:48 +02:00
Marios Trivyzas a2338bb116
SQL: Fix issue with wrong data type for scripted Grouping keys ()
When the grouping key of a GROUP BY is a painless script (functions are
involved), the data type of the key was incorrect in certain cases
(Boolean, IP, Date). This resulted in returning wrong data type for this
columns in the query results. E.g.:

```
SELECT COUNT(*), a > 10 AS a FROM t GROUP BY a
```

Fixes: 
2018-11-28 14:29:10 +01:00
Andrei Stefan aabff7318e
SQL: DATABASE() and USER() system functions () 2018-11-28 15:20:04 +02:00
Costin Leau 95346926ef
SQL: Lock down JDBC driver ()
Move classes under the same package to avoid internal classes being
 exposed to the outside. Remove public visibility outside 3 classes:
 EsDriver, EsDataSource and EsTypes.
The driver only has one package, namely org.elasticsearch.xpack.sql.jdbc
Use Es prefix for classes to ease name conflict and indicate their
 destination

Fix 
2018-11-28 12:48:26 +02:00
Christoph Büscher 2f547bac65
Remove deprecated methods from QueryStringQueryBuilder ()
This change removes the deprecated useDisMax() and useAllFields() methods from
the QueryStringQueryBuilder and related tests. The disMax parameter has already
been a no-op since 6.0 and also the useAllFields has been deprecated since 6.0
and there is a direct replacement via defaultField.
2018-11-28 11:09:03 +01:00
Jason Tedor c42d9d91c9
Deprecate X-Pack centric SQL endpoints ()
This commit is part of our plan to deprecate and ultimately remove the
use of _xpack in the REST APIs.
2018-11-27 22:16:21 -05:00
Marios Trivyzas 1da9c6faa0
SQL: Fix translation of math functions to painless ()
`SIGN` and `RADIANS` where wrongly overriding `mathFunction()`.
Converted `mathFunction()` to private in `MathFunction` since it
shouldn't be overriden, as it uses the assigned `MathOperation`
to get the funtion name for painless scripts.

Fixes: 
2018-11-27 15:33:43 +01:00
Marios Trivyzas c91ef1105d
SQL: Implement data type verification for conditionals ()
Add special verifier rule to check that the arguments of conditional
functions are of the same or compatible types. This way the user gets
a descriptive error message with line number and column indicating
where is the offending argument.

Closes: 
2018-11-27 14:46:11 +01:00
Ryan Ernst 10447dd962
Build: Fix jdbc jar to include deps ()
This commit adds back bundling of all deps of the sql jdbc jar. This was
lost in a refactoring of how the shadow plugin is handled for the entire
elasticsearch project.
2018-11-26 16:18:35 -08:00
Marios Trivyzas 3f7cae3f0d
SQL: Implement GREATEST and LEAST functions ()
Add GREATEST(expr1, expr2, ... exprN) and LEAST(expr1, expr2, exprN)
functions which are in the family of CONDITIONAL functions.

Implementation follows PostgreSQL behaviour, so the functions return
`NULL` when all of their arguments evaluate to `NULL`.

Renamed `CoalescePipe` and `CoalesceProcessor` to `ConditionalPipe` and
`ConditionalProcessor` respectively, to be able to reuse them for
`Greatest` and `Least` evaluations. To achieve that `ConditionalOperation`
has been added to differentiate between the functionalities at execution
time.

Closes: 
2018-11-26 18:21:36 +01:00
Costin Leau d291b080de
SQL: SYS COLUMNS returns ODBC specific schema ()
Due to some unresolvable type conflict between the expected definition
 in JDBC vs ODBC, the driver mode is now passed over so that certain
 command can change their results accordingly (in this case SYS COLUMNS)

Fix 
2018-11-26 16:59:09 +02:00
Marios Trivyzas b078e2970c
SQL: Implement null safe equality operator `<=>` ()
This operator handles nulls in different way than the normal `=`.
If one of the operants is `null` and the other not it returns `false`.
If both operants are `null` it returns `true`. Therefore in contrary to
`=`, which returns `null` if at least one of the operants is `null`, this one
never returns `null` as a result.

Closes: 
2018-11-26 14:02:02 +01:00
Costin Leau cd822b7ca8 SQL: Fix incorrect merging of 2018-11-26 12:41:43 +02:00
Costin Leau 633a562208 SQL: Fix incorrect merging of 2018-11-26 12:35:46 +02:00
Costin Leau 971299baf4
SQL: Add filtering to SYS TYPES ()
Fix 
2018-11-26 11:26:24 +02:00
Andrei Stefan 00e6fec718
SQL: XPack FeatureSet functionality ()
* Introduced "client.id" parameter for REST requests
* Bug that made the Verifier run twice, fixed in the Analyzer
* Single node IT and unit testing
2018-11-26 07:11:43 +02:00
Marios Trivyzas 410f570d5f
SQL: Implement NULLIF(expr1, expr2) function ()
NULLIF returns null if the 2 expressions are equal or the
expr1 otherwise.

Closes: 
2018-11-23 22:19:27 +01:00
Costin Leau e22a83554e
SQL: Polish grammar for intervals () 2018-11-23 17:14:52 +02:00
Jim Ferenczi e37a0ef844
Upgrade to lucene-8.0.0-snapshot-67cdd21996 () 2018-11-22 15:42:59 +01:00
Marios Trivyzas 92acf47c16
SQL: Implement NVL(expr1, expr2) ()
Add NVL as alias to IFNULL as they have the same
behaviour. Add basic tests and docs.

Closes: 
2018-11-22 11:41:00 +01:00
Marios Trivyzas d95d885bae
SQL: Implement ISNULL(expr1, expr2) ()
Add ISNULL as an alias of IFNULL as they have the
same behaviour. Add basic test and docs.

Closes: 
2018-11-21 23:15:10 +01:00
Marios Trivyzas e179bd393d
SQL: Implement IFNULL variant of COALESCE ()
IFNULL is a MySQL variant (also used in other DBs) which
takes only 2 arguments and returns the first one that is not null.

Closes: 
2018-11-21 17:07:07 +01:00
Costin Leau 03f003733d
SQL: Perform lazy evaluation of mismatched mappings ()
Move away from performing eager, fail-fast validation of mismatched
 mapping to a lazy evaluation based on the fields actually used in the
 query. This allows queries to run on the parts of the indices that
 "work" which is not just convenient but also a necessity for large
 mappings (like logging) where alignment is hard/impossible to achieve.

Fix 
2018-11-21 17:35:15 +02:00
Costin Leau f0a3d32602
SQL: Introduce INTERVAL support ()
Introduce INTERVAL as a DataType
Add INTERVAL to the grammar which supports the standard SQL declaration
 (without precision):
 > INTERVAL '1 23:45:01.123456789' DAY TO SECOND
 but also number for single unit intervals:
 > INTERVAL 1 YEAR
 as well as the plurals of the units:
 > INTERVAL 2 YEARS
Interval are internally supported as just another Literal being backed
 by java.time.Period and java.time.Duration
Move JDBC away from JDBCType enum to SQLType interface
Refactor DataType by moving it into server core and adding dedicated (and
 much simpler) JDBC driver type
Improve internal JDBC conversion by normalizing on the DataType
Rename JDBC columnInfo to JdbcColumnInfo to differentiate between it and
 the SQL ColumnInfo

Fix 
2018-11-21 15:45:59 +02:00
Christoph Büscher 6638708b56
Remove deprecated QueryStringQueryBuilder#splitOnWhiteSpace ()
This parameter has been deprecated and was ignored since 6.0, so its Java API
methods can be removed.
2018-11-21 10:29:08 +01:00
Marios Trivyzas b1818dbdce
SQL: [docs] Add documentation for COALESCE ()
Follows: 
2018-11-21 01:43:05 +01:00
Christoph Büscher e91f404d16
Remove remains of 'auto_generate_phrase_queries' ()
This parameter in the `query_string` query was deprecated in 6.0 and ignored
since then. Its API methods and remaining uses can be removed in the upcoming
major version.

Relates to 
2018-11-20 16:07:17 +01:00
David Roberts f70b7dc158 Mute DataTypeConversionTests.testConversionToDate
Due to https://github.com/elastic/elasticsearch/issues/35683
2018-11-19 12:55:33 +00:00
Costin Leau 4119409b6d
SQL: Improve validation of unsupported fields ()
Fix bug in Analyzer that caused it to report unsupported fields only
 when declared in projections. The rule has been extended to all field
 declarations.

Fix 
2018-11-18 23:35:18 +02:00
Costin Leau f8e333b117
SQL: Move internals from Joda to java.time ()
Remove/Limit usage of Joda through-out the processors and functions
Use ZonedDateTime wherever possible instead of long/tzId

Fix 
2018-11-17 15:30:27 +02:00
Andrei Stefan eaf010cd73
SQL: clear the cursor if nested inner hits are enough to fulfill the query required limits () 2018-11-15 14:33:47 +02:00
Nick Knize 2591f66a33
upgrade to lucene-8.0.0-snapshot-6d9c714052 () 2018-11-12 10:48:27 -06:00
Marios Trivyzas 55ff96b43f
SQL: Fix query translation for scripted queries ()
IsNull, IsNotNull and Not where generating wrong queries
as the check to generate ScriptQuery was missing.

Fixes: 
2018-11-12 10:42:27 +01:00
Christoph Büscher 09cac321e7
Upgrade to Joda 2.10.1 ()
This version contains a bugfix that allows us to reenable one of our muted tests
in DateTimeUnitTests.

Closes 
2018-11-12 10:02:41 +01:00
Marios Trivyzas 36da6e1671
SQL: Introduce IsNull node to simplify expressions ()
Add `IsNull` node in parser to simplify expressions so that `<value> IS NULL` is
no longer translated internally to `NOT(<value> IS NOT NULL)`

Replace `IsNotNullProcessor` with `CheckNullProcessor` to encapsulate both
isNull and isNotNull functionality.

Closes: 
Fixes: 
2018-11-09 11:32:38 +01:00
Marios Trivyzas c9a84fe361
SQL: Handle null literal for AND and OR in `WHERE` ()
Change `nullable()` logic of AND and OR to false since in the Optimizer
we cannot fold to null as we might be handling and expression in the
SELECT clause.

Introduce folding of null for AND and OR expressions in PruneFilter()
since we now know that we are in HAVING or WHERE clause and we
can fold `null` to `false`

Fixes: 

Co-authored-by: Costin Leau <costin.leau@gmail.com>
2018-11-08 23:32:59 +01:00
Alpar Torok 8a85b2eada
Remove build qualifier from server's Version ()
With this change, `Version` no longer carries information about the qualifier,
we still need a way to show the "display version" that does have both
qualifier and snapshot. This is now stored  by the build and red from `META-INF`.
2018-11-07 14:01:05 +02:00
Marios Trivyzas 42dcdd0aa8
SQL: Improve CircuitBreaker logic for SqlParser ()
Grammar's identifiers can be completely skipped from counting depths
as they just add another level to the tree and they are always children
of some other expression which gets counted.

Increased maximum depth from 100 to 200. After testing on production
configuration with -Xss1m, depths of at least 250 can be used, so being
conservative we put the limit lower.

Fixes: 
2018-11-07 12:08:32 +01:00
Andrei Stefan 432c518266
Upgrade jline to 3.8.2 () 2018-11-06 18:42:57 +02:00
Andrei Stefan c3e4575f61
SQL: new SQL CLI logo ()
Added new SQL CLI logo representing the Elastic logo "painted" with
"Elastic" words, "SQL" under the logo and version on the last line
2018-11-06 17:51:52 +02:00
Marios Trivyzas 1be64a7b8b
SQL: Fix null handling for AND and OR in SELECT ()
Override `process()` in `BinaryLogicProcessor` which doesn't immediately
return null if left or right argument is null, which is the behaviour of
`process()` of the parent class `BinaryProcessor`.

Also, add more tests for `AND` and `OR` in SELECT clause with literal.

Fixes: 
2018-11-06 15:40:16 +01:00
Costin Leau 75e9a639ee
SQL: Introduce Coalesce function ()
Add Coalesce conditional for replacing null values

Fix 
2018-11-06 13:12:24 +02:00
Nick Knize a5e1f4d3a2 Upgrade to lucene-8.0.0-snapshot-31d7dfe6b1 () 2018-11-06 11:55:23 +01:00
Marios Trivyzas 9ac7af6b3e
SQL: Introduce NotEquals node to simplify expressions ()
Add NotEquals node in parser to simplify expressions so that <value1> != <value2> is
no longer translated internally to NOT(<value1> = <value2>)

Closes: 
Fixes: 
2018-11-05 22:23:07 +01:00
Nik Everett f72ef9b5fd
Build: Pull "skip assemble on qa" to common build ()
Pull all of the logic that we use to skip the `assemble` and
`dependenciesInfo` tasks on `qa` projects into one spot in our root
build file.
2018-11-05 16:16:00 -05:00
Marios Trivyzas fd82813660
SQL: [tests] Fix select csv spec and enable it ()
Also, replace `||` and `&&` with `OR` and `AND` as the former are not
SQL standard operators.
2018-11-05 18:45:58 +01:00
Alexander Reelsen 409050e8de
Refactor: Remove settings from transport action CTOR ()
As settings are not used in the transport action constructor, this
removes the passing of the settings in all the transport actions.
2018-11-05 13:08:18 +01:00
Marios Trivyzas 340363b9fa
SQL: Fix null handling for IN => painless script ()
Include `null` literals when generating the painless script for `IN` expressions.
Previously, they were skipped, because of an issue that had been fixed with .

Fixes: 
2018-11-02 10:37:54 +01:00
Andrei Stefan b6659847c2
SQL: handle wildcard expansion on incorrect fields () 2018-11-01 11:30:05 +02:00
Marios Trivyzas 4f78e2b576
SQL: Improve painless script generated from `IN` ()
Replace standard `||` and `==` painless operators with
new `in` method introduced in `InternalSqlScriptUtils`.
This allows the list of values to become a script variable
which is replaced each time with the list of  values provided
by the user.

Move In to the same package as InPipe & InProcessor

Follow up to 

Co-authored-by: Costin Leau <costin.leau@gmail.com>
2018-11-01 10:23:49 +01:00
Nik Everett e28509fbfe
Core: Less settings to AbstractComponent ()
Stop passing `Settings` to `AbstractComponent`'s ctor. This allows us to
stop passing around `Settings` in a *ton* of places. While this change
touches many files, it touches them all in fairly small, mechanical
ways, doing a few things per file:
1. Drop the `super(settings);` line on everything that extends
`AbstractComponent`.
2. Drop the `settings` argument to the ctor if it is no longer used.
3. If the file doesn't use `logger` then drop `extends
AbstractComponent` from it.
4. Clean up all compilation failure caused by the `settings` removal
and drop any now unused `settings` isntances and method arguments.

I've intentionally *not* removed the `settings` argument from a few
files:
1. TransportAction
2. AbstractLifecycleComponent
3. BaseRestHandler

These files don't *need* `settings` either, but this change is large
enough as is.

Relates to 
2018-10-31 21:23:20 -04:00
Costin Leau f87a53451b
SQL: Register missing processors ()
Add registration (and tests) for missing processors in the serialization
chain.

Fix 
2018-10-31 23:07:36 +02:00
Marios Trivyzas bf6f521827
SQL: Fix NPE thrown if HAVING filter evals to null ()
Surround script with `nullSafeFilter` also for `AggFilter` translation.
Fixed query translation tests to properly set `onAggs`.

Fixes: 
2018-10-31 10:32:16 +01:00
Marios Trivyzas 455906d431
SQL: [tests] Remove AbstractBuilderTestCase dep ()
Extend directly from `EsTestCase` to speed up execution.

Fixes: 
2018-10-30 22:31:29 +01:00
Nik Everett 6857d30527
SQL: Move qa directory into sql directory ()
Moves `x-pack/qa/sql/*` into `x-pack/plugin/sql/qa` to make it simpler
to run all of the sql tests. This lines up with how newer projects like
cross cluster replication are testing themselves.
2018-10-30 14:54:15 -04:00
Costin Leau 6abddd8ca6
SQL: Optimizer rule for folding nullable expressions ()
Add optimization for folding nullable expressions with a NULL 
argument. This is a variant of folding for the NULL case.

Fix 
2018-10-30 20:17:20 +02:00
Andrei Stefan 253152172c
SQL: Proper handling of nested fields at the beginning of the columns list () 2018-10-30 15:52:05 +02:00
Pratik Sanglikar f1135ef0ce Core: Replace deprecated Loggers calls with LogManager. ()
Replace deprecated Loggers calls with LogManager.

Relates to 
2018-10-29 15:52:30 -04:00
Marios Trivyzas 42b4f23a76
SQL: Add `CAST` and `CONVERT` to `SHOW FUNCTIONS` ()
Fixes: 
2018-10-29 16:27:07 +01:00
Marios Trivyzas 8d7889d20c
SQL: Implement CAST between STRING and IP ()
This allows comparison between IP fields and STRING input
from the user where automatic conversion is not yet supported (e.g.: for IN)

Closes: 
2018-10-29 13:06:30 +01:00
Marios Trivyzas 731e48beff
SQL: [Test] Fix and enable test with randomness ()
Increase minimum number of elements for List<> ctor arguments
for specific classes that validate the size of the list.

Fixes: 
2018-10-29 12:02:28 +01:00
Marios Trivyzas c9ae1928e0
SQL: Fix function args verification and error msgs ()
Extract data type verification for function arguments to a single place
so that NULL type can be treated as RESOLVED for all functions. Moreover
this enables to have consistent verification error messages for all functions.

Fixes: 
Fixes: 
2018-10-29 11:32:17 +01:00
Costin Leau 14fb7edc1d
SQL: Fix incorrect AVG data type ()
AVG now returns double (not the type of the target field)

Close 
2018-10-28 22:13:04 +02:00
Costin Leau 55d48e4cc1
SQL: Handle aggregation for null group ()
When dealing with a null group, the associated metric aggs need to
return null as well

Fix 
2018-10-26 21:34:01 +03:00
Costin Leau 5a7b8c0e69
SQL: Provide null-safe scripts for Not and Neg ()
Introduce null-safe Painless scripts for Not and Neg
Simplify script generation for Unary functions

Close 
2018-10-26 18:21:14 +03:00
Marios Trivyzas 06d7431950
SQL: Return error with ORDER BY on non-grouped. ()
Previously, for some queries the validation for ORDER BY
fields didn't kick in since a HAVING close or an ORDER BY
with scalar function would add `Filter` and `Project` plans
between the `OrderBy` and the `Aggregate`.

Now the LogicalPlan tree beneath `OrderBy` is traversed and
the ORDER BY fields are properly verified.

Fixes: 
2018-10-25 22:15:28 +02:00
Marios Trivyzas bd143334d3
SQL: Fix edge case: `<field> IN (null)` ()
Handle the case when `null` is the only value in the list so that
it's translated to a `MatchNoDocsQuery`.

Followup to: 
2018-10-25 14:24:11 +02:00
Costin Leau b97546a5a9
SQL: Introduce ODBC mode, similar to JDBC ()
Close 
2018-10-25 12:40:00 +03:00
Andrei Stefan a7e08f462f
SQL: handle X-Pack or X-Pack SQL not being available in a more graceful way ()
Throw a different error message for a http response code of 400, but also when the error itself is of a specific type.
2018-10-25 12:14:49 +03:00
Costin Leau 7570d69254
SQL: Introduce support for IP fields ()
IP fields are recognized and can be used through-out the query

Close 
2018-10-24 22:03:11 +03:00
Marios Trivyzas 98cd7ca861
SQL: Fix queries with filter resulting in NO_MATCH ()
Previously, `Mapper` was returning an incorrect plan which resulted in an
```
SQLFeatureNotSupportedException: Found 1 problem(s)
line 1:8: Unexecutable item
```

Queries with a `WHERE` and/or `HAVING` clause which results in NO_MATCH
are now handled correctly and return 0 rows.

Fixes: 

Co-authored-by: Costin Leau <costin.leau@gmail.com>
2018-10-24 20:36:30 +02:00
Costin Leau f19565c3e0
SQL: Verifier allows aliases aggregates for sorting ()
Improve Verifier rule that prevented grouping with aliases inside aggregates
to not be accepted for ordering.

Close 
2018-10-24 19:31:26 +03:00
Marios Trivyzas 4c73854da7
SQL: Implement null handling for `IN(v1, v2, ...)` ()
Implemented null handling for both the value tested but also for
values inside the list of values tested against.

The null handling is implemented for local processors, painless scripts
and Lucene Terms queries making it available for `IN` expressions occuring
in `SELECT`, `WHERE` and `HAVING` clauses.

Closes: 
2018-10-24 14:42:40 +02:00
Julie Tibshirani 1f42024243 Mute NodeSubclassTests#testReplaceChildren while we await a fix. 2018-10-23 14:00:53 -07:00
Zachary Tong 299d044bfc
Collapse pipeline aggs into single package ()
- Restrict visibility of Aggregators and Factories
- Move PipelineAggregatorBuilders up a level so it is consistent with
AggregatorBuilders
- Checkstyle line length fixes for a few classes
- Minor odds/ends (swapping to method references, formatting, etc)
2018-10-23 16:01:01 -04:00
Costin Leau ca6808e55d
SQL: Support pattern against compatible indices ()
Extend querying support on multiple indices from being strictly
identical to being just compatible.
Use FieldCapabilities API (extended through ) for mapping merging.

Close  
2018-10-23 17:07:51 +03:00
Marios Trivyzas 4a8386f271
SQL: Implement IN(value1, value2, ...) expression. ()
Implement the functionality to translate the
`field IN (value1, value2,...)` expressions to proper Lucene queries
or painless script or local processors depending on the use case.

The `IN` expression can be used in SELECT, WHERE and HAVING clauses.

Closes: 
2018-10-23 14:28:23 +02:00
Marios Trivyzas e9e140790a
SQL: Implement `CONVERT`, an alternative to `CAST` ()
`CONVERT` works exactly like cast with slightly different syntax:
`CONVERT(<value>, <data_type)` as opposed to `CAST(<value> AS <data_type>)`

Moreover it support format of the MS-SQL data types `SQL_<type>`,
e.g.: `SQL_INTEGER`

Closes: 
2018-10-23 11:21:15 +02:00
Marios Trivyzas 1eb76f16b1
SQL: Allow min/max aggregates on date fields ()
Allow `MIN()` and `MAX()` aggregate functions to operate
also on arguments of type DATE apart from the numeric ones.

Fixes: 
2018-10-23 11:11:22 +02:00
Alpar Torok 0536635c44
Upgrade forbiddenapis to 2.6 ()
* Upgrade forbiddenapis to 2.6

Closes 

* Switch forbiddenApis back to official plugin

* Remove CLI based task

* Fix forbiddenApisJava9
2018-10-23 12:06:46 +03:00
Andrei Stefan 91434f7721
SQL: the SSL default configuration shouldn't override the https protocol if used ()
* The default SSL option shouldn't override the https protocol if specified. Fixes https://github.com/elastic/elasticsearch/issues/33817
2018-10-23 11:04:16 +03:00
Ryan Ernst 222652dfce
Scripting: Convert script fields to use script context ()
This commit removes the use of SearchScript for script fields and adds
a new FieldScript.
2018-10-20 16:33:49 -07:00
Costin Leau 52104aac27
SQL: Introduce support for NULL values ()
Make SQL aware of missing and/or unmapped fields treating them as NULL
Make _all_ functions and operators null-safe aware, including when used
in filtering or sorting contexts
Add missing and null-safe doc value extractor
Modify dataset to have null fields spread around (in groups of 10)
Enforce missing last and unmapped_type inside sorting
Consolidate Predicate templating and declaration
Add support for Like/RLike in scripting
Generalize NULLS LAST/FIRST
Introduce early schema declaration for CSV spec tests: to keep the doc
snippets in place (introduce schema:: prefix for declaration)
upfront.

Fix 
2018-10-19 16:44:33 +03:00
Andrei Stefan 60b8118d3a
A constant can be used outside aggregation only queries ()
A constant can now be used outside aggregation only queries.
Don't skip an ES query in case of constants-only selects.
Loosen the binary pipe restriction of being used only in aggregation queries.
Fixes https://github.com/elastic/elasticsearch/issues/31863
2018-10-18 13:33:01 +03:00
Armin Braun 3954d041a0
SCRIPTING: Move sort Context to its Own Class ()
* SCRIPTING: Move sort Context to its own Class
2018-10-17 10:02:44 +01:00
Nik Everett 540dfcf23e
JDBC: Fix artifactId in pom ()
We're publishing jdbc into our maven repo as though its artifactId is
`x-pack-sql-jdbc` but the pom listed the artifactId as `jdbc`. This
fixes the pom to line up with where we're publishing the artifact.

Closes 
2018-10-16 11:02:10 -04:00
Armin Braun ebca27371c
SCRIPTING: Move Aggregation Script Context to its own class ()
* SCRIPTING: Move Aggregation Script Context to its own class
2018-10-15 17:28:05 +01:00
Andrei Stefan d7a94fb6aa
SQL: Functions enhancements (OCTET_LENGTH function, order functions alphabetically, RANDOM function docs) ()
* New OCTET_LENGTH function
* Changed the way the FunctionRegistry stores functions, considering the alphabetic ordering by name
* Added documentation for the RANDOM function
2018-10-09 00:20:18 +03:00
Kazuhiro Sera d45fe43a68 Fix a variety of typos and misspelled words () 2018-10-03 18:11:38 +01:00
Marios Trivyzas 2ba18f50a8
SQL: Remove more ANTLR4 grammar ambiguities ()
The `-` and `+` as a number literal prefix are already
parsed by the rule in `valueExpression`. To accommodate
this, there are some code changes that enables the
`ExpressionBuilder` to parse Literal integers and decimals
together with the `-/+` prefix sign (if exists) and validate
them (wrong format, large numbers, etc.).

Follows: 
2018-10-02 15:26:04 +02:00
Marios Trivyzas a8a2a83d45
SQL: Fix grammar for `*` in arithm expressions ()
Previously, parsing an arithmetic expression with `*` and no spaces,
e.g.: `2*i` threw a parsing exception as the grammar rule for
tableIdentifier was clashing with the rule for arithmetic operator `*`.

This issue comes already in the lexer and the left part of the
expression (in our example `2*`) was recognised as a
TABLE_IDENTIFIER token.

The solution adopted is to allow the `*` wildcard in the table name
only if it's surrounded with double quotes, e.g.: `"my*index"`

Closes: 
2018-10-02 11:47:42 +03:00
Marios Trivyzas eb1113ba78
SQL: Fix function resolution ()
Remove CamelCase to CAMEL_CASE conversion when resolving
a function. Only convert user input to upper case and then
try to match with aliases or primary names.

Keep the internal conversion FunctionName to FUNCTION__NAME
which provides flexibility when registering functions by their class
name.

Fixes: 
2018-10-02 02:06:51 +03:00
Hendrik Muhs e2f310b56c
Fix AggregationFactories.Builder equality and hash regarding order ()
Fixes the equals and hash function to ignore the order of aggregations to ensure equality after serialization
and deserialization. This ensures storing configs with aggregation works properly.

This also addresses a potential issue in caching when the same query contains aggregations but in 
different order. 1st it will not hit in the cache, 2nd cache objects which shall be equal might end up twice in 
the cache.
2018-09-28 13:30:50 +02:00
Costin Leau 15515a616e
SQL: Internal refactoring of operators as functions ()
Centralize and simplify the script generation between operators and functions which are currently decoupled. As part of this process most predicates (<, <=, etc...) were made ScalarFunction as their purpose and functionality is quite similar (see % and MOD functions).
Renamed ProcessDefinition to Pipe
Add ScriptWeaver as a mixin-in interface for script customization
Add logic for equals/lte/lt
Improve BinaryOperator/expression toString
Minimize duplication across string functions

Close 
2018-09-27 23:42:57 +03:00
Christoph Büscher 5f19146bac
[SQL] Clean up LogicalPlanBuilder#doJoin ()
Currently the local `type` and `condition` variables are unused and can be removed.
This code can be added later again if joins are supported.
2018-09-27 16:27:49 +02:00
Christoph Büscher ba3ceeaccf
Clean up "unused variable" warnings ()
This change cleans up "unused variable" warnings. There are several cases were we 
most likely want to suppress the warnings (especially in the client documentation test
where the snippets contain many unused variables). In a lot of cases the unused
variables can just be deleted though.
2018-09-26 14:09:32 +02:00
Marios Trivyzas 5840be6a6b
SQL: Prevent StackOverflowError when parsing large statements ()
Implement circuit breaker logic in the parser which catches expressions
that can blow up the tree and result in StackOverflowError being thrown.

Co-authored-by: Costin Leau <costin.leau@gmail.com>
2018-09-25 19:20:25 +02:00
Marios Trivyzas 2ca177be41
SQL: Fix query translation of GroupBy with Having ()
Two issues are resolved:
1. The `value_type` should be either long or double in case of numeric.
2. The key label for the aggregate filter (having) was duplicate of an aggr key label.

Fixes: 
2018-09-25 12:17:14 +02:00
Costin Leau 17605bf1c6
SQL: Move away internally from JDBCType to SQLType ()
Replace JDBCType enum with SQLType interface for extensibility

Fix 
2018-09-22 11:03:38 +03:00
Andrei Stefan 6fb7e49b22
SQL: TRUNCATE and ROUND functions ()
* Added TRUNCATE function, modified ROUND to accept two parameters instead of one. Made the second parameter optional for both functions.
* Added documentation for both functions.
2018-09-20 15:29:53 +03:00
Marios Trivyzas 168a0b23fe
SQL: Fix ANTL4 Grammar ambiguities. ()
Removed rules in the grammar that were superfluous, as they
are already "caught" other rules in the same context.

Also switched to exact ambig detection for debug mode

Fixes: 
2018-09-20 14:26:07 +02:00
Marios Trivyzas d22b383b9c
SQL: Fix issue with options for QUERY() and MATCH(). ()
Previously multiple comma separated lists of options where not
recognized correctly which resulted in only the last of them
to be taked into account, e.g.:

For the following query:
  SELECT * FROM test WHERE QUERY('search', 'default_field=foo', 'default_operator=and')"
only the `default_operator=and` was finally passed to the ES query.

Fixes: 
2018-09-19 10:16:24 +02:00
Andrei Stefan c6e3231ef3
SQL: day and month name functions tests locale providers enforcement ()
DAYNAME and MONTHNAME functions tests will be skipped if the right JVM parameter (-Djava.locale.providers=COMPAT) is not used in unit testing environment
2018-09-19 07:33:15 +03:00
Jim Ferenczi 241c74efb2
upgrade to a new snapshot of Lucene 8 (7d0a7782fa) () 2018-09-18 18:16:40 +02:00
Costin Leau 91e45ca21b
SQL: Better handling of number parsing exceptions ()
Add proper exceptions in case the parsing of numbers (too large, invalid
format) fails.

Close 
2018-09-18 18:51:48 +03:00
Costin Leau ab9c28a2b1
SQL: Grammar tweak for number declarations ()
Consider plus and minus as part of a number declaration (to avoid the
minus be treated as a negation).

Close 
2018-09-18 11:44:52 +03:00
Costin Leau 736053c658
SQL: Return functions in JDBC driver metadata ()
Update JDBC database metadata to advertised the supported functions
Add aliases to some date/time functions to match the ODBC spec

Fix 
2018-09-14 09:05:34 +03:00
Costin Leau 60ab4f97ab
SQL: Return correct catalog separator in JDBC ()
JDBC DatabaseMetadata returns correct separator (:) for catalog/cluster names.

Fix 
2018-09-13 21:55:44 +03:00
Marios Trivyzas 7d3b99a9b7
SQL: Fix result column names for CAST ()
Previously, when an non-pruned cast (casting as a different
data type) got applied on a table column in the `SELECT` clause,
the name of the result column didn't contain the target data type
of the cast, e.g.:

  SELECT CAST(MAX(salary) AS DOUBLE) FROM "test_emp"

returned as column name:

  CAST(MAX(salary))

instead of:

  CAST(MAX(salary) AS DOUBLE)

Closes 

* Added more tests for trivial casts that are pruned
2018-09-13 10:28:05 +02:00
David Turner 94f6d4560d Revert "Mark NamedDateTimeProcessorTests as @AwaitsFix"
This reverts commit 44a80d61b2.
2018-09-13 07:32:33 +02:00
David Turner 44a80d61b2 Mark NamedDateTimeProcessorTests as @AwaitsFix 2018-09-13 07:24:51 +02:00
Vladimir Dolzhenko cfc20825ab mute NamedDateTimeProcessorTests 2018-09-12 20:34:56 +02:00
Costin Leau 91bca174f5
SQL: Make Literal a NamedExpression ()
* SQL: Make Literal a NamedExpression

Literal now is a NamedExpression reducing the need for Aliases for
folded expressions leading to simpler optimization rules.

Fix 
2018-09-11 18:47:49 +03:00
Andrei Stefan a3e1f1e46f
SQL: Adds MONTHNAME, DAYNAME and QUARTER functions ()
* Added monthname, dayname and quarter functions
* Updated docs tests with the new functions
2018-09-11 14:35:34 +03:00
Andrei Stefan a55fa4fd6b
Fix Replace function. Adds more tests to all string functions. () 2018-09-11 11:00:56 +03:00
Marios Trivyzas f441bb87ad
SQL: Fix result column names for arithmetic functions ()
Previously, when an arithmetic function got applied on a
table column in the `SELECT` clause, the name of the result
column contained weird characters used internally when
processing the SQL statement e.g.:

  SELECT CHAR(emp_no % 10000) FROM "test_emp"

returned:

  CHAR((emp_no{f}#14) % 10000))

as the column name instead of:

  CHAR((emp_no) % 10000))

Also, fix an issue that causes a ClassCastException to be thrown
when using functions where both arguments are literals.

Closes 
Closes 
2018-09-10 22:02:11 +02:00
Alan Woodward 39c3234c2f
Upgrade to latest Lucene snapshot ()
* LeafCollector.setScorer() now takes a Scorable
* Scorers may not have null Weights
* IndexWriter.getFlushingBytes() reports how much memory is being used by IW threads writing to disk
2018-09-10 20:51:55 +01:00
Colin Goodheart-Smithe 79e7969734
Removes redundant test method in SQL tests () 2018-09-07 13:10:27 +01:00
Costin Leau 7b923ea604
SQL: Improve alias vs index resolution ()
Improve pattern resolution for aliases vs indices
2018-09-07 07:24:43 +03:00
Jim Ferenczi 7ad71f906a
Upgrade to a Lucene 8 snapshot ()
The main benefit of the upgrade for users is the search optimization for top scored documents when the total hit count is not needed. However this optimization is not activated in this change, there is another issue opened to discuss how it should be integrated smoothly.
Some comments about the change:
* Tests that can produce negative scores have been adapted but we need to forbid them completely: 

Closes 
2018-09-06 14:42:06 +02:00
Costin Leau d7965ba681
SQL: Align SYS TABLE for ODBC SQL_ALL_* args ()
Fix a bug in SYS TABLES command that did skipped SQL_ALL_* arguments for
catalog and table types

Fix 
2018-09-05 10:44:18 +03:00
Costin Leau 17c7f99343
SQL: Show/desc commands now support table ids ()
Extend SHOW TABLES, DESCRIBE and SHOW COLUMNS to support table
identifiers not just SQL LIKE pattern.
This allows both Elasticsearch-style multi-index patterns and SQL LIKE.
To disambiguate between the two (as the " vs ' can be easy to miss),
the grammar now requires LIKE keyword as a prefix for all LIKE-like
patterns.

Also added some docs comparing the two types of patterns.

Fix 
2018-09-04 16:54:10 +03:00
Andrei Stefan 0c4b3162be
SQL: test coverage for JdbcResultSet ()
* Tests for JdbcResultSet
* Added VARCHAR conversion for different types
* Made error messages consistent: they now contain both the type that fails to be converted and the value itself
2018-08-31 16:12:01 +03:00
Andrei Stefan 20e1b5e2fe
Different handling for security specific errors in the CLI. Fix for https://github.com/elastic/elasticsearch/issues/33230 () 2018-08-31 13:08:32 +03:00
Costin Leau 73eb4cbbbe
SQL: Support multi-index format as table identifier ()
Extend tableIdentifier to support multi-index format; not just * but
also enumeration and exclusion

Fix 
2018-08-31 10:45:25 +03:00
Costin Leau 83c3d7a6cf
SQL: prevent duplicate generation for repeated aggs ()
Prevent generation of duplicate aggs caused by repetitive functions,
leading to invalid query.

Fix 
2018-08-31 00:13:03 +03:00
Alpar Torok f29f0af7bc
Consider multi release jars when running third party audit ()
Exclude classes meant for newer versions than what we are auditing against, those classes won't be found. There's no reason to exclude JDK classes from newer versions, with this PR, we will not extract them in the first place.
2018-08-29 09:53:04 +03:00
Alpar Torok 2cc611604f
Run Third party audit with forbidden APIs CLI (part3/3) ()
The new implementation is functional equivalent with the old, ant based one.
It parses task standard error to get the missing classes and violations in the same way.
I considered re-using ForbiddenApisCliTask but Gradle makes it hard to build inheritance with tasks that have task actions , since the order of the task actions can't be controlled.
This inheritance isn't dully desired either as the third party audit task is much more opinionated and we don't want to expose some of the configuration.
We could probably extract a common base class without any task actions, but probably more trouble than it's worth.

Closes 
2018-08-28 10:03:30 +03:00
Andrei Stefan 3d9ca4baee
SQL: Enable aggregations to create a separate bucket for missing values ()
Enable aggregations to create a separate bucket for missing values.
2018-08-27 17:56:28 +03:00
Andrei Stefan de95dead2d
SQL: skip uppercasing/lowercasing function tests for AZ locales as well ()
* Added the rest of the Locales that have different behavior for uppercasing/lowercasing scenarios to the skip list
2018-08-23 00:21:38 +03:00
Alpar Torok 82d10b484a
Run forbidden api checks with runtimeJavaVersion ()
Run forbidden APIs checks with runtime hava version
2018-08-22 09:05:22 +03:00
Nik Everett 2c81d7f77e
Build: Rework shadow plugin configuration ()
This reworks how we configure the `shadow` plugin in the build. The major
change is that we no longer bundle dependencies in the `compile` configuration,
instead we bundle dependencies in the new `bundle` configuration. This feels
more right because it is a little more "opt in" rather than "opt out" and the
name of the `bundle` configuration is a little more obvious.

As an neat side effect of this, the `runtimeElements` configuration used when
one project depends on another now contains exactly the dependencies needed
to run the project so you no longer need to reference projects that use the
shadow plugin like this:

```
testCompile project(path: ':client:rest-high-level', configuration: 'shadow')
```

You can instead use the much more normal:

```
testCompile "org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}"
```
2018-08-21 20:03:28 -04:00
Alpar Torok 4b34b3f4aa
Set forbidden APIs target compatibility to compiler java version ()
Set forbidden apis target compatibility to compiler version

Fix outstanding deprecation
2018-08-20 09:27:02 +03:00
Andrei Stefan 7b618f3db4
SQL: Bug fix for the optional "start" parameter usage inside LOCATE function ()
The incorrect NodeInfo is created when the optional parameter is not used, leading to the incorrect constructor being used. Simplified LocateFunctionProcessorDefinition by using one constructor instead of two.
Fixes https://github.com/elastic/elasticsearch/issues/32554
2018-08-09 19:30:02 +03:00
Andrei Stefan 6750e15773
SQL: Ignore H2 comparative tests for uppercasing/lowercasing string functions ()
Skip the comparative tests using lowercasing/uppercasing against H2 (which considers the Locale).
ES-SQL is, so far, ignoring the Locale.
Still, the same queries are executed against ES-SQL alone and results asserted to be correct.
2018-08-09 19:28:48 +03:00
Nicholas Knize e162127ff3 Upgrade to Lucene-7.5.0-snapshot-13b9e28f9d
The main feature is the inclusion of bkd backed geo_shape with
INTERSECT, DISJOINT, WITHIN bounding box and polygon query support.
2018-08-09 11:15:02 -05:00
Armin Braun 580d59e2d7
CORE: Upgrade to Jackson 2.8.11 ()
* closes 
2018-08-08 12:04:25 +02:00
Armin Braun 0a67cb4133
LOGGING: Upgrade to Log4J 2.11.1 ()
* LOGGING: Upgrade to Log4J 2.11.1
* Upgrade to `2.11.1` to fix memory leaks in slow logger when logging large requests
   * This was caused by a bug in Log4J https://issues.apache.org/jira/browse/LOG4J2-2269 and is fixed in `2.11.1` via https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=9496c0c
* Fixes 
* Fixes 
2018-08-06 14:56:21 +02:00
Andrei Stefan 9e1e38ff51
Minor fix for javadoc (applicable for java 11). () 2018-08-02 23:46:08 +03:00
David Turner 2db420a81d Add @AwaitsFix for 2018-08-01 17:26:45 +01:00
David Turner 621350c1b9 Remove broken @link in Javadoc 2018-08-01 17:12:55 +01:00
Andrei Stefan 4c388539a0
SQL: Added support for string manipulating functions with more than one parameter ()
Added support for string manipulating functions with more than one parameter:
CONCAT, LEFT, RIGHT, REPEAT, POSITION, LOCATE, REPLACE, SUBSTRING, INSERT
2018-08-01 12:29:06 +03:00
Jim Ferenczi 53ff06e621
Upgrade to Lucene-7.5.0-snapshot-608f0277b0 ()
The main highlight is the removal of the reclaim_deletes_weight in the TieredMergePolicy.
The es setting index.merge.policy.reclaim_deletes_weight is deprecated in this commit and the value is ignored. The new merge policy setting setDeletesPctAllowed should be added in a follow up.
2018-07-27 08:28:51 +02:00
Nik Everett e6b9f59e4e
Build: Shadow x-pack:protocol into x-pack:plugin:core ()
This bundles the x-pack:protocol project into the x-pack:plugin:core
project because we'd like folks to consider it an implementation detail
of our build rather than a separate artifact to be managed and depended
on. It is now bundled into both x-pack:plugin:core and
client:rest-high-level. To make this work I had to fix a few things.

Firstly, I had to make PluginBuildPlugin work with the shadow plugin.
In that case we have to bundle only the `shadow` dependencies and the
shadow jar.

Secondly, every reference to x-pack:plugin:core has to use the `shadow`
configuration. Without that the reference is missing all of the
un-shadowed dependencies. I tried to make it so that applying the shadow
plugin automatically redefines the `default` configuration to mirror the
`shadow` configuration which would allow us to use bare project references
to the x-pack:plugin:core project but I couldn't make it work. It'd *look*
like it works but then fail for transitive dependencies anyway. I think
it is still a good thing to do but I don't have the willpower to do it
now.

Finally, I had to fix an issue where Eclipse and IntelliJ didn't properly
reference shadowed transitive dependencies. Neither IDE supports shadowing
natively so they have to reference the shadowed projects. We fix this by
detecting `shadow` dependencies when in "Intellij mode" or "Eclipse mode"
and adding `runtime` dependencies to the same target. This convinces
IntelliJ and Eclipse to play nice.
2018-07-24 11:53:04 -04:00
Alexander Reelsen c5cde96691
Dependencies: Upgrade to joda time 2.10 ()
Changelog: http://www.joda.org/joda-time/changes-report.html
2018-07-20 10:18:38 +02:00
Nik Everett 1b97652a4c
Build: Move shadow customizations into common code ()
Moves the customizations to the build to produce nice shadow jars and
javadocs into common build code, mostly BuildPlugin with a little into
the root build.gradle file. This means that any project that applies the
shadow plugin will automatically be set up just like the high level rest
client:
* The non-shadow jar will not be built
* The shadow jar will not have a "classifier"
* Tests will run against the shadow jar
* Javadoc will include all of the shadowed classes
* Service files in `META-INF/services` will be merged
2018-07-17 14:20:41 -04:00
Costin Leau 20ea72e2f2
SQL: allow LEFT and RIGHT as function names ()
Due to the way ANTLR works, any declared tokens need to be accounted for
manually inside function names (otherwise a different rule gets applied).

Fix 
2018-07-16 23:42:44 +03:00
Christoph Büscher 92a9bb2b96 Re-instate link in StringFunctionUtils javadocs
The previous errors in compileJava were not cause by the brackets but my the
content of the @link section. Corrected this so its a working javadoc link again.
2018-07-13 14:36:44 +02:00
Christoph Büscher e31a877a64 Fix problematic chars in javadoc
Java 11 complains about unescaped ">" characters in javadocs. Also fixed some
compiler complaints about javadoc in StringFunctionUtils.
2018-07-13 11:13:24 +02:00
Andrei Stefan edf83c1d87
SQL: Add support for single parameter text manipulating functions ()
Added support for ASCII, BIT_LENGTH, CHAR, CHAR_LENGTH, LCASE, LENGTH, LTRIM, RTRIM, SPACE, UCASE functions.
Wherever Painless scripting is necessary (WHERE conditions, ORDER BY etc), those scripts are being used.
2018-07-12 15:05:42 +03:00
Costin Leau dc633e0000
SQL: Support for escape sequences ()
Enhance grammar to allow JDBC/ODBC escape sequences, namely
- date, time and timestamp {d ''}, {t ''} and {ts ''}
- guid {guid ''}
- LIKE escape {escape ''}
- scalar function {fn }

Fix 
2018-07-11 23:36:39 +03:00
Costin Leau 6136e49a05
SQL: HAVING clause should accept only aggregates ()
Improve Verifier to allow HAVING clauses only on aggregates

Close 
2018-07-11 23:31:46 +03:00
Costin Leau 9ffb26ab02
SQL: Remove restriction for single column grouping ()
For historical reasons SQL restricts GROUP BY to only one field.
This commit removes the restriction and improves the test suite with
multi group by tests.

Close 
2018-07-06 20:55:27 +03:00
hanbj 03adbf2a39 Check timeZone() argument in AbstractSqlQueryRequest ()
A value of `null` will throw an IAE.
2018-07-06 14:35:03 +02:00
Costin Leau 89cb0872cf
SQL: Fix incorrect HAVING equality ()
Fix bug that causes `HAVING a = b` to be translated ad-litteram in
Painless which uses `==` for equality checks not `=`.

Close 
2018-07-06 12:46:57 +03:00
Costin Leau 07470c950b
SQL: Allow long literals ()
Fix bug that caused integral literals to be only Integer (rejecting
Long). This commit fixes that and picks either an Integer or Long based
on size.
2018-07-05 20:07:03 +03:00
Costin Leau 6e9bd2652f
SQL: Fix incorrect message for aliases ()
* SQL: Fix incorrect message for aliases

Fix the naming in the verification message thrown for aliases over
multiple indices with different mappings.
2018-07-05 19:49:58 +03:00
Costin Leau 79193727bd SQL: Update CLI logo 2018-07-04 16:15:29 +03:00
Costin Leau de9e56aa01
DOC: Add examples to the SQL docs ()
Significantly improve the example snippets in the documentation.
The examples are part of the test suite and checked nightly.
To help readability, the existing dataset was extended (test_emp renamed
to emp plus library).
Improve output of JDBC tests to be consistent with the CLI
Add lenient flag to JDBC asserts to allow type widening (a long is
equivalent to a integer as long as the value is the same).
2018-07-03 16:56:31 +03:00
Andrei Stefan ce78925732
JDBC: Fix stackoverflow on getObject and timestamp conversion ()
StackOverflowError fix in JdbcResultSet getObject method.
Fix Timestamp conversion bug when getting the value of a time column.
2018-07-03 13:55:33 +03:00
Christoph Büscher 31aabe4bf9
Clean up double semicolon code typos () 2018-07-02 15:14:44 +02:00
Alpar Torok 200e1f45f2
Fix gradle4.8 deprecation warnings ()
* remove explicit wrapper task

It's created by Gradle and triggers a deprecation warning
Simplify configuration

* Upgrade shadow plugin to get rid of Gradle deprecation

* Move compile configuration to base plugin

Solves Gradle deprecation warning from earlier Gradle versions

* Enable stable publishing in the Gradle build

* Replace usage of deprecated property

* bump Gradle version in build compare
2018-06-29 19:17:19 +00:00
Igor Motov 0b1a0641ef
SQL: Refactor package names of sql-proto and sql-shared-proto projects ()
- renames project `sql-proto` to `sql-action`,
- renames package `sql.plugin` to `sql.action`
- renames project `sql-shared-client` to `sql-client`
- renames package `sql.shard.client` to `sql.client`
- renames project `sql-shared-proto` to `sql-proto`

Closes 
2018-06-28 05:56:16 -07:00
Alpar Torok 8557bbab28
Upgrade gradle wrapper to 4.8 ()
* Move to Gradle 4.8 RC1

* Use latest version of plugin

The current does not work with Gradle 4.8 RC1

* Switch to Gradle GA

* Add and configure build compare plugin

* add work-around for https://github.com/gradle/gradle/issues/5692

* work around https://github.com/gradle/gradle/issues/5696

* Make use of Gradle build compare with reference project

* Make the manifest more compare friendly

* Clear the manifest in compare friendly mode

* Remove animalsniffer from buildscript classpath

* Fix javadoc errors

* Fix doc issues

* reference Gradle issues in comments

* Conditionally configure build compare

* Fix some more doclint issues

* fix typo in build script

* Add sanity check to make sure the test task was replaced

Relates to . It seems like Gradle has an inconsistent behavior and
the taks is not always replaced.

* Include number of non conforming tasks in the exception.

* No longer replace test task, create implicit instead

Closes . The issue has full context in comments.

With this change the `test` task becomes nothing more than an alias for `utest`.
Some of the stand alone tests that had a `test` task now have `integTest`, and a
few of them that used to have `integTest` to run multiple tests now only
have `check`.
This will also help separarate unit/micro tests from integration tests.

* Revert "No longer replace test task, create implicit instead"

This reverts commit f1ebaf7d93e4a0a19e751109bf620477dc35023c.

* Fix replacement of the test task

Based on information from  replace the task taking
into account the task providres.
Closes .

* Only apply build comapare plugin if needed

* Make sure test runs before integTest

* Fix doclint aftter merge

* PR review comments

* Switch to Gradle 4.8.1 and remove workaround

* PR review comments

* Consolidate task ordering
2018-06-28 08:13:21 +03:00
Andrei Stefan 400db4f37d
JDBC driver prepared statement set* methods ()
Added setObject functionality and tests for it
2018-06-27 10:05:39 +03:00
Ryan Ernst 7a150ec06d
Core: Combine doExecute methods in TransportAction ()
TransportAction currently contains 2 doExecute methods, one which takes
a the task, and one that does not. The latter is what some subclasses
implement, while the first one just calls the latter, dropping the given
task. This commit combines these methods, in favor of just always
assuming a task is present.
2018-06-22 15:03:01 -07:00
Adrien Grand f023e95ae0
Upgrade to Lucene 7.4.0. ()
This moves Elasticsearch from a recent 7.4.0 snapshot to the GA release.
2018-06-22 16:17:17 +02:00
Ryan Ernst 4f9332ee16
Core: Remove ThreadPool from base TransportAction ()
Most transport actions don't need the node ThreadPool. This commit
removes the ThreadPool as a super constructor parameter for
TransportAction. The actions that do need the thread pool then have a
member added to keep it from their own constructor.
2018-06-21 11:25:26 -07:00
Ryan Ernst 401800d958
Core: Remove index name resolver from base TransportAction ()
Most transport actions don't need to resolve index names. This commit
removes the index name resolver as a super constructor parameter for
TransportAction. The actions that do need the resolver then have a
member added to keep the resolver from their own constructor.
2018-06-19 17:06:09 -07:00
Ryan Ernst e67aa96c81
Core: Combine Action and GenericAction ()
Since , Action no longer has anything but a call to the
GenericAction super constructor. This commit renames GenericAction
into Action, thus eliminating the Action class. Additionally, this
commit removes the Request generic parameter of the class, since
it was unused.
2018-06-18 23:53:04 +02:00
Igor Motov c3084a332b
SQL: Fix rest endpoint names in node stats ()
Fixes wrong name for the sql translate endpoint and makes rest endpoint
names in stats more consistent.
2018-06-15 19:07:47 -04:00
Nhat Nguyen 8453ca638d
Upgrade to Lucene-7.4.0-snapshot-518d303506 () 2018-06-15 10:58:21 -04:00
Costin Leau f7a0cafe55 SQL: Fix build on Java 10
Due to a runtime classpath clash, featureAware task was failing on JVMs
higher than 1.8 (since the ASM version from Painless was used instead
which does not recognized Java 9 or 10 bytecode) causing the task to
fail.
This commit excludes the ASM dependency (since it's not used by SQL
itself).
2018-06-14 18:30:27 +03:00
Costin Leau 43cb24035e
SQL: Whitelist SQL utility class for better scripting ()
Add SQL class for reusing code inside SQL functions within Painless

Fix 
2018-06-13 23:08:18 +03:00
Tanguy Leroux bf58660482
Remove all unused imports and fix CRLF ()
The X-Pack opening and the recent other refactorings left a lot of 
unused imports in the codebase. This commit removes them all.
2018-06-11 15:12:12 +02:00
Igor Motov 01140a3ad8
SQL: Make a single JDBC driver jar ()
Replaces zip archive containing multiple jars with a single JDBC driver jar 
that shades all external dependencies.

Closes 
2018-06-08 10:15:28 -04:00
Jason Tedor 94be9b471f
Rename elasticsearch-core to core ()
This commit renames :libs:elasticsearch-core to :libs:core.
2018-06-07 16:50:21 -04:00
Tim Brooks 237f9b8930
Add nio-transport as option for http smoke tests ()
This is related to  and . This commit adds the transport-nio
plugin as a random option when running the http smoke tests. As part of
this PR, I identified an issue where cors support was not properly
enabled causing these tests to fail when using transport-nio. This
commit also fixes that issue.
2018-06-07 09:46:36 -06:00
Nhat Nguyen abe61159a8
Upgrade to Lucene-7.4.0-snapshot-0a7c3f462f ()
This snapshot includes:
- LUCENE-8341: Record soft deletes in SegmentCommitInfo which will resolve 
- LUCENE-8335: Enforce soft-deletes field up-front
2018-06-04 14:18:46 -04:00
Ryan Ernst 46e8d97813
Core: Remove RequestBuilder from Action ()
This commit removes the RequestBuilder generic type from Action. It was
needed to be used by the newRequest method, which in turn was used by
client.prepareExecute. Both of these methods are now removed, along with
the existing users of prepareExecute constructing the appropriate
builder directly.
2018-05-31 16:15:00 +02:00