* SQL: update support for nested docs
Expand sample data with nested docs
Optimize source generation for nested parents
Nested objects fields are specified in inner-hits and don't need to be
specified at the top-level query. Further more disable parent source if
not needed.
ComputingFieldRef needs to return the hitName of its wrapped children
otherwise nested values cannot be extracted
Disable GROUP BY/HAVING on nested fields
Update FieldAttribute requirements in the random tests
Original commit: elastic/x-pack-elasticsearch@e44951b5f6
Always use term equality for analyzed terms by falling back (to possible
not present) to the not-analyzed field.
Add clarifying comment in test
Original commit: elastic/x-pack-elasticsearch@9e735d3fef
The grammar definition should not require the exact prediction on the
listener. Falling back to it hides potential ambiguities.
Moved it to a separate method so it can be enabled for debugging in
development similar to Painless picky mode.
Original commit: elastic/x-pack-elasticsearch@969cb0b5cb
Adds a mode parameter to all SQL-related requests. The mode parameter is used for license checks as well as to define the response content. For now only two modes are supported plain (default) and jdbc. We will add other modes in the future as we add more clients.
Relates elastic/x-pack-elasticsearch#3419
Original commit: elastic/x-pack-elasticsearch@b49ca38d4b
Tweak the grammar to differentiate between table and normal identifier.
The table one allows wildcard while the normal one (for fields) does not.
Original commit: elastic/x-pack-elasticsearch@a714e950db
Converts the collection of fields and the calculation of depth for `ProcessorDefinition`s
to OO style tree traversal without the need for `Node` or `instanceof` tests.
Original commit: elastic/x-pack-elasticsearch@5d0517af29
Replaces the `ExpressionIdGenerator` class with a static method and drops
the `jvmId` field from the `ExpressionId` altogether because it isn't needed.
We still have the potential to roll over expression ids if the server lives for
a long time but it is quite unlikely and rolling over only matters if we roll
over in the same query. So long as each expression id is unique to a
particular query we're fine.
Original commit: elastic/x-pack-elasticsearch@fe3d7f7216
Right now `ProcessorDefinition#resolveAttributes` relies on reference
equality to detect when the rewrite does nothing. At least, all the
nodes rely on this. Maybe this isn't that important, but it is what we
do so we may as well document it.
Original commit: elastic/x-pack-elasticsearch@662372db14
Add support for aliases and indices pattern
Enhance ShowTable info to differentiate between aliases and indices
Add regex filtering of index names
Handle security exceptions (in case of no privileges or no matching)
Original commit: elastic/x-pack-elasticsearch@91e3674ca7
There is an error in the optimizer that causes expressions that look like
`a OR FALSE` to not be rewritten to `a`.
Original commit: elastic/x-pack-elasticsearch@8d19b77b8b
Break lines longer than 140 characters in the planner package to make
them a bit easier to read and make checkstyle happy. It'll make some
merge conflicts but we should be able to deal with them easilly enough.
Original commit: elastic/x-pack-elasticsearch@de8c116f33
Break lines over 140 characters in the expression package to make them a
bit easier to read and to make checkstyle happy.
Original commit: elastic/x-pack-elasticsearch@89487a79cc
Break lines longer than 140 characters in the analyzer package into
multiple lines so they are easier to read and to appease checkstyle.
Original commit: elastic/x-pack-elasticsearch@74c4c6e4ad
Break the lines longer than 140 characters in the querydsl package into
multiple lines to make them easier to read. And to make checkstyle
happy.
Original commit: elastic/x-pack-elasticsearch@cffef88490
SQL's parse tree visitors had some lines longer than 140 characters.
This break them into multiple lines.
Original commit: elastic/x-pack-elasticsearch@58310b02f8
Adds line breaks in long lines in SQL's function package. Rewrites one
line to use `string + string` style instead of `String.format` style
because that is "more normal" in Elasticsearch.
Original commit: elastic/x-pack-elasticsearch@2f4d0358af
Reflows all the text so it wraps around 75 columns for pleasing reading.
And fixes checkstyle errors for the lines that wrap after 140!
Original commit: elastic/x-pack-elasticsearch@9630c8c32e
Collapses the interface `FunctionRegistry`, and the classes
`AbstractFunctionRegistry` and `DefaultFunctionRegistry` into a single
class, `FunctionRegistry` and adds some tests for the ctor referencing
behavior inroduced in elastic/x-pack-elasticsearch#3442.
Original commit: elastic/x-pack-elasticsearch@52a697e9b8
* Replaces long line comment with rewritten javadoc with nice line feeds
* Adds some line breaks in a few log lines
Original commit: elastic/x-pack-elasticsearch@00dc7cc9c8
This replaces the marker interfaces and reflection that we once used to
construct functions with method references to constructors. It uses a
few overloaded methods to build the `FunctionDefinition`s from the
method references that adapt the various forms of `Function`
constructors that we have into
`BiFunction<UnresolvedFunction, DateTimeZone, Function>` so that the
compiler can do the complex task of picking the appropriate adapter. It
is good at that sort of thing.
Many of these overloaded functions have `@SuppressWarnings("overloads")`
because they are ambiguous if you wrote one as a lambda without type
parameters. Since we always use constructor references this isn't a
problem.
It does not remove the reflection from function naming or from function
type derivation. This is big enough and these seemed significantly less
fraught.
Original commit: elastic/x-pack-elasticsearch@528d05754b
SQL's `Node` class is a utility for performing tree traversal and
rewrites using reflection. We're not big fans of the reflection part of
that we feel that, where possible, the tree traversal should be done
explicitly.
In this case `Query`'s tree is traversed for three things:
1. To generate the Elasticsearch `QueryBuilder`s. This uses explict tree
traversal and I left it that way.
2. To ehance sorts on nested fields with the filter in the nested field.
I added `enrichNestedSort` to `Query` so each query can implement this
on its own.
3. To add inner hits that are not explicitly mentioned in the query
already when they need to be fetched. I added `containsNestedField` and
`addNestedField` to `Query` to support this.
Note: The nested field code is somewhat dead because we don't support
nested fields at the moment but SQL once did. I've tried to keep it
mostly intact but it is difficult to know for sure if it is still
functioning the same way that it has always functioned.
Original commit: elastic/x-pack-elasticsearch@5d8a8d687a
* SQL: Move shared REST client methods to shared-client
This commit is a preliminary step for moving JDBC to the REST client. It extracts the common REST clients from CLI and moves it to shared-client. This will allow us to move to the 5 project setup: rest-proto, shared-client, server, jdbc, cli with the following dependencies:
server <-- rest-proto
shared-client <-- rest-proto
jdbc <-- shared-client
cli <-- shared-client
Relates to elastic/x-pack-elasticsearch#3419
Original commit: elastic/x-pack-elasticsearch@2e6a134de0
Switch attribute resolution from tree matching to OO. Adds
`ProcessorDefinition#resolveAttributes` which subclasess implement to
rewrite themselves against a query. `AttributeInput`s use this to
replace themselves with `ReferenceInput`s.
Original commit: elastic/x-pack-elasticsearch@97270d2ea4
Instead of ignoring or throwing an exception, unsupported types are read
If accessed, an error is returned (nicer than the mapping error).
When using * just like with object fields, they are filtered out.
Original commit: elastic/x-pack-elasticsearch@dd244f931c
Switches the "is this query aggs only?" question from pattern matching
on the column tree to an OO-style "ask the columns if they can be aggs
only" method.
I expect this could have been less code if I was willing to define
`supportedByAggsOnlyQuery` as `true` at the top of the
`ProcessorDefinition` object tree and override it only on nodes
`ReferenceInput` and `ScoreProcessorDefinition` but this feels dirty to
me. I tend to think of a superclass as a list of questions that all the
subclasses have to answer rather than a list of behaviors to share.
Pulling the `return true` up saves a few lines of code but breaks my
ability to reason about subclasses.
Original commit: elastic/x-pack-elasticsearch@b1338543cb
* SQL: Add support for object/inner/dotted fields
Improve validation when selecting compound fields
Improve fallback to exact field for text fields
Consolidate various field attributes into one
Consolidate various field HitExtractors into one
Improve grammar for column declaration
Update response of embedded server
Improve index validation to allow use of internal indices
Add clean-up of scroll in case of server errors
By default thrown an exception on multi-valued fields
Original commit: elastic/x-pack-elasticsearch@45b73fe0dc
We accidentally stopped returning fields in the same order that the
user asked for them in but some docs tests caught it.
Original commit: elastic/x-pack-elasticsearch@586e3cf207