Commit Graph

244 Commits

Author SHA1 Message Date
alexey-milovidov
9eca78273f Update AggregateFunctionSumMap.h 2017-10-13 21:51:03 +03:00
alexey-milovidov
1984782321 Update AggregateFunctionSumMap.h 2017-10-13 21:51:03 +03:00
Marek Vavruša
2edf5492d0 AggregateFunctionSumMap: support variardic arguments, specialized keys
The function is rewritten to avoid allocations on every insert with
Field deserialising each array. The key type is now specialized,
so it can be accessed directly. The value type is variant type,
but only individual values are deserialised (which is cheap, since they're PODs).
The function also support summing of multiple columns by the same key.

The SummingSortedBlockInputStream uses the function in case of
Nested structure with one numeric key and many values to sum.
2017-10-13 21:51:03 +03:00
Alexey Milovidov
1405415f94 Miscellaneous [#CLICKHOUSE-3]. 2017-10-09 01:53:38 +03:00
alexey-milovidov
2dfb3fa463 Update AggregateFunctionTopK.h 2017-10-09 01:12:38 +03:00
alexey-milovidov
6e5ea5cc10 Update AggregateFunctionTopK.h 2017-10-09 01:12:38 +03:00
Marek Vavruša
28bb5e25cf AggregateFunctionTopK: read alphaMap for generic
* the alpha_map vector always (de)serialises
  the actual version (could empty sometimes)
* AggregateFunctionTopK generic variant deserialises
  it as well instead of ignoring it
* AggregateFunctionTopK generic variant clears the
  array before deserialising

refs #1283
2017-10-09 01:12:38 +03:00
Alex Bocharov
e99c969a1c Aggregate function sumMap: improve insertResultInto method and change return type to Tuple(Array(K), Array(V)). 2017-09-19 13:35:25 +01:00
Alex Bocharov
07cd6829d0 Aggregate function sumMap: fix compilation error regarding getHeaderFilePath after merge with master. 2017-09-18 19:37:44 +01:00
Alex Bocharov
1f70d0e163 Resolve conflict in SummingSortedBlockInputStream when moving FieldVisitorSum. 2017-09-18 18:43:47 +01:00
Alex Bocharov
c1feea159e Aggregate function sumMap: optimize serialize/deserialize. 2017-09-18 18:11:16 +01:00
Alex Bocharov
6e74602e45 Aggregate function sumMap: use FieldVisitorSum instead of += operator. 2017-09-18 16:41:07 +01:00
alexey-milovidov
edb66bfffe Merge branch 'master' into master 2017-09-18 10:31:31 +03:00
Alexey Milovidov
ff1598c8d1 Improved performance of dynamic compilation [#CLICKHOUSE-2]. 2017-09-17 23:22:39 +03:00
Alexey Milovidov
156d48f3ee Removed aggregate function "debug" [#CLICKHOUSE-2]. 2017-09-17 23:12:02 +03:00
Alexey Milovidov
dd3e74c0eb Fixed weird translation [#CLICKHOUSE-2]. 2017-09-17 21:17:04 +03:00
Alexey Milovidov
86c46ad1bd Unification [#CLICKHOUSE-2]. 2017-09-15 15:16:12 +03:00
Alex Bocharov
591cd5c009 Add new aggregate function sumMap(key, value). 2017-09-15 12:14:19 +01:00
Alexey Milovidov
cd540c2674 Replaced Mersenne Twister to PCG-Random [#CLICKHOUSE-2]. 2017-09-10 02:17:38 +03:00
Alexey Milovidov
be79166199 Using pcg-random instead of boost::random::taus88 [#CLICKHOUSE-3174]. 2017-09-09 02:58:42 +03:00
Alexey Milovidov
c0324aeb66 Removed useless header [#CLICKHOUSE-3174]. 2017-09-09 02:40:48 +03:00
proller
aa1f27553e Header compile fixes 2017-09-01 22:05:29 +03:00
proller
1a8e22c37f Allow compile on 32bit systems (#1175)
* Trying compile under 32bit..

* PerformanceTest: use getMultiple*FromConfig, fix debug helpers

* Missing file

* clnag-format of Split ComplexKeyCacheDictionary

* wip

* Requested changes

* wip

* wip

* Fix boost 1.64 and gcc7+ compile errors

* More fixes

* wip

* Fix arm build

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* clean

* fix

* wip

* wip

* clean

* clean

* wip

* wip

* Update MergeTreeSettings.h

* Requested changes

* Requested changes

* Requested changes

* Requested changes
2017-09-01 20:21:03 +03:00
Alexey Milovidov
1531268281 Added aggregate functions groupBitAnd, groupBitOr, groupBitXor [#CLICKHOUSE-2]. 2017-08-30 21:52:14 +03:00
Alexey Milovidov
495daffa16 Miscellaneous [#CLICKHOUSE-2]. 2017-08-30 21:13:32 +03:00
Alexey Zatelepin
eec6a3ecb9 add forgotten aggregate functions to SpecializedAggregator.h [#CLICKHOUSE-3247] 2017-08-23 17:00:36 +03:00
Alexey Zatelepin
ec96183f59 put AggregateFunctionStatistics implementation out of anonymous namespace [#CLICKHOUSE-3247] 2017-08-23 17:00:36 +03:00
Alexey Zatelepin
8620dd6876 runtime compilation fix: put groupArray implementation out of anonymous namespace [#CLICKHOUSE-3247]
Demangled symbols from anonymous namespace contain "::(anonymous namespace)::" string
and thus cannot be used with runtime compilation of aggregation functions.
2017-08-23 17:00:36 +03:00
Alexey Milovidov
75f1df36e4 Miscellaneous [#CLICKHOUSE-2]. 2017-08-22 20:29:02 +03:00
Vadim Skipin
5f4e833925 Cleanup function factories:
* Switch to std::function to allow more complex creator logic
* Cleanup headers
2017-08-18 21:15:57 +03:00
Vitaliy Lyudvichenko
f36caa9c99 Parameter rename. [#CLICKHOUSE-3213] 2017-08-12 03:46:42 +03:00
Vitaliy Lyudvichenko
04dcec32b4 Specialized implementation of groupArray() for Date and DateTime. [#CLICKHOUSE-3213] 2017-08-12 03:46:42 +03:00
Alexey Milovidov
ce4349b6cd Fixed error when huge sets for IN, JOIN, DISTINCT cannot be created with exception message "Cannot mremap... Bad address" [#CLICKHOUSE-2]. 2017-08-11 02:25:51 +03:00
proller
ac178bde1f Cmake: link ltdl with pocoodbc static only. rename ARM -> ARCH_ARM (#1083)
* Cmake: link ltdl with pocoodbc static only. rename ARM -> ARCH_ARM

* Fix lib find order

* Allow define non-contrib cityhash farmhash metrohash

* Fix message

* Cmake: fixes

* clean

* Update CMakeLists.txt
2017-08-09 23:52:55 +03:00
proller
8f6c2d4e47 Fix .h compile 2017-08-01 18:02:16 +03:00
Alexey Milovidov
3502d36d7d Fixed build [#CLICKHOUSE-2]. 2017-07-28 02:23:13 +03:00
Alexey Milovidov
e4af70149f Fixed build [#CLICKHOUSE-2]. 2017-07-28 00:27:10 +03:00
Alexey Milovidov
6851a7754a Fixed linkage [#CLICKHOUSE-2]. 2017-07-25 21:32:52 +03:00
Vitaliy Lyudvichenko
870b1aefcb Get rid of of PODArray copypaste. [#CLICKHOUSE-3084] 2017-07-25 20:04:10 +03:00
Vitaliy Lyudvichenko
fefb4dad67 Get rid of old groupArray() implementations. [#CLICKHOUSE-3084] 2017-07-25 20:04:10 +03:00
Vitaliy Lyudvichenko
792faaa2db Add adaptive allocator. [#CLICKHOUSE-3084] 2017-07-25 20:04:10 +03:00
Vitaliy Lyudvichenko
03e5bf9471 Add support of parameters in aggregate function constructors. [#CLICKHOUSE-3084] 2017-07-25 20:04:10 +03:00
Vitaliy Lyudvichenko
c3a15da3f8 Add support of limit parameter into groupArray. [#CLICKHOUSE-3084] 2017-07-25 20:04:10 +03:00
Vitaliy Lyudvichenko
c2cc8d6147 Add several groupArray implementations. [#CLICKHOUSE-3084] 2017-07-25 20:04:10 +03:00
proller
57b9bcd354 Fix missing includes 2017-07-24 18:04:49 +03:00
alexey-milovidov
d4d266fa18 ColumnConst unification (#1011)
* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* Fixed error in ColumnArray::replicateGeneric [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].

* ColumnConst: unification (incomplete) [#CLICKHOUSE-3150].
2017-07-21 09:35:58 +03:00
Alexey Milovidov
5c3ca0c16e Inverted dependency in DataTypeFactory [#CLICKHOUSE-3149]. 2017-07-16 07:11:11 +03:00
Nikolai Kochetov
283810e8ab merged with master 2017-07-13 23:59:34 +03:00
Nikolai Kochetov
75be0b81d8 removed typeid_cast from IColumn.h 2017-07-13 23:58:19 +03:00
Nikolai Kochetov
985e449bd3 added IDataType::updateAvgValueSizeHints; renamed PODArray::allocated_size to PODArray::allocated_bytes; renamed renamed IColumn::allocatedSize to IColumn::allocatedBytes; removed IColumn.h from IDataType.h 2017-07-13 19:49:09 +03:00
Alexey Milovidov
be1710ecef Using lexer (development) [#CLICKHOUSE-2]. 2017-07-13 08:59:01 +03:00
Alexey Milovidov
d4974b0724 Using lexer (development) [#CLICKHOUSE-2]. 2017-07-13 08:59:01 +03:00
Alexey Milovidov
4255b81f3f Using lexer (development) [#CLICKHOUSE-2]. 2017-07-13 08:59:01 +03:00
Alexey Milovidov
1bab7fc344 Using lexer (incomplete) [#CLICKHOUSE-2]. 2017-07-13 08:59:01 +03:00
Alexey Milovidov
5b5795633e Using lexer (incomplete) [#CLICKHOUSE-2]. 2017-07-13 08:59:01 +03:00
Alexey Milovidov
bb38ec2c21 Fixed discrepancy in file names [#CLICKHOUSE-2]. 2017-07-12 04:16:01 +03:00
Alexey Milovidov
86eb4d2d06 Renamed Singleton to avoid conflicts with Arcadia* codebase [#DEVTOOLS-3343].
* - "Arcadia" is the name of Yandex's monorepo.
2017-07-10 07:34:14 +03:00
Guillaume Tassery
aeeb81fadf Rename field in UInt128 2017-07-04 18:10:36 +02:00
Marek Vavruša
e189c39056 SpaceSaving: internal storage for StringRef{}
The SpaceSaving has now specialised storage for
some keys, which only copies keys that
are to be retained in the structure, not all.

Most of the PODs implement this interface empty,
so there shouldn’t be any extra cost.
2017-06-26 21:16:13 +03:00
proller
4db8d09de9 Reorganize includes. part 1 (#921)
* Make libunwind optional. Allow use custom libcctz

* fix

* Fix

* fix

* Update BaseDaemon.cpp

* Update CMakeLists.txt

* Reorganize includes. part 1

* Update dbms_include.cmake

* Reorganize includes. part 2

* Reorganize includes. part 3

* dbms/src/Common/ThreadPool -> libs/libcommon

* Reorganize includes. part 4

* Fix print_include_directories

* Update thread_creation_latency.cpp

* Update StringRef.h
2017-06-23 23:22:35 +03:00
Alexey Milovidov
6df5d556e5 Changed namespace [#DEVTOOLS-3381]. 2017-06-21 11:35:38 +03:00
Alexey Milovidov
604de2bfeb Better [#DEVTOOLS-3381]. 2017-06-21 04:24:05 +03:00
Георгий Кондратьев
47161f8425 Specify all link dependencies [#DEVTOOLS-3381]
Tested with:

export LDFLAGS="-Wl,--no-undefined"
cmake -DUSE_STATIC_LIBRARIES=OFF -DBUILD_SHARED_LIBS=ON
2017-06-20 00:53:12 +03:00
Alexey Milovidov
ee49c37fa6 Whitespaces [#CLICKHOUSE-2]. 2017-06-16 19:23:23 +03:00
Alexey Milovidov
45c76803a9 Moved table functions to separate library; fixed errors; improved testability [#CLICKHOUSE-31]. 2017-06-10 12:04:31 +03:00
Alexey Milovidov
9c5ddce06d Get rid of .hpp files [#CLICKHOUSE-2]. 2017-06-06 20:18:32 +03:00
f1yegor
0bf5182020 translate comments: etc 2017-05-28 16:32:59 +02:00
Marek Vavruša
95d926ec14 AggregateFunctionTopK: smaller initial table size
By default start with 2^4 elements
2017-05-13 03:58:05 +04:00
Alexey Milovidov
cfc4c987c5 Added optional length parameter to aggregate function groupArrayInsertAt [#CLICKHOUSE-3003]. 2017-05-12 23:57:24 +03:00
Alexey Milovidov
1d090bd4e2 AggregateFunctionGroupArrayInsertAt: fixed error [#CLICKHOUSE-3003]. 2017-05-12 23:05:19 +03:00
Alexey Milovidov
9ad1d5676a Miscellaneous [#CLICKHOUSE-2]. 2017-05-12 01:21:06 +03:00
Marek Vavruša
45bd332460 AggregateFunctionTopK: fix memory usage, performance
* allow separate table key / hash key, and use
  std::string / StringRef for generic variant as
  it has built-in storage and StringRef is supported
  by the hash table, this avoids infinitely
  growing arena with serialised keys
* use power-of-2 size for alpha vector for faster
  binning without using modulo
* use custom grower and allocator for SpaceSaving
  to start with smaller tables
* store computed hash in counter for faster
  reinsertion of smallest element
2017-05-11 18:52:49 +04:00
Alexey Milovidov
2a57cfdbc2 Aggregate function groupArrayInsertAt: development [#CLICKHOUSE-2]. 2017-05-10 04:42:15 -04:00
Alexey Milovidov
21c5ee0f1d Aggregate function groupArrayInsertAt: development [#CLICKHOUSE-2]. 2017-05-10 04:41:25 -04:00
Alexey Milovidov
19d0d47c8a Aggregate function groupArrayInsertAt: development [#CLICKHOUSE-2]. 2017-05-10 04:40:14 -04:00
Alexey Milovidov
21af887758 Added aggregate function 'groupArrayInsertAt' (for Graphite) [#CLICKHOUSE-2]. 2017-05-10 01:46:23 -04:00
Alexey Milovidov
b9a7917a8d Tiny modifications [#CLICKHOUSE-2]. 2017-05-10 01:43:27 -04:00
Alexey Milovidov
542eba7e17 Fixed translation errors [#CLICKHOUSE-3]. 2017-05-10 00:30:33 -04:00
proller
fac00792f9 Move most AggregateFunctions to separate lib, use AggregateFunctionFactory as singletone, rename lib storages_system->clickhouse_storages_system 2017-05-05 16:59:18 -07:00
Alexey Milovidov
d3e6321967 AggregateFunctionTopK: minor modifications [#CLICKHOUSE-2]. 2017-05-05 16:36:02 -07:00
proller
9a937591e5 Try fix freebsd 11-STABLE OCbuild 2017-05-04 18:25:34 +03:00
Marek Vavruša
5f1e65b252 AggregateFunctions: implemented topK(n)
This implements a new function for approximate
computation of the most frequent entries using
Filtered Space Saving with a merge step adapted
from Parallel Space Saving paper.

It works better for cases where GROUP BY x
is impractical due to high cardinality of x,
such as top IP addresses or top search queries.
2017-05-03 23:09:52 -07:00
Vitaliy Lyudvichenko
6d93d9cefb Combinator -MergeState now returns AggregateFunction(nested_func). [#CLICKHOUSE-2891] 2017-05-03 20:59:42 -07:00
Alexey Milovidov
563e21247e Style [#CLICKHOUSE-2]. 2017-04-20 21:35:39 +03:00
Alexey Milovidov
b491ee7f63 Style [#CLICKHOUSE-2]. 2017-04-20 19:41:03 +03:00
f1yegor
0b243a8b01 translate comments 2017-04-16 23:17:32 +03:00
Alexey Milovidov
41e97787e3 Less dependencies [#CLICKHOUSE-2]. 2017-04-16 08:40:17 +03:00
Alexey Milovidov
6b5e6104a9 ForEach combinator of aggregate functions: little better [#CLICKHOUSE-2952]. 2017-04-16 07:35:21 +03:00
Alexey Milovidov
d9793bf5fe Fixed -ForEach combinator of aggregate functions [#CLICKHOUSE-2952]. 2017-04-16 07:16:22 +03:00
Alexey Milovidov
ef3557950c Less dependencies [#CLICKHOUSE-2952]. 2017-04-16 07:03:14 +03:00
Alexey Milovidov
83ed2a794b Fixed -ForEach combinator of aggregate functions [#CLICKHOUSE-2952]. 2017-04-16 06:38:37 +03:00
Maxim Fridental
99dc3ea016 Implement ForEach modifier for aggregate functions. 2017-04-16 02:49:11 +03:00
Alexey Milovidov
5b29658aae MemoryTracker: more convenient for investigations [#CLICKHOUSE-2935]. 2017-04-11 00:43:59 +03:00
Alexey Milovidov
a0b9bf5e97 Moved code to cpp [#CLICKHOUSE-2]. 2017-04-08 04:32:05 +03:00
Alexey Milovidov
310736cd7e Moved headers and sources to same place [#CLICKHOUSE-3]. 2017-04-01 12:22:42 +03:00
Alexey Milovidov
137ad95929 Changed tabs to spaces in code [#CLICKHOUSE-3]. 2017-04-01 11:35:09 +03:00
Alexey Milovidov
14c8003081 Normalized formatting [#CLICKHOUSE-3].
Apply in a loop:
find dbms -name '*.h' -or -name '*.cpp' | xargs grep -l -P '^(\t*)    ' | xargs sed -i -r -e 's/^(\t*)    /\1\t/'
2017-03-26 04:28:07 +03:00
f1yegor
bc0d9a2cae translate comments 2017-03-25 21:12:56 +01:00
alexey-milovidov
6d5bfc8c6f Refactoring of numeric DataTypes (#581)
* Better code [#CLICKHOUSE-2].

* Addition to prev. revision [#CLICKHOUSE-2].

* Addition to prev. revision [#CLICKHOUSE-2].

* Addition to prev. revision [#CLICKHOUSE-2].
2017-03-12 14:13:45 +04:00
Alexey Milovidov
17e3a4ff1f Implemented aggregate function 'count' with Nullable arguments to count number of not-NULL values [#CLICKHOUSE-2833]. 2017-02-10 12:02:10 +03:00