duckdb 0.6.2-dev1978.0 → 0.6.2-dev2015.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.
- package/package.json +1 -1
- package/src/duckdb/extension/json/buffered_json_reader.cpp +132 -18
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +29 -9
- package/src/duckdb/extension/json/include/json_common.hpp +56 -0
- package/src/duckdb/extension/json/include/json_functions.hpp +9 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +115 -25
- package/src/duckdb/extension/json/include/json_structure.hpp +73 -0
- package/src/duckdb/extension/json/include/json_transform.hpp +57 -0
- package/src/duckdb/extension/json/json-extension.cpp +3 -0
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_create.cpp +6 -10
- package/src/duckdb/extension/json/json_functions/json_extract.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_keys.cpp +60 -0
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +404 -150
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +216 -60
- package/src/duckdb/extension/json/json_functions/read_json.cpp +224 -0
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +6 -6
- package/src/duckdb/extension/json/json_functions.cpp +25 -0
- package/src/duckdb/extension/json/json_scan.cpp +192 -86
- package/src/duckdb/extension/json/yyjson/include/yyjson.hpp +18 -9
- package/src/duckdb/extension/json/yyjson/yyjson.cpp +58 -13
- package/src/duckdb/src/function/table/copy_csv.cpp +16 -11
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/function/scalar/strftime.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/extension_functions.hpp +5 -0
- package/src/duckdb/ub_extension_json_json_functions.cpp +4 -0
|
@@ -22,9 +22,8 @@
|
|
|
22
22
|
#include <limits.h>
|
|
23
23
|
#include <string.h>
|
|
24
24
|
#include <float.h>
|
|
25
|
-
#include "duckdb/common/fast_mem.hpp"
|
|
26
|
-
|
|
27
25
|
|
|
26
|
+
#include "duckdb/common/fast_mem.hpp"
|
|
28
27
|
|
|
29
28
|
/*==============================================================================
|
|
30
29
|
* Compile-time Options
|
|
@@ -229,7 +228,8 @@
|
|
|
229
228
|
|
|
230
229
|
/** likely for compiler */
|
|
231
230
|
#ifndef yyjson_likely
|
|
232
|
-
# if yyjson_has_builtin(__builtin_expect) ||
|
|
231
|
+
# if yyjson_has_builtin(__builtin_expect) || \
|
|
232
|
+
(YYJSON_GCC_VER >= 4 && YYJSON_GCC_VER != 5)
|
|
233
233
|
# define yyjson_likely(expr) __builtin_expect(!!(expr), 1)
|
|
234
234
|
# else
|
|
235
235
|
# define yyjson_likely(expr) (expr)
|
|
@@ -238,7 +238,8 @@
|
|
|
238
238
|
|
|
239
239
|
/** unlikely for compiler */
|
|
240
240
|
#ifndef yyjson_unlikely
|
|
241
|
-
# if yyjson_has_builtin(__builtin_expect) ||
|
|
241
|
+
# if yyjson_has_builtin(__builtin_expect) || \
|
|
242
|
+
(YYJSON_GCC_VER >= 4 && YYJSON_GCC_VER != 5)
|
|
242
243
|
# define yyjson_unlikely(expr) __builtin_expect(!!(expr), 0)
|
|
243
244
|
# else
|
|
244
245
|
# define yyjson_unlikely(expr) (expr)
|
|
@@ -620,7 +621,7 @@ typedef uint32_t yyjson_read_code;
|
|
|
620
621
|
/** Success, no error. */
|
|
621
622
|
static const yyjson_read_code YYJSON_READ_SUCCESS = 0;
|
|
622
623
|
|
|
623
|
-
/** Invalid parameter, such as NULL string or
|
|
624
|
+
/** Invalid parameter, such as NULL input string or 0 input length. */
|
|
624
625
|
static const yyjson_read_code YYJSON_READ_ERROR_INVALID_PARAMETER = 1;
|
|
625
626
|
|
|
626
627
|
/** Memory allocation failure occurs. */
|
|
@@ -816,6 +817,9 @@ yyjson_api_inline size_t yyjson_read_max_memory_usage(size_t len,
|
|
|
816
817
|
@param flg The JSON read options.
|
|
817
818
|
Multiple options can be combined with `|` operator. 0 means no options.
|
|
818
819
|
Suppors `YYJSON_READ_NUMBER_AS_RAW` and `YYJSON_READ_ALLOW_INF_AND_NAN`.
|
|
820
|
+
@param alc The memory allocator used for long number.
|
|
821
|
+
It is only used when the built-in floating point reader is disabled.
|
|
822
|
+
Pass NULL to use the libc's default allocator.
|
|
819
823
|
@param err A pointer to receive error information.
|
|
820
824
|
Pass NULL if you don't need error information.
|
|
821
825
|
@return If successful, a pointer to the character after the last character
|
|
@@ -824,6 +828,7 @@ yyjson_api_inline size_t yyjson_read_max_memory_usage(size_t len,
|
|
|
824
828
|
yyjson_api const char *yyjson_read_number(const char *dat,
|
|
825
829
|
yyjson_val *val,
|
|
826
830
|
yyjson_read_flag flg,
|
|
831
|
+
const yyjson_alc *alc,
|
|
827
832
|
yyjson_read_err *err);
|
|
828
833
|
|
|
829
834
|
/**
|
|
@@ -839,6 +844,9 @@ yyjson_api const char *yyjson_read_number(const char *dat,
|
|
|
839
844
|
@param flg The JSON read options.
|
|
840
845
|
Multiple options can be combined with `|` operator. 0 means no options.
|
|
841
846
|
Suppors `YYJSON_READ_NUMBER_AS_RAW` and `YYJSON_READ_ALLOW_INF_AND_NAN`.
|
|
847
|
+
@param alc The memory allocator used for long number.
|
|
848
|
+
It is only used when the built-in floating point reader is disabled.
|
|
849
|
+
Pass NULL to use the libc's default allocator.
|
|
842
850
|
@param err A pointer to receive error information.
|
|
843
851
|
Pass NULL if you don't need error information.
|
|
844
852
|
@return If successful, a pointer to the character after the last character
|
|
@@ -847,8 +855,9 @@ yyjson_api const char *yyjson_read_number(const char *dat,
|
|
|
847
855
|
yyjson_api_inline const char *yyjson_mut_read_number(const char *dat,
|
|
848
856
|
yyjson_mut_val *val,
|
|
849
857
|
yyjson_read_flag flg,
|
|
858
|
+
const yyjson_alc *alc,
|
|
850
859
|
yyjson_read_err *err) {
|
|
851
|
-
return yyjson_read_number(dat, (yyjson_val *)val, flg, err);
|
|
860
|
+
return yyjson_read_number(dat, (yyjson_val *)val, flg, alc, err);
|
|
852
861
|
}
|
|
853
862
|
|
|
854
863
|
|
|
@@ -4230,14 +4239,14 @@ yyjson_api_inline char *unsafe_yyjson_mut_strncpy(yyjson_mut_doc *doc,
|
|
|
4230
4239
|
char *mem;
|
|
4231
4240
|
const yyjson_alc *alc = &doc->alc;
|
|
4232
4241
|
yyjson_str_pool *pool = &doc->str_pool;
|
|
4233
|
-
|
|
4242
|
+
|
|
4234
4243
|
if (!str) return NULL;
|
|
4235
4244
|
if (yyjson_unlikely((size_t)(pool->end - pool->cur) <= len)) {
|
|
4236
4245
|
if (yyjson_unlikely(!unsafe_yyjson_str_pool_grow(pool, alc, len + 1))) {
|
|
4237
4246
|
return NULL;
|
|
4238
4247
|
}
|
|
4239
4248
|
}
|
|
4240
|
-
|
|
4249
|
+
|
|
4241
4250
|
mem = pool->cur;
|
|
4242
4251
|
pool->cur = mem + len + 1;
|
|
4243
4252
|
memcpy((void *)mem, (const void *)str, len);
|
|
@@ -4255,7 +4264,7 @@ yyjson_api_inline yyjson_mut_val *unsafe_yyjson_mut_val(yyjson_mut_doc *doc,
|
|
|
4255
4264
|
return NULL;
|
|
4256
4265
|
}
|
|
4257
4266
|
}
|
|
4258
|
-
|
|
4267
|
+
|
|
4259
4268
|
val = pool->cur;
|
|
4260
4269
|
pool->cur += count;
|
|
4261
4270
|
return val;
|
|
@@ -3041,7 +3041,7 @@ static_noinline bool read_number_raw(u8 **ptr,
|
|
|
3041
3041
|
if (unlikely(ext)) {
|
|
3042
3042
|
if (read_inf_or_nan(*hdr == '-', &cur, pre, val)) return_raw();
|
|
3043
3043
|
}
|
|
3044
|
-
return_err(cur
|
|
3044
|
+
return_err(cur, "no digit after minus sign");
|
|
3045
3045
|
}
|
|
3046
3046
|
|
|
3047
3047
|
/* read integral part */
|
|
@@ -3069,7 +3069,7 @@ static_noinline bool read_number_raw(u8 **ptr,
|
|
|
3069
3069
|
if (digi_is_exp(*cur)) {
|
|
3070
3070
|
cur += 1 + digi_is_sign(cur[1]);
|
|
3071
3071
|
if (!digi_is_digit(*cur++)) {
|
|
3072
|
-
return_err(cur
|
|
3072
|
+
return_err(cur, "no digit after exponent sign");
|
|
3073
3073
|
}
|
|
3074
3074
|
while (digi_is_digit(*cur)) cur++;
|
|
3075
3075
|
}
|
|
@@ -3481,7 +3481,7 @@ static_inline bool read_number(u8 **ptr,
|
|
|
3481
3481
|
return true;
|
|
3482
3482
|
}
|
|
3483
3483
|
}
|
|
3484
|
-
return_err(cur
|
|
3484
|
+
return_err(cur, "no digit after minus sign");
|
|
3485
3485
|
}
|
|
3486
3486
|
/* begin with 0 */
|
|
3487
3487
|
if (likely(!digi_is_digit_or_fp(*++cur))) return_i64(0);
|
|
@@ -3504,7 +3504,7 @@ static_inline bool read_number(u8 **ptr,
|
|
|
3504
3504
|
if (unlikely(digi_is_exp(*cur))) { /* 0 with any exponent is still 0 */
|
|
3505
3505
|
cur += (usize)1 + digi_is_sign(cur[1]);
|
|
3506
3506
|
if (unlikely(!digi_is_digit(*cur))) {
|
|
3507
|
-
return_err(cur
|
|
3507
|
+
return_err(cur, "no digit after exponent sign");
|
|
3508
3508
|
}
|
|
3509
3509
|
while (digi_is_digit(*++cur));
|
|
3510
3510
|
}
|
|
@@ -3658,7 +3658,7 @@ digi_exp_more:
|
|
|
3658
3658
|
exp_sign = (*++cur == '-');
|
|
3659
3659
|
cur += digi_is_sign(*cur);
|
|
3660
3660
|
if (unlikely(!digi_is_digit(*cur))) {
|
|
3661
|
-
return_err(cur
|
|
3661
|
+
return_err(cur, "no digit after exponent sign");
|
|
3662
3662
|
}
|
|
3663
3663
|
while (*cur == '0') cur++;
|
|
3664
3664
|
|
|
@@ -4056,7 +4056,7 @@ static_noinline bool read_number(u8 **ptr,
|
|
|
4056
4056
|
return true;
|
|
4057
4057
|
}
|
|
4058
4058
|
}
|
|
4059
|
-
return_err(cur
|
|
4059
|
+
return_err(cur, "no digit after minus sign");
|
|
4060
4060
|
}
|
|
4061
4061
|
if (*cur == '0') {
|
|
4062
4062
|
cur++;
|
|
@@ -4105,17 +4105,19 @@ read_double:
|
|
|
4105
4105
|
/* skip fraction part */
|
|
4106
4106
|
dot = cur;
|
|
4107
4107
|
cur++;
|
|
4108
|
-
if (!digi_is_digit(*cur
|
|
4109
|
-
return_err(cur
|
|
4108
|
+
if (!digi_is_digit(*cur)) {
|
|
4109
|
+
return_err(cur, "no digit after decimal point");
|
|
4110
4110
|
}
|
|
4111
|
+
cur++;
|
|
4111
4112
|
while (digi_is_digit(*cur)) cur++;
|
|
4112
4113
|
}
|
|
4113
4114
|
if (digi_is_exp(*cur)) {
|
|
4114
4115
|
/* skip exponent part */
|
|
4115
4116
|
cur += 1 + digi_is_sign(cur[1]);
|
|
4116
|
-
if (!digi_is_digit(*cur
|
|
4117
|
-
return_err(cur
|
|
4117
|
+
if (!digi_is_digit(*cur)) {
|
|
4118
|
+
return_err(cur, "no digit after exponent sign");
|
|
4118
4119
|
}
|
|
4120
|
+
cur++;
|
|
4119
4121
|
while (digi_is_digit(*cur)) cur++;
|
|
4120
4122
|
}
|
|
4121
4123
|
|
|
@@ -4896,6 +4898,7 @@ arr_val_begin:
|
|
|
4896
4898
|
cur++;
|
|
4897
4899
|
if (likely(ctn_len == 0)) goto arr_end;
|
|
4898
4900
|
if (has_flag(ALLOW_TRAILING_COMMAS)) goto arr_end;
|
|
4901
|
+
cur--;
|
|
4899
4902
|
goto fail_trailing_comma;
|
|
4900
4903
|
}
|
|
4901
4904
|
if (char_is_space(*cur)) {
|
|
@@ -4973,6 +4976,7 @@ obj_key_begin:
|
|
|
4973
4976
|
cur++;
|
|
4974
4977
|
if (likely(ctn_len == 0)) goto obj_end;
|
|
4975
4978
|
if (has_flag(ALLOW_TRAILING_COMMAS)) goto obj_end;
|
|
4979
|
+
cur--;
|
|
4976
4980
|
goto fail_trailing_comma;
|
|
4977
4981
|
}
|
|
4978
4982
|
if (char_is_space(*cur)) {
|
|
@@ -5095,7 +5099,10 @@ obj_end:
|
|
|
5095
5099
|
doc_end:
|
|
5096
5100
|
/* check invalid contents after json document */
|
|
5097
5101
|
if (unlikely(cur < end) && !has_flag(STOP_WHEN_DONE)) {
|
|
5098
|
-
if (has_flag(ALLOW_COMMENTS))
|
|
5102
|
+
if (has_flag(ALLOW_COMMENTS)) {
|
|
5103
|
+
skip_spaces_and_comments(&cur);
|
|
5104
|
+
if (byte_match_2(cur, "/*")) goto fail_comment;
|
|
5105
|
+
}
|
|
5099
5106
|
else while (char_is_space(*cur)) cur++;
|
|
5100
5107
|
if (unlikely(cur < end)) goto fail_garbage;
|
|
5101
5108
|
}
|
|
@@ -5296,6 +5303,7 @@ arr_val_begin:
|
|
|
5296
5303
|
cur++;
|
|
5297
5304
|
if (likely(ctn_len == 0)) goto arr_end;
|
|
5298
5305
|
if (has_flag(ALLOW_TRAILING_COMMAS)) goto arr_end;
|
|
5306
|
+
cur--;
|
|
5299
5307
|
goto fail_trailing_comma;
|
|
5300
5308
|
}
|
|
5301
5309
|
if (char_is_space(*cur)) {
|
|
@@ -5390,6 +5398,7 @@ obj_key_begin:
|
|
|
5390
5398
|
cur++;
|
|
5391
5399
|
if (likely(ctn_len == 0)) goto obj_end;
|
|
5392
5400
|
if (has_flag(ALLOW_TRAILING_COMMAS)) goto obj_end;
|
|
5401
|
+
cur--;
|
|
5393
5402
|
goto fail_trailing_comma;
|
|
5394
5403
|
}
|
|
5395
5404
|
if (char_is_space(*cur)) {
|
|
@@ -5521,7 +5530,10 @@ obj_end:
|
|
|
5521
5530
|
doc_end:
|
|
5522
5531
|
/* check invalid contents after json document */
|
|
5523
5532
|
if (unlikely(cur < end) && !has_flag(STOP_WHEN_DONE)) {
|
|
5524
|
-
if (has_flag(ALLOW_COMMENTS))
|
|
5533
|
+
if (has_flag(ALLOW_COMMENTS)) {
|
|
5534
|
+
skip_spaces_and_comments(&cur);
|
|
5535
|
+
if (byte_match_2(cur, "/*")) goto fail_comment;
|
|
5536
|
+
}
|
|
5525
5537
|
else while (char_is_space(*cur)) cur++;
|
|
5526
5538
|
if (unlikely(cur < end)) goto fail_garbage;
|
|
5527
5539
|
}
|
|
@@ -5777,6 +5789,7 @@ yyjson_doc *yyjson_read_file(const char *path,
|
|
|
5777
5789
|
const char *yyjson_read_number(const char *dat,
|
|
5778
5790
|
yyjson_val *val,
|
|
5779
5791
|
yyjson_read_flag flg,
|
|
5792
|
+
const yyjson_alc *alc,
|
|
5780
5793
|
yyjson_read_err *err) {
|
|
5781
5794
|
#define return_err(_pos, _code, _msg) do { \
|
|
5782
5795
|
err->pos = _pos > hdr ? (usize)(_pos - hdr) : 0; \
|
|
@@ -5792,8 +5805,13 @@ const char *yyjson_read_number(const char *dat,
|
|
|
5792
5805
|
u8 **pre; /* previous raw end pointer */
|
|
5793
5806
|
const char *msg;
|
|
5794
5807
|
yyjson_read_err dummy_err;
|
|
5795
|
-
if (!err) err = &dummy_err;
|
|
5796
5808
|
|
|
5809
|
+
#if !YYJSON_HAS_IEEE_754 || YYJSON_DISABLE_FAST_FP_CONV
|
|
5810
|
+
u8 buf[128];
|
|
5811
|
+
usize dat_len;
|
|
5812
|
+
#endif
|
|
5813
|
+
|
|
5814
|
+
if (!err) err = &dummy_err;
|
|
5797
5815
|
if (unlikely(!dat)) {
|
|
5798
5816
|
return_err(cur, INVALID_PARAMETER, "input data is NULL");
|
|
5799
5817
|
}
|
|
@@ -5801,6 +5819,23 @@ const char *yyjson_read_number(const char *dat,
|
|
|
5801
5819
|
return_err(cur, INVALID_PARAMETER, "output value is NULL");
|
|
5802
5820
|
}
|
|
5803
5821
|
|
|
5822
|
+
#if !YYJSON_HAS_IEEE_754 || YYJSON_DISABLE_FAST_FP_CONV
|
|
5823
|
+
if (!alc) alc = &YYJSON_DEFAULT_ALC;
|
|
5824
|
+
dat_len = strlen(dat);
|
|
5825
|
+
if (dat_len < sizeof(buf)) {
|
|
5826
|
+
memcpy(buf, dat, dat_len + 1);
|
|
5827
|
+
hdr = buf;
|
|
5828
|
+
cur = hdr;
|
|
5829
|
+
} else {
|
|
5830
|
+
hdr = (u8 *)alc->malloc(alc->ctx, dat_len + 1);
|
|
5831
|
+
cur = hdr;
|
|
5832
|
+
if (unlikely(!hdr)) {
|
|
5833
|
+
return_err(cur, MEMORY_ALLOCATION, "memory allocation failed");
|
|
5834
|
+
}
|
|
5835
|
+
memcpy(hdr, dat, dat_len + 1);
|
|
5836
|
+
}
|
|
5837
|
+
#endif
|
|
5838
|
+
|
|
5804
5839
|
#if YYJSON_DISABLE_NON_STANDARD
|
|
5805
5840
|
ext = false;
|
|
5806
5841
|
#else
|
|
@@ -5811,10 +5846,20 @@ const char *yyjson_read_number(const char *dat,
|
|
|
5811
5846
|
raw_end = NULL;
|
|
5812
5847
|
pre = raw ? &raw_end : NULL;
|
|
5813
5848
|
|
|
5849
|
+
#if !YYJSON_HAS_IEEE_754 || YYJSON_DISABLE_FAST_FP_CONV
|
|
5850
|
+
if (!read_number(&cur, pre, ext, val, &msg)) {
|
|
5851
|
+
if (dat_len >= sizeof(buf)) alc->free(alc->ctx, hdr);
|
|
5852
|
+
return_err(cur, INVALID_NUMBER, msg);
|
|
5853
|
+
}
|
|
5854
|
+
if (dat_len >= sizeof(buf)) alc->free(alc->ctx, hdr);
|
|
5855
|
+
if (raw) val->uni.str = dat;
|
|
5856
|
+
return dat + (cur - hdr);
|
|
5857
|
+
#else
|
|
5814
5858
|
if (!read_number(&cur, pre, ext, val, &msg)) {
|
|
5815
5859
|
return_err(cur, INVALID_NUMBER, msg);
|
|
5816
5860
|
}
|
|
5817
5861
|
return (const char *)cur;
|
|
5862
|
+
#endif
|
|
5818
5863
|
|
|
5819
5864
|
#undef return_err
|
|
5820
5865
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
#include "duckdb/function/table/read_csv.hpp"
|
|
2
|
-
#include "duckdb/execution/operator/persistent/parallel_csv_reader.hpp"
|
|
3
|
-
#include "duckdb/common/serializer/buffered_serializer.hpp"
|
|
4
|
-
#include "duckdb/function/copy_function.hpp"
|
|
5
|
-
#include "duckdb/parser/parsed_data/copy_info.hpp"
|
|
6
1
|
#include "duckdb/common/bind_helpers.hpp"
|
|
7
|
-
#include "duckdb/common/string_util.hpp"
|
|
8
2
|
#include "duckdb/common/file_system.hpp"
|
|
3
|
+
#include "duckdb/common/serializer/buffered_serializer.hpp"
|
|
4
|
+
#include "duckdb/common/string_util.hpp"
|
|
9
5
|
#include "duckdb/common/types/string_type.hpp"
|
|
10
6
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
|
7
|
+
#include "duckdb/execution/operator/persistent/parallel_csv_reader.hpp"
|
|
8
|
+
#include "duckdb/function/copy_function.hpp"
|
|
11
9
|
#include "duckdb/function/scalar/string_functions.hpp"
|
|
10
|
+
#include "duckdb/function/table/read_csv.hpp"
|
|
12
11
|
#include "duckdb/main/config.hpp"
|
|
12
|
+
#include "duckdb/parser/parsed_data/copy_info.hpp"
|
|
13
|
+
|
|
13
14
|
#include <limits>
|
|
14
15
|
|
|
15
16
|
namespace duckdb {
|
|
@@ -164,12 +165,14 @@ static bool RequiresQuotes(WriteCSVData &csv_data, const char *str, idx_t len) {
|
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
// check for delimiter
|
|
167
|
-
if (
|
|
168
|
+
if (options.delimiter.length() != 0 &&
|
|
169
|
+
ContainsFun::Find((const unsigned char *)str, len, (const unsigned char *)options.delimiter.c_str(),
|
|
168
170
|
options.delimiter.size()) != DConstants::INVALID_INDEX) {
|
|
169
171
|
return true;
|
|
170
172
|
}
|
|
171
173
|
// check for quote
|
|
172
|
-
if (
|
|
174
|
+
if (options.quote.length() != 0 &&
|
|
175
|
+
ContainsFun::Find((const unsigned char *)str, len, (const unsigned char *)options.quote.c_str(),
|
|
173
176
|
options.quote.size()) != DConstants::INVALID_INDEX) {
|
|
174
177
|
return true;
|
|
175
178
|
}
|
|
@@ -196,13 +199,15 @@ static void WriteQuotedString(Serializer &serializer, WriteCSVData &csv_data, co
|
|
|
196
199
|
break;
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
|
-
} else
|
|
202
|
+
} else {
|
|
200
203
|
// complex CSV
|
|
201
204
|
// check for quote or escape separately
|
|
202
|
-
if (
|
|
205
|
+
if (options.quote.length() != 0 &&
|
|
206
|
+
ContainsFun::Find((const unsigned char *)str, len, (const unsigned char *)options.quote.c_str(),
|
|
203
207
|
options.quote.size()) != DConstants::INVALID_INDEX) {
|
|
204
208
|
requires_escape = true;
|
|
205
|
-
} else if (
|
|
209
|
+
} else if (options.escape.length() != 0 &&
|
|
210
|
+
ContainsFun::Find((const unsigned char *)str, len, (const unsigned char *)options.escape.c_str(),
|
|
206
211
|
options.escape.size()) != DConstants::INVALID_INDEX) {
|
|
207
212
|
requires_escape = true;
|
|
208
213
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
|
2
|
-
#define DUCKDB_VERSION "0.6.2-
|
|
2
|
+
#define DUCKDB_VERSION "0.6.2-dev2015"
|
|
3
3
|
#endif
|
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
|
5
|
+
#define DUCKDB_SOURCE_ID "cbf43430b3"
|
|
6
6
|
#endif
|
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
|
8
8
|
#include "duckdb/main/database.hpp"
|
|
@@ -138,8 +138,8 @@ public:
|
|
|
138
138
|
|
|
139
139
|
DUCKDB_API bool Parse(string_t str, ParseResult &result);
|
|
140
140
|
|
|
141
|
-
bool TryParseDate(string_t str, date_t &result, string &error_message);
|
|
142
|
-
bool TryParseTimestamp(string_t str, timestamp_t &result, string &error_message);
|
|
141
|
+
DUCKDB_API bool TryParseDate(string_t str, date_t &result, string &error_message);
|
|
142
|
+
DUCKDB_API bool TryParseTimestamp(string_t str, timestamp_t &result, string &error_message);
|
|
143
143
|
|
|
144
144
|
date_t ParseDate(string_t str);
|
|
145
145
|
timestamp_t ParseTimestamp(string_t str);
|
|
@@ -46,6 +46,7 @@ static constexpr ExtensionFunction EXTENSION_FUNCTIONS[] = {
|
|
|
46
46
|
{"json_group_array", "json"},
|
|
47
47
|
{"json_group_object", "json"},
|
|
48
48
|
{"json_group_structure", "json"},
|
|
49
|
+
{"json_keys", "json"},
|
|
49
50
|
{"json_merge_patch", "json"},
|
|
50
51
|
{"json_object", "json"},
|
|
51
52
|
{"json_quote", "json"},
|
|
@@ -62,7 +63,11 @@ static constexpr ExtensionFunction EXTENSION_FUNCTIONS[] = {
|
|
|
62
63
|
{"postgres_attach", "postgres_scanner"},
|
|
63
64
|
{"postgres_scan", "postgres_scanner"},
|
|
64
65
|
{"postgres_scan_pushdown", "postgres_scanner"},
|
|
66
|
+
{"read_json", "json"},
|
|
67
|
+
{"read_json_auto", "json"},
|
|
65
68
|
{"read_json_objects", "json"},
|
|
69
|
+
{"read_ndjson", "json"},
|
|
70
|
+
{"read_ndjson_auto", "json"},
|
|
66
71
|
{"read_ndjson_objects", "json"},
|
|
67
72
|
{"read_parquet", "parquet"},
|
|
68
73
|
{"row_to_json", "json"},
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
#include "extension/json/json_functions/json_extract.cpp"
|
|
6
6
|
|
|
7
|
+
#include "extension/json/json_functions/json_keys.cpp"
|
|
8
|
+
|
|
7
9
|
#include "extension/json/json_functions/json_merge_patch.cpp"
|
|
8
10
|
|
|
9
11
|
#include "extension/json/json_functions/json_structure.cpp"
|
|
@@ -16,5 +18,7 @@
|
|
|
16
18
|
|
|
17
19
|
#include "extension/json/json_functions/json_valid.cpp"
|
|
18
20
|
|
|
21
|
+
#include "extension/json/json_functions/read_json.cpp"
|
|
22
|
+
|
|
19
23
|
#include "extension/json/json_functions/read_json_objects.cpp"
|
|
20
24
|
|