Skip to content

Commit b7ebe43

Browse files
duckdblabs-botgithub-actions[bot]
authored andcommitted
Update vendored DuckDB sources to fda0ba6a7a
1 parent d2caaf6 commit b7ebe43

File tree

31 files changed

+290
-87
lines changed

31 files changed

+290
-87
lines changed

src/duckdb/extension/json/json_extension.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ void JsonExtension::Load(DuckDB &db) {
6868

6969
// JSON copy function
7070
auto copy_fun = JSONFunctions::GetJSONCopyFunction();
71-
ExtensionUtil::RegisterFunction(db_instance, std::move(copy_fun));
71+
ExtensionUtil::RegisterFunction(db_instance, copy_fun);
72+
copy_fun.extension = "ndjson";
73+
copy_fun.name = "ndjson";
74+
ExtensionUtil::RegisterFunction(db_instance, copy_fun);
75+
copy_fun.extension = "jsonl";
76+
copy_fun.name = "jsonl";
77+
ExtensionUtil::RegisterFunction(db_instance, copy_fun);
7278

7379
// JSON macro's
7480
for (idx_t index = 0; json_macros[index].name != nullptr; index++) {

src/duckdb/src/catalog/catalog_set.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,11 @@ void CatalogSet::Scan(const std::function<void(CatalogEntry &)> &callback) {
721721
}
722722
}
723723

724+
void CatalogSet::SetDefaultGenerator(unique_ptr<DefaultGenerator> defaults_p) {
725+
lock_guard<mutex> lock(catalog_lock);
726+
defaults = std::move(defaults_p);
727+
}
728+
724729
void CatalogSet::Verify(Catalog &catalog_p) {
725730
D_ASSERT(&catalog_p == &catalog);
726731
vector<reference<CatalogEntry>> entries;

src/duckdb/src/catalog/duck_catalog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void DuckCatalog::Initialize(bool load_builtin) {
3030
CreateSchemaInfo info;
3131
info.schema = DEFAULT_SCHEMA;
3232
info.internal = true;
33+
info.on_conflict = OnCreateConflict::IGNORE_ON_CONFLICT;
3334
CreateSchema(data, info);
3435

3536
if (load_builtin) {

src/duckdb/src/common/enum_util.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,19 +1032,20 @@ const StringUtil::EnumStringLiteral *GetDataFileTypeValues() {
10321032
{ static_cast<uint32_t>(DataFileType::FILE_DOES_NOT_EXIST), "FILE_DOES_NOT_EXIST" },
10331033
{ static_cast<uint32_t>(DataFileType::DUCKDB_FILE), "DUCKDB_FILE" },
10341034
{ static_cast<uint32_t>(DataFileType::SQLITE_FILE), "SQLITE_FILE" },
1035-
{ static_cast<uint32_t>(DataFileType::PARQUET_FILE), "PARQUET_FILE" }
1035+
{ static_cast<uint32_t>(DataFileType::PARQUET_FILE), "PARQUET_FILE" },
1036+
{ static_cast<uint32_t>(DataFileType::UNKNOWN_FILE), "UNKNOWN_FILE" }
10361037
};
10371038
return values;
10381039
}
10391040

10401041
template<>
10411042
const char* EnumUtil::ToChars<DataFileType>(DataFileType value) {
1042-
return StringUtil::EnumToString(GetDataFileTypeValues(), 4, "DataFileType", static_cast<uint32_t>(value));
1043+
return StringUtil::EnumToString(GetDataFileTypeValues(), 5, "DataFileType", static_cast<uint32_t>(value));
10431044
}
10441045

10451046
template<>
10461047
DataFileType EnumUtil::FromString<DataFileType>(const char *value) {
1047-
return static_cast<DataFileType>(StringUtil::StringToEnum(GetDataFileTypeValues(), 4, "DataFileType", value));
1048+
return static_cast<DataFileType>(StringUtil::StringToEnum(GetDataFileTypeValues(), 5, "DataFileType", value));
10481049
}
10491050

10501051
const StringUtil::EnumStringLiteral *GetDateCastResultValues() {

src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ bool LineError::HandleErrors(StringValueResult &result) {
749749
default:
750750
throw InvalidInputException("CSV Error not allowed when inserting row");
751751
}
752-
result.error_handler.Error(csv_error);
752+
result.error_handler.Error(csv_error, result.try_row);
753753
}
754754
if (is_error_in_line && scan_id != StringValueScanner::LINE_FINDER_ID) {
755755
if (result.sniffing) {
@@ -777,7 +777,7 @@ void StringValueResult::NullPaddingQuotedNewlineCheck() const {
777777
// If we have null_padding set, we found a quoted new line, we are scanning the file in parallel; We error.
778778
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(), lines_read);
779779
auto csv_error = CSVError::NullPaddingFail(state_machine.options, lines_per_batch, path);
780-
error_handler.Error(csv_error);
780+
error_handler.Error(csv_error, try_row);
781781
}
782782
}
783783

@@ -847,13 +847,13 @@ bool StringValueResult::AddRowInternal() {
847847
state_machine.options, cur_col_id - 1, lines_per_batch, borked_line,
848848
current_line_position.begin.GetGlobalPosition(requested_size, first_nl),
849849
last_position.GetGlobalPosition(requested_size, first_nl), path);
850-
error_handler.Error(csv_error);
850+
error_handler.Error(csv_error, try_row);
851851
} else {
852852
auto csv_error = CSVError::IncorrectColumnAmountError(
853853
state_machine.options, cur_col_id - 1, lines_per_batch, borked_line,
854854
current_line_position.begin.GetGlobalPosition(requested_size, first_nl),
855855
last_position.GetGlobalPosition(requested_size), path);
856-
error_handler.Error(csv_error);
856+
error_handler.Error(csv_error, try_row);
857857
}
858858
}
859859
// If we are here we ignore_errors, so we delete this line
@@ -966,6 +966,7 @@ StringValueScanner::StringValueScanner(idx_t scanner_idx_p, const shared_ptr<CSV
966966
lines_read += csv_file_scan->skipped_rows;
967967
}
968968
iterator.buffer_size = state_machine->options.buffer_size_option.GetValue();
969+
result.try_row = scanner_idx == LINE_FINDER_ID;
969970
}
970971

