diff --git a/README.md b/README.md
index 896c9a48af6..d35790073fc 100644
--- a/README.md
+++ b/README.md
@@ -6,17 +6,13 @@
-
-
+
-
-
+
-
-
+
-
-
+
# Kùzu
diff --git a/src/binder/bind/ddl/bind_create_rdf_graph.cpp b/src/binder/bind/ddl/bind_create_rdf_graph.cpp
index f4e85b15a97..1fd97c0d70d 100644
--- a/src/binder/bind/ddl/bind_create_rdf_graph.cpp
+++ b/src/binder/bind/ddl/bind_create_rdf_graph.cpp
@@ -35,9 +35,9 @@ BoundCreateTableInfo Binder::bindCreateRdfGraphInfo(const CreateTableInfo* info)
std::vector resourceTripleProperties;
resourceTripleProperties.emplace_back(InternalKeyword::ID, *LogicalType::INTERNAL_ID());
resourceTripleProperties.emplace_back(std::string(rdf::PID), *LogicalType::INTERNAL_ID());
- auto boundResourceTripleExtraInfo = std::make_unique(
- common::RelMultiplicity::MANY, common::RelMultiplicity::MANY, INVALID_TABLE_ID,
- INVALID_TABLE_ID, std::move(resourceTripleProperties));
+ auto boundResourceTripleExtraInfo =
+ std::make_unique(RelMultiplicity::MANY, RelMultiplicity::MANY,
+ INVALID_TABLE_ID, INVALID_TABLE_ID, std::move(resourceTripleProperties));
auto boundResourceTripleCreateInfo = BoundCreateTableInfo(
TableType::REL, resourceTripleTableName, std::move(boundResourceTripleExtraInfo));
// Literal triple table.
@@ -45,9 +45,9 @@ BoundCreateTableInfo Binder::bindCreateRdfGraphInfo(const CreateTableInfo* info)
std::vector literalTripleProperties;
literalTripleProperties.emplace_back(InternalKeyword::ID, *LogicalType::INTERNAL_ID());
literalTripleProperties.emplace_back(std::string(rdf::PID), *LogicalType::INTERNAL_ID());
- auto boundLiteralTripleExtraInfo = std::make_unique(
- common::RelMultiplicity::MANY, common::RelMultiplicity::MANY, INVALID_TABLE_ID,
- INVALID_TABLE_ID, std::move(literalTripleProperties));
+ auto boundLiteralTripleExtraInfo =
+ std::make_unique(RelMultiplicity::MANY, RelMultiplicity::MANY,
+ INVALID_TABLE_ID, INVALID_TABLE_ID, std::move(literalTripleProperties));
auto boundLiteralTripleCreateInfo = BoundCreateTableInfo(
TableType::REL, literalTripleTableName, std::move(boundLiteralTripleExtraInfo));
// Rdf table.
diff --git a/src/binder/bind_expression/bind_function_expression.cpp b/src/binder/bind_expression/bind_function_expression.cpp
index 88ebe21f242..6e7f6c191a8 100644
--- a/src/binder/bind_expression/bind_function_expression.cpp
+++ b/src/binder/bind_expression/bind_function_expression.cpp
@@ -4,6 +4,7 @@
#include "binder/expression/property_expression.h"
#include "binder/expression_binder.h"
#include "common/exception/binder.h"
+#include "function/arithmetic/vector_arithmetic_functions.h"
#include "function/rewrite_function.h"
#include "function/schema/vector_label_functions.h"
#include "main/client_context.h"
@@ -323,12 +324,12 @@ std::shared_ptr ExpressionBinder::bindRecursiveJoinLengthFunction(
children.push_back(std::move(numRelsExpression));
children.push_back(
ku_dynamic_cast(*recursiveRels[0]).getLengthExpression());
- auto result = bindScalarFunctionExpression(children, ADD_FUNC_NAME);
+ auto result = bindScalarFunctionExpression(children, AddFunction::name);
for (auto i = 1u; i < recursiveRels.size(); ++i) {
children[0] = std::move(result);
children[1] = ku_dynamic_cast(*recursiveRels[i])
.getLengthExpression();
- result = bindScalarFunctionExpression(children, ADD_FUNC_NAME);
+ result = bindScalarFunctionExpression(children, AddFunction::name);
}
return result;
} else if (ExpressionUtil::isRecursiveRelPattern(expression)) {
diff --git a/src/catalog/catalog_entry/rel_table_catalog_entry.cpp b/src/catalog/catalog_entry/rel_table_catalog_entry.cpp
index e4f71b28481..b08a91c780a 100644
--- a/src/catalog/catalog_entry/rel_table_catalog_entry.cpp
+++ b/src/catalog/catalog_entry/rel_table_catalog_entry.cpp
@@ -10,8 +10,8 @@ namespace kuzu {
namespace catalog {
RelTableCatalogEntry::RelTableCatalogEntry(std::string name, table_id_t tableID,
- common::RelMultiplicity srcMultiplicity, common::RelMultiplicity dstMultiplicity,
- table_id_t srcTableID, table_id_t dstTableID)
+ RelMultiplicity srcMultiplicity, RelMultiplicity dstMultiplicity, table_id_t srcTableID,
+ table_id_t dstTableID)
: TableCatalogEntry{CatalogEntryType::REL_TABLE_ENTRY, std::move(name), tableID},
srcMultiplicity{srcMultiplicity}, dstMultiplicity{dstMultiplicity}, srcTableID{srcTableID},
dstTableID{dstTableID} {}
@@ -32,14 +32,13 @@ column_id_t RelTableCatalogEntry::getColumnID(property_id_t propertyID) const {
auto it = std::find_if(properties.begin(), properties.end(),
[&propertyID](const auto& property) { return property.getPropertyID() == propertyID; });
// Skip the first column in the rel table, which is reserved for nbrID.
- return it == properties.end() ? common::INVALID_COLUMN_ID :
- std::distance(properties.begin(), it) + 1;
+ return it == properties.end() ? INVALID_COLUMN_ID : std::distance(properties.begin(), it) + 1;
}
bool RelTableCatalogEntry::isSingleMultiplicity(RelDataDirection direction) const {
- return getMultiplicity(direction) == common::RelMultiplicity::ONE;
+ return getMultiplicity(direction) == RelMultiplicity::ONE;
}
-common::RelMultiplicity RelTableCatalogEntry::getMultiplicity(RelDataDirection direction) const {
+RelMultiplicity RelTableCatalogEntry::getMultiplicity(RelDataDirection direction) const {
return direction == RelDataDirection::FWD ? dstMultiplicity : srcMultiplicity;
}
table_id_t RelTableCatalogEntry::getBoundTableID(RelDataDirection relDirection) const {
@@ -59,8 +58,8 @@ void RelTableCatalogEntry::serialize(Serializer& serializer) const {
std::unique_ptr RelTableCatalogEntry::deserialize(
Deserializer& deserializer) {
- common::RelMultiplicity srcMultiplicity;
- common::RelMultiplicity dstMultiplicity;
+ RelMultiplicity srcMultiplicity;
+ RelMultiplicity dstMultiplicity;
table_id_t srcTableID;
table_id_t dstTableID;
deserializer.deserializeValue(srcMultiplicity);
diff --git a/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp b/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp
index de921bda66d..e7988a2ba07 100644
--- a/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp
+++ b/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp
@@ -5,6 +5,10 @@
namespace kuzu {
namespace catalog {
+ScalarFunctionCatalogEntry::ScalarFunctionCatalogEntry(
+ const char* name, function::function_set functionSet)
+ : ScalarFunctionCatalogEntry{std::string{name}, std::move(functionSet)} {}
+
ScalarFunctionCatalogEntry::ScalarFunctionCatalogEntry(
std::string name, function::function_set functionSet)
: FunctionCatalogEntry{
diff --git a/src/common/task_system/progress_bar.cpp b/src/common/task_system/progress_bar.cpp
index 3efb778a1e6..526dde33f45 100644
--- a/src/common/task_system/progress_bar.cpp
+++ b/src/common/task_system/progress_bar.cpp
@@ -9,6 +9,13 @@ void ProgressBar::startProgress() {
}
std::lock_guard lock(progressBarLock);
printProgressBar(0.0);
+ printing = true;
+}
+
+void ProgressBar::endProgress() {
+ std::lock_guard lock(progressBarLock);
+ resetProgressBar();
+ printing = false;
}
void ProgressBar::addPipeline() {
@@ -23,21 +30,23 @@ void ProgressBar::finishPipeline() {
return;
}
numPipelinesFinished++;
- prevCurPipelineProgress = 0.0;
+ // This ensures that the progress bar is updated back to 0% after a pipeline is finished.
+ prevCurPipelineProgress = -0.01;
updateProgress(0.0);
- if (numPipelines == numPipelinesFinished) {
- resetProgressBar();
- }
}
void ProgressBar::updateProgress(double curPipelineProgress) {
+ // Only update the progress bar if the progress has changed by at least 1%.
if (!trackProgress || curPipelineProgress - prevCurPipelineProgress < 0.01) {
return;
}
std::lock_guard lock(progressBarLock);
prevCurPipelineProgress = curPipelineProgress;
- std::cout << "\033[2A\033[2K\033[1B\033[2K\033[1A";
+ if (printing) {
+ std::cout << "\033[2A";
+ }
printProgressBar(curPipelineProgress);
+ printing = true;
}
void ProgressBar::printProgressBar(double curPipelineProgress) const {
@@ -55,9 +64,10 @@ void ProgressBar::printProgressBar(double curPipelineProgress) const {
}
void ProgressBar::resetProgressBar() {
- std::lock_guard lock(progressBarLock);
- std::cout << "\033[2A\033[2K\033[1B\033[2K\033[1A";
- std::cout.flush();
+ if (printing) {
+ std::cout << "\033[2A\033[2K\033[1B\033[2K\033[1A";
+ std::cout.flush();
+ }
numPipelines = 0;
numPipelinesFinished = 0;
prevCurPipelineProgress = 0.0;
diff --git a/src/common/vector/value_vector.cpp b/src/common/vector/value_vector.cpp
index ad00a5e4ed9..8593a19f2af 100644
--- a/src/common/vector/value_vector.cpp
+++ b/src/common/vector/value_vector.cpp
@@ -435,6 +435,16 @@ ku_string_t& StringVector::reserveString(ValueVector* vector, uint32_t vectorPos
return dstStr;
}
+void StringVector::reserveString(ValueVector* vector, ku_string_t& dstStr, uint64_t length) {
+ KU_ASSERT(vector->dataType.getPhysicalType() == PhysicalTypeID::STRING);
+ auto stringBuffer =
+ ku_dynamic_cast(vector->auxiliaryBuffer.get());
+ dstStr.len = length;
+ if (!ku_string_t::isShortString(length)) {
+ dstStr.overflowPtr = reinterpret_cast(stringBuffer->allocateOverflow(length));
+ }
+}
+
void StringVector::addString(ValueVector* vector, ku_string_t& dstStr, ku_string_t& srcStr) {
KU_ASSERT(vector->dataType.getPhysicalType() == PhysicalTypeID::STRING);
auto stringBuffer =
diff --git a/src/function/CMakeLists.txt b/src/function/CMakeLists.txt
index 55368d89150..f782566ac1c 100644
--- a/src/function/CMakeLists.txt
+++ b/src/function/CMakeLists.txt
@@ -13,8 +13,10 @@ add_library(kuzu_function
cast_from_string_functions.cpp
comparison_functions.cpp
find_function.cpp
+ function_collection.cpp
scalar_macro_function.cpp
vector_arithmetic_functions.cpp
+ vector_array_functions.cpp
vector_boolean_functions.cpp
vector_cast_functions.cpp
vector_date_functions.cpp
diff --git a/src/function/built_in_function_utils.cpp b/src/function/built_in_function_utils.cpp
index 0cd5b744d0c..839961b5119 100644
--- a/src/function/built_in_function_utils.cpp
+++ b/src/function/built_in_function_utils.cpp
@@ -15,13 +15,13 @@
#include "function/cast/vector_cast_functions.h"
#include "function/comparison/vector_comparison_functions.h"
#include "function/date/vector_date_functions.h"
+#include "function/function_collection.h"
#include "function/interval/vector_interval_functions.h"
#include "function/list/vector_list_functions.h"
#include "function/map/vector_map_functions.h"
#include "function/path/vector_path_functions.h"
#include "function/rdf/vector_rdf_functions.h"
#include "function/schema/vector_node_rel_functions.h"
-#include "function/string/vector_string_functions.h"
#include "function/struct/vector_struct_functions.h"
#include "function/table/call_functions.h"
#include "function/timestamp/vector_timestamp_functions.h"
@@ -52,17 +52,16 @@ void BuiltInFunctionsUtils::createFunctions(CatalogSet* catalogSet) {
registerScalarFunctions(catalogSet);
registerAggregateFunctions(catalogSet);
registerTableFunctions(catalogSet);
+
+ registerFunctions(catalogSet);
}
void BuiltInFunctionsUtils::registerScalarFunctions(CatalogSet* catalogSet) {
registerComparisonFunctions(catalogSet);
- registerArithmeticFunctions(catalogSet);
registerDateFunctions(catalogSet);
registerTimestampFunctions(catalogSet);
registerIntervalFunctions(catalogSet);
- registerStringFunctions(catalogSet);
registerCastFunctions(catalogSet);
- registerListFunctions(catalogSet);
registerStructFunctions(catalogSet);
registerMapFunctions(catalogSet);
registerUnionFunctions(catalogSet);
@@ -514,7 +513,7 @@ void BuiltInFunctionsUtils::validateSpecialCases(std::vector& candida
const std::string& name, const std::vector& inputTypes,
function::function_set& set) {
// special case for add func
- if (name == ADD_FUNC_NAME) {
+ if (name == AddFunction::name) {
auto targetType0 = candidateFunctions[0]->parameterTypeIDs[0];
auto targetType1 = candidateFunctions[0]->parameterTypeIDs[1];
auto inputType0 = inputTypes[0].getLogicalTypeID();
@@ -551,89 +550,6 @@ void BuiltInFunctionsUtils::registerComparisonFunctions(CatalogSet* catalogSet)
LESS_THAN_EQUALS_FUNC_NAME, LessThanEqualsFunction::getFunctionSet()));
}
-void BuiltInFunctionsUtils::registerArithmeticFunctions(CatalogSet* catalogSet) {
- catalogSet->createEntry(
- std::make_unique(ADD_FUNC_NAME, AddFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- SUBTRACT_FUNC_NAME, SubtractFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- MULTIPLY_FUNC_NAME, MultiplyFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- DIVIDE_FUNC_NAME, DivideFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- MODULO_FUNC_NAME, ModuloFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- POWER_FUNC_NAME, PowerFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(ABS_FUNC_NAME, AbsFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ACOS_FUNC_NAME, AcosFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ASIN_FUNC_NAME, AsinFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ATAN_FUNC_NAME, AtanFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ATAN2_FUNC_NAME, Atan2Function::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- BITWISE_XOR_FUNC_NAME, BitwiseXorFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- BITWISE_AND_FUNC_NAME, BitwiseAndFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- BITWISE_OR_FUNC_NAME, BitwiseOrFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- BITSHIFT_LEFT_FUNC_NAME, BitShiftLeftFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- BITSHIFT_RIGHT_FUNC_NAME, BitShiftRightFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- CBRT_FUNC_NAME, CbrtFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- CEIL_FUNC_NAME, CeilFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- CEILING_FUNC_NAME, CeilFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(COS_FUNC_NAME, CosFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(COT_FUNC_NAME, CotFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- DEGREES_FUNC_NAME, DegreesFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- EVEN_FUNC_NAME, EvenFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- FACTORIAL_FUNC_NAME, FactorialFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- FLOOR_FUNC_NAME, FloorFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- GAMMA_FUNC_NAME, GammaFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LGAMMA_FUNC_NAME, LgammaFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(LN_FUNC_NAME, LnFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(LOG_FUNC_NAME, LogFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LOG2_FUNC_NAME, Log2Function::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LOG10_FUNC_NAME, LogFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- NEGATE_FUNC_NAME, NegateFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(PI_FUNC_NAME, PiFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- POW_FUNC_NAME, PowerFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- RADIANS_FUNC_NAME, RadiansFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ROUND_FUNC_NAME, RoundFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(SIN_FUNC_NAME, SinFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- SIGN_FUNC_NAME, SignFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- SQRT_FUNC_NAME, SqrtFunction::getFunctionSet()));
- catalogSet->createEntry(
- std::make_unique(TAN_FUNC_NAME, TanFunction::getFunctionSet()));
-}
-
void BuiltInFunctionsUtils::registerDateFunctions(CatalogSet* catalogSet) {
catalogSet->createEntry(std::make_unique(
DATE_PART_FUNC_NAME, DatePartFunction::getFunctionSet()));
@@ -699,65 +615,6 @@ void BuiltInFunctionsUtils::registerUUIDFunctions(CatalogSet* catalogSet) {
GEN_RANDOM_UUID_FUNC_NAME, GenRandomUUIDFunction::getFunctionSet()));
}
-void BuiltInFunctionsUtils::registerStringFunctions(CatalogSet* catalogSet) {
- catalogSet->createEntry(std::make_unique(
- ARRAY_EXTRACT_FUNC_NAME, ArrayExtractFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- CONCAT_FUNC_NAME, ConcatFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- CONTAINS_FUNC_NAME, ContainsFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ENDS_WITH_FUNC_NAME, EndsWithFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LCASE_FUNC_NAME, LowerFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LEFT_FUNC_NAME, LeftFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LOWER_FUNC_NAME, LowerFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LPAD_FUNC_NAME, LpadFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LTRIM_FUNC_NAME, LtrimFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- PREFIX_FUNC_NAME, StartsWithFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- REPEAT_FUNC_NAME, RepeatFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- REVERSE_FUNC_NAME, ReverseFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- RIGHT_FUNC_NAME, RightFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- RPAD_FUNC_NAME, RpadFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- RTRIM_FUNC_NAME, RtrimFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- STARTS_WITH_FUNC_NAME, StartsWithFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- SUBSTR_FUNC_NAME, SubStrFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- SUBSTRING_FUNC_NAME, SubStrFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- SUFFIX_FUNC_NAME, EndsWithFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- TRIM_FUNC_NAME, TrimFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- UCASE_FUNC_NAME, UpperFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- UPPER_FUNC_NAME, UpperFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- REGEXP_FULL_MATCH_FUNC_NAME, RegexpFullMatchFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- REGEXP_MATCHES_FUNC_NAME, RegexpMatchesFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- REGEXP_REPLACE_FUNC_NAME, RegexpReplaceFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- REGEXP_EXTRACT_FUNC_NAME, RegexpExtractFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- REGEXP_EXTRACT_ALL_FUNC_NAME, RegexpExtractAllFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LEVENSHTEIN_FUNC_NAME, LevenshteinFunction::getFunctionSet()));
-}
-
void BuiltInFunctionsUtils::registerCastFunctions(CatalogSet* catalogSet) {
catalogSet->createEntry(std::make_unique(
CAST_DATE_FUNC_NAME, CastToDateFunction::getFunctionSet()));
@@ -811,75 +668,6 @@ void BuiltInFunctionsUtils::registerCastFunctions(CatalogSet* catalogSet) {
CAST_FUNC_NAME, CastAnyFunction::getFunctionSet()));
}
-void BuiltInFunctionsUtils::registerListFunctions(CatalogSet* catalogSet) {
- catalogSet->createEntry(std::make_unique(
- LIST_CREATION_FUNC_NAME, ListCreationFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_RANGE_FUNC_NAME, ListRangeFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- SIZE_FUNC_NAME, SizeFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_EXTRACT_FUNC_NAME, ListExtractFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_ELEMENT_FUNC_NAME, ListExtractFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_CONCAT_FUNC_NAME, ListConcatFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_CAT_FUNC_NAME, ListConcatFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_CONCAT_FUNC_NAME, ListConcatFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_CAT_FUNC_NAME, ListConcatFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_APPEND_FUNC_NAME, ListAppendFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_APPEND_FUNC_NAME, ListAppendFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_PUSH_BACK_FUNC_NAME, ListAppendFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_PREPEND_FUNC_NAME, ListPrependFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_PREPEND_FUNC_NAME, ListPrependFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_PUSH_FRONT_FUNC_NAME, ListPrependFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_POSITION_FUNC_NAME, ListPositionFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_POSITION_FUNC_NAME, ListPositionFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_INDEXOF_FUNC_NAME, ListPositionFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_INDEXOF_FUNC_NAME, ListPositionFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_CONTAINS_FUNC_NAME, ListContainsFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_HAS_FUNC_NAME, ListContainsFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_CONTAINS_FUNC_NAME, ListContainsFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_HAS_FUNC_NAME, ListContainsFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_SLICE_FUNC_NAME, ListSliceFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- ARRAY_SLICE_FUNC_NAME, ListSliceFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_SORT_FUNC_NAME, ListSortFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_REVERSE_SORT_FUNC_NAME, ListReverseSortFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_SUM_FUNC_NAME, ListSumFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_PRODUCT_FUNC_NAME, ListProductFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_DISTINCT_FUNC_NAME, ListDistinctFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_UNIQUE_FUNC_NAME, ListUniqueFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_ANY_VALUE_FUNC_NAME, ListAnyValueFunction::getFunctionSet()));
- catalogSet->createEntry(std::make_unique(
- LIST_REVERSE_FUNC_NAME, ListReverseFunction::getFunctionSet()));
-}
-
void BuiltInFunctionsUtils::registerStructFunctions(CatalogSet* catalogSet) {
catalogSet->createEntry(std::make_unique(
STRUCT_PACK_FUNC_NAME, StructPackFunctions::getFunctionSet()));
@@ -1064,6 +852,15 @@ void BuiltInFunctionsUtils::registerTableFunctions(CatalogSet* catalogSet) {
READ_FTABLE_FUNC_NAME, FTableScan::getFunctionSet()));
}
+void BuiltInFunctionsUtils::registerFunctions(catalog::CatalogSet* catalogSet) {
+ auto functions = FunctionCollection::getFunctions();
+ for (auto i = 0u; functions[i].name != nullptr; ++i) {
+ auto functionSet = functions[i].getFunctionSetFunc();
+ catalogSet->createEntry(std::make_unique(
+ functions[i].name, std::move(functionSet)));
+ }
+}
+
static std::string getFunctionMatchFailureMsg(const std::string name,
const std::vector& inputTypes, const std::string& supportedInputs,
bool isDistinct = false) {
diff --git a/src/function/function_collection.cpp b/src/function/function_collection.cpp
new file mode 100644
index 00000000000..9ce91ec019e
--- /dev/null
+++ b/src/function/function_collection.cpp
@@ -0,0 +1,89 @@
+#include "function/function_collection.h"
+
+#include "function/arithmetic/vector_arithmetic_functions.h"
+#include "function/array/vector_array_functions.h"
+#include "function/list/vector_list_functions.h"
+#include "function/string/vector_string_functions.h"
+
+namespace kuzu {
+namespace function {
+
+#define SCALAR_FUNCTION(_PARAM) \
+ { _PARAM::name, _PARAM::getFunctionSet }
+#define SCALAR_FUNCTION_ALIAS(_PARAM) \
+ { _PARAM::alias, _PARAM::getFunctionSet }
+#define FINAL_FUNCTION \
+ { nullptr, nullptr }
+
+FunctionCollection* FunctionCollection::getFunctions() {
+ static FunctionCollection functions[] = {
+
+ // Arithmetic Functions
+ SCALAR_FUNCTION(AddFunction), SCALAR_FUNCTION(SubtractFunction),
+ SCALAR_FUNCTION(MultiplyFunction), SCALAR_FUNCTION(DivideFunction),
+ SCALAR_FUNCTION(ModuloFunction), SCALAR_FUNCTION(PowerFunction),
+ SCALAR_FUNCTION(AbsFunction), SCALAR_FUNCTION(AcosFunction), SCALAR_FUNCTION(AsinFunction),
+ SCALAR_FUNCTION(AtanFunction), SCALAR_FUNCTION(Atan2Function),
+ SCALAR_FUNCTION(BitwiseXorFunction), SCALAR_FUNCTION(BitwiseAndFunction),
+ SCALAR_FUNCTION(BitwiseOrFunction), SCALAR_FUNCTION(BitShiftLeftFunction),
+ SCALAR_FUNCTION(BitShiftRightFunction), SCALAR_FUNCTION(CbrtFunction),
+ SCALAR_FUNCTION(CeilFunction), SCALAR_FUNCTION_ALIAS(CeilFunction),
+ SCALAR_FUNCTION(CosFunction), SCALAR_FUNCTION(CotFunction),
+ SCALAR_FUNCTION(DegreesFunction), SCALAR_FUNCTION(EvenFunction),
+ SCALAR_FUNCTION(FactorialFunction), SCALAR_FUNCTION(FloorFunction),
+ SCALAR_FUNCTION(GammaFunction), SCALAR_FUNCTION(LgammaFunction),
+ SCALAR_FUNCTION(LnFunction), SCALAR_FUNCTION(LogFunction),
+ SCALAR_FUNCTION_ALIAS(LogFunction), SCALAR_FUNCTION(Log2Function),
+ SCALAR_FUNCTION(NegateFunction), SCALAR_FUNCTION(PiFunction),
+ SCALAR_FUNCTION_ALIAS(PowerFunction), SCALAR_FUNCTION(RadiansFunction),
+ SCALAR_FUNCTION(RoundFunction), SCALAR_FUNCTION(SinFunction), SCALAR_FUNCTION(SignFunction),
+ SCALAR_FUNCTION(SqrtFunction), SCALAR_FUNCTION(TanFunction),
+
+ // String Functions
+ SCALAR_FUNCTION(ArrayExtractFunction), SCALAR_FUNCTION(ConcatFunction),
+ SCALAR_FUNCTION(ContainsFunction), SCALAR_FUNCTION(LowerFunction),
+ SCALAR_FUNCTION_ALIAS(LowerFunction), SCALAR_FUNCTION(LeftFunction),
+ SCALAR_FUNCTION(LpadFunction), SCALAR_FUNCTION(LtrimFunction),
+ SCALAR_FUNCTION(StartsWithFunction), SCALAR_FUNCTION_ALIAS(StartsWithFunction),
+ SCALAR_FUNCTION(RepeatFunction), SCALAR_FUNCTION(ReverseFunction),
+ SCALAR_FUNCTION(RightFunction), SCALAR_FUNCTION(RpadFunction),
+ SCALAR_FUNCTION(RtrimFunction), SCALAR_FUNCTION(SubStrFunction),
+ SCALAR_FUNCTION_ALIAS(SubStrFunction), SCALAR_FUNCTION(EndsWithFunction),
+ SCALAR_FUNCTION_ALIAS(EndsWithFunction), SCALAR_FUNCTION(TrimFunction),
+ SCALAR_FUNCTION(UpperFunction), SCALAR_FUNCTION_ALIAS(UpperFunction),
+ SCALAR_FUNCTION(RegexpFullMatchFunction), SCALAR_FUNCTION(RegexpMatchesFunction),
+ SCALAR_FUNCTION(RegexpReplaceFunction), SCALAR_FUNCTION(RegexpExtractFunction),
+ SCALAR_FUNCTION(RegexpExtractAllFunction), SCALAR_FUNCTION(LevenshteinFunction),
+
+ // Array Functions
+ SCALAR_FUNCTION(ArrayValueFunction), SCALAR_FUNCTION(ArrayCrossProductFunction),
+ SCALAR_FUNCTION(ArrayCosineSimilarityFunction), SCALAR_FUNCTION(ArrayDistanceFunction),
+ SCALAR_FUNCTION(ArrayInnerProductFunction), SCALAR_FUNCTION(ArrayDotProductFunction),
+
+ // List functions
+ SCALAR_FUNCTION(ListCreationFunction), SCALAR_FUNCTION(ListRangeFunction),
+ SCALAR_FUNCTION(ListExtractFunction), SCALAR_FUNCTION_ALIAS(ListExtractFunction),
+ SCALAR_FUNCTION(ListConcatFunction), SCALAR_FUNCTION_ALIAS(ListConcatFunction),
+ SCALAR_FUNCTION(ArrayConcatFunction), SCALAR_FUNCTION_ALIAS(ArrayConcatFunction),
+ SCALAR_FUNCTION(ListAppendFunction), SCALAR_FUNCTION(ArrayAppendFunction),
+ SCALAR_FUNCTION_ALIAS(ArrayAppendFunction), SCALAR_FUNCTION(ListPrependFunction),
+ SCALAR_FUNCTION(ArrayPrependFunction), SCALAR_FUNCTION_ALIAS(ArrayPrependFunction),
+ SCALAR_FUNCTION(ListPositionFunction), SCALAR_FUNCTION_ALIAS(ListPositionFunction),
+ SCALAR_FUNCTION(ArrayPositionFunction), SCALAR_FUNCTION_ALIAS(ArrayPositionFunction),
+ SCALAR_FUNCTION(ListContainsFunction), SCALAR_FUNCTION_ALIAS(ListContainsFunction),
+ SCALAR_FUNCTION(ArrayContainsFunction), SCALAR_FUNCTION_ALIAS(ArrayContainsFunction),
+ SCALAR_FUNCTION(ListSliceFunction), SCALAR_FUNCTION(ArraySliceFunction),
+ SCALAR_FUNCTION(ListSortFunction), SCALAR_FUNCTION(ListReverseSortFunction),
+ SCALAR_FUNCTION(ListSumFunction), SCALAR_FUNCTION(ListProductFunction),
+ SCALAR_FUNCTION(ListDistinctFunction), SCALAR_FUNCTION(ListUniqueFunction),
+ SCALAR_FUNCTION(ListAnyValueFunction), SCALAR_FUNCTION(ListReverseFunction),
+ SCALAR_FUNCTION(SizeFunction),
+
+ // End of array
+ FINAL_FUNCTION};
+
+ return functions;
+}
+
+} // namespace function
+} // namespace kuzu
diff --git a/src/function/pattern/id_function.cpp b/src/function/pattern/id_function.cpp
index 3305f047d83..2a8dc679f11 100644
--- a/src/function/pattern/id_function.cpp
+++ b/src/function/pattern/id_function.cpp
@@ -2,6 +2,7 @@
#include "binder/expression/node_expression.h"
#include "binder/expression/rel_expression.h"
#include "binder/expression_binder.h"
+#include "common/cast.h"
#include "function/rewrite_function.h"
#include "function/schema/vector_node_rel_functions.h"
diff --git a/src/function/vector_arithmetic_functions.cpp b/src/function/vector_arithmetic_functions.cpp
index 2fc12f016a1..f3e8e132b29 100644
--- a/src/function/vector_arithmetic_functions.cpp
+++ b/src/function/vector_arithmetic_functions.cpp
@@ -1,6 +1,7 @@
#include "function/arithmetic/vector_arithmetic_functions.h"
#include "common/types/date_t.h"
+#include "common/types/int128_t.h"
#include "common/types/interval_t.h"
#include "common/types/timestamp_t.h"
#include "function/arithmetic/abs.h"
@@ -13,6 +14,7 @@
#include "function/arithmetic/subtract.h"
#include "function/list/functions/list_concat_function.h"
#include "function/list/vector_list_functions.h"
+#include "function/scalar_function.h"
#include "function/string/functions/concat_function.h"
using namespace kuzu::common;
@@ -20,50 +22,167 @@ using namespace kuzu::common;
namespace kuzu {
namespace function {
+template
+static void getUnaryExecFunc(LogicalTypeID operandTypeID, scalar_func_exec_t& func) {
+ switch (operandTypeID) {
+ case LogicalTypeID::SERIAL:
+ case LogicalTypeID::INT64: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::INT32: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::INT16: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::INT8: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT64: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT32: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT16: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT8: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::INT128: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::DOUBLE: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ case LogicalTypeID::FLOAT: {
+ func = ScalarFunction::UnaryExecFunction;
+ } break;
+ default:
+ KU_UNREACHABLE;
+ }
+}
+
+template
+static void getBinaryExecFunc(LogicalTypeID operandTypeID, scalar_func_exec_t& func) {
+ switch (operandTypeID) {
+ case LogicalTypeID::SERIAL:
+ case LogicalTypeID::INT64: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::INT32: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::INT16: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::INT8: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT64: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT32: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT16: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::UINT8: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::INT128: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::DOUBLE: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ case LogicalTypeID::FLOAT: {
+ func = ScalarFunction::BinaryExecFunction;
+ } break;
+ default:
+ KU_UNREACHABLE;
+ }
+}
+
+template
+static std::unique_ptr getUnaryFunction(
+ std::string name, LogicalTypeID operandTypeID) {
+ function::scalar_func_exec_t execFunc;
+ getUnaryExecFunc(operandTypeID, execFunc);
+ return std::make_unique(
+ std::move(name), std::vector{operandTypeID}, operandTypeID, execFunc);
+}
+
+template
+static std::unique_ptr getUnaryFunction(
+ std::string name, LogicalTypeID operandTypeID, LogicalTypeID resultTypeID) {
+ return std::make_unique(std::move(name),
+ std::vector{operandTypeID}, resultTypeID,
+ ScalarFunction::UnaryExecFunction);
+}
+
+template
+static inline std::unique_ptr getBinaryFunction(
+ std::string name, LogicalTypeID operandTypeID) {
+ function::scalar_func_exec_t execFunc;
+ getBinaryExecFunc(operandTypeID, execFunc);
+ return std::make_unique(std::move(name),
+ std::vector{operandTypeID, operandTypeID}, operandTypeID, execFunc);
+}
+
+template
+static inline std::unique_ptr getBinaryFunction(
+ std::string name, LogicalTypeID operandTypeID, LogicalTypeID resultTypeID) {
+ return std::make_unique(std::move(name),
+ std::vector{operandTypeID, operandTypeID}, resultTypeID,
+ ScalarFunction::BinaryExecFunction);
+}
+
function_set AddFunction::getFunctionSet() {
function_set result;
for (auto typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(ArithmeticFunction::getBinaryFunction(ADD_FUNC_NAME, typeID));
+ result.push_back(getBinaryFunction(name, typeID));
}
// list + list -> list
- result.push_back(std::make_unique(ADD_FUNC_NAME,
+ result.push_back(std::make_unique(name,
std::vector{LogicalTypeID::VAR_LIST, LogicalTypeID::VAR_LIST},
LogicalTypeID::VAR_LIST,
ScalarFunction::BinaryExecListStructFunction,
nullptr, ListConcatFunction::bindFunc, false /* isVarlength*/));
// string + string -> string
- result.push_back(std::make_unique(ADD_FUNC_NAME,
- std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING},
+ result.push_back(std::make_unique(name,
+ std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING},
LogicalTypeID::STRING,
- ScalarFunction::BinaryStringExecFunction));
+ ScalarFunction::BinaryStringExecFunction));
// interval + interval → interval
- result.push_back(ArithmeticFunction::getBinaryFunction(
- ADD_FUNC_NAME, LogicalTypeID::INTERVAL, LogicalTypeID::INTERVAL));
+ result.push_back(getBinaryFunction(
+ name, LogicalTypeID::INTERVAL, LogicalTypeID::INTERVAL));
// date + int → date
- result.push_back(make_unique(ADD_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::DATE, LogicalTypeID::INT64}, LogicalTypeID::DATE,
ScalarFunction::BinaryExecFunction));
// int + date → date
- result.push_back(make_unique(ADD_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::INT64, LogicalTypeID::DATE}, LogicalTypeID::DATE,
ScalarFunction::BinaryExecFunction));
// date + interval → date
- result.push_back(make_unique(ADD_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::DATE, LogicalTypeID::INTERVAL},
LogicalTypeID::DATE, ScalarFunction::BinaryExecFunction));
// interval + date → date
- result.push_back(make_unique(ADD_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::INTERVAL, LogicalTypeID::DATE},
LogicalTypeID::DATE, ScalarFunction::BinaryExecFunction));
// timestamp + interval → timestamp
- result.push_back(make_unique(ADD_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::TIMESTAMP, LogicalTypeID::INTERVAL},
LogicalTypeID::TIMESTAMP,
ScalarFunction::BinaryExecFunction));
// interval + timestamp → timestamp
- result.push_back(make_unique(ADD_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::INTERVAL, LogicalTypeID::TIMESTAMP},
LogicalTypeID::TIMESTAMP,
ScalarFunction::BinaryExecFunction));
@@ -73,40 +192,38 @@ function_set AddFunction::getFunctionSet() {
function_set SubtractFunction::getFunctionSet() {
function_set result;
for (auto typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(
- ArithmeticFunction::getBinaryFunction(SUBTRACT_FUNC_NAME, typeID));
+ result.push_back(getBinaryFunction(name, typeID));
}
// date - date → int64
- result.push_back(ArithmeticFunction::getBinaryFunction(
- SUBTRACT_FUNC_NAME, LogicalTypeID::DATE, LogicalTypeID::INT64));
+ result.push_back(getBinaryFunction(
+ name, LogicalTypeID::DATE, LogicalTypeID::INT64));
// date - integer → date
- result.push_back(make_unique(SUBTRACT_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::DATE, LogicalTypeID::INT64}, LogicalTypeID::DATE,
ScalarFunction::BinaryExecFunction));
// date - interval → date
- result.push_back(make_unique(SUBTRACT_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::DATE, LogicalTypeID::INTERVAL},
LogicalTypeID::DATE,
ScalarFunction::BinaryExecFunction));
// timestamp - timestamp → interval
- result.push_back(ArithmeticFunction::getBinaryFunction(
- SUBTRACT_FUNC_NAME, LogicalTypeID::TIMESTAMP, LogicalTypeID::INTERVAL));
+ result.push_back(getBinaryFunction(
+ name, LogicalTypeID::TIMESTAMP, LogicalTypeID::INTERVAL));
// timestamp - interval → timestamp
- result.push_back(make_unique(SUBTRACT_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::TIMESTAMP, LogicalTypeID::INTERVAL},
LogicalTypeID::TIMESTAMP,
ScalarFunction::BinaryExecFunction));
// interval - interval → interval
- result.push_back(ArithmeticFunction::getBinaryFunction(
- SUBTRACT_FUNC_NAME, LogicalTypeID::INTERVAL, LogicalTypeID::INTERVAL));
+ result.push_back(getBinaryFunction(
+ name, LogicalTypeID::INTERVAL, LogicalTypeID::INTERVAL));
return result;
}
function_set MultiplyFunction::getFunctionSet() {
function_set result;
for (auto typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(
- ArithmeticFunction::getBinaryFunction(MULTIPLY_FUNC_NAME, typeID));
+ result.push_back(getBinaryFunction(name, typeID));
}
return result;
}
@@ -114,10 +231,10 @@ function_set MultiplyFunction::getFunctionSet() {
function_set DivideFunction::getFunctionSet() {
function_set result;
for (auto typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(ArithmeticFunction::getBinaryFunction(DIVIDE_FUNC_NAME, typeID));
+ result.push_back(getBinaryFunction(name, typeID));
}
// interval / int → interval
- result.push_back(make_unique(DIVIDE_FUNC_NAME,
+ result.push_back(make_unique(name,
std::vector{LogicalTypeID::INTERVAL, LogicalTypeID::INT64},
LogicalTypeID::INTERVAL,
ScalarFunction::BinaryExecFunction));
@@ -127,7 +244,7 @@ function_set DivideFunction::getFunctionSet() {
function_set ModuloFunction::getFunctionSet() {
function_set result;
for (auto typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(ArithmeticFunction::getBinaryFunction(MODULO_FUNC_NAME, typeID));
+ result.push_back(getBinaryFunction(name, typeID));
}
return result;
}
@@ -135,15 +252,15 @@ function_set ModuloFunction::getFunctionSet() {
function_set PowerFunction::getFunctionSet() {
function_set result;
// double ^ double -> double
- result.push_back(ArithmeticFunction::getBinaryFunction(
- POWER_FUNC_NAME, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
+ result.push_back(
+ getBinaryFunction(name, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
return result;
}
function_set NegateFunction::getFunctionSet() {
function_set result;
for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(ArithmeticFunction::getUnaryFunction(NEGATE_FUNC_NAME, typeID));
+ result.push_back(getUnaryFunction(name, typeID));
}
return result;
}
@@ -151,7 +268,7 @@ function_set NegateFunction::getFunctionSet() {
function_set AbsFunction::getFunctionSet() {
function_set result;
for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(ArithmeticFunction::getUnaryFunction(ABS_FUNC_NAME, typeID));
+ result.push_back(getUnaryFunction(name, typeID));
}
return result;
}
@@ -159,7 +276,7 @@ function_set AbsFunction::getFunctionSet() {
function_set FloorFunction::getFunctionSet() {
function_set result;
for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(ArithmeticFunction::getUnaryFunction(FLOOR_FUNC_NAME, typeID));
+ result.push_back(getUnaryFunction(name, typeID));
}
return result;
}
@@ -167,159 +284,159 @@ function_set FloorFunction::getFunctionSet() {
function_set CeilFunction::getFunctionSet() {
function_set result;
for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) {
- result.push_back(ArithmeticFunction::getUnaryFunction(CEIL_FUNC_NAME, typeID));
+ result.push_back(getUnaryFunction(name, typeID));
}
return result;
}
function_set SinFunction::getFunctionSet() {
function_set result;
- result.push_back(ArithmeticFunction::getUnaryFunction(
- SIN_FUNC_NAME, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
+ result.push_back(
+ getUnaryFunction(name, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
return result;
}
function_set CosFunction::getFunctionSet() {
function_set result;
- result.push_back(ArithmeticFunction::getUnaryFunction(
- COS_FUNC_NAME, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
+ result.push_back(
+ getUnaryFunction(name, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
return result;
}
function_set TanFunction::getFunctionSet() {
function_set result;
- result.push_back(ArithmeticFunction::getUnaryFunction(
- TAN_FUNC_NAME, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
+ result.push_back(
+ getUnaryFunction(name, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
return result;
}
function_set CotFunction::getFunctionSet() {
function_set result;
- result.push_back(ArithmeticFunction::getUnaryFunction(
- COT_FUNC_NAME, LogicalTypeID::DOUBLE, LogicalTypeID::DOUBLE));
+ result.push_back(
+ getUnaryFunction