druid/extensions-core
Gian Merlino ffa25b7832
Query vectorization. (#6794)
* Benchmarks: New SqlBenchmark, add caching & vectorization to some others.

- Introduce a new SqlBenchmark geared towards benchmarking a wide
  variety of SQL queries. Rename the old SqlBenchmark to
  SqlVsNativeBenchmark.
- Add (optional) caching to SegmentGenerator to enable easier
  benchmarking of larger segments.
- Add vectorization to FilteredAggregatorBenchmark and GroupByBenchmark.

* Query vectorization.

This patch includes vectorized timeseries and groupBy engines, as well
as some analogs of your favorite Druid classes:

- VectorCursor is like Cursor. (It comes from StorageAdapter.makeVectorCursor.)
- VectorColumnSelectorFactory is like ColumnSelectorFactory, and it has
  methods to create analogs of the column selectors you know and love.
- VectorOffset and ReadableVectorOffset are like Offset and ReadableOffset.
- VectorAggregator is like BufferAggregator.
- VectorValueMatcher is like ValueMatcher.

There are some noticeable differences between vectorized and regular
execution:

- Unlike regular cursors, vector cursors do not understand time
  granularity. They expect query engines to handle this on their own,
  which a new VectorCursorGranularizer class helps with. This is to
  avoid too much batch-splitting and to respect the fact that vector
  selectors are somewhat more heavyweight than regular selectors.
- Unlike FilteredOffset, FilteredVectorOffset does not leverage indexes
  for filters that might partially support them (like an OR of one
  filter that supports indexing and another that doesn't). I'm not sure
  that this behavior is desirable anyway (it is potentially too eager)
  but, at any rate, it'd be better to harmonize it between the two
  classes. Potentially they should both do some different thing that
  is smarter than what either of them is doing right now.
- When vector cursors are created by QueryableIndexCursorSequenceBuilder,
  they use a morphing binary-then-linear search to find their start and
  end rows, rather than linear search.

Limitations in this patch are:

- Only timeseries and groupBy have vectorized engines.
- GroupBy doesn't handle multi-value dimensions yet.
- Vector cursors cannot handle virtual columns or descending order.
- Only some filters have vectorized matchers: "selector", "bound", "in",
  "like", "regex", "search", "and", "or", and "not".
- Only some aggregators have vectorized implementations: "count",
  "doubleSum", "floatSum", "longSum", "hyperUnique", and "filtered".
- Dimension specs other than "default" don't work yet (no extraction
  functions or filtered dimension specs).

Currently, the testing strategy includes adding vectorization-enabled
tests to TimeseriesQueryRunnerTest, GroupByQueryRunnerTest,
GroupByTimeseriesQueryRunnerTest, CalciteQueryTest, and all of the
filtering tests that extend BaseFilterTest. In all of those classes,
there are some test cases that don't support vectorization. They are
marked by special function calls like "cannotVectorize" or "skipVectorize"
that tell the test harness to either expect an exception or to skip the
test case.

Testing should be expanded in the future -- a project in and of itself.

Related to #3011.

* WIP

* Adjustments for unused things.

* Adjust javadocs.

* DimensionDictionarySelector adjustments.

* Add "clone" to BatchIteratorAdapter.

* ValueMatcher javadocs.

* Fix benchmark.

* Fixups post-merge.

* Expect exception on testGroupByWithStringVirtualColumn for IncrementalIndex.

* BloomDimFilterSqlTest: Tag two non-vectorizable tests.

* Minor adjustments.

* Update surefire, bump up Xmx in Travis.

* Some more adjustments.

* Javadoc adjustments

* AggregatorAdapters adjustments.

* Additional comments.

* Remove switching search.

* Only missiles.
2019-07-12 12:54:07 -07:00
..
avro-extensions Remove static imports from tests (#8036) 2019-07-06 09:33:12 -07:00
datasketches Query vectorization. (#6794) 2019-07-12 12:54:07 -07:00
druid-basic-security Druid basic authentication class composition config (#7789) 2019-06-06 15:51:37 +02:00
druid-bloom-filter Query vectorization. (#6794) 2019-07-12 12:54:07 -07:00
druid-kerberos [druid-kerberos] Fix checking of host URI when reading cookies from cookie store (#7825) 2019-06-03 19:32:50 -07:00
ec2-extensions Bump up snapshot version to 0.16.0 (#7802) 2019-05-30 17:17:33 -07:00
google-extensions Remove static imports from tests (#8036) 2019-07-06 09:33:12 -07:00
hdfs-storage Bump up snapshot version to 0.16.0 (#7802) 2019-05-30 17:17:33 -07:00
histogram fail complex type 'serde' registration when registered type does not match expected type (#7985) 2019-07-11 23:03:15 -07:00
kafka-extraction-namespace Remove static imports from tests (#8036) 2019-07-06 09:33:12 -07:00
kafka-indexing-service fix master branch build (#8057) 2019-07-10 14:58:10 -07:00
kinesis-indexing-service add config to optionally disable all compression in intermediate segment persists while ingestion (#7919) 2019-07-10 12:22:24 -07:00
lookups-cached-global Bump up snapshot version to 0.16.0 (#7802) 2019-05-30 17:17:33 -07:00
lookups-cached-single Bump up snapshot version to 0.16.0 (#7802) 2019-05-30 17:17:33 -07:00
mysql-metadata-storage Bump up snapshot version to 0.16.0 (#7802) 2019-05-30 17:17:33 -07:00
orc-extensions Remove static imports from tests (#8036) 2019-07-06 09:33:12 -07:00
parquet-extensions Remove static imports from tests (#8036) 2019-07-06 09:33:12 -07:00
postgresql-metadata-storage Bump up snapshot version to 0.16.0 (#7802) 2019-05-30 17:17:33 -07:00
protobuf-extensions Remove static imports from tests (#8036) 2019-07-06 09:33:12 -07:00
s3-extensions Remove static imports from tests (#8036) 2019-07-06 09:33:12 -07:00
simple-client-sslcontext switch links from druid.io to druid.apache.org (#7914) 2019-06-18 09:06:27 -07:00
stats Query vectorization. (#6794) 2019-07-12 12:54:07 -07:00