971972
StringValueScanner::StringValueScanner(const shared_ptr<CSVBufferManager> &buffer_manager,
@@ -1710,19 +1711,24 @@ bool StringValueScanner::IsRowValid(CSVIterator &current_iterator) const {
17101711
return false;
17111712
}
17121713
constexpr idx_t result_size = 1;
1713-
auto scan_finder = make_uniq<StringValueScanner>(StringValueScanner::LINE_FINDER_ID, buffer_manager,
1714-
state_machine_strict, make_shared_ptr<CSVErrorHandler>(),
1715-
csv_file_scan, false, current_iterator, result_size);
1716-
auto &tuples = scan_finder->ParseChunk();
1717-
current_iterator.pos = scan_finder->GetIteratorPosition();
1718-
bool has_error = false;
1719-
if (tuples.current_errors.HasError()) {
1720-
if (tuples.current_errors.Size() != 1 || !tuples.current_errors.HasErrorType(MAXIMUM_LINE_SIZE)) {
1721-
// We ignore maximum line size errors
1722-
has_error = true;
1723-
}
1724-
}
1725-
return (tuples.number_of_rows == 1 || tuples.first_line_is_comment) && !has_error && tuples.borked_rows.empty();
1714+
auto scan_finder = make_uniq<StringValueScanner>(LINE_FINDER_ID, buffer_manager, state_machine_strict,
1715+
make_shared_ptr<CSVErrorHandler>(), csv_file_scan, false,
1716+
current_iterator, result_size);
1717+
try {
1718+
auto &tuples = scan_finder->ParseChunk();
1719+
current_iterator.pos = scan_finder->GetIteratorPosition();
1720+
bool has_error = false;
1721+
if (tuples.current_errors.HasError()) {
1722+
if (tuples.current_errors.Size() != 1 || !tuples.current_errors.HasErrorType(MAXIMUM_LINE_SIZE)) {
1723+
// We ignore maximum line size errors
1724+
has_error = true;
1725+
}
1726+
}
1727+
return (tuples.number_of_rows == 1 || tuples.first_line_is_comment) && !has_error && tuples.borked_rows.empty();
1728+
} catch (const Exception &e) {
1729+
return false;
1730+
}
1731+
return true;
17261732
}
17271733

