Skip to content

Commit bff9dfe

Browse files
committed
chore: move main table functions to files
[no ci]
1 parent 5915634 commit bff9dfe

19 files changed

+206
-154
lines changed

src/functions/extract_domain.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@
55

66
namespace duckdb
77
{
8+
// Function to extract the domain from a URL
9+
void ExtractDomainFunction(DataChunk &args, ExpressionState &state, Vector &result)
10+
{
11+
// Extract the input from the arguments
12+
auto &input_vector = args.data[0];
13+
auto input = input_vector.GetValue(0).ToString();
14+
15+
if (input.empty())
16+
{
17+
result.SetValue(0, Value(""));
18+
return;
19+
}
20+
21+
// Extract the domain using the utility function
22+
auto domain = netquack::ExtractDomain(state, input);
23+
24+
result.SetValue(0, Value(domain));
25+
}
26+
827
namespace netquack
928
{
1029
std::string ExtractDomain(ExpressionState &state, const std::string &input)

src/functions/extract_domain.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace duckdb
66
{
7+
void ExtractDomainFunction(DataChunk &args, ExpressionState &state, Vector &result);
8+
79
namespace netquack
810
{
911
// Function to extract the main domain from a URL

src/functions/extract_host.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the host from a URL
8+
void ExtractHostFunction(DataChunk &args, ExpressionState &state, Vector &result)
9+
{
10+
// Extract the input from the arguments
11+
auto &input_vector = args.data[0];
12+
auto input = input_vector.GetValue(0).ToString();
13+
14+
// Extract the host using the utility function
15+
auto host = netquack::ExtractHost(input);
16+
17+
// Set the result
18+
result.SetValue(0, Value(host));
19+
}
20+
721
namespace netquack
822
{
923
std::string ExtractHost(const std::string &input)

src/functions/extract_host.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the host from a URL
8+
void ExtractHostFunction(DataChunk &args, ExpressionState &state, Vector &result);
9+
710
namespace netquack
811
{
912
// Function to extract the host from a URL

src/functions/extract_path.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the path from a URL
8+
void ExtractPathFunction(DataChunk &args, ExpressionState &state, Vector &result)
9+
{
10+
// Extract the input from the arguments
11+
auto &input_vector = args.data[0];
12+
auto input = input_vector.GetValue(0).ToString();
13+
14+
// Extract the path using the utility function
15+
auto path = netquack::ExtractPath(input);
16+
17+
// Set the result
18+
result.SetValue(0, Value(path));
19+
}
20+
721
namespace netquack
822
{
923
std::string ExtractPath(const std::string &input)

src/functions/extract_path.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the path from a URL
8+
void ExtractPathFunction(DataChunk &args, ExpressionState &state, Vector &result);
9+
710
namespace netquack
811
{
912
// Function to extract the path from a URL or host

src/functions/extract_query.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the query string from a URL
8+
void ExtractQueryStringFunction(DataChunk &args, ExpressionState &state, Vector &result)
9+
{
10+
// Extract the URL from the input
11+
auto &url_vector = args.data[0];
12+
auto url = url_vector.GetValue(0).ToString();
13+
14+
// Extract the query string
15+
auto query_string = netquack::ExtractQueryString(url);
16+
17+
// Set the result
18+
result.SetValue(0, Value(query_string));
19+
}
20+
721
namespace netquack
822
{
923
std::string ExtractQueryString(const std::string &input)

src/functions/extract_query.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the query string from a URL
8+
void ExtractQueryStringFunction(DataChunk &args, ExpressionState &state, Vector &result);
9+
710
namespace netquack
811
{
912
// Function to extract the query string from a URL

src/functions/extract_schema.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the schema from a URL
8+
void ExtractSchemaFunction(DataChunk &args, ExpressionState &state, Vector &result)
9+
{
10+
// Extract the input from the arguments
11+
auto &input_vector = args.data[0];
12+
auto input = input_vector.GetValue(0).ToString();
13+
14+
// Extract the schema using the utility function
15+
auto schema = netquack::ExtractSchema(input);
16+
17+
// Set the result
18+
result.SetValue(0, Value(schema));
19+
}
20+
721
namespace netquack
822
{
923
std::string ExtractSchema(const std::string &input)

src/functions/extract_schema.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace duckdb
66
{
7+
// Function to extract the schema from a URL
8+
void ExtractSchemaFunction(DataChunk &args, ExpressionState &state, Vector &result);
9+
710
namespace netquack
811
{
912
// Function to extract the schema from a URL

0 commit comments

Comments
 (0)