duckdb 0.8.2-dev4871.0 → 0.8.2-dev5002.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/src/common/operator/cast_operators.cpp +18 -0
  3. package/src/duckdb/src/common/row_operations/row_matcher.cpp +5 -38
  4. package/src/duckdb/src/common/types/data_chunk.cpp +48 -11
  5. package/src/duckdb/src/common/types/vector.cpp +0 -1
  6. package/src/duckdb/src/common/types.cpp +1 -1
  7. package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +5 -1
  8. package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +10 -1
  9. package/src/duckdb/src/core_functions/scalar/map/map_concat.cpp +0 -2
  10. package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp +20 -27
  11. package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp +21 -9
  12. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +7 -7
  13. package/src/duckdb/src/execution/operator/csv_scanner/csv_reader_options.cpp +1 -1
  14. package/src/duckdb/src/function/cast/time_casts.cpp +12 -0
  15. package/src/duckdb/src/function/pragma/pragma_queries.cpp +3 -0
  16. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  17. package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -0
  18. package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +27 -0
  19. package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +38 -2
  20. package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +4 -4
  21. package/src/duckdb/src/include/duckdb/core_functions/scalar/blob_functions.hpp +4 -4
  22. package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +5 -5
  23. package/src/duckdb/src/include/duckdb/core_functions/scalar/enum_functions.hpp +7 -7
  24. package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +12 -12
  25. package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +12 -12
  26. package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +3 -3
  27. package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +33 -33
  28. package/src/duckdb/src/include/duckdb/core_functions/scalar/operators_functions.hpp +2 -2
  29. package/src/duckdb/src/include/duckdb/core_functions/scalar/random_functions.hpp +3 -3
  30. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +12 -12
  31. package/src/duckdb/src/include/duckdb/core_functions/scalar/struct_functions.hpp +2 -2
  32. package/src/duckdb/src/include/duckdb/core_functions/scalar/union_functions.hpp +2 -2
  33. package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -0
  34. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +1 -2
  35. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -1
  36. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -1
  37. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -1
  38. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
  39. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -1
  40. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +28 -6
  41. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +3 -0
  42. package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +14 -6
  43. package/src/duckdb/src/planner/operator/logical_create_table.cpp +3 -3
  44. package/src/duckdb/src/planner/operator/logical_delete.cpp +3 -2
  45. package/src/duckdb/src/planner/operator/logical_insert.cpp +3 -2
  46. package/src/duckdb/src/planner/operator/logical_update.cpp +3 -2
  47. package/src/duckdb/src/storage/data_table.cpp +8 -8
  48. package/src/duckdb/src/storage/local_storage.cpp +2 -3
  49. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +64 -80
  50. package/src/duckdb/src/storage/storage_manager.cpp +6 -2
  51. package/src/duckdb/src/storage/table/row_group.cpp +6 -0
  52. package/src/duckdb/src/storage/table/row_group_collection.cpp +4 -3
  53. package/src/duckdb/src/storage/table/struct_column_data.cpp +2 -0
  54. package/src/duckdb/src/transaction/duck_transaction.cpp +1 -0