17281734
ValidRowInfo StringValueScanner::TryRow(CSVState state, idx_t start_pos, idx_t end_pos) const {

src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void CSVErrorHandler::ThrowError(const CSVError &csv_error) {
6060

6161
void CSVErrorHandler::Error(const CSVError &csv_error, bool force_error) {
6262
lock_guard<mutex> parallel_lock(main_mutex);
63-
if ((ignore_errors && !force_error) || (PrintLineNumber(csv_error) && !CanGetLine(csv_error.GetBoundaryIndex()))) {
63+
if (!force_error && (ignore_errors || (PrintLineNumber(csv_error) && !CanGetLine(csv_error.GetBoundaryIndex())))) {
6464
// We store this error, we can't throw it now, or we are ignoring it
6565
errors.push_back(csv_error);
6666
return;

src/duckdb/src/execution/operator/schema/physical_attach.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,6 @@ SourceResultType PhysicalAttach::GetData(ExecutionContext &context, DataChunk &c
6262
}
6363
}
6464

65-
string extension = "";
66-
if (FileSystem::IsRemoteFile(path, extension)) {
67-
if (!ExtensionHelper::TryAutoLoadExtension(context.client, extension)) {
68-
throw MissingExtensionException("Attaching path '%s' requires extension '%s' to be loaded", path,
69-
extension);
70-
}
71-
if (options.access_mode == AccessMode::AUTOMATIC) {
72-
// Attaching of remote files gets bumped to READ_ONLY
73-
// This is due to the fact that on most (all?) remote files writes to DB are not available
74-
// and having this raised later is not super helpful
75-
options.access_mode = AccessMode::READ_ONLY;
76-
}
77-
}
78-
7965
// Get the database type and attach the database.
8066
db_manager.GetDatabaseType(context.client, *info, config, options);
8167
auto attached_db = db_manager.AttachDatabase(context.client, *info, options);

src/duckdb/src/function/table/version/pragma_version.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev3309"
2+
#define DUCKDB_PATCH_VERSION "0-dev3365"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 3
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.3.0-dev3309"
11+
#define DUCKDB_VERSION "v1.3.0-dev3365"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "027bc16ee8"
14+
#define DUCKDB_SOURCE_ID "fda0ba6a7a"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//===----------------------------------------------------------------------===//
22
// DuckDB
33
//
4-
// duckdb/catalog/catalog_entry/dschema_catalog_entry.hpp
4+
// duckdb/catalog/catalog_entry/duck_schema_entry.hpp
55
//
66
//
77
//===----------------------------------------------------------------------===//
@@ -70,11 +70,10 @@ class DuckSchemaEntry : public SchemaCatalogEntry {
7070

7171
void Verify(Catalog &catalog) override;
7272

73-
private:
74-
void OnDropEntry(CatalogTransaction transaction, CatalogEntry &entry);
75-
76-
private:
7773
//! Get the catalog set for the specified type
7874
CatalogSet &GetCatalogSet(CatalogType type);
75+
76+
private:
77+
void OnDropEntry(CatalogTransaction transaction, CatalogEntry &entry);
7978
};
8079
} // namespace duckdb

src/duckdb/src/include/duckdb/catalog/catalog_set.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ class CatalogSet {
128128

129129
void Verify(Catalog &catalog);
130130

131+
//! Override the default generator - this should not be used after the catalog set has been used
132+
void SetDefaultGenerator(unique_ptr<DefaultGenerator> defaults);
133+
131134
private:
132135
bool DropDependencies(CatalogTransaction transaction, const string &name, bool cascade,
133136
bool allow_drop_internal = false);

0 commit comments

Comments
 (0)