Skip to content

Commit

Permalink
Merge branch 'master' into import_path_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hououou committed Mar 22, 2024
2 parents 9678007 + 96d9a91 commit d11219b
Show file tree
Hide file tree
Showing 88 changed files with 22,974 additions and 1,208 deletions.
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@

<p align="center">
<a href="https://github.com/kuzudb/kuzu/actions">
<img src="https://github.com/kuzudb/kuzu/actions/workflows/ci-workflow.yml/badge.svg?branch=master" alt="Github Actions Badge">
</a>
<img src="https://github.com/kuzudb/kuzu/actions/workflows/ci-workflow.yml/badge.svg?branch=master" alt="Github Actions Badge"></a>
<a href="https://codecov.io/gh/kuzudb/kuzu" >
<img src="https://codecov.io/github/kuzudb/kuzu/branch/master/graph/badge.svg?token=N1AT6H79LM"/>
</a>
<img src="https://codecov.io/github/kuzudb/kuzu/branch/master/graph/badge.svg?token=N1AT6H79LM"/></a>
<a href="https://discord.gg/VtX2gw9Rug">
<img src="https://img.shields.io/discord/1196510116388806837?logo=discord" alt="discord" />
</a>
<img src="https://img.shields.io/discord/1196510116388806837?logo=discord" alt="discord" /></a>
<a href="https://twitter.com/kuzudb">
<img src="https://img.shields.io/badge/follow-@kuzudb-1DA1F2?logo=twitter" alt="twitter">
</a>
<img src="https://img.shields.io/badge/follow-@kuzudb-1DA1F2?logo=twitter" alt="twitter"></a>
</p>

# Kùzu
Expand Down
12 changes: 6 additions & 6 deletions src/binder/bind/ddl/bind_create_rdf_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ BoundCreateTableInfo Binder::bindCreateRdfGraphInfo(const CreateTableInfo* info)
std::vector<PropertyInfo> resourceTripleProperties;
resourceTripleProperties.emplace_back(InternalKeyword::ID, *LogicalType::INTERNAL_ID());
resourceTripleProperties.emplace_back(std::string(rdf::PID), *LogicalType::INTERNAL_ID());
auto boundResourceTripleExtraInfo = std::make_unique<BoundExtraCreateRelTableInfo>(
common::RelMultiplicity::MANY, common::RelMultiplicity::MANY, INVALID_TABLE_ID,
INVALID_TABLE_ID, std::move(resourceTripleProperties));
auto boundResourceTripleExtraInfo =
std::make_unique<BoundExtraCreateRelTableInfo>(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.
auto literalTripleTableName = RDFGraphCatalogEntry::getLiteralTripleTableName(rdfGraphName);
std::vector<PropertyInfo> literalTripleProperties;
literalTripleProperties.emplace_back(InternalKeyword::ID, *LogicalType::INTERNAL_ID());
literalTripleProperties.emplace_back(std::string(rdf::PID), *LogicalType::INTERNAL_ID());
auto boundLiteralTripleExtraInfo = std::make_unique<BoundExtraCreateRelTableInfo>(
common::RelMultiplicity::MANY, common::RelMultiplicity::MANY, INVALID_TABLE_ID,
INVALID_TABLE_ID, std::move(literalTripleProperties));
auto boundLiteralTripleExtraInfo =
std::make_unique<BoundExtraCreateRelTableInfo>(RelMultiplicity::MANY, RelMultiplicity::MANY,
INVALID_TABLE_ID, INVALID_TABLE_ID, std::move(literalTripleProperties));
auto boundLiteralTripleCreateInfo = BoundCreateTableInfo(
TableType::REL, literalTripleTableName, std::move(boundLiteralTripleExtraInfo));
// Rdf table.
Expand Down
5 changes: 3 additions & 2 deletions src/binder/bind_expression/bind_function_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -323,12 +324,12 @@ std::shared_ptr<Expression> ExpressionBinder::bindRecursiveJoinLengthFunction(
children.push_back(std::move(numRelsExpression));
children.push_back(
ku_dynamic_cast<Expression&, RelExpression&>(*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<Expression&, RelExpression&>(*recursiveRels[i])
.getLengthExpression();
result = bindScalarFunctionExpression(children, ADD_FUNC_NAME);
result = bindScalarFunctionExpression(children, AddFunction::name);
}
return result;
} else if (ExpressionUtil::isRecursiveRelPattern(expression)) {
Expand Down
15 changes: 7 additions & 8 deletions src/catalog/catalog_entry/rel_table_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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} {}
Expand All @@ -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 {
Expand All @@ -59,8 +58,8 @@ void RelTableCatalogEntry::serialize(Serializer& serializer) const {

std::unique_ptr<RelTableCatalogEntry> 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);
Expand Down
4 changes: 4 additions & 0 deletions src/catalog/catalog_entry/scalar_function_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
26 changes: 18 additions & 8 deletions src/common/task_system/progress_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ void ProgressBar::startProgress() {
}
std::lock_guard<std::mutex> lock(progressBarLock);
printProgressBar(0.0);
printing = true;
}

void ProgressBar::endProgress() {
std::lock_guard<std::mutex> lock(progressBarLock);
resetProgressBar();
printing = false;
}

void ProgressBar::addPipeline() {
Expand All @@ -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<std::mutex> 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 {
Expand All @@ -55,9 +64,10 @@ void ProgressBar::printProgressBar(double curPipelineProgress) const {
}

void ProgressBar::resetProgressBar() {
std::lock_guard<std::mutex> 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;
Expand Down
10 changes: 10 additions & 0 deletions src/common/vector/value_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<AuxiliaryBuffer*, StringAuxiliaryBuffer*>(vector->auxiliaryBuffer.get());
dstStr.len = length;
if (!ku_string_t::isShortString(length)) {
dstStr.overflowPtr = reinterpret_cast<uint64_t>(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 =
Expand Down
2 changes: 2 additions & 0 deletions src/function/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit d11219b

Please sign in to comment.