Commit Graph

3925 Commits

Author SHA1 Message Date
zvonand
a61fd73c88 fix test fails 2022-08-25 00:26:44 +03:00
zvonand
5c00428940 updated as was before 2022-08-24 19:46:17 +03:00
Roman Vasin
01dc483b64 Add IFunctionDateOrDateTime 2022-08-24 15:44:53 +00:00
Alexander Gololobov
c9177d2cb3
Merge pull request #40475 from ClickHouse/allow-conversion-from-string-datetime64-to-date-date32
Allow conversion from String with DateTime64 to Date and Date32
2022-08-24 17:33:20 +02:00
zvonand
b4564099f9 fix inherited parts 2022-08-24 17:07:30 +03:00
avogar
fa320f65f6 Fix possible logical error in arrayElement function with Map 2022-08-24 11:01:39 +00:00
Kruglov Pavel
860d0baa48
Better exception messages in FunctionArrayMapped 2022-08-24 12:28:44 +02:00
zvonand
e257f9d0cd update docs, tests + small fixes 2022-08-24 01:09:14 +03:00
Roman Vasin
423a4f22cc Fix toStartOfYear, toStartOfISOYear, toStartOfQuarter and toStartOfMonth to return Date32 2022-08-23 16:55:53 +00:00
Roman Vasin
505a8ad0e0 Fix toMonday() function to return Date32 2022-08-23 15:39:21 +00:00
zvonand
42f86442ab updated tests + toStartOfWeek 2022-08-23 18:33:09 +03:00
Andrey Zvonov
52159b77d0
Merge branch 'master' into zvonand-minmax 2022-08-23 17:18:57 +03:00
zvonand
6abe09a725 updated tests + teStartOfWeek 2022-08-23 17:13:39 +03:00
Roman Vasin
e40b8f471d Add compatibility parameter enable_date32_results 2022-08-23 12:43:08 +00:00
pzhdfy
d81462c095 check all ArgumentsDataTypes and use equals 2022-08-23 15:08:35 +08:00
Robert Schulze
ec9ef741fc
Merge branch 'master' into less-string-ref 2022-08-22 20:48:16 +02:00
Roman Vasin
d73a80a54c Delete not needed code from getReturnTypeImpl of FunctionDateOrDateTimeToDateOrDate32 2022-08-22 16:24:45 +00:00
zvonand
d789dabc9d Fixed , updated docs 2022-08-22 17:36:56 +03:00
zvonand
e5b4fb4191 fix some issues 2022-08-22 17:36:56 +03:00
zvonand
a7a1269e60 updated tests + improve logic 2022-08-22 17:36:55 +03:00
zvonand
537fb8c4ee fix 1 2022-08-22 17:36:55 +03:00
Alexey Milovidov
a3e4753d83
Merge pull request #40466 from ClickHouse/remove-some-trash
Remove some trash
2022-08-22 15:59:50 +03:00
Alexey Milovidov
c4a60b8123 Allow conversion from String with DateTime64 to Date and Date32 2022-08-22 00:23:10 +02:00
Alexey Milovidov
996aa2d126 Remove some trash 2022-08-21 20:46:33 +02:00
Alexey Milovidov
8dd5c215e0
Merge pull request #40462 from ClickHouse/revert-39000-avx-enablement
Revert "Avx enablement"
2022-08-21 21:32:45 +03:00
Robert Schulze
4caf2c4c33
Reduce some usage of StringRef
See #39535 and #39300
2022-08-21 18:10:32 +00:00
Robert Schulze
3aa5acdb35
Merge pull request #40391 from ClickHouse/reduce-StringRef
Reduce some usage of StringRef
2022-08-21 20:04:57 +02:00
Alexey Milovidov
6fbff6d1f6
Revert "Avx enablement" 2022-08-21 15:47:02 +03:00
Robert Schulze
77e64935e1
Reduce some usage of StringRef 2022-08-19 09:56:59 +00:00
Robert Schulze
24615059fb
Merge pull request #40319 from ClickHouse/custom-error-code-in-throwif
Allow custom error code in throwIf
2022-08-19 09:49:35 +02:00
Robert Schulze
5037ce547f
Only allow 8/16/32-bit signed integers as custom error code data type
The internally used data type for error code is "int", and by
disallowing unsigned integers or integers >= 64 bit we avoid truncation
issues.
2022-08-18 15:16:08 +00:00
Robert Schulze
d6e5a6b7e7
fix: prevent possible race between getReturnTypeImpl() and executeImpl()
I don't know if the context (in detail: the config settings) can change
between calls to getReturnTypeImpl() and executeImpl() but we better
don't find out. Instead, read setting "allow_custom_error_code_in_throwif"
just just once in the ctor of FunctionThrowIf.
2022-08-18 12:24:42 +00:00
Robert Schulze
baae7726a7
style: "Fix" style check in CI 2022-08-18 10:13:58 +00:00
Robert Schulze
f121941916
feat: allow custom error code for SQL function throwIf() 2022-08-17 21:14:40 +00:00
Robert Schulze
164fc3d296
style: improve code aesthetics 2022-08-17 20:39:37 +00:00
Roman Vasin
19cb6d87c8 Add FunctionDateOrDateTimeToDateOrDate32 and make toLastDayOfMonth working 2022-08-17 16:38:06 +00:00
Roman Vasin
be3151937c Set return type to Date32 for toLastDayOfMonth function 2022-08-17 08:51:14 +00:00
pzhdfy
48fcf6580d Merge branch 'UniqSketch' of github.com:pzhdfy/ClickHouse into UniqSketch 2022-08-17 11:26:44 +08:00
pzhdfy
172b5025e2 use camelCase aNotB 2022-08-17 11:24:19 +08:00
Robert Schulze
df889351ad
feat: replace unbounded vectorscan cache by bounded cache
VectorScan patterns can grow large (up to multiple MBs) and queries
involving different VectorScan patterns lead to an ever increasing
pattern cache size.

