Skip to content

Commit 2a7e0cf

Browse files
committed
Changes for DuckDB 1.5.x
1 parent 8c1deef commit 2a7e0cf

13 files changed

Lines changed: 6 additions & 89 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if(EMSCRIPTEN)
1717
# needed, but somehow some global symbols are not properly
1818
# exported otherwise this solves by basically re-linking (at the moment the
1919
# Wasm binary is actually produced)
20-
set(DUCKDB_EXTENSION_SPATIAL_LINKED_LIBS
20+
set(DUCKDB_EXTENSION_EUROSTAT_LINKED_LIBS
2121
"../../vcpkg_installed/wasm32-emscripten/lib/lib*.a")
2222
endif()
2323

duckdb

Submodule duckdb updated 4302 files

src/eurostat/eurostat.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace eurostat {
55

66
//! Get the level for a GEO code in the NUTS classification or if it is considered aggregates.
77
std::string Dimension::GetGeoLevelFromGeoCode(const std::string &geo_code) {
8-
98
#define STARTS_WITH(str, prefix) ((strlen(prefix) <= str.size()) && strncmp(str.c_str(), prefix, strlen(prefix)) == 0)
109

1110
//

src/eurostat/eurostat_data_functions.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ namespace {
4545
//======================================================================================================================
4646

4747
struct ES_Read {
48-
4948
//------------------------------------------------------------------------------------------------------------------
5049
// Bind
5150
//------------------------------------------------------------------------------------------------------------------
@@ -64,7 +63,6 @@ struct ES_Read {
6463

6564
static unique_ptr<FunctionData> Bind(ClientContext &context, TableFunctionBindInput &input,
6665
vector<LogicalType> &return_types, vector<string> &names) {
67-
6866
D_ASSERT(input.inputs.size() == 2);
6967

7068
const string &provider_id = StringValue::Get(input.inputs[0]);
@@ -127,7 +125,6 @@ struct ES_Read {
127125
//! Parse a data row from a TSV line.
128126
static bool ParseDatarow(State &data_table, const std::vector<string> &time_periods, int32_t geo_column_index,
129127
const string &line, std::unordered_map<string, bool> &row_keys, const bool &check_keys) {
130-
131128
std::vector<bool> state_keys;
132129

133130
// Split line by tabs.
@@ -182,7 +179,6 @@ struct ES_Read {
182179
// Parse observation values for each time period.
183180

184181
for (size_t i = 0; i < time_periods.size(); i++) {
185-
186182
// Duplicate row, skip.
187183

188184
if (check_keys && state_keys[i]) {
@@ -214,7 +210,6 @@ struct ES_Read {
214210
static std::vector<string> GetDataUrls(ClientContext &context, TableFunctionInitInput &input,
215211
const std::vector<eurostat::Dimension> &data_structure,
216212
const string &base_url, const BindData &bind_data) {
217-
218213
std::unordered_map<string, bool> urls;
219214

220215
// Use complex filters previously parsed in 'PushdownComplexFilter' function.
@@ -246,7 +241,6 @@ struct ES_Read {
246241
}
247242

248243
static unique_ptr<GlobalTableFunctionState> Init(ClientContext &context, TableFunctionInitInput &input) {
249-
250244
auto &bind_data = input.bind_data->Cast<BindData>();
251245
auto global_state = make_uniq_base<GlobalTableFunctionState, State>();
252246
auto &data_table = global_state->Cast<State>();
@@ -268,7 +262,6 @@ struct ES_Read {
268262
bool check_keys = data_urls.size() > 1;
269263

270264
for (const auto &data_url : data_urls) {
271-
272265
EUROSTAT_SCAN_DEBUG_LOG(1, "Fetching data from URL: %s", data_url.c_str());
273266

274267
// Execute HTTP GET request.
@@ -311,7 +304,6 @@ struct ES_Read {
311304

312305
while (std::getline(line_stream, line)) {
313306
if (!line.empty()) {
314-
315307
// Parse header line to...
316308
if (line_index == 0) {
317309
size_t pos = line.find("\\TIME_PERIOD");
@@ -368,7 +360,6 @@ struct ES_Read {
368360
//------------------------------------------------------------------------------------------------------------------
369361

370362
static void Execute(ClientContext &context, TableFunctionInput &input, DataChunk &output) {
371-
372363
auto &gstate = input.global_state->Cast<State>();
373364

374365
// Calculate how many record we can fit in the output
@@ -382,7 +373,6 @@ struct ES_Read {
382373

383374
// Load current subset of rows.
384375
for (idx_t row_idx = 0, record_idx = current_row; row_idx < output_size; row_idx++, record_idx++) {
385-
386376
const auto &datarow = gstate.rows[record_idx];
387377
const DimensionValues &dim_values = gstate.dimensions[datarow.dimension_index];
388378
const auto &dim_count = dim_values.values.size();
@@ -439,7 +429,6 @@ struct ES_Read {
439429

440430
static void PushdownComplexFilter(ClientContext &context, LogicalGet &get, FunctionData *bind_data_p,
441431
vector<unique_ptr<Expression>> &expressions) {
442-
443432
auto &bind_data = bind_data_p->Cast<BindData>();
444433

445434
// Get column_ids from LogicalGet to map expression column indices to table columns.
@@ -473,7 +462,6 @@ struct ES_Read {
473462
//------------------------------------------------------------------------------------------------------------------
474463

475464
static void Register(ExtensionLoader &loader) {
476-
477465
InsertionOrderPreservingMap<string> tags;
478466
tags.insert("ext", "eurostat");
479467
tags.insert("category", "table");
@@ -499,7 +487,6 @@ struct ES_Read {
499487
// #####################################################################################################################
500488

501489
void EurostatDataFunctions::Register(ExtensionLoader &loader) {
502-
503490
ES_Read::Register(loader);
504491
}
505492

src/eurostat/eurostat_info_functions.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ namespace {
2929
//======================================================================================================================
3030

3131
struct ES_Endpoints {
32-
3332
//------------------------------------------------------------------------------------------------------------------
3433
// Bind
3534
//------------------------------------------------------------------------------------------------------------------
@@ -42,7 +41,6 @@ struct ES_Endpoints {
4241

4342
static unique_ptr<FunctionData> Bind(ClientContext &context, TableFunctionBindInput &input,
4443
vector<LogicalType> &return_types, vector<string> &names) {
45-
4644
names.emplace_back("provider_id");
4745
return_types.push_back(LogicalType::VARCHAR);
4846
names.emplace_back("organization");
@@ -122,7 +120,6 @@ struct ES_Endpoints {
122120
//------------------------------------------------------------------------------------------------------------------
123121

124122
static void Register(ExtensionLoader &loader) {
125-
126123
InsertionOrderPreservingMap<string> tags;
127124
tags.insert("ext", "eurostat");
128125
tags.insert("category", "table");
@@ -137,7 +134,6 @@ struct ES_Endpoints {
137134
//======================================================================================================================
138135

139136
struct ES_Dataflows {
140-
141137
#define INFO_COLUMN_PROVIDER_ID 0
142138
#define INFO_COLUMN_DATAFLOW_ID 1
143139
#define INFO_COLUMN_TYPE 2
@@ -174,7 +170,6 @@ struct ES_Dataflows {
174170
//! Parse DataflowInfo from JSON object
175171
inline static DataflowInfo ParseDataflow(const string &provider_id, yyjson_val *object_val,
176172
bool &load_datastructure, bool &load_annotations) {
177-
178173
yyjson_val *extension_val = nullptr;
179174
yyjson_val *annotation_val = nullptr;
180175
yyjson_val *attrib_val = nullptr;
@@ -300,7 +295,6 @@ struct ES_Dataflows {
300295

301296
static unique_ptr<FunctionData> Bind(ClientContext &context, TableFunctionBindInput &input,
302297
vector<LogicalType> &return_types, vector<string> &names) {
303-
304298
std::vector<string> providers;
305299
std::vector<string> dataflows;
306300
string language = "en";
@@ -417,7 +411,6 @@ struct ES_Dataflows {
417411
};
418412

419413
static unique_ptr<GlobalTableFunctionState> Init(ClientContext &context, TableFunctionInitInput &input) {
420-
421414
const auto &bind_data = input.bind_data->Cast<BindData>();
422415
const auto &providers = bind_data.providers;
423416
const auto &dataflows = bind_data.dataflows;
@@ -519,7 +512,6 @@ struct ES_Dataflows {
519512
//------------------------------------------------------------------------------------------------------------------
520513

521514
static void Execute(ClientContext &context, TableFunctionInput &input, DataChunk &output) {
522-
523515
auto &gstate = input.global_state->Cast<State>();
524516

525517
// Calculate how many record we can fit in the output
@@ -659,7 +651,6 @@ struct ES_Dataflows {
659651
//------------------------------------------------------------------------------------------------------------------
660652

661653
static void Register(ExtensionLoader &loader) {
662-
663654
InsertionOrderPreservingMap<string> tags;
664655
tags.insert("ext", "eurostat");
665656
tags.insert("category", "table");
@@ -696,7 +687,6 @@ static constexpr const char *ES_VALUES_PATH =
696687
static constexpr const char *ES_ERROR_PATH = "/S:Fault/faultstring";
697688

698689
struct ES_DataStructure {
699-
700690
//! Information of a Dimension of an EUROSTAT Dataflow
701691
struct Dimension {
702692
int32_t position = -1;
@@ -709,7 +699,6 @@ struct ES_DataStructure {
709699
//! Returns the basic data structure of an EUROSTAT Dataflow.
710700
static std::vector<Dimension> GetBasicDataSchema(ClientContext &context, const string &provider_id,
711701
const string &dataflow_id, const string &language) {
712-
713702
std::vector<Dimension> dimensions;
714703

715704
// Execute HTTP GET request
@@ -738,9 +727,7 @@ struct ES_DataStructure {
738727
xmlXPathObjectPtr xpath_obj = nullptr;
739728

740729
for (const auto &xpath : {ES_DIMENSION_PATH, ES_TIME_DIMENSION_PATH}) {
741-
742730
if ((xpath_obj = xmlXPathEvalExpression(BAD_CAST xpath, xpath_ctx)) && xpath_obj->nodesetval) {
743-
744731
for (int i = 0; i < xpath_obj->nodesetval->nodeNr; i++) {
745732
xmlNodePtr node = xpath_obj->nodesetval->nodeTab[i];
746733

@@ -790,17 +777,14 @@ struct ES_DataStructure {
790777
// Get the Concept names for Dimensions
791778

792779
if ((xpath_obj = xmlXPathEvalExpression(BAD_CAST ES_CONCEPT_PATH, xpath_ctx)) && xpath_obj->nodesetval) {
793-
794780
for (int i = 0; i < xpath_obj->nodesetval->nodeNr; i++) {
795781
xmlNodePtr node = xpath_obj->nodesetval->nodeTab[i];
796782

797783
auto concept_id = XmlUtils::GetNodeAttributeValue(node, "id");
798784
if (!concept_id.empty()) {
799785
for (auto &dim : dimensions) {
800786
if (dim.concept_id == concept_id) {
801-
802787
for (xmlNodePtr child = node->children; child; child = child->next) {
803-
804788
if (strcmp((const char *)child->name, "Name") == 0) {
805789
string lang = XmlUtils::GetNodeAttributeValue(child, "lang", language);
806790

@@ -826,7 +810,6 @@ struct ES_DataStructure {
826810
//! Returns the data structure of an EUROSTAT Dataflow.
827811
static std::vector<Dimension> GetDataSchema(ClientContext &context, const string &provider_id,
828812
const string &dataflow_id, const string &language) {
829-
830813
auto dimensions = ES_DataStructure::GetBasicDataSchema(context, provider_id, dataflow_id, language);
831814

832815
// Execute HTTP GET request
@@ -853,7 +836,6 @@ struct ES_DataStructure {
853836
xmlXPathObjectPtr xpath_obj = nullptr;
854837

855838
if ((xpath_obj = xmlXPathEvalExpression(BAD_CAST ES_VALUES_PATH, xpath_ctx)) && xpath_obj->nodesetval) {
856-
857839
for (int i = 0; i < xpath_obj->nodesetval->nodeNr; i++) {
858840
xmlNodePtr node = xpath_obj->nodesetval->nodeTab[i];
859841

@@ -863,7 +845,6 @@ struct ES_DataStructure {
863845

864846
for (auto &dim : dimensions) {
865847
if (dim.id == dim_id) {
866-
867848
for (xmlNodePtr child = node->children; child; child = child->next) {
868849
if (strcmp((const char *)child->name, "Value") == 0) {
869850
string code_value = XmlUtils::GetNodeTextContent(child);
@@ -900,7 +881,6 @@ struct ES_DataStructure {
900881

901882
static unique_ptr<FunctionData> Bind(ClientContext &context, TableFunctionBindInput &input,
902883
vector<LogicalType> &return_types, vector<string> &names) {
903-
904884
D_ASSERT(input.inputs.size() == 2);
905885

906886
const string provider_id = StringValue::Get(input.inputs[0]);
@@ -975,7 +955,6 @@ struct ES_DataStructure {
975955
//------------------------------------------------------------------------------------------------------------------
976956

977957
static unique_ptr<NodeStatistics> Cardinality(ClientContext &context, const FunctionData *data) {
978-
979958
auto &bind_data = data->Cast<BindData>();
980959
auto result = make_uniq<NodeStatistics>();
981960

@@ -991,7 +970,6 @@ struct ES_DataStructure {
991970
//------------------------------------------------------------------------------------------------------------------
992971

993972
static void Execute(ClientContext &context, TableFunctionInput &input, DataChunk &output) {
994-
995973
auto &bind_data = input.bind_data->Cast<BindData>();
996974
auto &gstate = input.global_state->Cast<State>();
997975

@@ -1086,7 +1064,6 @@ struct ES_DataStructure {
10861064
//------------------------------------------------------------------------------------------------------------------
10871065

10881066
static void Register(ExtensionLoader &loader) {
1089-
10901067
InsertionOrderPreservingMap<string> tags;
10911068
tags.insert("ext", "eurostat");
10921069
tags.insert("category", "table");
@@ -1109,7 +1086,6 @@ struct ES_DataStructure {
11091086
//! Returns the data structure (dimensions) of a given dataflow
11101087
std::vector<eurostat::Dimension> EurostatUtils::DataStructureOf(ClientContext &context, const std::string &provider_id,
11111088
const std::string &dataflow_id) {
1112-
11131089
auto dimensions = ES_DataStructure::GetBasicDataSchema(context, provider_id, dataflow_id, "en");
11141090
std::vector<eurostat::Dimension> data_structure;
11151091

@@ -1122,7 +1098,6 @@ std::vector<eurostat::Dimension> EurostatUtils::DataStructureOf(ClientContext &c
11221098

11231099
//! Extracts the error message of a given Eurostat API response body
11241100
std::string EurostatUtils::GetXmlErrorMessage(const std::string &response_body) {
1125-
11261101
XmlDocument document = XmlDocument(response_body);
11271102
xmlXPathContextPtr xpath_ctx = document.GetXPathContext();
11281103
xmlXPathObjectPtr xpath_obj = nullptr;
@@ -1131,7 +1106,6 @@ std::string EurostatUtils::GetXmlErrorMessage(const std::string &response_body)
11311106

11321107
if ((xpath_obj = xmlXPathEvalExpression(BAD_CAST ES_ERROR_PATH, xpath_ctx)) && xpath_obj->nodesetval &&
11331108
xpath_obj->nodesetval->nodeNr > 0) {
1134-
11351109
xmlNodePtr node = xpath_obj->nodesetval->nodeTab[0];
11361110
error_msg = XmlUtils::GetNodeTextContent(node);
11371111
}
@@ -1144,7 +1118,6 @@ std::string EurostatUtils::GetXmlErrorMessage(const std::string &response_body)
11441118
}
11451119

11461120
void EurostatInfoFunctions::Register(ExtensionLoader &loader) {
1147-
11481121
ES_Endpoints::Register(loader);
11491122
ES_Dataflows::Register(loader);
11501123
ES_DataStructure::Register(loader);

src/eurostat/eurostat_scalar_functions.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace {
1818
//======================================================================================================================
1919

2020
struct ES_GeoLevel {
21-
2221
//! Returns the level for a GEO code in the NUTS classification or if it is considered aggregates.
2322
inline static void GetGeoLevelFromGeoCode(DataChunk &args, ExpressionState &state, Vector &result) {
2423
D_ASSERT(args.data.size() == 1);
@@ -52,7 +51,6 @@ struct ES_GeoLevel {
5251
//------------------------------------------------------------------------------------------------------------------
5352

5453
static void Register(ExtensionLoader &loader) {
55-
5654
InsertionOrderPreservingMap<string> tags;
5755
tags.insert("ext", "eurostat");
5856
tags.insert("category", "scalar");
@@ -71,7 +69,6 @@ struct ES_GeoLevel {
7169
// #####################################################################################################################
7270

7371
void EurostatScalarFunctions::Register(ExtensionLoader &loader) {
74-
7572
ES_GeoLevel::Register(loader);
7673
}
7774

0 commit comments

Comments
 (0)