diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f859def28..7cb3f6d377 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,9 @@ if(CMAKE_BUILD_TYPE MATCHES Release) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") endif() endif() +if(NOT MSVC) + add_compile_options(-Wall) +endif() if(${ENABLE_THREAD_SANITIZER}) if(MSVC) diff --git a/src/binder/bind/bind_copy.cpp b/src/binder/bind/bind_copy.cpp index 88b44fcffd..dea47d90a2 100644 --- a/src/binder/bind/bind_copy.cpp +++ b/src/binder/bind/bind_copy.cpp @@ -40,7 +40,7 @@ std::unique_ptr Binder::bindCopyToClause(const Statement& statem } auto csvConfig = bindParsingOptions(copyToStatement.getParsingOptionsRef()); return std::make_unique(boundFilePath, fileType, std::move(columnNames), - std::move(columnTypes), std::move(query), std::move(csvConfig->option.copy())); + std::move(columnTypes), std::move(query), csvConfig->option.copy()); } // As a temporary constraint, we require npy files loaded with COPY FROM BY COLUMN keyword. diff --git a/src/common/arrow/arrow_converter.cpp b/src/common/arrow/arrow_converter.cpp index eb8d03a2c4..42d7701113 100644 --- a/src/common/arrow/arrow_converter.cpp +++ b/src/common/arrow/arrow_converter.cpp @@ -191,7 +191,7 @@ std::unique_ptr ArrowConverter::toArrowSchema( outSchema->private_data = rootHolder.release(); outSchema->release = releaseArrowSchema; - return std::move(outSchema); + return outSchema; } void ArrowConverter::toArrowArray( diff --git a/src/common/arrow/arrow_row_batch.cpp b/src/common/arrow/arrow_row_batch.cpp index 3632ce169c..e2b65bc625 100644 --- a/src/common/arrow/arrow_row_batch.cpp +++ b/src/common/arrow/arrow_row_batch.cpp @@ -187,7 +187,7 @@ std::unique_ptr ArrowRowBatch::createVector( KU_UNREACHABLE; } } - return std::move(result); + return result; } static void getBitPosition(std::int64_t pos, std::int64_t& bytePos, std::int64_t& bitOffset) { @@ -580,7 +580,7 @@ static std::unique_ptr createArrayFromVector(ArrowVector& vector) { result->n_buffers++; result->buffers[1] = vector.data.data(); } - return std::move(result); + return result; } template diff --git a/src/common/types/blob.cpp b/src/common/types/blob.cpp index f9f3d0ce91..c71e70a397 100644 --- a/src/common/types/blob.cpp +++ b/src/common/types/blob.cpp @@ -48,10 +48,10 @@ uint64_t Blob::fromString(const char* str, uint64_t length, uint8_t* resultBuffe for (auto i = 0u; i < length; i++) { if (str[i] == '\\') { validateHexCode(reinterpret_cast(str), length, i); - auto firstByte = - HexFormatConstants::HEX_MAP[str[i + HexFormatConstants::FIRST_BYTE_POS]]; - auto secondByte = - HexFormatConstants::HEX_MAP[str[i + HexFormatConstants::SECOND_BYTES_POS]]; + auto firstByte = HexFormatConstants::HEX_MAP[( + unsigned char)str[i + HexFormatConstants::FIRST_BYTE_POS]]; + auto secondByte = HexFormatConstants::HEX_MAP[( + unsigned char)str[i + HexFormatConstants::SECOND_BYTES_POS]]; resultBuffer[resultPos++] = (firstByte << HexFormatConstants::NUM_BYTES_TO_SHIFT_FOR_FIRST_BYTE) + secondByte; i += HexFormatConstants::LENGTH - 1; diff --git a/src/expression_evaluator/case_evaluator.cpp b/src/expression_evaluator/case_evaluator.cpp index 68d69b3ef0..e84414c8e9 100644 --- a/src/expression_evaluator/case_evaluator.cpp +++ b/src/expression_evaluator/case_evaluator.cpp @@ -73,7 +73,7 @@ std::unique_ptr CaseExpressionEvaluator::clone() { clonedAlternativeEvaluators.push_back(alternative->clone()); } return make_unique( - expression, std::move(clonedAlternativeEvaluators), std::move(elseEvaluator->clone())); + expression, std::move(clonedAlternativeEvaluators), elseEvaluator->clone()); } void CaseExpressionEvaluator::resolveResultVector( @@ -101,7 +101,7 @@ void CaseExpressionEvaluator::fillEntry(sel_t resultPos, const ValueVector& then } else { if (thenVector.dataType.getLogicalTypeID() == LogicalTypeID::VAR_LIST) { auto srcListEntry = thenVector.getValue(thenPos); - list_entry_t resultEntry = ListVector::addList(resultVector.get(), srcListEntry.size); + ListVector::addList(resultVector.get(), srcListEntry.size); resultVector->copyFromVectorData(resultPos, &thenVector, thenPos); } else { auto val = thenVector.getValue(thenPos); diff --git a/src/function/cast/cast_fixed_list.cpp b/src/function/cast/cast_fixed_list.cpp index b7e9dab5eb..8880798e23 100644 --- a/src/function/cast/cast_fixed_list.cpp +++ b/src/function/cast/cast_fixed_list.cpp @@ -30,7 +30,6 @@ bool CastFixedListHelper::containsListToFixedList( dstType->toString())}; } - auto result = false; std::vector fields; for (auto i = 0u; i < srcFieldTypes.size(); i++) { if (containsListToFixedList(srcFieldTypes[i], dstFieldTypes[i])) { diff --git a/src/include/binder/binder.h b/src/include/binder/binder.h index 153fcd79a6..834679be41 100644 --- a/src/include/binder/binder.h +++ b/src/include/binder/binder.h @@ -19,17 +19,17 @@ class ClientContext; } namespace function { -class TableFunction; +struct TableFunction; } namespace binder { -class BoundInsertInfo; -class BoundSetPropertyInfo; -class BoundDeleteInfo; +struct BoundInsertInfo; +struct BoundSetPropertyInfo; +struct BoundDeleteInfo; class BoundWithClause; class BoundReturnClause; -class BoundFileScanInfo; +struct BoundFileScanInfo; // BinderScope keeps track of expressions in scope and their aliases. We maintain the order of // expressions in diff --git a/src/include/binder/expression_binder.h b/src/include/binder/expression_binder.h index 423ca9e50d..fb181bc69d 100644 --- a/src/include/binder/expression_binder.h +++ b/src/include/binder/expression_binder.h @@ -11,7 +11,7 @@ class Value; namespace binder { class Binder; -class CaseAlternative; +struct CaseAlternative; class ExpressionBinder { friend class Binder; diff --git a/src/include/binder/query/updating_clause/bound_delete_info.h b/src/include/binder/query/updating_clause/bound_delete_info.h index a5d85aade6..25219bd321 100644 --- a/src/include/binder/query/updating_clause/bound_delete_info.h +++ b/src/include/binder/query/updating_clause/bound_delete_info.h @@ -14,11 +14,11 @@ struct BoundDeleteInfo { BoundDeleteInfo(UpdateTableType updateTableType, std::shared_ptr nodeOrRel, common::DeleteClauseType deleteClauseType) - : updateTableType{updateTableType}, nodeOrRel{std::move(nodeOrRel)}, - deleteClauseType{deleteClauseType} {} + : deleteClauseType{deleteClauseType}, updateTableType{updateTableType}, nodeOrRel{std::move( + nodeOrRel)} {} BoundDeleteInfo(const BoundDeleteInfo& other) - : updateTableType{other.updateTableType}, nodeOrRel{other.nodeOrRel}, - deleteClauseType{other.deleteClauseType} {} + : deleteClauseType{other.deleteClauseType}, + updateTableType{other.updateTableType}, nodeOrRel{other.nodeOrRel} {} inline std::unique_ptr copy() { return std::make_unique(*this); diff --git a/src/include/common/utils.h b/src/include/common/utils.h index bf04ae6389..222908bb0b 100644 --- a/src/include/common/utils.h +++ b/src/include/common/utils.h @@ -33,7 +33,7 @@ class BitmaskUtils { } }; -static uint64_t nextPowerOfTwo(uint64_t v) { +inline uint64_t nextPowerOfTwo(uint64_t v) { v--; v |= v >> 1; v |= v >> 2; @@ -45,7 +45,7 @@ static uint64_t nextPowerOfTwo(uint64_t v) { return v; } -static bool isLittleEndian() { +inline bool isLittleEndian() { // Little endian arch stores the least significant value in the lower bytes. int testNumber = 1; return *(uint8_t*)&testNumber == 1; diff --git a/src/include/function/aggregate_function.h b/src/include/function/aggregate_function.h index 8afd46d86f..a08cb9d85a 100644 --- a/src/include/function/aggregate_function.h +++ b/src/include/function/aggregate_function.h @@ -9,8 +9,6 @@ namespace kuzu { namespace function { -class AggregateFunction; - struct AggregateState { virtual inline uint32_t getStateSize() const = 0; virtual void moveResultToVector(common::ValueVector* outputVector, uint64_t pos) = 0; @@ -37,10 +35,10 @@ struct AggregateFunction final : public BaseScalarFunction { scalar_bind_func bindFunc = nullptr, param_rewrite_function_t paramRewriteFunc = nullptr) : BaseScalarFunction{FunctionType::AGGREGATE, std::move(name), std::move(parameterTypeIDs), returnTypeID, std::move(bindFunc)}, - initializeFunc{std::move(initializeFunc)}, updateAllFunc{std::move(updateAllFunc)}, - updatePosFunc{std::move(updatePosFunc)}, combineFunc{std::move(combineFunc)}, - finalizeFunc{std::move(finalizeFunc)}, isDistinct{isDistinct}, paramRewriteFunc{std::move( - paramRewriteFunc)} { + isDistinct{isDistinct}, initializeFunc{std::move(initializeFunc)}, + updateAllFunc{std::move(updateAllFunc)}, updatePosFunc{std::move(updatePosFunc)}, + combineFunc{std::move(combineFunc)}, finalizeFunc{std::move(finalizeFunc)}, + paramRewriteFunc{std::move(paramRewriteFunc)} { initialNullAggregateState = createInitialNullAggregateState(); } diff --git a/src/include/function/cast/functions/cast_string_non_nested_functions.h b/src/include/function/cast/functions/cast_string_non_nested_functions.h index a14e226727..c2602ad822 100644 --- a/src/include/function/cast/functions/cast_string_non_nested_functions.h +++ b/src/include/function/cast/functions/cast_string_non_nested_functions.h @@ -53,7 +53,7 @@ void castStringToBool(const char* input, uint64_t len, bool& result); // cast to numerical values // TODO(Kebing): support exponent + decimal template -static bool integerCastLoop(const char* input, uint64_t len, T& result) { +inline bool integerCastLoop(const char* input, uint64_t len, T& result) { int64_t start_pos = 0; if (NEGATIVE) { start_pos = 1; @@ -75,7 +75,7 @@ static bool integerCastLoop(const char* input, uint64_t len, T& result) { } template -static bool tryIntegerCast(const char* input, uint64_t& len, T& result) { +inline bool tryIntegerCast(const char* input, uint64_t& len, T& result) { StringUtils::removeCStringWhiteSpaces(input, len); if (len == 0) { return false; @@ -159,7 +159,7 @@ struct Int128CastOperation { } }; -static bool trySimpleInt128Cast(const char* input, uint64_t len, int128_t& result) { +inline bool trySimpleInt128Cast(const char* input, uint64_t len, int128_t& result) { Int128CastData data{}; data.result = 0; if (tryIntegerCast(input, len, data)) { @@ -169,7 +169,7 @@ static bool trySimpleInt128Cast(const char* input, uint64_t len, int128_t& resul return false; } -static void simpleInt128Cast(const char* input, uint64_t len, int128_t& result) { +inline void simpleInt128Cast(const char* input, uint64_t len, int128_t& result) { if (!trySimpleInt128Cast(input, len, result)) { throw ConversionException( stringFormat("Cast failed. {} is not within INT128 range.", std::string{input, len})); @@ -177,7 +177,7 @@ static void simpleInt128Cast(const char* input, uint64_t len, int128_t& result) } template -static bool trySimpleIntegerCast(const char* input, uint64_t len, T& result) { +inline bool trySimpleIntegerCast(const char* input, uint64_t len, T& result) { IntegerCastData data; data.result = 0; if (tryIntegerCast, IS_SIGNED>(input, len, data)) { @@ -188,7 +188,7 @@ static bool trySimpleIntegerCast(const char* input, uint64_t len, T& result) { } template -static void simpleIntegerCast( +inline void simpleIntegerCast( const char* input, uint64_t len, T& result, LogicalTypeID typeID = LogicalTypeID::ANY) { if (!trySimpleIntegerCast(input, len, result)) { throw ConversionException(stringFormat("Cast failed. {} is not in {} range.", @@ -197,7 +197,7 @@ static void simpleIntegerCast( } template -static bool tryDoubleCast(const char* input, uint64_t len, T& result) { +inline bool tryDoubleCast(const char* input, uint64_t len, T& result) { StringUtils::removeCStringWhiteSpaces(input, len); if (len == 0) { return false; @@ -217,7 +217,7 @@ static bool tryDoubleCast(const char* input, uint64_t len, T& result) { } template -static void doubleCast( +inline void doubleCast( const char* input, uint64_t len, T& result, LogicalTypeID typeID = LogicalTypeID::ANY) { if (!tryDoubleCast(input, len, result)) { throw ConversionException(stringFormat("Cast failed. {} is not in {} range.", diff --git a/src/include/function/cast/functions/numeric_cast.h b/src/include/function/cast/functions/numeric_cast.h index f33a8cb876..861fe0724a 100644 --- a/src/include/function/cast/functions/numeric_cast.h +++ b/src/include/function/cast/functions/numeric_cast.h @@ -9,7 +9,7 @@ namespace kuzu { namespace function { template -static bool tryCastWithOverflowCheck(SRC value, DST& result) { +inline bool tryCastWithOverflowCheck(SRC value, DST& result) { if (NumericLimits::isSigned() != NumericLimits::isSigned()) { if (NumericLimits::isSigned()) { if (NumericLimits::digits() > NumericLimits::digits()) { @@ -53,7 +53,7 @@ static bool tryCastWithOverflowCheck(SRC value, DST& result) { } template -bool tryCastWithOverflowCheckFloat(SRC value, T& result, SRC min, SRC max) { +inline bool tryCastWithOverflowCheckFloat(SRC value, T& result, SRC min, SRC max) { if (!(value >= min && value < max)) { return false; } @@ -63,99 +63,99 @@ bool tryCastWithOverflowCheckFloat(SRC value, T& result, SRC min, SRC max) { } template<> -bool tryCastWithOverflowCheck(float value, int8_t& result) { +inline bool tryCastWithOverflowCheck(float value, int8_t& result) { return tryCastWithOverflowCheckFloat(value, result, -128.0f, 128.0f); } template<> -bool tryCastWithOverflowCheck(float value, int16_t& result) { +inline bool tryCastWithOverflowCheck(float value, int16_t& result) { return tryCastWithOverflowCheckFloat(value, result, -32768.0f, 32768.0f); } template<> -bool tryCastWithOverflowCheck(float value, int32_t& result) { +inline bool tryCastWithOverflowCheck(float value, int32_t& result) { return tryCastWithOverflowCheckFloat( value, result, -2147483648.0f, 2147483648.0f); } template<> -bool tryCastWithOverflowCheck(float value, int64_t& result) { +inline bool tryCastWithOverflowCheck(float value, int64_t& result) { return tryCastWithOverflowCheckFloat( value, result, -9223372036854775808.0f, 9223372036854775808.0f); } template<> -bool tryCastWithOverflowCheck(float value, uint8_t& result) { +inline bool tryCastWithOverflowCheck(float value, uint8_t& result) { return tryCastWithOverflowCheckFloat(value, result, 0.0f, 256.0f); } template<> -bool tryCastWithOverflowCheck(float value, uint16_t& result) { +inline bool tryCastWithOverflowCheck(float value, uint16_t& result) { return tryCastWithOverflowCheckFloat(value, result, 0.0f, 65536.0f); } template<> -bool tryCastWithOverflowCheck(float value, uint32_t& result) { +inline bool tryCastWithOverflowCheck(float value, uint32_t& result) { return tryCastWithOverflowCheckFloat(value, result, 0.0f, 4294967296.0f); } template<> -bool tryCastWithOverflowCheck(float value, uint64_t& result) { +inline bool tryCastWithOverflowCheck(float value, uint64_t& result) { return tryCastWithOverflowCheckFloat( value, result, 0.0f, 18446744073709551616.0f); } template<> -bool tryCastWithOverflowCheck(double value, int8_t& result) { +inline bool tryCastWithOverflowCheck(double value, int8_t& result) { return tryCastWithOverflowCheckFloat(value, result, -128.0, 128.0); } template<> -bool tryCastWithOverflowCheck(double value, int16_t& result) { +inline bool tryCastWithOverflowCheck(double value, int16_t& result) { return tryCastWithOverflowCheckFloat(value, result, -32768.0, 32768.0); } template<> -bool tryCastWithOverflowCheck(double value, int32_t& result) { +inline bool tryCastWithOverflowCheck(double value, int32_t& result) { return tryCastWithOverflowCheckFloat( value, result, -2147483648.0, 2147483648.0); } template<> -bool tryCastWithOverflowCheck(double value, int64_t& result) { +inline bool tryCastWithOverflowCheck(double value, int64_t& result) { return tryCastWithOverflowCheckFloat( value, result, -9223372036854775808.0, 9223372036854775808.0); } template<> -bool tryCastWithOverflowCheck(double value, uint8_t& result) { +inline bool tryCastWithOverflowCheck(double value, uint8_t& result) { return tryCastWithOverflowCheckFloat(value, result, 0.0, 256.0); } template<> -bool tryCastWithOverflowCheck(double value, uint16_t& result) { +inline bool tryCastWithOverflowCheck(double value, uint16_t& result) { return tryCastWithOverflowCheckFloat(value, result, 0.0, 65536.0); } template<> -bool tryCastWithOverflowCheck(double value, uint32_t& result) { +inline bool tryCastWithOverflowCheck(double value, uint32_t& result) { return tryCastWithOverflowCheckFloat(value, result, 0.0, 4294967296.0); } template<> -bool tryCastWithOverflowCheck(double value, uint64_t& result) { +inline bool tryCastWithOverflowCheck(double value, uint64_t& result) { return tryCastWithOverflowCheckFloat( value, result, 0.0, 18446744073709551615.0); } template<> -bool tryCastWithOverflowCheck(float input, double& result) { +inline bool tryCastWithOverflowCheck(float input, double& result) { result = double(input); return true; } template<> -bool tryCastWithOverflowCheck(double input, float& result) { +inline bool tryCastWithOverflowCheck(double input, float& result) { result = float(input); return true; } diff --git a/src/include/function/table_functions/call_functions.h b/src/include/function/table_functions/call_functions.h index b61a8a611f..44584e7ce1 100644 --- a/src/include/function/table_functions/call_functions.h +++ b/src/include/function/table_functions/call_functions.h @@ -58,8 +58,8 @@ struct CurrentSettingBindData : public CallTableFuncBindData { CurrentSettingBindData(std::string result, std::vector> returnTypes, std::vector returnColumnNames, common::offset_t maxOffset) - : result{std::move(result)}, CallTableFuncBindData{std::move(returnTypes), - std::move(returnColumnNames), maxOffset} {} + : CallTableFuncBindData{std::move(returnTypes), std::move(returnColumnNames), maxOffset}, + result{std::move(result)} {} inline std::unique_ptr copy() override { return std::make_unique( @@ -91,8 +91,8 @@ struct ShowTablesBindData : public CallTableFuncBindData { ShowTablesBindData(std::vector tables, std::vector> returnTypes, std::vector returnColumnNames, common::offset_t maxOffset) - : tables{std::move(tables)}, CallTableFuncBindData{std::move(returnTypes), - std::move(returnColumnNames), maxOffset} {} + : CallTableFuncBindData{std::move(returnTypes), std::move(returnColumnNames), maxOffset}, + tables{std::move(tables)} {} inline std::unique_ptr copy() override { return std::make_unique( @@ -115,8 +115,8 @@ struct TableInfoBindData : public CallTableFuncBindData { TableInfoBindData(catalog::TableSchema* tableSchema, std::vector> returnTypes, std::vector returnColumnNames, common::offset_t maxOffset) - : tableSchema{tableSchema}, CallTableFuncBindData{std::move(returnTypes), - std::move(returnColumnNames), maxOffset} {} + : CallTableFuncBindData{std::move(returnTypes), std::move(returnColumnNames), maxOffset}, + tableSchema{tableSchema} {} inline std::unique_ptr copy() override { return std::make_unique( @@ -139,8 +139,9 @@ struct ShowConnectionBindData : public TableInfoBindData { ShowConnectionBindData(catalog::Catalog* catalog, catalog::TableSchema* tableSchema, std::vector> returnTypes, std::vector returnColumnNames, common::offset_t maxOffset) - : catalog{catalog}, TableInfoBindData{tableSchema, std::move(returnTypes), - std::move(returnColumnNames), maxOffset} {} + : TableInfoBindData{tableSchema, std::move(returnTypes), std::move(returnColumnNames), + maxOffset}, + catalog{catalog} {} inline std::unique_ptr copy() override { return std::make_unique( diff --git a/src/include/main/client_context.h b/src/include/main/client_context.h index 230e4a6d76..7d2890b401 100644 --- a/src/include/main/client_context.h +++ b/src/include/main/client_context.h @@ -37,10 +37,10 @@ class ClientContext { friend class binder::Binder; friend class testing::TinySnbDDLTest; friend class testing::TinySnbCopyCSVTransactionTest; - friend class ThreadsSetting; - friend class TimeoutSetting; - friend class VarLengthExtendMaxDepthSetting; - friend class EnableSemiMaskSetting; + friend struct ThreadsSetting; + friend struct TimeoutSetting; + friend struct VarLengthExtendMaxDepthSetting; + friend struct EnableSemiMaskSetting; public: explicit ClientContext(Database* database); diff --git a/src/include/parser/copy.h b/src/include/parser/copy.h index 6b9576e1f6..667a9190be 100644 --- a/src/include/parser/copy.h +++ b/src/include/parser/copy.h @@ -45,8 +45,8 @@ class CopyFrom : public Copy { class CopyTo : public Copy { public: CopyTo(std::string filePath, std::unique_ptr regularQuery) - : Copy{common::StatementType::COPY_TO}, - regularQuery{std::move(regularQuery)}, filePath{std::move(filePath)} {} + : Copy{common::StatementType::COPY_TO}, filePath{std::move(filePath)}, + regularQuery{std::move(regularQuery)} {} inline std::string getFilePath() const { return filePath; } inline RegularQuery* getRegularQuery() const { return regularQuery.get(); } diff --git a/src/include/parser/expression/parsed_expression.h b/src/include/parser/expression/parsed_expression.h index 77436a3d5d..d90f0501a5 100644 --- a/src/include/parser/expression/parsed_expression.h +++ b/src/include/parser/expression/parsed_expression.h @@ -10,7 +10,7 @@ namespace kuzu { namespace common { -class FileInfo; +struct FileInfo; class Serializer; class Deserializer; } // namespace common diff --git a/src/include/planner/query_planner.h b/src/include/planner/query_planner.h index c823eb292f..36b6f3fa0a 100644 --- a/src/include/planner/query_planner.h +++ b/src/include/planner/query_planner.h @@ -12,17 +12,17 @@ namespace kuzu { namespace binder { -class BoundInsertInfo; -class BoundSetPropertyInfo; -class BoundDeleteInfo; +struct BoundInsertInfo; +struct BoundSetPropertyInfo; +struct BoundDeleteInfo; struct BoundFileScanInfo; } // namespace binder namespace planner { -class LogicalInsertNodeInfo; -class LogicalInsertRelInfo; -class LogicalSetPropertyInfo; +struct LogicalInsertNodeInfo; +struct LogicalInsertRelInfo; +struct LogicalSetPropertyInfo; class QueryPlanner { friend class Planner; diff --git a/src/include/processor/operator/call/in_query_call.h b/src/include/processor/operator/call/in_query_call.h index 3f13c56e81..fa2d40c411 100644 --- a/src/include/processor/operator/call/in_query_call.h +++ b/src/include/processor/operator/call/in_query_call.h @@ -44,8 +44,8 @@ class InQueryCall : public PhysicalOperator { InQueryCall(std::unique_ptr localState, std::shared_ptr sharedState, PhysicalOperatorType operatorType, uint32_t id, const std::string& paramsString) - : inQueryCallInfo{std::move(localState)}, sharedState{std::move(sharedState)}, - PhysicalOperator{operatorType, id, paramsString} {} + : PhysicalOperator{operatorType, id, paramsString}, inQueryCallInfo{std::move(localState)}, + sharedState{std::move(sharedState)} {} inline bool isSource() const override { return true; } diff --git a/src/include/processor/operator/call/standalone_call.h b/src/include/processor/operator/call/standalone_call.h index 5b1087f2e8..7f4883309b 100644 --- a/src/include/processor/operator/call/standalone_call.h +++ b/src/include/processor/operator/call/standalone_call.h @@ -24,8 +24,8 @@ class StandaloneCall : public PhysicalOperator { public: StandaloneCall(std::unique_ptr localState, PhysicalOperatorType operatorType, uint32_t id, const std::string& paramsString) - : standaloneCallInfo{std::move(localState)}, PhysicalOperator{ - operatorType, id, paramsString} {} + : PhysicalOperator{operatorType, id, paramsString}, standaloneCallInfo{ + std::move(localState)} {} inline bool isSource() const override { return true; } inline bool canParallel() const final { return false; } diff --git a/src/include/processor/operator/comment_on.h b/src/include/processor/operator/comment_on.h index 9ed951eec5..5514d67817 100644 --- a/src/include/processor/operator/comment_on.h +++ b/src/include/processor/operator/comment_on.h @@ -26,8 +26,8 @@ class CommentOn : public PhysicalOperator { public: CommentOn( std::unique_ptr localState, uint32_t id, const std::string& paramsString) - : commentOnInfo{std::move(localState)}, PhysicalOperator{PhysicalOperatorType::COMMENT_ON, - id, paramsString} {} + : PhysicalOperator{PhysicalOperatorType::COMMENT_ON, id, paramsString}, + commentOnInfo{std::move(localState)} {} inline bool isSource() const override { return true; } inline bool canParallel() const final { return false; } diff --git a/src/include/processor/operator/ddl/create_rel_table_group.h b/src/include/processor/operator/ddl/create_rel_table_group.h index c9445af6cb..c470d96f34 100644 --- a/src/include/processor/operator/ddl/create_rel_table_group.h +++ b/src/include/processor/operator/ddl/create_rel_table_group.h @@ -11,7 +11,7 @@ class CreateRelTableGroup : public DDL { std::unique_ptr info, const DataPos& outputPos, uint32_t id, const std::string& paramsString) : DDL{PhysicalOperatorType::CREATE_REL_TABLE, catalog, outputPos, id, paramsString}, - info{std::move(info)}, storageManager{storageManager} {} + storageManager{storageManager}, info{std::move(info)} {} void executeDDLInternal(ExecutionContext* context) override; diff --git a/src/include/processor/operator/persistent/copy_node.h b/src/include/processor/operator/persistent/copy_node.h index 09f5fe645d..1adbb6ad3b 100644 --- a/src/include/processor/operator/persistent/copy_node.h +++ b/src/include/processor/operator/persistent/copy_node.h @@ -18,7 +18,7 @@ class CopyNodeSharedState { public: explicit CopyNodeSharedState(InQueryCallSharedState* readerSharedState) - : readerSharedState{readerSharedState}, pkIndex{nullptr}, currentNodeGroupIdx{0}, + : pkIndex{nullptr}, readerSharedState{readerSharedState}, currentNodeGroupIdx{0}, sharedNodeGroup{nullptr} {}; void init(); diff --git a/src/include/processor/operator/persistent/copy_to_parquet.h b/src/include/processor/operator/persistent/copy_to_parquet.h index e709ba87f3..878bf4d35b 100644 --- a/src/include/processor/operator/persistent/copy_to_parquet.h +++ b/src/include/processor/operator/persistent/copy_to_parquet.h @@ -17,9 +17,8 @@ struct CopyToParquetInfo final : public CopyToInfo { CopyToParquetInfo(std::unique_ptr tableSchema, std::vector> types, std::vector names, std::vector dataPoses, std::string fileName) - : tableSchema{std::move(tableSchema)}, types{std::move(types)}, CopyToInfo{std::move(names), - std::move(dataPoses), - std::move(fileName)} {} + : CopyToInfo{std::move(names), std::move(dataPoses), std::move(fileName)}, + tableSchema{std::move(tableSchema)}, types{std::move(types)} {} inline std::unique_ptr copy() override { return std::make_unique( diff --git a/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h b/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h index 956fef7571..1e94f8757d 100644 --- a/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h +++ b/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h @@ -48,7 +48,6 @@ class ListColumnReader : public ColumnReader { parquet_filter_t childFilter; uint64_t overflowChildCount; std::unique_ptr vectorToRead; - storage::MemoryManager* memoryManager; }; } // namespace processor diff --git a/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h b/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h index 6004ab2750..65b489c034 100644 --- a/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h +++ b/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h @@ -17,8 +17,8 @@ class RdfReader { RdfReader( std::string filePath, common::FileType fileType, const common::RdfReaderConfig& config) : filePath{std::move(filePath)}, fileType{fileType}, mode{config.mode}, index{config.index}, - reader{nullptr}, rowOffset{0}, vectorSize{0}, sVector{nullptr}, pVector{nullptr}, - oVector{nullptr}, status{SERD_SUCCESS} {} + reader{nullptr}, rowOffset{0}, vectorSize{0}, status{SERD_SUCCESS}, sVector{nullptr}, + pVector{nullptr}, oVector{nullptr} {} ~RdfReader(); diff --git a/src/include/processor/operator/physical_operator.h b/src/include/processor/operator/physical_operator.h index c1cf06324e..9cd23f3a72 100644 --- a/src/include/processor/operator/physical_operator.h +++ b/src/include/processor/operator/physical_operator.h @@ -92,7 +92,7 @@ class PhysicalOperator { public: // Leaf operator PhysicalOperator(PhysicalOperatorType operatorType, uint32_t id, std::string paramsString) - : operatorType{operatorType}, id{id}, transaction{nullptr}, paramsString{ + : id{id}, operatorType{operatorType}, transaction{nullptr}, paramsString{ std::move(paramsString)} {} // Unary operator PhysicalOperator(PhysicalOperatorType operatorType, std::unique_ptr child, diff --git a/src/include/processor/plan_mapper.h b/src/include/processor/plan_mapper.h index 4cc31a9946..7939044b88 100644 --- a/src/include/processor/plan_mapper.h +++ b/src/include/processor/plan_mapper.h @@ -18,14 +18,14 @@ class LogicalCopyFrom; namespace processor { -struct HashJoinBuildInfo; +class HashJoinBuildInfo; struct AggregateInputInfo; class NodeInsertExecutor; class RelInsertExecutor; class NodeSetExecutor; class RelSetExecutor; class CopyRelSharedState; -class PartitionerSharedState; +struct PartitionerSharedState; class PlanMapper { public: diff --git a/src/include/storage/local_storage/local_table.h b/src/include/storage/local_storage/local_table.h index a0a81fc49f..0040702000 100644 --- a/src/include/storage/local_storage/local_table.h +++ b/src/include/storage/local_storage/local_table.h @@ -112,8 +112,7 @@ class LocalTableData { class Column; class LocalTable { public: - LocalTable(common::table_id_t tableID, common::TableType tableType) - : tableID{tableID}, tableType{tableType} {}; + explicit LocalTable(common::TableType tableType) : tableType{tableType} {}; LocalTableData* getOrCreateLocalTableData(const std::vector>& columns, MemoryManager* mm, common::ColumnDataFormat dataFormat = common::ColumnDataFormat::REGULAR, @@ -124,7 +123,6 @@ class LocalTable { } private: - common::table_id_t tableID; common::TableType tableType; // For a node table, it should only contain one LocalTableData, while a rel table should contain // two, one for each direction. diff --git a/src/include/storage/store/column_chunk.h b/src/include/storage/store/column_chunk.h index ed9579fc5d..5eeee75430 100644 --- a/src/include/storage/store/column_chunk.h +++ b/src/include/storage/store/column_chunk.h @@ -29,8 +29,8 @@ struct ColumnChunkMetadata { // Base data segment covers all fixed-sized data types. class ColumnChunk { public: - friend class ColumnChunkFactory; - friend class VarListDataColumnChunk; + friend struct ColumnChunkFactory; + friend struct VarListDataColumnChunk; // ColumnChunks must be initialized after construction, so this constructor should only be used // through the ColumnChunkFactory diff --git a/src/include/storage/store/table_data.h b/src/include/storage/store/table_data.h index 7c71fb5ffd..6761de794f 100644 --- a/src/include/storage/store/table_data.h +++ b/src/include/storage/store/table_data.h @@ -53,8 +53,8 @@ class TableData { TableData(BMFileHandle* dataFH, BMFileHandle* metadataFH, common::table_id_t tableID, BufferManager* bufferManager, WAL* wal, bool enableCompression, common::ColumnDataFormat dataFormat) - : dataFH{dataFH}, metadataFH{metadataFH}, tableID{tableID}, bufferManager{bufferManager}, - wal{wal}, enableCompression{enableCompression}, dataFormat{dataFormat} {} + : dataFormat{dataFormat}, dataFH{dataFH}, metadataFH{metadataFH}, tableID{tableID}, + bufferManager{bufferManager}, wal{wal}, enableCompression{enableCompression} {} protected: common::ColumnDataFormat dataFormat; diff --git a/src/main/query_result.cpp b/src/main/query_result.cpp index a33c29b364..c12c207201 100644 --- a/src/main/query_result.cpp +++ b/src/main/query_result.cpp @@ -48,7 +48,7 @@ std::unique_ptr DataTypeInfo::getInfoForDataType( // DO NOTHING } } - return std::move(columnTypeInfo); + return columnTypeInfo; } QueryResult::QueryResult() = default; @@ -125,7 +125,7 @@ std::vector> QueryResult::getColumnTypesInfo() con } result.push_back(std::move(columnTypeInfo)); } - return std::move(result); + return result; } void QueryResult::initResultTableAndIterator( diff --git a/src/processor/map/map_dummy_scan.cpp b/src/processor/map/map_dummy_scan.cpp index f138e360d0..39ecbac391 100644 --- a/src/processor/map/map_dummy_scan.cpp +++ b/src/processor/map/map_dummy_scan.cpp @@ -8,8 +8,7 @@ using namespace kuzu::planner; namespace kuzu { namespace processor { -std::unique_ptr PlanMapper::mapDummyScan(LogicalOperator* logicalOperator) { - auto logicalDummyScan = (LogicalDummyScan*)logicalOperator; +std::unique_ptr PlanMapper::mapDummyScan(LogicalOperator* /*logicalOperator*/) { auto inSchema = std::make_unique(); auto expression = LogicalDummyScan::getDummyExpression(); auto tableSchema = std::make_unique(); diff --git a/src/processor/operator/fill_table_id.cpp b/src/processor/operator/fill_table_id.cpp index c61a0ca9e9..00ed31ce5a 100644 --- a/src/processor/operator/fill_table_id.cpp +++ b/src/processor/operator/fill_table_id.cpp @@ -10,7 +10,6 @@ bool FillTableID::getNextTuplesInternal(ExecutionContext* context) { auto data = (common::internalID_t*)internalIDVector->getData(); for (auto i = 0u; i < internalIDVector->state->selVector->selectedSize; ++i) { data[i].tableID = tableID; - auto a = data[i]; } return true; } diff --git a/src/processor/operator/partitioner.cpp b/src/processor/operator/partitioner.cpp index 1fa937a30b..bbc384829f 100644 --- a/src/processor/operator/partitioner.cpp +++ b/src/processor/operator/partitioner.cpp @@ -75,7 +75,7 @@ Partitioner::Partitioner(std::unique_ptr resultSetDescripto uint32_t id, const std::string& paramsString) : Sink{std::move(resultSetDescriptor), PhysicalOperatorType::PARTITIONER, std::move(child), id, paramsString}, - sharedState{std::move(sharedState)}, infos{std::move(infos)} { + infos{std::move(infos)}, sharedState{std::move(sharedState)} { partitionIdxes = std::make_unique(LogicalTypeID::INT64); } diff --git a/src/processor/operator/persistent/reader/parquet/list_column_reader.cpp b/src/processor/operator/persistent/reader/parquet/list_column_reader.cpp index 9184be31a0..8b8223aa89 100644 --- a/src/processor/operator/persistent/reader/parquet/list_column_reader.cpp +++ b/src/processor/operator/persistent/reader/parquet/list_column_reader.cpp @@ -8,8 +8,7 @@ ListColumnReader::ListColumnReader(ParquetReader& reader, std::unique_ptr childColumnReader, storage::MemoryManager* memoryManager) : ColumnReader(reader, std::move(type), schema, schemaIdx, maxDefine, maxRepeat), - childColumnReader(std::move(childColumnReader)), - overflowChildCount(0), memoryManager{memoryManager} { + childColumnReader(std::move(childColumnReader)), overflowChildCount(0) { childDefines.resize(common::DEFAULT_VECTOR_CAPACITY); childRepeats.resize(common::DEFAULT_VECTOR_CAPACITY); childDefinesPtr = (uint8_t*)childDefines.ptr; diff --git a/src/storage/buffer_manager/bm_file_handle.cpp b/src/storage/buffer_manager/bm_file_handle.cpp index d8aacace7c..df1e32932b 100644 --- a/src/storage/buffer_manager/bm_file_handle.cpp +++ b/src/storage/buffer_manager/bm_file_handle.cpp @@ -18,8 +18,8 @@ WALPageIdxGroup::WALPageIdxGroup() { BMFileHandle::BMFileHandle(const std::string& path, uint8_t flags, BufferManager* bm, PageSizeClass pageSizeClass, FileVersionedType fileVersionedType) - : FileHandle{path, flags}, bm{bm}, pageSizeClass{pageSizeClass}, fileVersionedType{ - fileVersionedType} { + : FileHandle{path, flags}, fileVersionedType{fileVersionedType}, bm{bm}, pageSizeClass{ + pageSizeClass} { initPageStatesAndGroups(); } diff --git a/src/storage/local_storage/local_storage.cpp b/src/storage/local_storage/local_storage.cpp index d866530117..4d1accc969 100644 --- a/src/storage/local_storage/local_storage.cpp +++ b/src/storage/local_storage/local_storage.cpp @@ -15,7 +15,7 @@ LocalTableData* LocalStorage::getOrCreateLocalTableData(table_id_t tableID, const std::vector>& columns, TableType tableType, ColumnDataFormat dataFormat, vector_idx_t dataIdx) { if (!tables.contains(tableID)) { - tables[tableID] = std::make_unique(tableID, tableType); + tables[tableID] = std::make_unique(tableType); } return tables.at(tableID)->getOrCreateLocalTableData(columns, mm, dataFormat, dataIdx); } diff --git a/src/storage/stats/node_table_statistics.cpp b/src/storage/stats/node_table_statistics.cpp index 8827bc5119..a840880c4a 100644 --- a/src/storage/stats/node_table_statistics.cpp +++ b/src/storage/stats/node_table_statistics.cpp @@ -40,9 +40,9 @@ NodeTableStatsAndDeletedIDs::NodeTableStatsAndDeletedIDs(const NodeTableStatsAnd NodeTableStatsAndDeletedIDs::NodeTableStatsAndDeletedIDs(table_id_t tableID, offset_t maxNodeOffset, const std::vector& deletedNodeOffsets, std::unordered_map>&& propertyStatistics) - : tableID{tableID}, TableStatistics{TableType::NODE, - getNumTuplesFromMaxNodeOffset(maxNodeOffset), tableID, - std::move(propertyStatistics)} { + : TableStatistics{TableType::NODE, getNumTuplesFromMaxNodeOffset(maxNodeOffset), tableID, + std::move(propertyStatistics)}, + tableID{tableID} { if (getNumTuples() > 0) { hasDeletedNodesPerMorsel.resize((getNumTuples() / DEFAULT_VECTOR_CAPACITY) + 1, false); } diff --git a/src/storage/storage_structure/disk_array.cpp b/src/storage/storage_structure/disk_array.cpp index 2bd137a211..3c541d6861 100644 --- a/src/storage/storage_structure/disk_array.cpp +++ b/src/storage/storage_structure/disk_array.cpp @@ -135,7 +135,7 @@ uint64_t BaseDiskArray::resize(uint64_t newNumElements) { std::unique_lock xLck{diskArraySharedMtx}; hasTransactionalUpdates = true; auto currentNumElements = getNumElementsNoLock(transaction::TransactionType::WRITE); - U val; + U val{}; while (currentNumElements < newNumElements) { pushBackNoLock(val); currentNumElements++; diff --git a/src/storage/store/column.cpp b/src/storage/store/column.cpp index 0526d263b8..b8b1454b15 100644 --- a/src/storage/store/column.cpp +++ b/src/storage/store/column.cpp @@ -342,8 +342,8 @@ Column::Column(std::unique_ptr dataType, const MetadataDAHInfo& met transaction::Transaction* transaction, RWPropertyStats propertyStatistics, bool enableCompression, bool requireNullColumn) : dbFileID{DBFileID::newDataFileID()}, dataType{std::move(dataType)}, dataFH{dataFH}, - metadataFH{metadataFH}, bufferManager{bufferManager}, - propertyStatistics{propertyStatistics}, wal{wal}, enableCompression{enableCompression} { + metadataFH{metadataFH}, bufferManager{bufferManager}, wal{wal}, + propertyStatistics{propertyStatistics}, enableCompression{enableCompression} { metadataDA = std::make_unique>(*metadataFH, DBFileID::newMetadataFileID(), metaDAHeaderInfo.dataDAHPageIdx, bufferManager, wal, transaction); diff --git a/test/include/graph_test/base_graph_test.h b/test/include/graph_test/base_graph_test.h index 286b962a23..700b7685aa 100644 --- a/test/include/graph_test/base_graph_test.h +++ b/test/include/graph_test/base_graph_test.h @@ -105,8 +105,6 @@ class BaseGraphTest : public Test { private: void setDatabasePath() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); databasePath = TestHelper::appendKuzuRootPath( TestHelper::TMP_TEST_DIR + getTestGroupAndName() + TestHelper::getMillisecondsSuffix()); } diff --git a/test/include/test_runner/test_parser.h b/test/include/test_runner/test_parser.h index 8f4601cc13..85bad4ed87 100644 --- a/test/include/test_runner/test_parser.h +++ b/test/include/test_runner/test_parser.h @@ -65,7 +65,7 @@ class LogicToken { class TestParser { public: explicit TestParser(const std::string& path) - : testGroup{std::make_unique()}, path{path} {} + : path{path}, testGroup{std::make_unique()} {} std::unique_ptr parseTestFile(); private: diff --git a/test/runner/e2e_test.cpp b/test/runner/e2e_test.cpp index 383a9dabcb..554d9df964 100644 --- a/test/runner/e2e_test.cpp +++ b/test/runner/e2e_test.cpp @@ -15,8 +15,8 @@ class EndToEndTest : public DBTest { const std::set& connNames, std::vector> testStatements) : datasetType{datasetType}, dataset{std::move(dataset)}, bufferPoolSize{bufferPoolSize}, - checkpointWaitTimeout{checkpointWaitTimeout}, connNames{connNames}, - testStatements{std::move(testStatements)} {} + checkpointWaitTimeout{checkpointWaitTimeout}, + testStatements{std::move(testStatements)}, connNames{connNames} {} void SetUp() override { setUpDataset(); @@ -64,7 +64,7 @@ class EndToEndTest : public DBTest { void parseAndRegisterTestGroup(const std::string& path, bool generateTestList = false) { auto testParser = std::make_unique(path); - auto testGroup = std::move(testParser->parseTestFile()); + auto testGroup = testParser->parseTestFile(); if (testGroup->isValid() && testGroup->hasStatements()) { auto datasetType = testGroup->datasetType; auto dataset = testGroup->dataset; diff --git a/tools/java_api/src/jni/kuzu_java.cpp b/tools/java_api/src/jni/kuzu_java.cpp index efd2baf659..8ab099cde1 100644 --- a/tools/java_api/src/jni/kuzu_java.cpp +++ b/tools/java_api/src/jni/kuzu_java.cpp @@ -510,7 +510,6 @@ JNIEXPORT void JNICALL Java_com_kuzudb_KuzuNative_kuzu_1flat_1tuple_1destroy( JNIEXPORT jobject JNICALL Java_com_kuzudb_KuzuNative_kuzu_1flat_1tuple_1get_1value( JNIEnv* env, jclass, jobject thisFT, jlong index) { FlatTuple* ft = getFlatTuple(env, thisFT); - uint32_t idx = static_cast(index); Value* value; try { value = ft->getValue(index); diff --git a/tools/nodejs_api/src_cpp/include/node_connection.h b/tools/nodejs_api/src_cpp/include/node_connection.h index d8b7d6a9ae..7a03cb59a8 100644 --- a/tools/nodejs_api/src_cpp/include/node_connection.h +++ b/tools/nodejs_api/src_cpp/include/node_connection.h @@ -66,8 +66,9 @@ class ConnectionExecuteAsyncWorker : public Napi::AsyncWorker { ConnectionExecuteAsyncWorker(Napi::Function& callback, std::shared_ptr& connection, std::shared_ptr preparedStatement, NodeQueryResult* nodeQueryResult, std::unordered_map> params) - : Napi::AsyncWorker(callback), preparedStatement(std::move(preparedStatement)), - nodeQueryResult(nodeQueryResult), connection(connection), params(std::move(params)) {} + : Napi::AsyncWorker(callback), connection(connection), + preparedStatement(std::move(preparedStatement)), nodeQueryResult(nodeQueryResult), + params(std::move(params)) {} ~ConnectionExecuteAsyncWorker() override = default; inline void Execute() override {