With this commit, the unbounded cache for vectorscan patterns is
replaced by a bounded cache with "CacheTable" eviction strategy, similar
to what we have for re2 patterns. The cache size is currently hard-coded
to 500 entries.

Fixes #19869
2022-08-16 21:09:47 +00:00
Robert Schulze
89bf69c35f
style: improve code aesthetics and make it slightly safer 2022-08-16 21:09:32 +00:00
Igor Nikonov
e7baf920a9
Merge pull request #39600 from zvonand/zvonand-decimal-overflow
Check Decimal division overflow based on operands scale
2022-08-15 15:03:06 +02:00
Alexey Milovidov
ad936ae32a
Merge pull request #40211 from canhld94/ch_canh_fix_datetime
Fix unexpected result arrayDifference of Array(UInt32)
2022-08-15 04:52:58 +03:00
Igor Nikonov
6f00643bc1
Merge branch 'master' into zvonand-decimal-overflow 2022-08-15 02:38:45 +02:00
Igor Nikonov
2cb78c7220 Detailed comment about overflow check 2022-08-15 00:37:18 +00:00
Duc Canh Le
272447c5dc remove junk log 2022-08-14 16:19:09 +08:00
Duc Canh Le
71dd2a19fc fix arrayDiff 2022-08-14 16:14:13 +08:00
Alexey Milovidov
10022ee974 Fix insufficient argument check for encryption functions 2022-08-14 04:28:30 +02:00
Alexey Milovidov
31dbb68185 Fix array signed const positive subscript operator 2022-08-13 08:04:24 +02:00
Kseniia Sumarokova
a6cfc7bc3b
Merge pull request #34651 from alexX512/master
New caching strategies
2022-08-12 17:23:37 +02:00
Kruglov Pavel
456291f335
Fix style 2022-08-11 13:08:56 +02:00
Igor Nikonov
394a71dcfd More correct fix + tests 2022-08-11 06:24:40 +00:00
Alexey Milovidov
8374f31306
Merge pull request #39425 from arenadata/ADQM-485
Add support of dates from year 1900 to 2299 for Date32 and DateTime64
2022-08-11 05:01:53 +03:00
Nikolay Degterinsky
547662f88b
Merge pull request #40002 from Algunenano/fix_hashid
Fix hashId crash and salt parameter not being used
2022-08-11 02:25:10 +02:00
Alexey Milovidov
53097b3d65
Merge pull request #40015 from tbragin/master
Add parseDateTime64BestEffortUS* functions
2022-08-10 20:00:50 +03:00
Roman Vasin
537ba613dc Remove clamping from AddDaysImpl and AddWeeksImpl; fix 01921_datatype_date32 test 2022-08-10 08:14:16 +00:00
Kruglov Pavel
4bbe5186c2
Merge pull request #39999 from HeenaBansal2009/Support_H_syntax_in_Hour_Interval_Kind
Added H literal for Hour IntervalKind
2022-08-09 11:24:41 +02:00
Roman Vasin
96598e3574 Replace normalizeDayNum() by std::clamp() 2022-08-09 08:52:02 +00:00
Tanya Bragin
eb61db3b67 initial changes to close #37492 2022-08-08 19:45:00 -07:00
HeenaBansal2009
d2bdf6fc3e Added tests 2022-08-08 11:51:05 -07:00
Raúl Marín
c8f8ceea8d Fix hashId crash and salt not applying 2022-08-08 18:25:34 +02:00
alexX512
6bf29cb610 Change class LRUCache to class CachBase. Check running CacheBase with default pcahce policy SLRU 2022-08-07 19:59:30 +00:00
pzhdfy
2d5446a86b add FunctionsUniqTheta 2022-08-05 14:11:52 +08:00
Nikolai Kochetov
658a269d56
Merge branch 'master' into use-dag-in-key-condition 2022-08-04 16:18:40 +02:00
Kruglov Pavel
b84e65bb3b
Merge pull request #39716 from arthurpassos/fix_scalar_cte_with_lc_result
Unwrap LC column in IExecutablefunction::executeWithoutSparseColumns
2022-08-03 18:53:37 +02:00
zvonand
99a458c12d small fix 2022-08-03 16:36:36 +03:00
Arthur Passos
e9b124b4bc Don't use default implementation for LC columns in Scalar functions 2022-08-02 09:17:53 -03:00
Anton Popov
f94d4d4877
Merge branch 'master' into hash-functions-map 2022-08-02 13:26:54 +02:00
Robert Schulze
bf574b9154
Merge pull request #39760 from ClickHouse/bit-fiddling
Use std::popcount, ::countl_zero, ::countr_zero functions
2022-08-01 17:04:51 +02:00
Kruglov Pavel
dfdfabec94
Merge pull request #39218 from evillique/file_default_value
Add default argument to the function `file`
2022-08-01 13:04:19 +02:00
Nikolai Kochetov
22fbfe19a4 Merge branch 'master' into use-dag-in-key-condition 2022-07-31 21:54:12 +02:00
Robert Schulze
a7734672b9
Use std::popcount, ::countl_zero, ::countr_zero functions
- Introduced with the C++20 <bit> header

