Skip to content

Commit

Permalink
Fixed the build
Browse files Browse the repository at this point in the history
  • Loading branch information
sherman-the-tank committed Apr 6, 2020
1 parent e19f317 commit ec97c12
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 37 deletions.
35 changes: 19 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ find_package(OpenSSL REQUIRED)
find_package(Krb5 REQUIRED gssapi)
find_package(GPERF 2.8 REQUIRED)
find_package(Libunwind REQUIRED)
find_package(LZ4 MODULE)
find_package(LibLZMA MODULE)

find_package(Rocksdb REQUIRED)
Expand Down Expand Up @@ -269,6 +270,20 @@ if(ENABLE_FUZZ_TEST)
endif()
endif()

# All thrift libraries
set(THRIFT_LIBRARIES
thriftcpp2
thrift
thriftprotocol
async
protocol
transport
concurrency
security
thriftfrozen2
thrift-core
)

macro(nebula_add_executable)
cmake_parse_arguments(
nebula_exec # prefix
Expand Down Expand Up @@ -349,21 +364,6 @@ include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src/kvstore/plugins/hbase)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${NEBULA_THIRDPARTY_ROOT}/lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${NEBULA_THIRDPARTY_ROOT}/lib64")

# All thrift libraries
set(THRIFT_LIBRARIES
thriftcpp2
thrift
thriftprotocol
async
esrotocol
-dependency
tranport
concurrency
security
thriftfrozen2
thrift-core
)

set(ROCKSDB_LIBRARIES ${Rocksdb_LIBRARY})

# All compression libraries
Expand All @@ -372,6 +372,10 @@ if (LIBLZMA_FOUND)
include_directories(SYSTEM ${LIBLZMA_INCLUDE_DIRS})
list(APPEND COMPRESSION_LIBRARIES ${LIBLZMA_LIBRARIES})
endif()
if (LZ4_FOUND)
include_directories(SYSTEM ${LZ4_INCLUDE_DIR})
list(APPEND COMPRESSION_LIBRARIES ${LZ4_LIBRARY})
endif()

if (NOT ENABLE_JEMALLOC OR ENABLE_ASAN)
set(JEMALLOC_LIB )
Expand Down Expand Up @@ -408,7 +412,6 @@ macro(nebula_link_libraries target)
event
double-conversion
resolv
s2
${COMPRESSION_LIBRARIES}
${JEMALLOC_LIB}
${OPENSSL_SSL_LIBRARY}
Expand Down
27 changes: 27 additions & 0 deletions cmake/FindLZ4.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Finds liblz4.
#
# This module defines:
# LZ4_FOUND
# LZ4_INCLUDE_DIR
# LZ4_LIBRARY
#

find_path(LZ4_INCLUDE_DIR NAMES lz4.h)

find_library(LZ4_LIBRARY_DEBUG NAMES lz4d)
find_library(LZ4_LIBRARY_RELEASE NAMES lz4)

include(SelectLibraryConfigurations)
SELECT_LIBRARY_CONFIGURATIONS(LZ4)

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LZ4 DEFAULT_MSG
LZ4_LIBRARY LZ4_INCLUDE_DIR
)

if (LZ4_FOUND)
message(STATUS "Found LZ4: ${LZ4_LIBRARY}")
endif()

mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
35 changes: 22 additions & 13 deletions src/codec/test/ResultSchemaProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ const char* ResultSchemaProvider::ResultSchemaField::name() const {
}


