File tree Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,23 @@ namespace duckdb
99 {
1010 // Extract the input from the arguments
1111 auto &input_vector = args.data [0 ];
12- auto input = input_vector. GetValue ( 0 ). ToString ( );
12+ auto result_data = FlatVector::GetData< string_t > (result );
1313
14- // Extract the path using the utility function
15- auto path = netquack::ExtractPath (input);
14+ for (idx_t i = 0 ; i < args.size (); i++)
15+ {
16+ auto input = input_vector.GetValue (i).ToString ();
1617
17- // Set the result
18- result.SetValue (0 , Value (path));
18+ try
19+ {
20+ // Extract the path using the utility function
21+ auto path = netquack::ExtractPath (input);
22+ result_data[i] = StringVector::AddString (result, path);
23+ }
24+ catch (const std::exception &e)
25+ {
26+ result_data[i] = " Error extracting path: " + std::string (e.what ());
27+ }
28+ };
1929 }
2030
2131 namespace netquack
Original file line number Diff line number Diff line change 44
55require netquack
66
7+ statement ok
8+ CREATE TABLE uri_list AS SELECT * FROM read_csv('test/data/examples.csv', header=false, columns={'uri': 'VARCHAR'});
9+
710query I
811SELECT extract_path('http://example.com.ac/path');
912----
@@ -63,3 +66,16 @@ query I
6366SELECT extract_path('rsync://rpki.exmple.com/path/path');
6467----
6568/path/path
69+
70+ query I
71+ SELECT extract_path(uri) from uri_list;
72+ ----
73+ /
74+ /
75+ /
76+ /
77+ /a
78+ /a
79+ /
80+ /
81+ /path/
You can’t perform that action at this time.
0 commit comments