@@ -18,7 +18,7 @@ namespace duckdb {
18
18
  struct AbsOperatorFun {
19
19
  static constexpr const char *Name = "@";
20
20
  static constexpr const char *Parameters = "x";
21
- static constexpr const char *Description = "absolute value";
21
+ static constexpr const char *Description = "Absolute value";
22
22
  static constexpr const char *Example = "abs(-17.4)";
23
23
 
24
24
  static ScalarFunctionSet GetFunctions();
@@ -33,7 +33,7 @@ struct AbsFun {
33
33
  struct PowOperatorFun {
34
34
  static constexpr const char *Name = "**";
35
35
  static constexpr const char *Parameters = "x,y";
36
- static constexpr const char *Description = "computes x to the power of y";
36
+ static constexpr const char *Description = "Computes x to the power of y";
37
37
  static constexpr const char *Example = "pow(2, 3)";
38
38
 
39
39
  static ScalarFunction GetFunction();
@@ -60,7 +60,7 @@ struct PowOperatorFunAlias {
60
60
  struct FactorialOperatorFun {
61
61
  static constexpr const char *Name = "!__postfix";
62
62
  static constexpr const char *Parameters = "x";
63
- static constexpr const char *Description = "factorial of x. Computes the product of the current integer and all integers below it";
63
+ static constexpr const char *Description = "Factorial of x. Computes the product of the current integer and all integers below it";
64
64
  static constexpr const char *Example = "4!";
65
65
 
66
66
  static ScalarFunction GetFunction();
@@ -75,7 +75,7 @@ struct FactorialFun {
75
75
  struct AcosFun {
76
76
  static constexpr const char *Name = "acos";
77
77
  static constexpr const char *Parameters = "x";
78
- static constexpr const char *Description = "computes the arccosine of x";
78
+ static constexpr const char *Description = "Computes the arccosine of x";
79
79
  static constexpr const char *Example = "acos(0.5)";
80
80
 
81
81
  static ScalarFunction GetFunction();
@@ -84,7 +84,7 @@ struct AcosFun {
84
84
  struct AsinFun {
85
85
  static constexpr const char *Name = "asin";
86
86
  static constexpr const char *Parameters = "x";
87
- static constexpr const char *Description = "computes the arcsine of x";
87
+ static constexpr const char *Description = "Computes the arcsine of x";
88
88
  static constexpr const char *Example = "asin(0.5)";
89
89
 
90
90
  static ScalarFunction GetFunction();
@@ -93,7 +93,7 @@ struct AsinFun {
93
93
  struct AtanFun {
94
94
  static constexpr const char *Name = "atan";
95
95
  static constexpr const char *Parameters = "x";
96
- static constexpr const char *Description = "computes the arctangent of x";
96
+ static constexpr const char *Description = "Computes the arctangent of x";
97
97
  static constexpr const char *Example = "atan(0.5)";
98
98
 
99
99
  static ScalarFunction GetFunction();
@@ -102,7 +102,7 @@ struct AtanFun {
102
102
  struct Atan2Fun {
103
103
  static constexpr const char *Name = "atan2";
104
104
  static constexpr const char *Parameters = "y,x";
105
- static constexpr const char *Description = "computes the arctangent (y, x)";
105
+ static constexpr const char *Description = "Computes the arctangent (y, x)";
106
106
  static constexpr const char *Example = "atan2(1.0, 0.0)";
107
107
 
108
108
  static ScalarFunction GetFunction();
@@ -111,7 +111,7 @@ struct Atan2Fun {
111
111
  struct BitCountFun {
112
112
  static constexpr const char *Name = "bit_count";
113
113
  static constexpr const char *Parameters = "x";
114
- static constexpr const char *Description = "returns the number of bits that are set";
114
+ static constexpr const char *Description = "Returns the number of bits that are set";
115
115
  static constexpr const char *Example = "bit_count(31)";
116
116
 
117
117
  static ScalarFunctionSet GetFunctions();
@@ -120,7 +120,7 @@ struct BitCountFun {
120
120
  struct CbrtFun {
121
121
  static constexpr const char *Name = "cbrt";
122
122
  static constexpr const char *Parameters = "x";
123
- static constexpr const char *Description = "returns the cube root of x";
123
+ static constexpr const char *Description = "Returns the cube root of x";
124
124
  static constexpr const char *Example = "cbrt(8)";
125
125
 
126
126
  static ScalarFunction GetFunction();
@@ -129,7 +129,7 @@ struct CbrtFun {
129
129
  struct CeilFun {
130
130
  static constexpr const char *Name = "ceil";
131
131
  static constexpr const char *Parameters = "x";
132
- static constexpr const char *Description = "rounds the number up";
132
+ static constexpr const char *Description = "Rounds the number up";
133
133
  static constexpr const char *Example = "ceil(17.4)";
134
134
 
135
135
  static ScalarFunctionSet GetFunctions();
@@ -144,7 +144,7 @@ struct CeilingFun {
144
144
  struct CosFun {
145
145
  static constexpr const char *Name = "cos";
146
146
  static constexpr const char *Parameters = "x";
147
- static constexpr const char *Description = "computes the cos of x";
147
+ static constexpr const char *Description = "Computes the cos of x";
148
148
  static constexpr const char *Example = "cos(90)";
149
149
 
150
150
  static ScalarFunction GetFunction();
@@ -153,7 +153,7 @@ struct CosFun {
153
153
  struct CotFun {
154
154
  static constexpr const char *Name = "cot";
155
155
  static constexpr const char *Parameters = "x";
156
- static constexpr const char *Description = "computes the cotangent of x";
156
+ static constexpr const char *Description = "Computes the cotangent of x";
157
157
  static constexpr const char *Example = "cot(0.5)";
158
158
 
159
159
  static ScalarFunction GetFunction();
@@ -162,7 +162,7 @@ struct CotFun {
162
162
  struct DegreesFun {
163
163
  static constexpr const char *Name = "degrees";
164
164
  static constexpr const char *Parameters = "x";
165
- static constexpr const char *Description = "converts radians to degrees";
165
+ static constexpr const char *Description = "Converts radians to degrees";
166
166
  static constexpr const char *Example = "degrees(pi())";
167
167
 
168
168
  static ScalarFunction GetFunction();
@@ -171,7 +171,7 @@ struct DegreesFun {
171
171
  struct EvenFun {
172
172
  static constexpr const char *Name = "even";
173
173
  static constexpr const char *Parameters = "x";
174
- static constexpr const char *Description = "round to next even number by rounding away from zero.";
174
+ static constexpr const char *Description = "Rounds x to next even number by rounding away from zero";
175
175
  static constexpr const char *Example = "even(2.9)";
176
176
 
177
177
  static ScalarFunction GetFunction();
@@ -180,7 +180,7 @@ struct EvenFun {
180
180
  struct ExpFun {
181
181
  static constexpr const char *Name = "exp";
182
182
  static constexpr const char *Parameters = "x";
183
- static constexpr const char *Description = "computes e to the power of x";
183
+ static constexpr const char *Description = "Computes e to the power of x";
184
184
  static constexpr const char *Example = "exp(1)";
185
185
 
186
186
  static ScalarFunction GetFunction();
@@ -189,7 +189,7 @@ struct ExpFun {
189
189
  struct FloorFun {
190
190
  static constexpr const char *Name = "floor";
191
191
  static constexpr const char *Parameters = "x";
192
- static constexpr const char *Description = "rounds the number down";
192
+ static constexpr const char *Description = "Rounds the number down";
193
193
  static constexpr const char *Example = "floor(17.4)";
194
194
 
195
195
  static ScalarFunctionSet GetFunctions();
@@ -225,7 +225,7 @@ struct IsNanFun {
225
225
  struct GammaFun {
226
226
  static constexpr const char *Name = "gamma";
227
227
  static constexpr const char *Parameters = "x";
228
- static constexpr const char *Description = "interpolation of (x-1) factorial (so decimal inputs are allowed)";
228
+ static constexpr const char *Description = "Interpolation of (x-1) factorial (so decimal inputs are allowed)";
229
229
  static constexpr const char *Example = "gamma(5.5)";
230
230
 
231
231
  static ScalarFunction GetFunction();
@@ -234,7 +234,7 @@ struct GammaFun {
234
234
  struct GreatestCommonDivisorFun {
235
235
  static constexpr const char *Name = "greatest_common_divisor";
236
236
  static constexpr const char *Parameters = "x,y";
237
- static constexpr const char *Description = "computes the greatest common divisor of x and y";
237
+ static constexpr const char *Description = "Computes the greatest common divisor of x and y";
238
238
  static constexpr const char *Example = "greatest_common_divisor(42, 57)";
239
239
 
240
240
  static ScalarFunctionSet GetFunctions();
@@ -249,7 +249,7 @@ struct GcdFun {
249
249
  struct LeastCommonMultipleFun {
250
250
  static constexpr const char *Name = "least_common_multiple";
251
251
  static constexpr const char *Parameters = "x,y";
252
- static constexpr const char *Description = "computes the least common multiple of x and y";
252
+ static constexpr const char *Description = "Computes the least common multiple of x and y";
253
253
  static constexpr const char *Example = "least_common_multiple(42, 57)";
254
254
 
255
255
  static ScalarFunctionSet GetFunctions();
@@ -264,7 +264,7 @@ struct LcmFun {
264
264
  struct LogGammaFun {
265
265
  static constexpr const char *Name = "lgamma";
266
266
  static constexpr const char *Parameters = "x";
267
- static constexpr const char *Description = "computes the log of the gamma function.";
267
+ static constexpr const char *Description = "Computes the log of the gamma function";
268
268
  static constexpr const char *Example = "lgamma(2)";
269
269
 
270
270
  static ScalarFunction GetFunction();
@@ -273,7 +273,7 @@ struct LogGammaFun {
273
273
  struct LnFun {
274
274
  static constexpr const char *Name = "ln";
275
275
  static constexpr const char *Parameters = "x";
276
- static constexpr const char *Description = "computes the natural logarithm of x";
276
+ static constexpr const char *Description = "Computes the natural logarithm of x";
277
277
  static constexpr const char *Example = "ln(2)";
278
278
 
279
279
  static ScalarFunction GetFunction();
@@ -282,7 +282,7 @@ struct LnFun {
282
282
  struct Log2Fun {
283
283
  static constexpr const char *Name = "log2";
284
284
  static constexpr const char *Parameters = "x";
285
- static constexpr const char *Description = "computes the 2-log of x";
285
+ static constexpr const char *Description = "Computes the 2-log of x";
286
286
  static constexpr const char *Example = "log2(8)";
287
287
 
288
288
  static ScalarFunction GetFunction();
@@ -291,7 +291,7 @@ struct Log2Fun {
291
291
  struct Log10Fun {
292
292
  static constexpr const char *Name = "log10";
293
293
  static constexpr const char *Parameters = "x";
294
- static constexpr const char *Description = "computes the 10-log of x";
294
+ static constexpr const char *Description = "Computes the 10-log of x";
295
295
  static constexpr const char *Example = "log10(1000)";
296
296
 
297
297
  static ScalarFunction GetFunction();
@@ -306,7 +306,7 @@ struct LogFun {
306
306
  struct NextAfterFun {
307
307
  static constexpr const char *Name = "nextafter";
308
308
  static constexpr const char *Parameters = "x, y";
309
- static constexpr const char *Description = "return the next floating point value after x in the direction of y";
309
+ static constexpr const char *Description = "Returns the next floating point value after x in the direction of y";
310
310
  static constexpr const char *Example = "nextafter(1::float, 2::float)";
311
311
 
312
312
  static ScalarFunctionSet GetFunctions();
@@ -315,7 +315,7 @@ struct NextAfterFun {
315
315
  struct PiFun {
316
316
  static constexpr const char *Name = "pi";
317
317
  static constexpr const char *Parameters = "";
318
- static constexpr const char *Description = "returns the value of pi";
318
+ static constexpr const char *Description = "Returns the value of pi";
319
319
  static constexpr const char *Example = "pi()";
320
320
 
321
321
  static ScalarFunction GetFunction();
@@ -324,7 +324,7 @@ struct PiFun {
324
324
  struct RadiansFun {
325
325
  static constexpr const char *Name = "radians";
326
326
  static constexpr const char *Parameters = "x";
327
- static constexpr const char *Description = "converts degrees to radians";
327
+ static constexpr const char *Description = "Converts degrees to radians";
328
328
  static constexpr const char *Example = "radians(90)";
329
329
 
330
330
  static ScalarFunction GetFunction();
@@ -333,7 +333,7 @@ struct RadiansFun {
333
333
  struct RoundFun {
334
334
  static constexpr const char *Name = "round";
335
335
  static constexpr const char *Parameters = "x,precision";
336
- static constexpr const char *Description = "round to s decimal places";
336
+ static constexpr const char *Description = "Rounds x to s decimal places";
337
337
  static constexpr const char *Example = "round(42.4332, 2)";
338
338
 
339
339
  static ScalarFunctionSet GetFunctions();
@@ -342,7 +342,7 @@ struct RoundFun {
342
342
  struct SignFun {
343
343
  static constexpr const char *Name = "sign";
344
344
  static constexpr const char *Parameters = "x";
345
- static constexpr const char *Description = "returns the sign of x as -1, 0 or 1";
345
+ static constexpr const char *Description = "Returns the sign of x as -1, 0 or 1";
346
346
  static constexpr const char *Example = "sign(-349)";
347
347
 
348
348
  static ScalarFunctionSet GetFunctions();
@@ -351,7 +351,7 @@ struct SignFun {
351
351
  struct SignBitFun {
352
352
  static constexpr const char *Name = "signbit";
353
353
  static constexpr const char *Parameters = "x";
354
- static constexpr const char *Description = "returns whether the signbit is set or not";
354
+ static constexpr const char *Description = "Returns whether the signbit is set or not";
355
355
  static constexpr const char *Example = "signbit(-0.0)";
356
356
 
357
357
  static ScalarFunctionSet GetFunctions();
@@ -360,7 +360,7 @@ struct SignBitFun {
360
360
  struct SinFun {
361
361
  static constexpr const char *Name = "sin";
362
362
  static constexpr const char *Parameters = "x";
363
- static constexpr const char *Description = "computes the sin of x";
363
+ static constexpr const char *Description = "Computes the sin of x";
364
364
  static constexpr const char *Example = "sin(90)";
365
365
 
366
366
  static ScalarFunction GetFunction();
@@ -369,7 +369,7 @@ struct SinFun {
369
369
  struct SqrtFun {
370
370
  static constexpr const char *Name = "sqrt";
371
371
  static constexpr const char *Parameters = "x";
372
- static constexpr const char *Description = "returns the square root of x";
372
+ static constexpr const char *Description = "Returns the square root of x";
373
373
  static constexpr const char *Example = "sqrt(4)";
374
374
 
375
375
  static ScalarFunction GetFunction();
@@ -378,7 +378,7 @@ struct SqrtFun {
378
378
  struct TanFun {
379
379
  static constexpr const char *Name = "tan";
380
380
  static constexpr const char *Parameters = "x";
381
- static constexpr const char *Description = "computes the tan of x";
381
+ static constexpr const char *Description = "Computes the tan of x";
382
382
  static constexpr const char *Example = "tan(90)";
383
383
 
384
384
  static ScalarFunction GetFunction();
@@ -387,7 +387,7 @@ struct TanFun {
387
387
  struct TruncFun {
388
388
  static constexpr const char *Name = "trunc";
389
389
  static constexpr const char *Parameters = "x";
390
- static constexpr const char *Description = "truncates the number";
390
+ static constexpr const char *Description = "Truncates the number";
391
391
  static constexpr const char *Example = "trunc(17.4)";
392
392
 
393
393
  static ScalarFunctionSet GetFunctions();
@@ -45,7 +45,7 @@ struct BitwiseNotFun {
45
45
  struct LeftShiftFun {
46
46
  static constexpr const char *Name = "<<";
47
47
  static constexpr const char *Parameters = "input";
48
- static constexpr const char *Description = "bitwise shift left";
48
+ static constexpr const char *Description = "Bitwise shift left";
49
49
  static constexpr const char *Example = "1 << 4";
50
50
 
51
51
  static ScalarFunctionSet GetFunctions();
@@ -54,7 +54,7 @@ struct LeftShiftFun {
54
54
  struct RightShiftFun {
55
55
  static constexpr const char *Name = ">>";
56
56
  static constexpr const char *Parameters = "input";
57
- static constexpr const char *Description = "bitwise shift right";
57
+ static constexpr const char *Description = "Bitwise shift right";
58
58
  static constexpr const char *Example = "8 >> 2";
59
59
 
60
60
  static ScalarFunctionSet GetFunctions();
@@ -18,7 +18,7 @@ namespace duckdb {
18
18
  struct RandomFun {
19
19
  static constexpr const char *Name = "random";
20
20
  static constexpr const char *Parameters = "";
21
- static constexpr const char *Description = "returns a random number between 0 and 1";
21
+ static constexpr const char *Description = "Returns a random number between 0 and 1";
22
22
  static constexpr const char *Example = "random()";
23
23
 
24
24
  static ScalarFunction GetFunction();
@@ -27,7 +27,7 @@ struct RandomFun {
27
27
  struct SetseedFun {
28
28
  static constexpr const char *Name = "setseed";
29
29
  static constexpr const char *Parameters = "";
30
- static constexpr const char *Description = "sets the seed to be used for the random function";
30
+ static constexpr const char *Description = "Sets the seed to be used for the random function";
31
31
  static constexpr const char *Example = "setseed(0.42)";
32
32
 
33
33
  static ScalarFunction GetFunction();
@@ -36,7 +36,7 @@ struct SetseedFun {
36
36
  struct UUIDFun {
37
37
  static constexpr const char *Name = "uuid";
38
38
  static constexpr const char *Parameters = "";
39
- static constexpr const char *Description = "Return a random uuid similar to this: eeccb8c5-9943-b2bb-bb5e-222f4e14b687";
39
+ static constexpr const char *Description = "Returns a random UUID similar to this: eeccb8c5-9943-b2bb-bb5e-222f4e14b687";
40
40
  static constexpr const char *Example = "uuid()";
41
41
 
42
42
  static ScalarFunction GetFunction();
@@ -18,7 +18,7 @@ namespace duckdb {
18
18
  struct StartsWithOperatorFun {
19
19
  static constexpr const char *Name = "^@";
20
20
  static constexpr const char *Parameters = "string,search_string";
21
- static constexpr const char *Description = "Return true if string begins with search_string";
21
+ static constexpr const char *Description = "Returns true if string begins with search_string";
22
22
  static constexpr const char *Example = "starts_with('abc','a')";
23
23
 
24
24
  static ScalarFunction GetFunction();
@@ -33,7 +33,7 @@ struct StartsWithFun {
33
33
  struct ASCIIFun {
34
34
  static constexpr const char *Name = "ascii";
35
35
  static constexpr const char *Parameters = "string";
36
- static constexpr const char *Description = "Returns an integer that represents the Unicode code point of the first character of the string.";
36
+ static constexpr const char *Description = "Returns an integer that represents the Unicode code point of the first character of the string";
37
37
  static constexpr const char *Example = "ascii('Ω')";
38
38
 
39
39
  static ScalarFunction GetFunction();
@@ -42,7 +42,7 @@ struct ASCIIFun {
42
42
  struct BarFun {
43
43
  static constexpr const char *Name = "bar";
44
44
  static constexpr const char *Parameters = "x,min,max,width";
45
- static constexpr const char *Description = "Draw a band whose width is proportional to (x - min) and equal to width characters when x = max. width defaults to 80.";
45
+ static constexpr const char *Description = "Draws a band whose width is proportional to (x - min) and equal to width characters when x = max. width defaults to 80";
46
46
  static constexpr const char *Example = "bar(5, 0, 20, 10)";
47
47
 
48
48
  static ScalarFunctionSet GetFunctions();
@@ -66,7 +66,7 @@ struct ToBinaryFun {
66
66
  struct ChrFun {
67
67
  static constexpr const char *Name = "chr";
68
68
  static constexpr const char *Parameters = "code_point";
69
- static constexpr const char *Description = "returns a character which is corresponding the ASCII code value or Unicode code point";
69
+ static constexpr const char *Description = "Returns a character which is corresponding the ASCII code value or Unicode code point";
70
70
  static constexpr const char *Example = "chr(65)";
71
71
 
72
72
  static ScalarFunction GetFunction();
@@ -75,7 +75,7 @@ struct ChrFun {
75
75
  struct DamerauLevenshteinFun {
76
76
  static constexpr const char *Name = "damerau_levenshtein";
77
77
  static constexpr const char *Parameters = "str1,str2";
78
- static constexpr const char *Description = "Extension of Levenshtein distance to also include transposition of adjacent characters as an allowed edit operation. In other words, the minimum number of edit operations (insertions, deletions, substitutions or transpositions) required to change one string to another. Different case is considered different.";
78
+ static constexpr const char *Description = "Extension of Levenshtein distance to also include transposition of adjacent characters as an allowed edit operation. In other words, the minimum number of edit operations (insertions, deletions, substitutions or transpositions) required to change one string to another. Different case is considered different";
79
79
  static constexpr const char *Example = "damerau_levenshtein('hello', 'world')";
80
80
 
81
81
  static ScalarFunction GetFunction();
@@ -108,7 +108,7 @@ struct FormatreadabledecimalsizeFun {
108
108
  struct HammingFun {
109
109
  static constexpr const char *Name = "hamming";
110
110
  static constexpr const char *Parameters = "str1,str2";
111
- static constexpr const char *Description = "The number of positions with different characters for 2 strings of equal length. Different case is considered different.";
111
+ static constexpr const char *Description = "The number of positions with different characters for 2 strings of equal length. Different case is considered different";
112
112
  static constexpr const char *Example = "hamming('duck','luck')";
113
113
 
114
114
  static ScalarFunction GetFunction();
@@ -138,7 +138,7 @@ struct ToHexFun {
138
138
  struct InstrFun {
139
139
  static constexpr const char *Name = "instr";
140
140
  static constexpr const char *Parameters = "haystack,needle";
141
- static constexpr const char *Description = "Return location of first occurrence of needle in haystack, counting from 1. Returns 0 if no match found.";
141
+ static constexpr const char *Description = "Returns location of first occurrence of needle in haystack, counting from 1. Returns 0 if no match found";
142
142
  static constexpr const char *Example = "instr('test test','es')";
143
143
 
144
144
  static ScalarFunction GetFunction();
@@ -159,7 +159,7 @@ struct PositionFun {
159
159
  struct JaccardFun {
160
160
  static constexpr const char *Name = "jaccard";
161
161
  static constexpr const char *Parameters = "str1,str2";
162
- static constexpr const char *Description = "The Jaccard similarity between two strings. Different case is considered different. Returns a number between 0 and 1.";
162
+ static constexpr const char *Description = "The Jaccard similarity between two strings. Different case is considered different. Returns a number between 0 and 1";
163
163
  static constexpr const char *Example = "jaccard('duck','luck')";
164
164
 
165
165
  static ScalarFunction GetFunction();
@@ -168,7 +168,7 @@ struct JaccardFun {
168
168
  struct JaroSimilarityFun {
169
169
  static constexpr const char *Name = "jaro_similarity";
170
170
  static constexpr const char *Parameters = "str1,str2";
171
- static constexpr const char *Description = "The Jaro similarity between two strings. Different case is considered different. Returns a number between 0 and 1.";
171
+ static constexpr const char *Description = "The Jaro similarity between two strings. Different case is considered different. Returns a number between 0 and 1";
172
172
  static constexpr const char *Example = "jaro_similarity('duck','duckdb')";
173
173
 
174
174
  static ScalarFunction GetFunction();
@@ -177,7 +177,7 @@ struct JaroSimilarityFun {
177
177
  struct JaroWinklerSimilarityFun {
178
178
  static constexpr const char *Name = "jaro_winkler_similarity";
179
179
  static constexpr const char *Parameters = "str1,str2";
180
- static constexpr const char *Description = "The Jaro-Winkler similarity between two strings. Different case is considered different. Returns a number between 0 and 1.";
180
+ static constexpr const char *Description = "The Jaro-Winkler similarity between two strings. Different case is considered different. Returns a number between 0 and 1";
181
181
  static constexpr const char *Example = "jaro_winkler_similarity('duck','duckdb')";
182
182
 
183
183
  static ScalarFunction GetFunction();
@@ -204,7 +204,7 @@ struct LeftGraphemeFun {
204
204
  struct LevenshteinFun {
205
205
  static constexpr const char *Name = "levenshtein";
206
206
  static constexpr const char *Parameters = "str1,str2";
207
- static constexpr const char *Description = "The minimum number of single-character edits (insertions, deletions or substitutions) required to change one string to the other. Different case is considered different.";
207
+ static constexpr const char *Description = "The minimum number of single-character edits (insertions, deletions or substitutions) required to change one string to the other. Different case is considered different";
208
208
  static constexpr const char *Example = "levenshtein('duck','db')";
209
209
 
210
210
  static ScalarFunction GetFunction();
@@ -402,7 +402,7 @@ struct RegexpSplitToArrayFun {
402
402
  struct TranslateFun {
403
403
  static constexpr const char *Name = "translate";
404
404
  static constexpr const char *Parameters = "string,from,to";
405
- static constexpr const char *Description = "Replaces each character in string that matches a character in the from set with the corresponding character in the to set. If from is longer than to, occurrences of the extra characters in from are deleted.";
405
+ static constexpr const char *Description = "Replaces each character in string that matches a character in the from set with the corresponding character in the to set. If from is longer than to, occurrences of the extra characters in from are deleted";
406
406
  static constexpr const char *Example = "translate('12345', '143', 'ax')";
407
407
 
408
408
  static ScalarFunction GetFunction();
@@ -18,7 +18,7 @@ namespace duckdb {
18
18
  struct StructInsertFun {
19
19
  static constexpr const char *Name = "struct_insert";
20
20
  static constexpr const char *Parameters = "struct,any";
21
- static constexpr const char *Description = "Add field(s)/value(s) to an existing STRUCT with the argument values. The entry name(s) will be the bound variable name(s).";
21
+ static constexpr const char *Description = "Adds field(s)/value(s) to an existing STRUCT with the argument values. The entry name(s) will be the bound variable name(s)";
22
22
  static constexpr const char *Example = "struct_insert({'a': 1}, b := 2)";
23
23
 
24
24
  static ScalarFunction GetFunction();
@@ -27,7 +27,7 @@ struct StructInsertFun {
27
27
  struct StructPackFun {
28
28
  static constexpr const char *Name = "struct_pack";
29
29
  static constexpr const char *Parameters = "any";
30
- static constexpr const char *Description = "Create a STRUCT containing the argument values. The entry name will be the bound variable name";
30
+ static constexpr const char *Description = "Creates a STRUCT containing the argument values. The entry name will be the bound variable name";
31
31
  static constexpr const char *Example = "struct_pack(i := 4, s := 'string')";
32
32
 
33
33
  static ScalarFunction GetFunction();
@@ -27,7 +27,7 @@ struct UnionExtractFun {
27
27
  struct UnionTagFun {
28
28
  static constexpr const char *Name = "union_tag";
29
29
  static constexpr const char *Parameters = "union";
30
- static constexpr const char *Description = "Retrieve the currently selected tag of the union as an Enum.";
30
+ static constexpr const char *Description = "Retrieve the currently selected tag of the union as an ENUM";
31
31
  static constexpr const char *Example = "union_tag(union_value(k := 'foo'))";
32
32
 
33
33
  static ScalarFunction GetFunction();
@@ -36,7 +36,7 @@ struct UnionTagFun {
36
36
  struct UnionValueFun {
37
37
  static constexpr const char *Name = "union_value";
38
38
  static constexpr const char *Parameters = "tag";
39
- static constexpr const char *Description = "Create a single member UNION containing the argument value. The tag of the value will be the bound variable name.";
39
+ static constexpr const char *Description = "Create a single member UNION containing the argument value. The tag of the value will be the bound variable name";
40
40
  static constexpr const char *Example = "union_value(k := 'hello')";
41
41
 
42
42
  static ScalarFunction GetFunction();
@@ -21,6 +21,7 @@ class BoundSelectNode;
21
21
  struct BoundGroupInformation {
22
22
  parsed_expression_map_t<idx_t> map;
23
23
  case_insensitive_map_t<idx_t> alias_map;
24
+ unordered_map<idx_t, idx_t> collated_groups;
24
25
  };
25
26
 
26
27
  //! The BaseSelectBinder is the base binder of the SELECT, HAVING and QUALIFY binders. It can bind aggregates and window
@@ -35,7 +35,6 @@ protected:
35
35
  void ResolveTypes() override;
36
36
 
37
37
  private:
38
- LogicalCreateTable(ClientContext &context, const string &catalog, const string &schema,
39
- unique_ptr<CreateInfo> info);
38
+ LogicalCreateTable(ClientContext &context, unique_ptr<CreateInfo> info);
40
39
  };
41
40
  } // namespace duckdb
@@ -37,6 +37,6 @@ protected:
37
37
  void ResolveTypes() override;
38
38
 
39
39
  private:
40
- LogicalDelete(ClientContext &context, const string &catalog, const string &schema, const string &table);
40
+ LogicalDelete(ClientContext &context, const unique_ptr<CreateInfo> &table_info);
41
41
  };
42
42
  } // namespace duckdb
@@ -72,6 +72,6 @@ protected:
72
72
  string GetName() const override;
73
73
 
74
74
  private:
75
- LogicalInsert(ClientContext &context, const string &catalog, const string &schema, const string &table);
75
+ LogicalInsert(ClientContext &context, const unique_ptr<CreateInfo> table_info);
76
76
  };
77
77
  } // namespace duckdb
@@ -42,6 +42,6 @@ protected:
42
42
  void ResolveTypes() override;
43
43
 
44
44
  private:
45
- LogicalUpdate(ClientContext &context, const string &catalog, const string &schema, const string &table);
45
+ LogicalUpdate(ClientContext &context, const unique_ptr<CreateInfo> &table_info);
46
46
  };
47
47
  } // namespace duckdb
@@ -144,7 +144,7 @@ public:
144
144
  //! Revert a set of appends made by the given AppendState, used to revert appends in the event of an error during
145
145
  //! commit (e.g. because of an I/O exception)
146
146
  void RevertAppend(idx_t start_row, idx_t count);
147
- void RevertAppendInternal(idx_t start_row, idx_t count);
147
+ void RevertAppendInternal(idx_t start_row);
148
148
 
149
149
  void ScanTableSegment(idx_t start_row, idx_t count, const std::function<void(DataChunk &chunk)> &function);
150
150
 
@@ -73,7 +73,7 @@ public:
73
73
  //! FinalizeAppend flushes an append with a variable number of rows.
74
74
  void FinalizeAppend(TransactionData transaction, TableAppendState &state);
75
75
  void CommitAppend(transaction_t commit_id, idx_t row_start, idx_t count);
76
- void RevertAppendInternal(idx_t start_row, idx_t count);
76
+ void RevertAppendInternal(idx_t start_row);
77
77
 
78
78
  void MergeStorage(RowGroupCollection &data);
79
79
 
@@ -1,25 +1,29 @@
1
1
  #include "duckdb/common/limits.hpp"
2
2
  #include "duckdb/common/string_util.hpp"
3
3
  #include "duckdb/execution/expression_executor.hpp"
4
+ #include "duckdb/function/aggregate/distributive_functions.hpp"
5
+ #include "duckdb/function/function_binder.hpp"
4
6
  #include "duckdb/main/config.hpp"
5
7
  #include "duckdb/parser/expression/columnref_expression.hpp"
6
8
  #include "duckdb/parser/expression/comparison_expression.hpp"
9
+ #include "duckdb/parser/expression/conjunction_expression.hpp"
7
10
  #include "duckdb/parser/expression/constant_expression.hpp"
8
- #include "duckdb/parser/expression/subquery_expression.hpp"
9
11
  #include "duckdb/parser/expression/star_expression.hpp"
12
+ #include "duckdb/parser/expression/subquery_expression.hpp"
10
13
  #include "duckdb/parser/query_node/select_node.hpp"
11
14
  #include "duckdb/parser/tableref/joinref.hpp"
12
15
  #include "duckdb/planner/binder.hpp"
16
+ #include "duckdb/planner/expression/bound_aggregate_expression.hpp"
13
17
  #include "duckdb/planner/expression_binder/column_alias_binder.hpp"
14
18
  #include "duckdb/planner/expression_binder/constant_binder.hpp"
15
19
  #include "duckdb/planner/expression_binder/group_binder.hpp"
16
20
  #include "duckdb/planner/expression_binder/having_binder.hpp"
17
- #include "duckdb/planner/expression_binder/qualify_binder.hpp"
18
21
  #include "duckdb/planner/expression_binder/order_binder.hpp"
22
+ #include "duckdb/planner/expression_binder/qualify_binder.hpp"
19
23
  #include "duckdb/planner/expression_binder/select_binder.hpp"
20
24
  #include "duckdb/planner/expression_binder/where_binder.hpp"
25
+ #include "duckdb/planner/expression_iterator.hpp"
21
26
  #include "duckdb/planner/query_node/bound_select_node.hpp"
22
- #include "duckdb/parser/expression/conjunction_expression.hpp"
23
27
 
24
28
  namespace duckdb {
25
29
 
@@ -380,10 +384,28 @@ unique_ptr<BoundQueryNode> Binder::BindSelectNode(SelectNode &statement, unique_
380
384
  auto bound_expr = group_binder.Bind(group_expressions[i], &group_type);
381
385
  D_ASSERT(bound_expr->return_type.id() != LogicalTypeId::INVALID);
382
386
 
387
+ // find out whether the expression contains a subquery, it can't be copied if so
388
+ auto &bound_expr_ref = *bound_expr;
389
+ bool contains_subquery = bound_expr_ref.HasSubquery();
390
+
383
391
  // push a potential collation, if necessary
384
- bound_expr = ExpressionBinder::PushCollation(context, std::move(bound_expr),
385
- StringType::GetCollation(group_type), true);
386
- result->groups.group_expressions.push_back(std::move(bound_expr));
392
+ auto collated_expr = ExpressionBinder::PushCollation(context, std::move(bound_expr),
393
+ StringType::GetCollation(group_type), true);
394
+ if (!contains_subquery && !collated_expr->Equals(bound_expr_ref)) {
395
+ // if there is a collation on a group x, we should group by the collated expr,
396
+ // but also push a first(x) aggregate in case x is selected (uncollated)
397
+ info.collated_groups[i] = result->aggregates.size();
398
+
399
+ auto first_fun = FirstFun::GetFunction(LogicalType::VARCHAR);
400
+ vector<unique_ptr<Expression>> first_children;
401
+ // FIXME: would be better to just refer to this expression, but for now we copy
402
+ first_children.push_back(bound_expr_ref.Copy());
403
+
404
+ FunctionBinder function_binder(context);
405
+ auto function = function_binder.BindAggregateFunction(first_fun, std::move(first_children));
406
+ result->aggregates.push_back(std::move(function));
407
+ }
408
+ result->groups.group_expressions.push_back(std::move(collated_expr));
387
409
 
388
410
  // in the unbound expression we DO bind the table names of any ColumnRefs
389
411
  // we do this to make sure that "table.a" and "a" are treated the same
@@ -39,6 +39,9 @@ BoundStatement Binder::Bind(DropStatement &stmt) {
39
39
  if (!entry) {
40
40
  break;
41
41
  }
42
+ if (entry->internal) {
43
+ throw CatalogException("Cannot drop internal catalog entry \"%s\"!", entry->name);
44
+ }
42
45
  stmt.info->catalog = entry->ParentCatalog().GetName();
43
46
  if (!entry->temporary) {
44
47
  // we can only drop temporary tables in read-only mode