Skip to content

Commit

Permalink
Merge branch 'master' into bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Xscaperrr authored Nov 18, 2024
2 parents b62ff5b + 6c59b79 commit 8f19722
Show file tree
Hide file tree
Showing 57 changed files with 3,118 additions and 272 deletions.
6 changes: 3 additions & 3 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ NebulaGraph内核 1.x 与 2.x 数据格式、通信协议、客户端等均双

## 快速使用

您可以在[云上](https://docs.nebula-graph.com.cn/3.3.0/2.quick-start/1.quick-start-overview/#_2)[本地](https://docs.nebula-graph.com.cn/3.3.0/2.quick-start/1.quick-start-overview/#_6)快速体验 **NebulaGraph**
您可以在[云上](https://cloud.nebula-graph.io/login)[本地](https://docs.nebula-graph.com.cn/3.8.0/2.quick-start/3.quick-start-on-premise/2.install-nebula-graph/)快速体验 **NebulaGraph**

<!--
在开始使用 **NebulaGraph** 之前,必须通过[编译源码](https://docs.nebula-graph.com.cn/manual-CN/3.build-develop-and-administration/1.build/1.build-source-code/)或者 [docker compose](https://docs.nebula-graph.com.cn/manual-CN/3.build-develop-and-administration/1.build/2.build-by-docker/) 方式安装 **NebulaGraph**。您也可以观看[视频](https://space.bilibili.com/472621355)学习如何安装 **NebulaGraph**。
-->

## 安装方式

您可以通过[下载](https://www.nebula-graph.com.cn/download)安装包或者[源码编译](https://docs.nebula-graph.com.cn/3.3.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code/)安装 **NebulaGraph**
您可以通过[下载](https://www.nebula-graph.com.cn/download)安装包或者[源码编译](https://docs.nebula-graph.com.cn/3.8.0/2.quick-start/3.quick-start-on-premise/2.install-nebula-graph/)安装 **NebulaGraph**

## 获取帮助

在使用 **NebulaGraph** 过程中遇到任何问题,都可以通过下面的方式寻求帮助:

* [FAQ](https://docs.nebula-graph.com.cn/3.3.0/20.appendix/0.FAQ/)
* [FAQ](https://docs.nebula-graph.com.cn/3.8.0/20.appendix/0.FAQ/)
* [访问论坛](https://discuss.nebula-graph.com.cn/)
* [查看文档](https://docs.nebula-graph.com.cn/)

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,26 @@ See our [Roadmap](https://github.com/vesoft-inc/nebula/wiki/Nebula-Graph-Roadmap

## Quick start

Read the [getting started](https://docs.nebula-graph.io/3.6.0/2.quick-start/1.quick-start-workflow/) docs for a quick start.
Read the [getting started](https://docs.nebula-graph.io/3.8.0/2.quick-start/1.quick-start-workflow/) docs for a quick start.

## Using NebulaGraph

NebulaGraph is a distributed graph database with multiple components. You can [download](https://www.nebula-graph.io/download) or try in following ways:

- [Build from source](https://docs.nebula-graph.io/3.3.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code/)
- [Build from source](https://docs.nebula-graph.io/3.8.0/2.quick-start/2.install-nebula-graph/)

- In the cloud: [AWS](https://docs.nebula-graph.io/3.1.3/nebula-cloud/nebula-cloud-on-aws/1.aws-overview/) and [Azure](https://docs.nebula-graph.io/3.1.3/nebula-cloud/nebula-cloud-on-azure/azure-self-managed/1.azure-overview/)
- In the cloud: [AWS](https://cloud.nebula-graph.io/login)

## Getting help

In case you encounter any problems playing around **NebulaGraph**, please reach out for help:
* [FAQ](https://docs.nebula-graph.io/3.6.0/20.appendix/0.FAQ/)
* [FAQ](https://docs.nebula-graph.io/3.8.0/20.appendix/0.FAQ/)
* [Discussions](https://github.com/vesoft-inc/nebula/discussions)
* [Documentation](https://docs.nebula-graph.io/)

## DevTools

NebulaGraph comes with a set of tools to help you manage and monitor your graph database. See [Ecosystem](https://docs.nebula-graph.io/3.6.0/20.appendix/6.eco-tool-version/).
NebulaGraph comes with a set of tools to help you manage and monitor your graph database. See [Ecosystem](https://docs.nebula-graph.io/3.8.0/20.appendix/6.eco-tool-version/).

## Contributing

Expand Down
3 changes: 3 additions & 0 deletions conf/nebula-graphd.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
--stderrthreshold=3
# wether logging files' name contain time stamp.
--timestamp_in_logfile_name=true
# use max_log_size or log_clean_days to control the log file size and log file clean days. Set log_clean_days to 0 to disable log file cleaning.
--log_clean_days=0

########## query ##########
# Whether to treat partial success as an error.
# This flag is only used for Read-only access, and Modify access always treats partial success as an error.
Expand Down
2 changes: 2 additions & 0 deletions conf/nebula-metad.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
--stderrthreshold=3
# wether logging files' name contain time stamp, If Using logrotate to rotate logging files, than should set it to true.
--timestamp_in_logfile_name=true
# use max_log_size or log_clean_days to control the log file size and log file clean days. Set log_clean_days to 0 to disable log file cleaning.
--log_clean_days=0

########## networking ##########
# Comma separated Meta Server addresses
Expand Down
2 changes: 2 additions & 0 deletions conf/nebula-standalone.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
--stderr_log_file=standalone-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=3
# use max_log_size or log_clean_days to control the log file size and log file clean days. Set log_clean_days to 0 to disable log file cleaning.
--log_clean_days=0

########## query ##########
# Whether to treat partial success as an error.
Expand Down
2 changes: 2 additions & 0 deletions conf/nebula-storaged-listener.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
--stderrthreshold=3
# Wether logging files' name contain timestamp.
--timestamp_in_logfile_name=true
# use max_log_size or log_clean_days to control the log file size and log file clean days. Set log_clean_days to 0 to disable log file cleaning.
--log_clean_days=0

########## networking ##########
# Meta server address
Expand Down
2 changes: 2 additions & 0 deletions conf/nebula-storaged.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
--stderrthreshold=3
# Wether logging files' name contain time stamp.
--timestamp_in_logfile_name=true
# use max_log_size or log_clean_days to control the log file size and log file clean days. Set log_clean_days to 0 to disable log file cleaning.
--log_clean_days=0

########## networking ##########
# Comma separated Meta server addresses
Expand Down
97 changes: 96 additions & 1 deletion src/codec/RowReaderV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,44 @@
*
* This source code is licensed under Apache 2.0 License.
*/

#include "codec/RowReaderV2.h"

namespace nebula {

using nebula::cpp2::PropertyType;

template <typename T, typename Container>
Value extractIntOrFloat(const folly::StringPiece& data, size_t& offset) {
int32_t containerOffset;
memcpy(reinterpret_cast<void*>(&containerOffset), data.data() + offset, sizeof(int32_t));
if (static_cast<size_t>(containerOffset) >= data.size()) {
LOG(ERROR) << "Container offset out of bounds. Offset: " << containerOffset
<< ", Data size: " << data.size();
return Value::kNullValue;
}
int32_t containerSize;
memcpy(reinterpret_cast<void*>(&containerSize), data.data() + containerOffset, sizeof(int32_t));
containerOffset += sizeof(int32_t);
Container container;
for (int32_t i = 0; i < containerSize; ++i) {
T value;
if (static_cast<size_t>(containerOffset + sizeof(T)) > data.size()) {
LOG(ERROR) << "Reading beyond data bounds. Attempting to read at offset: " << containerOffset
<< ", Data size: " << data.size();
return Value::kNullValue;
}
memcpy(reinterpret_cast<void*>(&value), data.data() + containerOffset, sizeof(T));
containerOffset += sizeof(T);

if constexpr (std::is_same_v<Container, List>) {
container.values.emplace_back(Value(value));
} else if constexpr (std::is_same_v<Container, Set>) {
container.values.insert(Value(value));
}
}
return Value(std::move(container));
}

bool RowReaderV2::resetImpl(meta::NebulaSchemaProvider const* schema, folly::StringPiece row) {
schema_ = schema;
data_ = row;
Expand Down Expand Up @@ -206,6 +237,70 @@ Value RowReaderV2::getValueByIndex(const int64_t index) const {
}
return std::move(geogRet).value();
}
case PropertyType::LIST_STRING: {
int32_t listOffset;
memcpy(reinterpret_cast<void*>(&listOffset), &data_[offset], sizeof(int32_t));
if (static_cast<size_t>(listOffset) >= data_.size()) {
LOG(ERROR) << "List offset out of bounds for LIST_STRING.";
return Value::kNullValue;
}
int32_t listSize;
memcpy(reinterpret_cast<void*>(&listSize), &data_[listOffset], sizeof(int32_t));
listOffset += sizeof(int32_t);

List list;
for (int32_t i = 0; i < listSize; ++i) {
int32_t strLen;
memcpy(reinterpret_cast<void*>(&strLen), &data_[listOffset], sizeof(int32_t));
listOffset += sizeof(int32_t);
if (static_cast<size_t>(listOffset + strLen) > data_.size()) {
LOG(ERROR) << "String length out of bounds for LIST_STRING.";
return Value::kNullValue;
}
std::string str(&data_[listOffset], strLen);
listOffset += strLen;
list.values.emplace_back(str);
}
return Value(std::move(list));
}
case PropertyType::LIST_INT:
return nebula::extractIntOrFloat<int32_t, List>(data_, offset);
case PropertyType::LIST_FLOAT:
return nebula::extractIntOrFloat<float, List>(data_, offset);
case PropertyType::SET_STRING: {
int32_t setOffset;
memcpy(reinterpret_cast<void*>(&setOffset), &data_[offset], sizeof(int32_t));
if (static_cast<size_t>(setOffset) >= data_.size()) {
LOG(ERROR) << "Set offset out of bounds for SET_STRING.";
return Value::kNullValue;
}
int32_t setSize;
memcpy(reinterpret_cast<void*>(&setSize), &data_[setOffset], sizeof(int32_t));
setOffset += sizeof(int32_t);

Set set;
std::unordered_set<std::string> uniqueStrings;
for (int32_t i = 0; i < setSize; ++i) {
int32_t strLen;
memcpy(reinterpret_cast<void*>(&strLen), &data_[setOffset], sizeof(int32_t));
setOffset += sizeof(int32_t);
if (static_cast<size_t>(setOffset + strLen) > data_.size()) {
LOG(ERROR) << "String length out of bounds for SET_STRING.";
return Value::kNullValue;
}
std::string str(&data_[setOffset], strLen);
setOffset += strLen;
uniqueStrings.insert(std::move(str));
}
for (const auto& str : uniqueStrings) {
set.values.insert(Value(str));
}
return Value(std::move(set));
}
case PropertyType::SET_INT:
return nebula::extractIntOrFloat<int32_t, Set>(data_, offset);
case PropertyType::SET_FLOAT:
return nebula::extractIntOrFloat<float, Set>(data_, offset);
case PropertyType::UNKNOWN:
break;
}
Expand Down
Loading

0 comments on commit 8f19722

Please sign in to comment.