- The problem with __builtin_c(l|t)z() is that 0 as input has an
  undefined result (*) and the code did not always check. The std::
  versions do not have this issue.

- In some cases, we continue to use buildin_c(l|t)z(), (e.g. in
  src/Common/BitHelpers.h) because the std:: versions only accept
  unsigned inputs (and they also check that) and the casting would be
  ugly.

(*) https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
2022-07-31 15:16:51 +00:00
Robert Schulze
4d7627e45e
Fix include 2022-07-31 07:36:40 +00:00
Robert Schulze
8ca236de08
Enable SQL function getOSKernelVersion() on all platforms
Follow up to PR #38615
2022-07-30 22:36:47 +00:00
Robert Schulze
85773e0926
Merge pull request #38615 from liyinsg/simplified_function_registration_interface
Simplified function registration interface
2022-07-31 00:18:37 +02:00
Robert Schulze
b52843d5fd
Merge pull request #37951 from zvonand/dt64_timeslots
Fix timeSlots for DateTime64
2022-07-30 20:49:05 +02:00
Alexey Milovidov
8f348edbbd
Merge pull request #39000 from ClickHouse/avx-enablement
Avx enablement
2022-07-30 04:51:07 +03:00
Arthur Passos
f0f19874da fix style 2022-07-29 13:56:01 -03:00
Arthur Passos
59fbd21024 Unwrap LC column in IExecutablefunction::executeWithoutSparseColumns 2022-07-29 12:03:09 -03:00
Nikolai Kochetov
59a11b32ad
Merge branch 'master' into use-dag-in-key-condition 2022-07-29 17:01:33 +02:00
zvonand
b390bcfe7c fix wrong data type cast 2022-07-29 13:25:40 +03:00
Li Yin
4088c0a7f3 Automated function registration
Automated register all functions with below naming convention by
iterating through the symbols:
void DB::registerXXX(DB::FunctionFactory &)
2022-07-29 15:39:50 +08:00
Anton Popov
45da56d802 support hash functions with Map type 2022-07-28 19:15:19 +00:00
Alexander Gololobov
9525bd19bf
Merge pull request #39592 from ClickHouse/fix-wrong-regexp-replace
Fix wrong regexp replace
2022-07-27 09:54:28 +02:00
Antonio Andelic
904a05ac21
Merge pull request #39496 from azat/custom-tld-exclamation-asterisk
Add support of !/* (exclamation/asterisk) in custom TLDs
2022-07-27 08:55:49 +02:00
Vladimir C
d9e8e9b948
Merge pull request #39552 from filimonov/maxsplit-bug
Fix bug with maxsplit in the splitByChar
2022-07-26 11:14:27 +02:00
Alexey Milovidov
833b24b486 Fix the wrong REGEXP_REPLACE alias 2022-07-26 08:01:49 +02:00
Azat Khuzhin
1d4a7c7290 Add support of !/* (exclamation/asterisk) in custom TLDs
Public suffix list may contain special characters (you may find format
here - [1]):
- asterisk (*)
- exclamation mark (!)

  [1]: https://github.com/publicsuffix/list/wiki/Format

It is easier to describe how it should be interpreted with an examples.

Consider the following part of the list:

    *.sch.uk
    *.kawasaki.jp
    !city.kawasaki.jp

And here are the results for `cutToFirstSignificantSubdomainCustom()`:

If you have only asterisk (*):

    foo.something.sheffield.sch.uk -> something.sheffield.sch.uk
    sheffield.sch.uk               -> sheffield.sch.uk

If you have exclamation mark (!) too:

    foo.kawasaki.jp                -> foo.kawasaki.jp
    foo.foo.kawasaki.jp            -> foo.foo.kawasaki.jp
    city.kawasaki.jp               -> city.kawasaki.jp
    some.city.kawasaki.jp          -> city.kawasaki.jp

TLDs had been verified wit the following script [2], to match with
python publicsuffix2 module.

  [2]: https://gist.github.com/azat/c1a7a9f1e3519793134ef4b1df5461a6

v2: fix StringHashTable padding requirements
Fixes: #39468
Follow-up for: #17748
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-26 08:34:30 +03:00
Roman Vasin
b462366415 Merge branch 'master' of github.com:ClickHouse/ClickHouse into ADQM-485 2022-07-25 17:55:47 +00:00
Roman Vasin
b412ea5f6d Improve generateRandom() for Date32; fix tests 01087_table_function_generate, 01277_fromUnixTimestamp64, 01691_DateTime64_clamp and 01702_toDateTime_from_string_clamping 2022-07-25 17:06:11 +00:00
Nikolai Kochetov
b70be40804
Merge branch 'master' into use-dag-in-key-condition 2022-07-25 14:30:22 +02:00
Alexander Gololobov
dbcb7e5f1e Fix for empty function name on FreeBSD build 2022-07-25 13:11:36 +02:00
Mikhail Filimonov
33ee858d18
Fix bug with maxsplit in the splitByChar 2022-07-25 13:11:02 +02:00
Alexey Milovidov
6fdcb009ff
Merge pull request #39533 from ClickHouse/now-in-block
Add function `nowInBlock`
2022-07-25 04:22:11 +03:00
Alexey Milovidov
cff712970e Add function nowInBlock 2022-07-24 19:58:48 +02:00
Robert Schulze
c788e05c77
Merge pull request #39292 from zvonand/zvonand-b58-datatype
Simplify Base58 encoding/decoding
2022-07-24 18:09:40 +02:00
Kruglov Pavel
f79924f270
Merge branch 'master' into file_default_value 2022-07-22 21:17:37 +02:00
Robert Schulze
6a631426b7
Disable vectorization for uint64 --> float32 cast 2022-07-22 12:49:16 +00:00
Robert Schulze
cad0e7a62c
Move hot loop inside nested if/else statements
- required to control the vectorization of a specific cast which
  annotates the loop using pragmas
2022-07-22 11:53:23 +00:00
Alexander Tokmakov
bed2206ae9
Merge pull request #39460 from ClickHouse/remove_some_dead_and_commented_code
Remove some dead and commented code
2022-07-22 13:24:34 +03:00
Robert Schulze
ea0a3bf600
Merge branch 'master' into stringref-to-string_view 2022-07-21 18:33:06 +02:00
Kruglov Pavel
f4f05ec786
Merge pull request #39447 from Avogar/better-parse-time-delta
Extend time units in parseTimeDelta function
2022-07-21 17:39:40 +02:00
Andrey Zvonov
e473606cd1
Merge branch 'master' into zvonand-b58-datatype 2022-07-21 15:55:05 +02:00
Alexander Tokmakov
a8da5d96fc remove some dead and commented code 2022-07-21 15:05:48 +02:00
avogar
d63786e709 Better 2022-07-21 09:07:23 +00:00
avogar
49d980d16c Extend time units in parseTimeDelta function 2022-07-21 08:55:51 +00:00
Roman Vasin
e3192cf753 Correct docs to reflect new range 1900..2299 for Date32 and DateTime64; Cleanup code 2022-07-20 15:19:02 +00:00
lokax
22792d1c6a fix style
Signed-off-by: lokax <m632656684@gmail.com>
2022-07-20 21:20:00 +08:00
lokax
140f5e6685 recursive check array offsets
Signed-off-by: lokax <m632656684@gmail.com>
2022-07-20 21:20:00 +08:00
lokax
d40f04b860 fix function name
Signed-off-by: lokax <m632656684@gmail.com>
2022-07-20 21:20:00 +08:00
lokax
ff433c1c01 fix build
Signed-off-by: lokax <m632656684@gmail.com>
2022-07-20 21:20:00 +08:00
lokax
647eafa00e support for array type 2022-07-20 21:20:00 +08:00
lokax
5c6b18a9bd fix: 3rd parameter must be constant 2022-07-20 21:20:00 +08:00
lokax
6e23d2cb85 feat(function): tupleElement with default value 2022-07-20 21:20:00 +08:00
Nikolay Degterinsky
c9ae525da7
Merge branch 'master' into file_default_value 2022-07-20 14:22:58 +02:00
zvonand
11b8d788ca small improvements 2022-07-20 13:36:47 +02:00
zvonand
592499e290 fix server crash on negative size 2022-07-19 23:11:03 +02:00
Nikolai Kochetov
f570cde815 Fixing build. 2022-07-19 20:19:57 +00:00
Roman Vasin
5f9c293963 Fix addDays() and addWeeks() in upper and lower limits of Date and Date32 2022-07-19 17:29:08 +00:00
Nikolai Kochetov
eaeb30a71a Merge branch 'master' into use-dag-in-key-condition 2022-07-19 18:39:52 +02:00
Robert Schulze
9d0e3d107b
Update src/Functions/formatReadableTimeDelta.cpp
Co-authored-by: Nikolay Degterinsky <43110995+evillique@users.noreply.github.com>
2022-07-19 13:17:33 +02:00
alesapin
bdc09c8319
Merge pull request #39303 from ClickHouse/whitespaces
Whitespaces
2022-07-19 13:17:29 +02:00
Kruglov Pavel
12221cffc9
Merge pull request #39071 from jiahui-97/parse_timedelta
implementation of parseTimeDelta function
2022-07-19 12:39:56 +02:00
zvonand
d245d6349a fixed zero check 2022-07-19 12:08:08 +02:00
Nikolay Degterinsky
4ae356f218 Fix NULL, add test 2022-07-19 09:15:42 +00:00
Robert Schulze
81ef1099cc
Even less usage of StringRef
--> see #39300
2022-07-19 07:01:06 +00:00
jiahui-97
e7af88b688 implementation of parseTimeDelta function
Co-authored-by: Kruglov Pavel <48961922+Avogar@users.noreply.github.com>
2022-07-19 09:33:02 +08:00
Robert Schulze
6df3c9d799
Merge pull request #39300 from ClickHouse/stringref-to-stringview
First try at reducing the use of StringRef
2022-07-18 19:20:16 +02:00
Robert Schulze
74e55e42f6
Merge pull request #39167 from ClickHouse/multiStringAllPositions-non-const-needle
multiStringAllPositions() with non-const needle
2022-07-18 15:30:14 +02:00
Kruglov Pavel
85f8b5990f
Merge pull request #39192 from Avogar/improve-is-nullable
Improve isNullable/isConstant/isNull/isNotNull performance for LowCardinality argument
2022-07-18 12:33:34 +02:00
Robert Schulze
3b0ca82d56
Fix build, pt. II 2022-07-18 09:41:01 +00:00
Alexey Milovidov
03aec06da1 Whitespaces 2022-07-17 23:20:05 +02:00
zvonand
18827ab312 Merge branch 'master' of github.com:ClickHouse/ClickHouse into dt64_timeslots 2022-07-17 22:59:18 +02:00
Robert Schulze
13482af4ee
First try at reducing the use of StringRef
- to be replaced by std::string_view
- suggested in #39262
2022-07-17 17:26:02 +00:00
Andrey Zvonov
e0d1954fac
Merge branch 'master' into dt64_timeslots 2022-07-16 22:33:46 +02:00
zvonand
728219e640 updated due to review 2022-07-16 22:16:19 +02:00
zvonand
d07a652883 merge 2022-07-16 19:05:07 +02:00
zvonand
4ab52b6873 added new DataType + fixes 2022-07-16 18:58:47 +02:00
avogar
7508448275 Better 2022-07-15 16:23:56 +00:00
Kruglov Pavel
0867e5fc4b
Merge branch 'master' into multiStringAllPositions-non-const-needle 2022-07-15 14:26:24 +02:00
Robert Schulze
deda29b46b
Pass const StringRef by value, not by reference
See #39224
2022-07-15 11:34:56 +00:00
Kruglov Pavel
a944a92d4c
Merge pull request #39224 from Avogar/string-view-by-value
Pass const std::string_view by value, not by reference
2022-07-15 13:05:56 +02:00
Roman Vasin
1d0818d9cf Set max year to 2299; Code cleanup; Make working 02245_make_datetime64 test 2022-07-15 10:33:52 +00:00
Nikolay Degterinsky
6f5275d9bb Fix build 2022-07-15 10:08:14 +00:00
Roman Vasin
266039ea64 Correct gTests for DateLUT 2022-07-14 19:00:17 +00:00
avogar
9291d33080 Pass const std::string_view & by value, not by reference 2022-07-14 16:11:57 +00:00
Maksim Kita
f5bacedaf9
Merge pull request #38553 from hexiaoting/mapupdate_dev
Fix bug for mapUpdate
2022-07-14 17:59:37 +02:00
Robert Schulze
ac5a06d944
Update doxygen 2022-07-14 11:02:01 +00:00
Kruglov Pavel
6d85dcd8a8
Update src/Functions/isNotNull.cpp
Co-authored-by: Igor Nikonov <954088+devcrafter@users.noreply.github.com>
2022-07-14 12:51:50 +02:00
Nikolay Degterinsky
9ca2935d72 Add default argument to function file 2022-07-14 09:54:44 +00:00