const PropertyType ResultSchemaProvider::ResultSchemaField::type() const {
PropertyType ResultSchemaProvider::ResultSchemaField::type() const {
DCHECK(!!column_);
return column_->get_type();
}


bool ResultSchemaProvider::ResultSchemaField::isValid() const {
return column_ != nullptr;
bool ResultSchemaProvider::ResultSchemaField::nullable() const {
LOG(FATAL) << "Not Supported";
}


Expand All @@ -49,6 +49,14 @@ const Value& ResultSchemaProvider::ResultSchemaField::defaultValue() const {
LOG(FATAL) << "Not Supported";
}

size_t ResultSchemaProvider::ResultSchemaField::size() const {
return 0;
}

size_t ResultSchemaProvider::ResultSchemaField::offset() const {
return 0;
}


/***********************************
*
Expand Down Expand Up @@ -88,7 +96,7 @@ const char* ResultSchemaProvider::getFieldName(int64_t index) const {
}


const PropertyType ResultSchemaProvider::getFieldType(int64_t index) const {
PropertyType ResultSchemaProvider::getFieldType(int64_t index) const {
if (index < 0 || index >= static_cast<int64_t>(columns_.size())) {
return PropertyType::UNKNOWN;
}
Expand All @@ -97,7 +105,7 @@ const PropertyType ResultSchemaProvider::getFieldType(int64_t index) const {
}


const PropertyType ResultSchemaProvider::getFieldType(const folly::StringPiece name) const {
PropertyType ResultSchemaProvider::getFieldType(const folly::StringPiece name) const {
auto index = getFieldIndex(name);
if (index < 0) {
return PropertyType::UNKNOWN;
Expand All @@ -106,22 +114,23 @@ const PropertyType ResultSchemaProvider::getFieldType(const folly::StringPiece n
}


std::shared_ptr<const meta::SchemaProviderIf::Field>
ResultSchemaProvider::field(int64_t index) const {
const meta::SchemaProviderIf::Field* ResultSchemaProvider::field(int64_t index) const {
if (index < 0 || index >= static_cast<int64_t>(columns_.size())) {
return std::shared_ptr<ResultSchemaField>();
return nullptr;
}
return std::make_shared<ResultSchemaField>(&(columns_[index]));
field_.reset(new ResultSchemaField(&(columns_[index])));
return field_.get();
}


std::shared_ptr<const meta::SchemaProviderIf::Field>
ResultSchemaProvider::field(const folly::StringPiece name) const {
const meta::SchemaProviderIf::Field* ResultSchemaProvider::field(
const folly::StringPiece name) const {
auto index = getFieldIndex(name);
if (index < 0) {
return std::shared_ptr<ResultSchemaField>();
return nullptr;
}
return std::make_shared<ResultSchemaField>(&(columns_[index]));
field_.reset(new ResultSchemaField(&(columns_[index])));
return field_.get();
}

} // namespace nebula
Expand Down
24 changes: 16 additions & 8 deletions src/codec/test/ResultSchemaProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class ResultSchemaProvider : public meta::SchemaProviderIf {
explicit ResultSchemaField(const meta::cpp2::ColumnDef* col = nullptr);

const char* name() const override;
const meta::cpp2::PropertyType type() const override;
bool isValid() const override;
meta::cpp2::PropertyType type() const override;
bool nullable() const override;
bool hasDefault() const override;
const Value& defaultValue() const override;
size_t size() const override;
size_t offset() const override;

private:
const meta::cpp2::ColumnDef* column_;
Expand All @@ -41,18 +43,21 @@ class ResultSchemaProvider : public meta::SchemaProviderIf {

size_t getNumFields() const noexcept override;

size_t size() const noexcept override {
LOG(FATAL) << "Not Supported";
}

int64_t getFieldIndex(const folly::StringPiece name) const override;
const char* getFieldName(int64_t index) const override;

const meta::cpp2::PropertyType getFieldType(int64_t index) const override;
const meta::cpp2::PropertyType getFieldType(const folly::StringPiece name)
meta::cpp2::PropertyType getFieldType(int64_t index) const override;
meta::cpp2::PropertyType getFieldType(const folly::StringPiece name)
const override;

std::shared_ptr<const meta::SchemaProviderIf::Field>
field(int64_t index) const override;
const meta::SchemaProviderIf::Field* field(int64_t index) const override;

std::shared_ptr<const meta::SchemaProviderIf::Field>
field(const folly::StringPiece name) const override;
const meta::SchemaProviderIf::Field* field(const folly::StringPiece name)
const override;

protected:
SchemaVer schemaVer_{0};
Expand All @@ -61,6 +66,9 @@ class ResultSchemaProvider : public meta::SchemaProviderIf {
// Map of Hash64(field_name) -> array index
std::unordered_map<uint64_t, int64_t> nameIndex_;

// The current field
mutable std::shared_ptr<ResultSchemaField> field_;

// Default constructor, only used by SchemaWriter
explicit ResultSchemaProvider(SchemaVer ver = 0) : schemaVer_(ver) {}
};
Expand Down

0 comments on commit ec97c12

Please sign in to comment.