Open MusKaya opened 3 years ago
@bitsondatadev fyi
@bitsondatadev @findepi @martint Is this valid? Do we support regex based tables currently? Is this something we should start supporting because elasticsearch supports?
@bitsondatadev @findepi @martint Is this valid? Do we support regex based tables currently? Is this something we should start supporting because elasticsearch supports?
I remember at one point I had to define an alias to get the wildcard behavior but that may have been on Presto (before the Presto/Trino split) and there's been a lot of changes on the Trino side since. I wonder if @MusKaya's ability to do wildcard comes from passthrough queries or if we actually support wildcard semantics.
It might be fine to do it this way, provided the passthrough queries still use the caching and merging of indices you're adding in #8202. The only questions in my mind is how is that referenced in cache if we currently use the alias name. We would need to figure that part out. It could just be some sort of wildcard signature.
Could you also write a test at the bare minimum to see if the wildcard semantics work with your changes via passthrough queries?
Background Elasticsearch allows us to do wildcard searches, such as:
curl 'localhost:9200/stest*/_search?pretty'
gets us results from all indices that matchstest*
pattern.Problem Statement Trino does also allow such searches however, the ES connectors just assumes the same mapping for all matching indices. For instance, if I have the following indices:
and
then I get the combined result from this search:
On the other hand, Trino gives me a partial result:
My tables/indices:
stest-1 contents
stest-2 contents
combined result
Suggestion We need to create a superset of field mapping of all the matching indices and execute a select statement with that superset. In this example, the result should look as follows (also note how I'm manually building a union query that covers the entire superset of fields by assigning NULL to any field/subfield that is not present in the related index).