Fix Scan raw unit test where the annotation column resolves to 3 bytes instead
of 5 when normalized from milliseconds to seconds.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add the Pair class since Map.Entry<?, ?> doesn't deserialize in Jackson
automatically or easily and we don't want to include a library like Apache
Commons for a single class.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add ByteArrayPair utility class for storing two byte arrays in a list with
a comparator that sorts on the bytes. Also allows storing nulls for the key
or value of the pair. This will be needed for some situations where we may
query for a tagk without a tagv or a tagv without a tagk.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Make RowKey.metricNameAsync() public so it can be used elsewhere

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Extend SearchQuery for lookups with a metric and a tags field.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add overloads to parse() and parseWithMetric() in the Tags class for parsing a
time series lookup query where a metric, tag, and or tagv may be missing. These
overloads allow for null values in the results.
Add unit test for the new overloads
Add unit tests for the normal Tags.parseWithMetric() method.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add the TimeSeriesLookup.java for looking up time series related to a metric,
tag name and/or tagk. Includes unit tests.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Implement /api/search/lookup in the SearchRpc class

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add the Search CLI tool

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add support for lookups with an asterisk as a wildcard. Nulls are still allowed
but when writing the docs, it looks much better to write "m=*{host=*}" than
"m={host=}"

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Align the start of downsampling
Aligned the start time of downsampling by the given downsampling interval
so that the same set of data points belongs to the same downsampling period
regardless of the start time of a user-requested time range.
- Made the start time of a downsampling period its representative timestamp
  without computing the average of the timestamps of the data points of the
  period.
- Factored downsampling code out from Span.java to its own class to make it
  easier to write unit tests.
- Made the type of downsampling result double regardless of the original type
  to get rid of the loop that checked the type of the raw input data points.
  By using double, we could handle very small integers and very big integers
  within a reasonable error margin. Some values are too small to round off.
  For example, the integer average of four values (2, 2, 2, 1) is 1, which is
  far from the real average of 1.75. Some values are so big that it could
  cause long-integer overflow while downsampling.
- Factored out the piece of code that computes the rate of changes to make
  it easier to understand and test.
- Factored out the piece of code that iterates over a list of spans to aggregate.
- Added unit tests against the AggregationIter class.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Refactor Downsampler to avoid the MutableDataPoint class and reduce method
calls.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify MutableDataPoint.java to store a long or a double encoded as a long to
save a primitive that won't be used.
Rename MutableDataPoint.resetWithLongValue() and resetWithDoubleValue() to
reset().
Remove MutableDoubleDataPoint.java as it's redundant.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix SeekableViewsForTest to handle the reset(long, double) overload properly

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Flatten RateSpan for efficiency.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Merge remote-tracking branch 'remotes/official/next' into next
Add auto_tagk and auto_tagv fields to the Config class along with defaults
(to true for both) in preparation for #331.
Create Config.loadStaticVariables() to load the static variables whenever a
config value changes. Now overrideConfig() will reload the statics.
Change setAutoMetric() so that it will update the hash map with the given value
in case users access the config from the GUI and have toggled the flag via CLI.
Modify Tags.resolveAllInternal() to use the new config flags to allow or block
UID assignment for tagks and tagvs. This fixes #331.
Also add unit tests for the UID creation.