duckdb 0.8.2-dev4623.0 → 0.8.2-dev4653.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 +8 -8
- package/src/duckdb/extension/json/json_functions/read_json.cpp +6 -2
- package/src/duckdb/extension/json/json_scan.cpp +4 -6
- package/src/duckdb/src/execution/operator/csv_scanner/csv_reader_options.cpp +1 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb.h +3 -3
- package/src/duckdb/src/storage/checkpoint_manager.cpp +3 -3
- package/src/duckdb/src/storage/table/table_statistics.cpp +1 -3
- package/src/duckdb/src/storage/wal_replay.cpp +8 -2
package/package.json
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
#include "buffered_json_reader.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/file_opener.hpp"
|
4
|
-
#include "duckdb/common/printer.hpp"
|
5
|
-
#include "duckdb/common/serializer/serializer.hpp"
|
6
4
|
#include "duckdb/common/serializer/deserializer.hpp"
|
5
|
+
#include "duckdb/common/serializer/serializer.hpp"
|
7
6
|
|
8
7
|
#include <utility>
|
9
8
|
|
@@ -24,7 +23,7 @@ bool JSONFileHandle::IsOpen() const {
|
|
24
23
|
}
|
25
24
|
|
26
25
|
void JSONFileHandle::Close() {
|
27
|
-
if (IsOpen()) {
|
26
|
+
if (IsOpen() && plain_file_source) {
|
28
27
|
file_handle->Close();
|
29
28
|
file_handle = nullptr;
|
30
29
|
}
|
@@ -174,12 +173,13 @@ BufferedJSONReader::BufferedJSONReader(ClientContext &context, BufferedJSONReade
|
|
174
173
|
}
|
175
174
|
|
176
175
|
void BufferedJSONReader::OpenJSONFile() {
|
177
|
-
D_ASSERT(!IsOpen());
|
178
176
|
lock_guard<mutex> guard(lock);
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
177
|
+
if (!IsOpen()) {
|
178
|
+
auto &file_system = FileSystem::GetFileSystem(context);
|
179
|
+
auto regular_file_handle = file_system.OpenFile(file_name.c_str(), FileFlags::FILE_FLAGS_READ,
|
180
|
+
FileLockType::NO_LOCK, options.compression);
|
181
|
+
file_handle = make_uniq<JSONFileHandle>(std::move(regular_file_handle), BufferAllocator::Get(context));
|
182
|
+
}
|
183
183
|
Reset();
|
184
184
|
}
|
185
185
|
|
@@ -17,6 +17,7 @@ void JSONScan::AutoDetect(ClientContext &context, JSONScanData &bind_data, vecto
|
|
17
17
|
Vector string_vector(LogicalType::VARCHAR);
|
18
18
|
|
19
19
|
// Loop through the files (if union_by_name, else just sample the first file)
|
20
|
+
idx_t remaining = bind_data.sample_size;
|
20
21
|
for (idx_t file_idx = 0; file_idx < bind_data.files.size(); file_idx++) {
|
21
22
|
// Create global/local state and place the reader in the right field
|
22
23
|
JSONScanGlobalState gstate(context, bind_data);
|
@@ -28,7 +29,6 @@ void JSONScan::AutoDetect(ClientContext &context, JSONScanData &bind_data, vecto
|
|
28
29
|
}
|
29
30
|
|
30
31
|
// Read and detect schema
|
31
|
-
idx_t remaining = bind_data.sample_size;
|
32
32
|
while (remaining != 0) {
|
33
33
|
allocator.Reset();
|
34
34
|
auto read_count = lstate.ReadNext(gstate);
|
@@ -56,7 +56,11 @@ void JSONScan::AutoDetect(ClientContext &context, JSONScanData &bind_data, vecto
|
|
56
56
|
}
|
57
57
|
|
58
58
|
// Close the file and stop detection if not union_by_name
|
59
|
-
if (
|
59
|
+
if (bind_data.options.file_options.union_by_name) {
|
60
|
+
// When union_by_name=true we sample sample_size per file
|
61
|
+
remaining = bind_data.sample_size;
|
62
|
+
} else if (remaining == 0) {
|
63
|
+
// When union_by_name=false, we sample sample_size in total (across the first files)
|
60
64
|
break;
|
61
65
|
}
|
62
66
|
}
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
#include "duckdb/common/enum_util.hpp"
|
4
4
|
#include "duckdb/common/multi_file_reader.hpp"
|
5
|
+
#include "duckdb/common/serializer/deserializer.hpp"
|
6
|
+
#include "duckdb/common/serializer/serializer.hpp"
|
5
7
|
#include "duckdb/main/extension_helper.hpp"
|
6
8
|
#include "duckdb/parallel/task_scheduler.hpp"
|
7
9
|
#include "duckdb/storage/buffer_manager.hpp"
|
8
|
-
#include "duckdb/common/serializer/serializer.hpp"
|
9
|
-
#include "duckdb/common/serializer/deserializer.hpp"
|
10
10
|
|
11
11
|
namespace duckdb {
|
12
12
|
|
@@ -558,10 +558,8 @@ bool JSONScanLocalState::ReadNextBuffer(JSONScanGlobalState &gstate) {
|
|
558
558
|
if (current_reader) {
|
559
559
|
// If we performed the final read of this reader in the previous iteration, close it now
|
560
560
|
if (is_last) {
|
561
|
-
|
562
|
-
|
563
|
-
current_reader->CloseJSONFile();
|
564
|
-
}
|
561
|
+
TryIncrementFileIndex(gstate);
|
562
|
+
current_reader->CloseJSONFile();
|
565
563
|
current_reader = nullptr;
|
566
564
|
continue;
|
567
565
|
}
|
@@ -500,7 +500,7 @@ void CSVReaderOptions::ToNamedParameters(named_parameter_map_t &named_params) {
|
|
500
500
|
}
|
501
501
|
|
502
502
|
named_params["normalize_names"] = Value::BOOLEAN(normalize_names);
|
503
|
-
if (!name_list.empty()) {
|
503
|
+
if (!name_list.empty() && !named_params.count("column_names") && !named_params.count("names")) {
|
504
504
|
named_params["column_names"] = StringVectorToValue(name_list);
|
505
505
|
}
|
506
506
|
named_params["all_varchar"] = Value::BOOLEAN(all_varchar);
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.8.2-
|
2
|
+
#define DUCKDB_VERSION "0.8.2-dev4653"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "bb287d4b22"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -1740,7 +1740,7 @@ DUCKDB_API duckdb_vector duckdb_struct_vector_get_child(duckdb_vector vector, id
|
|
1740
1740
|
/*!
|
1741
1741
|
Returns whether or not a row is valid (i.e. not NULL) in the given validity mask.
|
1742
1742
|
|
1743
|
-
* validity: The validity mask, as obtained through `
|
1743
|
+
* validity: The validity mask, as obtained through `duckdb_vector_get_validity`
|
1744
1744
|
* row: The row index
|
1745
1745
|
* returns: true if the row is valid, false otherwise
|
1746
1746
|
*/
|
@@ -1749,10 +1749,10 @@ DUCKDB_API bool duckdb_validity_row_is_valid(uint64_t *validity, idx_t row);
|
|
1749
1749
|
/*!
|
1750
1750
|
In a validity mask, sets a specific row to either valid or invalid.
|
1751
1751
|
|
1752
|
-
Note that `
|
1752
|
+
Note that `duckdb_vector_ensure_validity_writable` should be called before calling `duckdb_vector_get_validity`,
|
1753
1753
|
to ensure that there is a validity mask to write to.
|
1754
1754
|
|
1755
|
-
* validity: The validity mask, as obtained through `
|
1755
|
+
* validity: The validity mask, as obtained through `duckdb_vector_get_validity`.
|
1756
1756
|
* row: The row index
|
1757
1757
|
* valid: Whether or not to set the row to valid, or invalid
|
1758
1758
|
*/
|
@@ -131,11 +131,11 @@ void SingleFileCheckpointWriter::CreateCheckpoint() {
|
|
131
131
|
throw FatalException("Checkpoint aborted before truncate because of PRAGMA checkpoint_abort flag");
|
132
132
|
}
|
133
133
|
|
134
|
-
// truncate the WAL
|
135
|
-
wal->Truncate(0);
|
136
|
-
|
137
134
|
// truncate the file
|
138
135
|
block_manager.Truncate();
|
136
|
+
|
137
|
+
// truncate the WAL
|
138
|
+
wal->Truncate(0);
|
139
139
|
}
|
140
140
|
|
141
141
|
void CheckpointReader::LoadCheckpoint(ClientContext &context, MetadataReader &reader) {
|
@@ -102,9 +102,7 @@ void TableStatistics::CopyStats(TableStatistics &other) {
|
|
102
102
|
}
|
103
103
|
|
104
104
|
void TableStatistics::Serialize(Serializer &serializer) const {
|
105
|
-
|
106
|
-
serializer.WriteList(100, "column_stats", column_count,
|
107
|
-
[&](Serializer::List &list, idx_t i) { list.WriteElement(column_stats[i]); });
|
105
|
+
serializer.WriteProperty(100, "column_stats", column_stats);
|
108
106
|
}
|
109
107
|
|
110
108
|
void TableStatistics::Deserialize(Deserializer &deserializer, ColumnList &columns) {
|
@@ -57,7 +57,10 @@ bool WriteAheadLog::Replay(AttachedDatabase &database, string &path) {
|
|
57
57
|
deserializer.End();
|
58
58
|
}
|
59
59
|
}
|
60
|
-
} catch (
|
60
|
+
} catch (SerializationException &ex) { // LCOV_EXCL_START
|
61
|
+
// serialization exception - torn WAL
|
62
|
+
// continue reading
|
63
|
+
} catch (std::exception &ex) {
|
61
64
|
Printer::PrintF("Exception in WAL playback during initial read: %s\n", ex.what());
|
62
65
|
return false;
|
63
66
|
} catch (...) {
|
@@ -104,7 +107,10 @@ bool WriteAheadLog::Replay(AttachedDatabase &database, string &path) {
|
|
104
107
|
deserializer.End();
|
105
108
|
}
|
106
109
|
}
|
107
|
-
} catch (
|
110
|
+
} catch (SerializationException &ex) { // LCOV_EXCL_START
|
111
|
+
// serialization error during WAL replay: rollback
|
112
|
+
con.Rollback();
|
113
|
+
} catch (std::exception &ex) {
|
108
114
|
// FIXME: this should report a proper warning in the connection
|
109
115
|
Printer::PrintF("Exception in WAL playback: %s\n", ex.what());
|
110
116
|
// exception thrown in WAL replay: rollback
|