diff --git a/datatypes/mcs_data_condition.h b/datatypes/mcs_data_condition.h index c1313a174..731143ead 100644 --- a/datatypes/mcs_data_condition.h +++ b/datatypes/mcs_data_condition.h @@ -58,7 +58,7 @@ class DataCondition return mError; } - // Adjust a sigened integer of any size to the range [-absMaxVal , +absMaxVal] + // Adjust a signed integer of any size to the range [-absMaxVal , +absMaxVal] template void adjustSIntXRange(T& val, T absMaxVal) { diff --git a/datatypes/mcs_datatype.h b/datatypes/mcs_datatype.h index a7e869433..6e16c1f96 100644 --- a/datatypes/mcs_datatype.h +++ b/datatypes/mcs_datatype.h @@ -125,7 +125,7 @@ struct WidthToSIntegralType<16> : _WidthToSIntegralType<16, int128_t> { }; -void decimalPrecisionAndScale(const utils::NullString& value, int &precision, int &scale); +void decimalPrecisionAndScale(const utils::NullString& value, int& precision, int& scale); // XXX: It is assumed here that ALL TYPES have width, scale and precision. // XXX: And then some of them have the type tag itself. @@ -147,8 +147,8 @@ class TypeAttributesStd /** @brief Convenience method to get int128 from a std::string. */ - int128_t decimal128FromString(const std::string& value, bool* saturate = 0) const; - int128_t decimal128FromString(const utils::NullString& value, bool* saturate = 0) const; + int128_t decimal128FromString(const std::string& value, bool* saturate = nullptr) const; + int128_t decimal128FromString(const utils::NullString& value, bool* saturate = nullptr) const; /** @brief The method sets the legacy scale and precision of a wide decimal @@ -507,7 +507,7 @@ class SessionParam long m_timeZone; public: - SessionParam(long timeZone) : m_timeZone(timeZone) + explicit SessionParam(long timeZone) : m_timeZone(timeZone) { } long timeZone() const @@ -576,7 +576,7 @@ class SimpleValue class SimpleValueSInt64 : public SimpleValue { public: - SimpleValueSInt64(int64_t value) : SimpleValue(value, 0, 0) + explicit SimpleValueSInt64(int64_t value) : SimpleValue(value, 0, 0) { } }; @@ -584,7 +584,7 @@ class SimpleValueSInt64 : public SimpleValue class SimpleValueUInt64 : public SimpleValue { public: - SimpleValueUInt64(uint64_t value) : SimpleValue(static_cast(value), 0, 0) + explicit SimpleValueUInt64(uint64_t value) : SimpleValue(static_cast(value), 0, 0) { } }; @@ -592,7 +592,7 @@ class SimpleValueUInt64 : public SimpleValue class SimpleValueSInt128 : public SimpleValue { public: - SimpleValueSInt128(int128_t value) : SimpleValue(0, value, 0) + explicit SimpleValueSInt128(int128_t value) : SimpleValue(0, value, 0) { } }; @@ -740,7 +740,7 @@ class MinMaxPartitionInfo : public MinMaxInfo public: MinMaxPartitionInfo() : m_status(0){}; - MinMaxPartitionInfo(const BRM::EMEntry& entry); + explicit MinMaxPartitionInfo(const BRM::EMEntry& entry); void set_invalid() { m_status |= CPINVALID; @@ -859,8 +859,8 @@ class DatabaseQualifiedColumnName std::string m_column; public: - DatabaseQualifiedColumnName(const std::string& db, const std::string& table, const std::string& column) - : m_db(db), m_table(table), m_column(column) + DatabaseQualifiedColumnName(std::string db, std::string table, std::string column) + : m_db(std::move(db)), m_table(std::move(table)), m_column(std::move(column)) { } const std::string& db() const @@ -880,9 +880,8 @@ class DatabaseQualifiedColumnName class StoreField { public: - virtual ~StoreField() - { - } + virtual ~StoreField() = default; + virtual int32_t colWidth() const = 0; virtual int32_t precision() const = 0; virtual int32_t scale() const = 0; @@ -910,9 +909,8 @@ class StoreField class WriteBatchField { public: - virtual ~WriteBatchField() - { - } + virtual ~WriteBatchField() = default; + virtual size_t ColWriteBatchDate(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0; virtual size_t ColWriteBatchDatetime(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0; virtual size_t ColWriteBatchTime(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0; @@ -957,9 +955,8 @@ class TypeHandler public: static const TypeHandler* find(SystemCatalog::ColDataType typeCode, const TypeAttributesStd& attr); static const TypeHandler* find_by_ddltype(const ddlpackage::ColumnType& ct); - virtual ~TypeHandler() - { - } + virtual ~TypeHandler() = default; + virtual const string& name() const = 0; virtual const string print(const TypeAttributesStd& attr) const { @@ -985,11 +982,11 @@ class TypeHandler const SimpleColumnParam& prm) const = 0; virtual SimpleValue getMinValueSimple() const { - return SimpleValue(std::numeric_limits::min(), std::numeric_limits::min(), 0); + return {std::numeric_limits::min(), std::numeric_limits::min(), 0}; } virtual SimpleValue getMaxValueSimple() const { - return SimpleValue(std::numeric_limits::max(), std::numeric_limits::max(), 0); + return {std::numeric_limits::max(), std::numeric_limits::max(), 0}; } virtual SimpleValue toSimpleValue(const SessionParam& sp, const TypeAttributesStd& attr, const char* str, round_style_t& rf) const = 0; @@ -1052,18 +1049,18 @@ class TypeHandlerBit : public TypeHandler const SimpleColumnParam& prm) const override { idbassert(0); - return NULL; + return nullptr; } SimpleValue toSimpleValue(const SessionParam& sp, const TypeAttributesStd& attr, const char* str, round_style_t& rf) const override { idbassert(0); - return SimpleValue(); + return {}; } boost::any getNullValueForType(const TypeAttributesStd& attr) const override { // TODO: How to communicate with write engine? - return boost::any(); + return {}; } boost::any convertFromString(const TypeAttributesStd& colType, const ConvertFromStringParam& prm, const std::string& str, bool& pushWarning) const override; @@ -1808,11 +1805,11 @@ class TypeHandlerSDecimal128 : public TypeHandlerXDecimal } SimpleValue getMinValueSimple() const override { - return SimpleValue(std::numeric_limits::min(), datatypes::minInt128, 0); + return {std::numeric_limits::min(), datatypes::minInt128, 0}; } SimpleValue getMaxValueSimple() const override { - return SimpleValue(std::numeric_limits::max(), datatypes::maxInt128, 0); + return {std::numeric_limits::max(), datatypes::maxInt128, 0}; } MinMaxInfo widenMinMaxInfo(const TypeAttributesStd& attr, const MinMaxInfo& a, const MinMaxInfo& b) const override @@ -1914,7 +1911,7 @@ class TypeHandlerReal : public TypeHandler SimpleValue toSimpleValue(const SessionParam& sp, const TypeAttributesStd& attr, const char* str, round_style_t& rf) const override { - return SimpleValue(); // QQ: real types were not handled in IDB_format() + return {}; // QQ: real types were not handled in IDB_format() } std::string format(const SimpleValue& v, const TypeAttributesStd& attr) const override { @@ -2047,13 +2044,13 @@ class TypeHandlerSLongDouble : public TypeHandlerReal boost::any getNullValueForType(const TypeAttributesStd& attr) const override { // QQ: DDLPackageProcessor::getNullValueForType() did not handle LONGDOUBLE - return boost::any(); + return {}; } boost::any convertFromString(const TypeAttributesStd& colType, const ConvertFromStringParam& prm, const std::string& str, bool& pushWarning) const override { throw logging::QueryDataExcept("convertColumnData: unknown column data type.", logging::dataTypeErr); - return boost::any(); + return {}; } const uint8_t* getEmptyValueForType(const TypeAttributesStd& attr) const override { @@ -2255,7 +2252,7 @@ class TypeHandlerClob : public TypeHandlerStr } boost::any getNullValueForType(const TypeAttributesStd& attr) const override { - return boost::any(); // QQ + return {}; // QQ } boost::any convertFromString(const TypeAttributesStd& colType, const ConvertFromStringParam& prm, const std::string& str, bool& pushWarning) const override; diff --git a/datatypes/mcs_decimal.h b/datatypes/mcs_decimal.h index 79988935f..6326bf03c 100644 --- a/datatypes/mcs_decimal.h +++ b/datatypes/mcs_decimal.h @@ -300,9 +300,9 @@ struct lldiv_t_128 inline lldiv_t_128 lldiv128(const int128_t& dividend, const int128_t& divisor) { if (UNLIKELY(divisor == 0) || UNLIKELY(dividend == 0)) - return lldiv_t_128(); + return {}; - return lldiv_t_128(dividend / divisor, dividend % divisor); + return {dividend / divisor, dividend % divisor}; } // TODO: derive it from TSInt64 eventually @@ -381,9 +381,8 @@ class TDecimal128 : public TSInt128 } public: - TDecimal128() - { - } + TDecimal128() = default; + explicit TDecimal128(const int128_t val) : TSInt128(val) { } @@ -541,11 +540,6 @@ class Decimal : public TDecimal128, public TDecimal64 return TSInt128(s128Value); } - inline TFloat128 toTFloat128() const - { - return TFloat128(s128Value); - } - inline double toDouble() const { int128_t scaleDivisor; @@ -554,7 +548,7 @@ class Decimal : public TDecimal128, public TDecimal64 return static_cast(tmpval); } - inline operator double() const + inline explicit operator double() const { return toDouble(); } @@ -567,7 +561,7 @@ class Decimal : public TDecimal128, public TDecimal64 return static_cast(tmpval); } - inline operator float() const + inline explicit operator float() const { return toFloat(); } @@ -580,7 +574,7 @@ class Decimal : public TDecimal128, public TDecimal64 return static_cast(tmpval); } - inline operator long double() const + inline explicit operator long double() const { return toLongDouble(); } @@ -1016,7 +1010,6 @@ struct NoOverflowCheck { void operator()(const int128_t& x, const int128_t& y) { - return; } }; diff --git a/dbcon/ddlpackage/ddlpkg.h b/dbcon/ddlpackage/ddlpkg.h index e1564c4cb..8d49466b9 100644 --- a/dbcon/ddlpackage/ddlpkg.h +++ b/dbcon/ddlpackage/ddlpkg.h @@ -349,11 +349,9 @@ enum DDL_SERIAL_TYPE */ struct SchemaObject { - virtual ~SchemaObject() - { - } + virtual ~SchemaObject() = default; - SchemaObject(std::string name) : fName(name) + explicit SchemaObject(std::string name) : fName(name) { } @@ -418,9 +416,7 @@ struct SqlStatement */ struct SqlStatementList { - SqlStatementList() - { - } + SqlStatementList() = default; SqlStatement* operator[](int i) const { @@ -452,17 +448,13 @@ struct QualifiedName /** @brief Serialize to ByteStream */ EXPORT virtual int serialize(messageqcpp::ByteStream& bs); - QualifiedName() - { - } + QualifiedName() = default; - EXPORT QualifiedName(const char* name); + EXPORT explicit QualifiedName(const char* name); EXPORT QualifiedName(const char* name, const char* schema); EXPORT QualifiedName(const char* name, const char* schema, const char* catalog); - virtual ~QualifiedName() - { - } + virtual ~QualifiedName() = default; std::string fCatalog; std::string fName; @@ -479,7 +471,7 @@ struct TableDef : public SchemaObject /** @brief Serialize to ByteStream */ EXPORT virtual int serialize(messageqcpp::ByteStream& bs); - TableDef() : fQualifiedName(0) + TableDef() : fQualifiedName(nullptr) { } @@ -495,7 +487,7 @@ struct TableDef : public SchemaObject { } - EXPORT virtual ~TableDef(); + EXPORT ~TableDef() override; QualifiedName* fQualifiedName; @@ -512,22 +504,22 @@ struct TableDef : public SchemaObject struct CreateTableStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ EXPORT CreateTableStatement(); /** @brief You can't have a CreateTableStatement without a table defintion */ - EXPORT CreateTableStatement(TableDef* tableDef); + EXPORT explicit CreateTableStatement(TableDef* tableDef); - EXPORT virtual ~CreateTableStatement(); + EXPORT ~CreateTableStatement() override; /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; std::string schemaName() const { @@ -561,13 +553,9 @@ struct AlterTableAction EXPORT virtual int serialize(messageqcpp::ByteStream& bs) = 0; /** @brief Ctor for deserialization */ - AlterTableAction() - { - } + AlterTableAction() = default; - virtual ~AlterTableAction() - { - } + virtual ~AlterTableAction() = default; /** @brief QualifiedName of the focal table for this statement. */ @@ -582,24 +570,24 @@ struct AlterTableAction struct AtaAddColumn : public AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaAddColumn() : fColumnDef(0) + AtaAddColumn() : fColumnDef(nullptr) { } /** @brief You can't add a column without specifying a column definition. */ - AtaAddColumn(ColumnDef* columnDef); + explicit AtaAddColumn(ColumnDef* columnDef); - virtual ~AtaAddColumn(); + ~AtaAddColumn() override; /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief The focal column definition. */ ColumnDef* fColumnDef; @@ -611,22 +599,20 @@ struct AtaAddColumn : public AlterTableAction struct AtaAddColumns : public AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaAddColumns() - { - } + AtaAddColumns() = default; - AtaAddColumns(TableElementList* tableElements); + explicit AtaAddColumns(TableElementList* tableElements); - virtual ~AtaAddColumns(); + ~AtaAddColumns() override; /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; ColumnDefList fColumns; }; @@ -637,22 +623,20 @@ struct AtaAddColumns : public AlterTableAction struct AtaDropColumns : public AlterTableAction { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaDropColumns() - { - } + AtaDropColumns() = default; - EXPORT AtaDropColumns(ColumnNameList* tableElements); + EXPORT explicit AtaDropColumns(ColumnNameList* tableElements); - EXPORT virtual ~AtaDropColumns(); + EXPORT ~AtaDropColumns() override; /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; ColumnNameList fColumns; }; @@ -662,22 +646,22 @@ struct AtaDropColumns : public AlterTableAction struct AtaAddTableConstraint : public AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaAddTableConstraint() : fTableConstraint(0) + AtaAddTableConstraint() : fTableConstraint(nullptr) { } - AtaAddTableConstraint(TableConstraintDef* tableConstraint); + explicit AtaAddTableConstraint(TableConstraintDef* tableConstraint); - virtual ~AtaAddTableConstraint(); + ~AtaAddTableConstraint() override; /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; TableConstraintDef* fTableConstraint; }; @@ -687,25 +671,21 @@ struct AtaAddTableConstraint : public AlterTableAction struct AtaDropColumn : public AlterTableAction { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaDropColumn() - { - } + AtaDropColumn() = default; /** @brief Ctor for parser construction */ EXPORT AtaDropColumn(std::string columnName, DDL_REFERENTIAL_ACTION dropBehavior); /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; - virtual ~AtaDropColumn() - { - } + ~AtaDropColumn() override = default; std::string fColumnName; DDL_REFERENTIAL_ACTION fDropBehavior; }; @@ -715,19 +695,19 @@ struct AtaDropColumn : public AlterTableAction struct AtaSetColumnDefault : AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; - AtaSetColumnDefault() : fDefaultValue(0) + AtaSetColumnDefault() : fDefaultValue(nullptr) { } /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~AtaSetColumnDefault(); + ~AtaSetColumnDefault() override; AtaSetColumnDefault(const char* colName, ColumnDefaultValue* defaultValue); @@ -739,25 +719,21 @@ struct AtaSetColumnDefault : AlterTableAction struct AtaDropColumnDefault : AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaDropColumnDefault() - { - } + AtaDropColumnDefault() = default; /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~AtaDropColumnDefault() - { - } + ~AtaDropColumnDefault() override = default; /** @brief Ctor for parser construction */ - AtaDropColumnDefault(const char* colName); + explicit AtaDropColumnDefault(const char* colName); std::string fColumnName; }; @@ -766,22 +742,18 @@ struct AtaDropColumnDefault : AlterTableAction struct AtaDropTableConstraint : AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaDropTableConstraint() - { - } + AtaDropTableConstraint() = default; /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~AtaDropTableConstraint() - { - } + ~AtaDropTableConstraint() override = default; AtaDropTableConstraint(const char* constraintName, DDL_REFERENTIAL_ACTION dropBehavior); @@ -793,21 +765,21 @@ struct AtaDropTableConstraint : AlterTableAction struct AtaRenameTable : public AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaRenameTable() : fQualifiedName(0) + AtaRenameTable() : fQualifiedName(nullptr) { } - AtaRenameTable(QualifiedName* qualifiedName); + explicit AtaRenameTable(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~AtaRenameTable(); + ~AtaRenameTable() override; QualifiedName* fQualifiedName; }; @@ -816,21 +788,21 @@ struct AtaRenameTable : public AlterTableAction struct AtaTableComment : public AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ AtaTableComment() : fTableComment("") { } - AtaTableComment(const char* tableComment); + explicit AtaTableComment(const char* tableComment); /** @brief Dump to stdout. */ - std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~AtaTableComment(); + ~AtaTableComment() override; std::string fTableComment; }; @@ -839,13 +811,13 @@ struct AtaTableComment : public AlterTableAction struct AtaModifyColumnType : public AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaModifyColumnType() : fColumnType(0) + AtaModifyColumnType() : fColumnType(nullptr) { } @@ -854,12 +826,12 @@ struct AtaModifyColumnType : public AlterTableAction { } - AtaModifyColumnType(QualifiedName* qualifiedName); + explicit AtaModifyColumnType(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~AtaModifyColumnType(); + ~AtaModifyColumnType() override; ColumnType* fColumnType; @@ -870,28 +842,28 @@ struct AtaModifyColumnType : public AlterTableAction struct AtaRenameColumn : public AlterTableAction { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - AtaRenameColumn() : fNewType(0), fDefaultValue(0) + AtaRenameColumn() : fNewType(nullptr), fDefaultValue(nullptr) { } - AtaRenameColumn(const char* name, const char* newName, ColumnType* newType, const char* comment = NULL) + AtaRenameColumn(const char* name, const char* newName, ColumnType* newType, const char* comment = nullptr) : fName(name), fNewName(newName), fNewType(newType) { if (comment) fComment = comment; - fDefaultValue = 0; + fDefaultValue = nullptr; } AtaRenameColumn(const char* name, const char* newName, ColumnType* newType, ColumnConstraintList* constraint_list, ColumnDefaultValue* defaultValue, - const char* comment = NULL) + const char* comment = nullptr) : fName(name), fNewName(newName), fNewType(newType), fDefaultValue(defaultValue) { if (constraint_list) @@ -906,12 +878,12 @@ struct AtaRenameColumn : public AlterTableAction fComment = comment; } - AtaRenameColumn(QualifiedName* qualifiedName); + explicit AtaRenameColumn(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~AtaRenameColumn(); + ~AtaRenameColumn() override; std::string fName; ///< current column name std::string fNewName; ///< new column name @@ -935,7 +907,7 @@ struct ColumnType EXPORT int serialize(messageqcpp::ByteStream& bs); /** @brief For deserialization. */ - ColumnType() : fCharset(NULL), fCollate(NULL), fCharsetNum(0), fExplicitLength(false) + ColumnType() : fCharset(nullptr), fCollate(nullptr), fCharsetNum(0), fExplicitLength(false) { } @@ -951,9 +923,7 @@ struct ColumnType EXPORT ColumnType(int type); - virtual ~ColumnType() - { - } + virtual ~ColumnType() = default; /** @brief Type code from DDL_DATATYPES */ int fType; @@ -1003,19 +973,15 @@ struct ColumnConstraintDef : public SchemaObject /** @brief Serialize to ByteStream */ EXPORT virtual int serialize(messageqcpp::ByteStream& bs); - ColumnConstraintDef() - { - } + ColumnConstraintDef() = default; /** @brief Constructs as check constraint. */ - EXPORT ColumnConstraintDef(const char* check); + EXPORT explicit ColumnConstraintDef(const char* check); /** @brief Constructs as other constraint. */ - EXPORT ColumnConstraintDef(DDL_CONSTRAINTS type); + EXPORT explicit ColumnConstraintDef(DDL_CONSTRAINTS type); - virtual ~ColumnConstraintDef() - { - } + ~ColumnConstraintDef() override = default; /** @brief Whether deferrable. */ bool fDeferrable; @@ -1039,15 +1005,11 @@ struct ColumnDefaultValue /** @brief Serialize to ByteStream */ virtual int serialize(messageqcpp::ByteStream& bs); - ColumnDefaultValue() - { - } + ColumnDefaultValue() = default; - ColumnDefaultValue(const char* value); + explicit ColumnDefaultValue(const char* value); - virtual ~ColumnDefaultValue() - { - } + virtual ~ColumnDefaultValue() = default; /** @brief Is NULL the default value? */ bool fNull; @@ -1067,20 +1029,20 @@ struct ColumnDef : public SchemaObject EXPORT virtual int serialize(messageqcpp::ByteStream& bs); /** @brief For deserialization. */ - ColumnDef() : fType(0) + ColumnDef() : fType(nullptr) { } - EXPORT virtual ~ColumnDef(); + EXPORT ~ColumnDef() override; /** @brief Parser ctor. */ EXPORT ColumnDef(const char* name, ColumnType* type, ColumnConstraintList* constraint_list, - ColumnDefaultValue* defaultValue, const char* comment = NULL); + ColumnDefaultValue* defaultValue, const char* comment = nullptr); /** @brief ColumnDef ctor. * ctor */ ColumnDef(const char* name, ColumnType* type, ColumnConstraintList constraints, - ColumnDefaultValue* defaultValue = NULL, const char* comment = NULL) + ColumnDefaultValue* defaultValue = nullptr, const char* comment = nullptr) : SchemaObject(name), fType(type), fConstraints(constraints), fDefaultValue(defaultValue) { } @@ -1114,14 +1076,12 @@ struct TableConstraintDef : public SchemaObject TableConstraintDef(); - TableConstraintDef(DDL_CONSTRAINTS cType); + explicit TableConstraintDef(DDL_CONSTRAINTS cType); /** @brief Dump to stdout. */ virtual std::ostream& put(std::ostream& os) const; - virtual ~TableConstraintDef() - { - } + ~TableConstraintDef() override = default; // std::string fName; DDL_CONSTRAINTS fConstraintType; }; @@ -1131,28 +1091,26 @@ struct TableConstraintDef : public SchemaObject struct TableUniqueConstraintDef : public TableConstraintDef { /** @brief Return DDL_SERIAL code */ - virtual DDL_SERIAL_TYPE getSerialType() + DDL_SERIAL_TYPE getSerialType() override { return DDL_TABLE_UNIQUE_CONSTRAINT_DEF; } /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; TableUniqueConstraintDef() : TableConstraintDef(DDL_UNIQUE) { } - TableUniqueConstraintDef(ColumnNameList* columns); - virtual ~TableUniqueConstraintDef() - { - } + explicit TableUniqueConstraintDef(ColumnNameList* columns); + ~TableUniqueConstraintDef() override = default; /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; ColumnNameList fColumnNameList; }; @@ -1162,29 +1120,27 @@ struct TableUniqueConstraintDef : public TableConstraintDef struct TablePrimaryKeyConstraintDef : public TableConstraintDef { /** @brief Return DDL_SERIAL code */ - virtual DDL_SERIAL_TYPE getSerialType() + DDL_SERIAL_TYPE getSerialType() override { return DDL_TABLE_PRIMARY_CONSTRAINT_DEF; } /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; TablePrimaryKeyConstraintDef() : TableConstraintDef(DDL_PRIMARY_KEY) { } - EXPORT TablePrimaryKeyConstraintDef(ColumnNameList* columns); + EXPORT explicit TablePrimaryKeyConstraintDef(ColumnNameList* columns); - virtual ~TablePrimaryKeyConstraintDef() - { - } + ~TablePrimaryKeyConstraintDef() override = default; /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; ColumnNameList fColumnNameList; }; @@ -1194,9 +1150,7 @@ struct TablePrimaryKeyConstraintDef : public TableConstraintDef */ struct ReferentialAction { - virtual ~ReferentialAction() - { - } + virtual ~ReferentialAction() = default; /** @brief Deserialize from ByteStream */ virtual int unserialize(messageqcpp::ByteStream& bs); @@ -1213,18 +1167,19 @@ struct ReferentialAction struct TableReferencesConstraintDef : public TableConstraintDef { /** @brief Return DDL_SERIAL code */ - virtual DDL_SERIAL_TYPE getSerialType() + DDL_SERIAL_TYPE getSerialType() override { return DDL_TABLE_REFERENCES_CONSTRAINT_DEF; } /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; - TableReferencesConstraintDef() : TableConstraintDef(DDL_REFERENCES), fTableName(0), fRefAction(0) + TableReferencesConstraintDef() + : TableConstraintDef(DDL_REFERENCES), fTableName(nullptr), fRefAction(nullptr) { } @@ -1232,10 +1187,10 @@ struct TableReferencesConstraintDef : public TableConstraintDef ColumnNameList* foreignColumns, DDL_MATCH_TYPE matchType, ReferentialAction* refAction); - virtual ~TableReferencesConstraintDef(); + ~TableReferencesConstraintDef() override; /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; ColumnNameList fColumns; QualifiedName* fTableName; @@ -1249,29 +1204,27 @@ struct TableReferencesConstraintDef : public TableConstraintDef struct TableCheckConstraintDef : public TableConstraintDef { /** @brief Return DDL_SERIAL code */ - virtual DDL_SERIAL_TYPE getSerialType() + DDL_SERIAL_TYPE getSerialType() override { return DDL_TABLE_CHECK_CONSTRAINT_DEF; } /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; TableCheckConstraintDef() : TableConstraintDef(DDL_CHECK) { } - TableCheckConstraintDef(const char* check); + explicit TableCheckConstraintDef(const char* check); /** @brief Dump to stdout. */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~TableCheckConstraintDef() - { - } + ~TableCheckConstraintDef() override = default; std::string fCheck; }; @@ -1284,22 +1237,22 @@ struct TableCheckConstraintDef : public TableConstraintDef struct AlterTableStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; - AlterTableStatement() : fTableName(0) + AlterTableStatement() : fTableName(nullptr) { } EXPORT AlterTableStatement(QualifiedName* qName, AlterTableActionList* ataList); /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; /** @brief Delete members. */ - EXPORT virtual ~AlterTableStatement(); + EXPORT ~AlterTableStatement() override; std::string schemaName() const { @@ -1341,18 +1294,14 @@ struct ConstraintAttributes /** @brief Serialize to ByteStream */ virtual int serialize(messageqcpp::ByteStream& bs); - ConstraintAttributes() - { - } + ConstraintAttributes() = default; ConstraintAttributes(DDL_CONSTRAINT_ATTRIBUTES checkTime, bool deferrable) : fCheckTime(checkTime), fDeferrable(deferrable) { } - virtual ~ConstraintAttributes() - { - } + virtual ~ConstraintAttributes() = default; DDL_CONSTRAINT_ATTRIBUTES fCheckTime; bool fDeferrable; @@ -1366,19 +1315,19 @@ struct ConstraintAttributes struct CreateIndexStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; CreateIndexStatement(); CreateIndexStatement(QualifiedName* qualifiedName1, QualifiedName* qualifiedName2, ColumnNameList* columnNames, bool unique); /** @brief Dump to stdout. */ - std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~CreateIndexStatement(); + ~CreateIndexStatement() override; QualifiedName* fIndexName; QualifiedName* fTableName; @@ -1391,20 +1340,20 @@ struct CreateIndexStatement : public SqlStatement struct DropIndexStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - virtual int unserialize(messageqcpp::ByteStream& bs); + int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - virtual int serialize(messageqcpp::ByteStream& bs); + int serialize(messageqcpp::ByteStream& bs) override; - DropIndexStatement() : fIndexName(0) + DropIndexStatement() : fIndexName(nullptr) { } - DropIndexStatement(QualifiedName* qualifiedName); + explicit DropIndexStatement(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; - virtual ~DropIndexStatement(); + ~DropIndexStatement() override; QualifiedName* fIndexName; }; @@ -1414,20 +1363,20 @@ struct DropIndexStatement : public SqlStatement struct DropTableStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; - DropTableStatement() : fTableName(0) + DropTableStatement() : fTableName(nullptr) { } EXPORT DropTableStatement(QualifiedName* qualifiedName, bool cascade); /** @brief Dump to stdout. */ - EXPORT std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; - virtual ~DropTableStatement() + ~DropTableStatement() override { delete fTableName; } @@ -1473,20 +1422,20 @@ struct DebugDDLStatement : public SqlStatement struct TruncTableStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; - TruncTableStatement() : fTableName(0) + TruncTableStatement() : fTableName(nullptr) { } - EXPORT TruncTableStatement(QualifiedName* qualifiedName); + EXPORT explicit TruncTableStatement(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - EXPORT std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; - virtual ~TruncTableStatement() + ~TruncTableStatement() override { delete fTableName; } @@ -1508,23 +1457,23 @@ struct TruncTableStatement : public SqlStatement struct MarkPartitionStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - MarkPartitionStatement() : fTableName(0) + MarkPartitionStatement() : fTableName(nullptr) { } /** @brief You can't have a CreateTableStatement without a table defintion */ - EXPORT MarkPartitionStatement(QualifiedName* qualifiedName); + EXPORT explicit MarkPartitionStatement(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; - virtual ~MarkPartitionStatement() + ~MarkPartitionStatement() override { delete fTableName; } @@ -1539,22 +1488,22 @@ struct MarkPartitionStatement : public SqlStatement struct RestorePartitionStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - RestorePartitionStatement() : fTableName(0) + RestorePartitionStatement() : fTableName(nullptr) { } - EXPORT RestorePartitionStatement(QualifiedName* qualifiedName); + EXPORT explicit RestorePartitionStatement(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; - virtual ~RestorePartitionStatement() + ~RestorePartitionStatement() override { delete fTableName; } @@ -1569,22 +1518,22 @@ struct RestorePartitionStatement : public SqlStatement struct DropPartitionStatement : public SqlStatement { /** @brief Deserialize from ByteStream */ - EXPORT virtual int unserialize(messageqcpp::ByteStream& bs); + EXPORT int unserialize(messageqcpp::ByteStream& bs) override; /** @brief Serialize to ByteStream */ - EXPORT virtual int serialize(messageqcpp::ByteStream& bs); + EXPORT int serialize(messageqcpp::ByteStream& bs) override; /** @brief Ctor for deserialization */ - DropPartitionStatement() : fTableName(0) + DropPartitionStatement() : fTableName(nullptr) { } - EXPORT DropPartitionStatement(QualifiedName* qualifiedName); + EXPORT explicit DropPartitionStatement(QualifiedName* qualifiedName); /** @brief Dump to stdout. */ - EXPORT virtual std::ostream& put(std::ostream& os) const; + EXPORT std::ostream& put(std::ostream& os) const override; - virtual ~DropPartitionStatement() + ~DropPartitionStatement() override { delete fTableName; } diff --git a/dbcon/ddlpackage/sqlparser.h b/dbcon/ddlpackage/sqlparser.h index 3a16ccb5c..e7e3dfaed 100644 --- a/dbcon/ddlpackage/sqlparser.h +++ b/dbcon/ddlpackage/sqlparser.h @@ -29,7 +29,7 @@ #include #include "collation.h" // CHARSET_INFO #include "ddlpkg.h" -#include "mariadb_my_sys.h" // myf, MYF() +#include "mariadb_my_sys.h" // myf, MYF() #define EXPORT @@ -86,12 +86,8 @@ struct pass_to_bison const CHARSET_INFO* default_table_charset; myf utf8_flag; - pass_to_bison(ParseTree* pt) : - fParseTree(pt) - , scanner(NULL) - , default_table_charset(NULL) - , utf8_flag(MYF(0)) - {}; + pass_to_bison(ParseTree* pt) + : fParseTree(pt), scanner(nullptr), default_table_charset(nullptr), utf8_flag(MYF(0)){}; }; class SqlParser diff --git a/dbcon/ddlpackageproc/createtableprocessor.h b/dbcon/ddlpackageproc/createtableprocessor.h index 48d14bb08..4ae32260e 100644 --- a/dbcon/ddlpackageproc/createtableprocessor.h +++ b/dbcon/ddlpackageproc/createtableprocessor.h @@ -49,7 +49,7 @@ class CreateTableProcessor : public DDLPackageProcessor * * @param createTableStmt the CreateTableStatement */ - DDLResult processPackageInternal(ddlpackage::SqlStatement* sqlTableStmt); + DDLResult processPackageInternal(ddlpackage::SqlStatement* sqlTableStmt) override; }; } // namespace ddlpackageprocessor diff --git a/dbcon/ddlpackageproc/ddlindexpopulator.h b/dbcon/ddlpackageproc/ddlindexpopulator.h index 1570d2221..52f79b318 100644 --- a/dbcon/ddlpackageproc/ddlindexpopulator.h +++ b/dbcon/ddlpackageproc/ddlindexpopulator.h @@ -22,7 +22,7 @@ ***********************************************************************/ /** @file */ -#ifndef DDLINDEXPOPULATOR_H +#pragma once #include #include @@ -302,5 +302,4 @@ class DDLIndexPopulator }; }; -} // namespace ddlpackageprocessor -#endif // DDLPINDEXPOPULATOR_H +} // namespace ddlpackageprocessor \ No newline at end of file diff --git a/dbcon/ddlpackageproc/ddlpackageprocessor.h b/dbcon/ddlpackageproc/ddlpackageprocessor.h index 6d5171019..b1763f833 100644 --- a/dbcon/ddlpackageproc/ddlpackageprocessor.h +++ b/dbcon/ddlpackageproc/ddlpackageprocessor.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -49,7 +49,7 @@ #define EXPORT -//#define IDB_DDL_DEBUG +// #define IDB_DDL_DEBUG namespace ddlpackageprocessor { #define SUMMARY_INFO(message) \ @@ -206,8 +206,8 @@ class DDLPackageProcessor struct NJLSysDataList { NJLSysDataVector sysDataVec; - EXPORT NJLSysDataList(){}; - EXPORT ~NJLSysDataList(); + EXPORT NJLSysDataList() = default; + EXPORT ~NJLSysDataList() = default; NJLSysDataVector::const_iterator begin() { return sysDataVec.begin(); diff --git a/dbcon/ddlpackageproc/dropindexprocessor.h b/dbcon/ddlpackageproc/dropindexprocessor.h index b92c569ba..ec73d77b2 100644 --- a/dbcon/ddlpackageproc/dropindexprocessor.h +++ b/dbcon/ddlpackageproc/dropindexprocessor.h @@ -38,7 +38,7 @@ class DropIndexProcessor : public DDLPackageProcessor * * @param dropIndexStmt the drop index statement */ - DDLResult processPackageInternal(ddlpackage::SqlStatement& dropIndexStmt); + DDLResult processPackageInternal(ddlpackage::SqlStatement* dropIndexStmt) override; protected: private: diff --git a/dbcon/ddlpackageproc/droppartitionprocessor.h b/dbcon/ddlpackageproc/droppartitionprocessor.h index 914df8f56..c3fa7edd9 100644 --- a/dbcon/ddlpackageproc/droppartitionprocessor.h +++ b/dbcon/ddlpackageproc/droppartitionprocessor.h @@ -46,7 +46,7 @@ class DropPartitionProcessor : public DDLPackageProcessor, FormatStatementString * * @param dropTableStmt the drop table statement */ - DDLResult processPackageInternal(ddlpackage::SqlStatement* dropPartitionStmt); + DDLResult processPackageInternal(ddlpackage::SqlStatement* dropPartitionStmt) override; }; } // namespace ddlpackageprocessor diff --git a/dbcon/ddlpackageproc/droptableprocessor.h b/dbcon/ddlpackageproc/droptableprocessor.h index 1a86706e3..aa87d6f77 100644 --- a/dbcon/ddlpackageproc/droptableprocessor.h +++ b/dbcon/ddlpackageproc/droptableprocessor.h @@ -46,7 +46,7 @@ class DropTableProcessor : public DDLPackageProcessor * * @param dropTableStmt the drop table statement */ - DDLResult processPackageInternal(ddlpackage::SqlStatement* dropTableStmt); + DDLResult processPackageInternal(ddlpackage::SqlStatement* dropTableStmt) override; }; /** @brief specialization of a DDLPacakageProcessor @@ -66,7 +66,7 @@ class TruncTableProcessor : public DDLPackageProcessor * * @param truncTableStmt the truncate table statement */ - DDLResult processPackageInternal(ddlpackage::SqlStatement* truncTableStmt); + DDLResult processPackageInternal(ddlpackage::SqlStatement* truncTableStmt) override; }; } // namespace ddlpackageprocessor diff --git a/dbcon/ddlpackageproc/markpartitionprocessor.h b/dbcon/ddlpackageproc/markpartitionprocessor.h index ed3454f94..5fedb70c4 100644 --- a/dbcon/ddlpackageproc/markpartitionprocessor.h +++ b/dbcon/ddlpackageproc/markpartitionprocessor.h @@ -46,7 +46,7 @@ class MarkPartitionProcessor : public DDLPackageProcessor, FormatStatementString * * @param createTableStmt the CreateTableStatement */ - DDLResult processPackageInternal(ddlpackage::SqlStatement* MarkPartitionStmt); + DDLResult processPackageInternal(ddlpackage::SqlStatement* MarkPartitionStmt) override; }; } // namespace ddlpackageprocessor diff --git a/dbcon/ddlpackageproc/restorepartitionprocessor.h b/dbcon/ddlpackageproc/restorepartitionprocessor.h index d2b6e74f9..cef47d9c4 100644 --- a/dbcon/ddlpackageproc/restorepartitionprocessor.h +++ b/dbcon/ddlpackageproc/restorepartitionprocessor.h @@ -46,7 +46,7 @@ class RestorePartitionProcessor : public DDLPackageProcessor, FormatStatementStr * * @param dropTableStmt the drop table statement */ - DDLResult processPackageInternal(ddlpackage::SqlStatement* RestorePartitionStmt); + DDLResult processPackageInternal(ddlpackage::SqlStatement* RestorePartitionStmt) override; }; } // namespace ddlpackageprocessor diff --git a/dbcon/dmlpackage/calpontdmlpackage.h b/dbcon/dmlpackage/calpontdmlpackage.h index 651c151a7..dbf5b9311 100644 --- a/dbcon/dmlpackage/calpontdmlpackage.h +++ b/dbcon/dmlpackage/calpontdmlpackage.h @@ -188,7 +188,7 @@ class CalpontDMLPackage { fTableName = tableName; - if (fTable != 0) + if (fTable != nullptr) fTable->set_TableName(tableName); } @@ -207,7 +207,7 @@ class CalpontDMLPackage { fSchemaName = schemaName; - if (fTable != 0) + if (fTable != nullptr) fTable->set_SchemaName(schemaName); } diff --git a/dbcon/dmlpackage/commanddmlpackage.h b/dbcon/dmlpackage/commanddmlpackage.h index bd2af3c5f..11bb7f413 100644 --- a/dbcon/dmlpackage/commanddmlpackage.h +++ b/dbcon/dmlpackage/commanddmlpackage.h @@ -47,33 +47,33 @@ class CommandDMLPackage : public CalpontDMLPackage /** @brief dtor */ - EXPORT virtual ~CommandDMLPackage(); + EXPORT ~CommandDMLPackage() override; /** @brief write a CommandDMLPackage to a ByteStream * * @param bytestream the ByteStream to write to */ - EXPORT int write(messageqcpp::ByteStream& bytestream); + EXPORT int write(messageqcpp::ByteStream& bytestream) override; /** @brief read CommandDMLPackage from bytestream * * @param bytestream the ByteStream to read from */ - EXPORT int read(messageqcpp::ByteStream& bytestream); + EXPORT int read(messageqcpp::ByteStream& bytestream) override; /** @brief do nothing * * @param buffer * @param columns the number of columns in the buffer * @param rows the number of rows in the buffer */ - inline int buildFromBuffer(std::string& buffer, int columns = 0, int rows = 0) + inline int buildFromBuffer(std::string& buffer, int columns = 0, int rows = 0) override { return 1; }; /** @brief build a CommandDMLPackage from a CommandSqlStatement */ - EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement); + EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override; /** @brief build a InsertDMLPackage from MySQL buffer * @@ -81,7 +81,7 @@ class CommandDMLPackage : public CalpontDMLPackage * @param rows the number of rows in the buffer */ int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows, - NullValuesBitset& nullValues) + NullValuesBitset& nullValues) override { return 1; }; diff --git a/dbcon/dmlpackage/deletedmlpackage.h b/dbcon/dmlpackage/deletedmlpackage.h index 3d2615592..e9e608e29 100644 --- a/dbcon/dmlpackage/deletedmlpackage.h +++ b/dbcon/dmlpackage/deletedmlpackage.h @@ -53,19 +53,19 @@ class DeleteDMLPackage : public CalpontDMLPackage /** @brief dtor */ - EXPORT virtual ~DeleteDMLPackage(); + EXPORT ~DeleteDMLPackage() override; /** @brief write a DeleteDMLPackage to a ByteStream * * @param bytestream the ByteStream to write to */ - EXPORT int write(messageqcpp::ByteStream& bytestream); + EXPORT int write(messageqcpp::ByteStream& bytestream) override; /** @brief read a DeleteDMLPackage from a ByteStream * * @param bytestream the ByteStream to read from */ - EXPORT int read(messageqcpp::ByteStream& bytestream); + EXPORT int read(messageqcpp::ByteStream& bytestream) override; /** @brief build a DeleteDMLPackage from a string buffer * @@ -73,20 +73,20 @@ class DeleteDMLPackage : public CalpontDMLPackage * @param columns the number of columns in the buffer * @param rows the number of rows in the buffer */ - EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows); + EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows) override; /** @brief build a DeleteDMLPackage from a parsed DeleteSqlStatement * * @param sqlStatement the parsed DeleteSqlStatement */ - EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement); + EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override; /** @brief build a InsertDMLPackage from MySQL buffer * * @param colNameList, tableValuesMap * @param rows the number of rows in the buffer */ EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, - int rows, NullValuesBitset& nullValues); + int rows, NullValuesBitset& nullValues) override; protected: private: diff --git a/dbcon/dmlpackage/dmlcolumn.h b/dbcon/dmlpackage/dmlcolumn.h index 13f2b4718..1859847b0 100644 --- a/dbcon/dmlpackage/dmlcolumn.h +++ b/dbcon/dmlpackage/dmlcolumn.h @@ -52,27 +52,27 @@ class DMLColumn : public DMLObject uint32_t funcScale = 0, bool isNULL = false); /** @brief new ctor - * + * */ - EXPORT DMLColumn(std::string name, utils::NullString& value, bool isFromCol = false, - uint32_t funcScale = 0, bool isNULL = false); + EXPORT DMLColumn(std::string name, utils::NullString& value, bool isFromCol = false, uint32_t funcScale = 0, + bool isNULL = false); /** @brief dtor */ - EXPORT ~DMLColumn(); + EXPORT ~DMLColumn() override; /** @brief read a DMLColumn from a ByteStream * * @param bytestream the ByteStream to read from */ - EXPORT int read(messageqcpp::ByteStream& bytestream); + EXPORT int read(messageqcpp::ByteStream& bytestream) override; /** @brief write a DML column to a ByteStream * * @param bytestream the ByteStream to write to */ - EXPORT int write(messageqcpp::ByteStream& bytestream); + EXPORT int write(messageqcpp::ByteStream& bytestream) override; /** @brief get the data for the column */ diff --git a/dbcon/dmlpackage/dmlpkg.h b/dbcon/dmlpackage/dmlpkg.h index c85bbb25f..0c4b548ef 100644 --- a/dbcon/dmlpackage/dmlpkg.h +++ b/dbcon/dmlpackage/dmlpkg.h @@ -23,13 +23,14 @@ /** @file */ #pragma once +#include #include #include #include #include #include #include -#include +#include #include "nullstring.h" namespace dmlpackage @@ -158,9 +159,7 @@ class SqlStatementList public: /** @brief ctor */ - SqlStatementList() - { - } + SqlStatementList() = default; /** @brief dtor */ @@ -218,19 +217,19 @@ class InsertSqlStatement : public SqlStatement /** @brief dtor */ - virtual ~InsertSqlStatement(); + ~InsertSqlStatement() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get a string representation of the query spec */ - virtual std::string getQueryString() const; + std::string getQueryString() const override; /** @brief get the statement type - DML_INSERT */ - inline virtual int getStatementType() const + inline int getStatementType() const override { return DML_INSERT; } @@ -259,25 +258,25 @@ class UpdateSqlStatement : public SqlStatement * @param whereClausePtr pointer to a WhereClause object - default 0 */ UpdateSqlStatement(TableName* tableNamePtr, ColumnAssignmentList* colAssignmentListPtr, - WhereClause* whereClausePtr = 0); + WhereClause* whereClausePtr = nullptr); /** @brief dtor */ - virtual ~UpdateSqlStatement(); + ~UpdateSqlStatement() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the * SET assignment_commalist opt_where_clause * statement */ - virtual std::string getQueryString() const; + std::string getQueryString() const override; /** @brief get the statement type - DML_UPDATE */ - inline virtual int getStatementType() const + inline int getStatementType() const override { return DML_UPDATE; } @@ -304,23 +303,23 @@ class DeleteSqlStatement : public SqlStatement * @param tableNamePtr pointer to a TableName object * @param whereClausePtr pointer to a WhereClause object - default = 0 */ - DeleteSqlStatement(TableName* tableNamePtr, WhereClause* whereClausePtr = 0); + explicit DeleteSqlStatement(TableName* tableNamePtr, WhereClause* whereClausePtr = nullptr); /** @brief dtor */ - virtual ~DeleteSqlStatement(); + ~DeleteSqlStatement() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the WHERE clause */ - virtual std::string getQueryString() const; + std::string getQueryString() const override; /** @brief get the statement type - DML_DELETE */ - inline virtual int getStatementType() const + inline int getStatementType() const override { return DML_DELETE; } @@ -346,22 +345,22 @@ class CommandSqlStatement : public SqlStatement * * @param command the COMMIT or ROLLBACK string */ - CommandSqlStatement(std::string command); + explicit CommandSqlStatement(std::string command); /** @brief get the statement type - DML_COMMAND */ - inline virtual int getStatementType() const + inline int getStatementType() const override { return DML_COMMAND; } /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the COMMIT or ROLLBACK string */ - virtual std::string getQueryString() const; + std::string getQueryString() const override; std::string fCommandText; }; @@ -380,7 +379,7 @@ class TableName * * @param name the table name */ - TableName(char* name); + explicit TableName(char* name); /** @brief ctor * @@ -406,11 +405,10 @@ class TableName class ColumnAssignment { public: - explicit ColumnAssignment(std::string const& column, std::string const& op = "=", - std::string const& expr = "") - : fColumn(column) - , fOperator(op) - , fScalarExpression(expr) + explicit ColumnAssignment(std::string column, std::string op = "=", std::string expr = "") + : fColumn(std::move(column)) + , fOperator(std::move(op)) + , fScalarExpression(std::move(expr)) , fFromCol(false) , fFuncScale(0) , fIsNull(false){}; @@ -449,13 +447,13 @@ class ValuesOrQuery * * @param valuesPtr pointer to a ValuesList object */ - ValuesOrQuery(ValuesList* valuesPtr); + explicit ValuesOrQuery(ValuesList* valuesPtr); /** @brief ctor * * @param querySpecPtr pointer to a QuerySpec object */ - ValuesOrQuery(QuerySpec* querySpecPtr); + explicit ValuesOrQuery(QuerySpec* querySpecPtr); /** @brief dtor */ @@ -491,7 +489,7 @@ class SelectFilter * * @param columnListPtr pointer to a ColumnNameList object */ - SelectFilter(ColumnNameList* columnListPtr); + explicit SelectFilter(ColumnNameList* columnListPtr); /** @brief dtor */ @@ -524,7 +522,7 @@ class FromClause * * @param tableNameList pointer to a TableNameList object */ - FromClause(TableNameList* tableNameList); + explicit FromClause(TableNameList* tableNameList); /** @brief dtor */ @@ -663,7 +661,7 @@ class Predicate * * @param predicateType the PREDICATE_TYPE */ - Predicate(PREDICATE_TYPE predicateType); + explicit Predicate(PREDICATE_TYPE predicateType); /** @brief dtor */ @@ -696,16 +694,16 @@ class ComparisonPredicate : public Predicate /** @brief dtor */ - ~ComparisonPredicate(); + ~ComparisonPredicate() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the COMPARISON * predicate */ - virtual std::string getPredicateString() const; + std::string getPredicateString() const override; std::string fLHScalarExpression; std::string fRHScalarExpression; @@ -731,16 +729,16 @@ class BetweenPredicate : public Predicate /** @brief dtor */ - ~BetweenPredicate(); + ~BetweenPredicate() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the BETWEEN * predicate */ - virtual std::string getPredicateString() const; + std::string getPredicateString() const override; std::string fLHScalarExpression; std::string fRH1ScalarExpression; @@ -766,16 +764,16 @@ class LikePredicate : public Predicate /** @brief dtor */ - ~LikePredicate(); + ~LikePredicate() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the LIKE * predicate */ - virtual std::string getPredicateString() const; + std::string getPredicateString() const override; std::string fLHScalarExpression; std::string fAtom; @@ -800,16 +798,16 @@ class NullTestPredicate : public Predicate /** @brief dtor */ - ~NullTestPredicate(); + ~NullTestPredicate() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the NULL test * predicate */ - std::string getPredicateString() const; + std::string getPredicateString() const override; std::string fColumnRef; @@ -834,16 +832,16 @@ class InPredicate : public Predicate /** @brief dtor */ - ~InPredicate(); + ~InPredicate() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the IN * predicate */ - virtual std::string getPredicateString() const; + std::string getPredicateString() const override; std::string fScalarExpression; std::string fOperator; @@ -867,16 +865,16 @@ class AllOrAnyPredicate : public Predicate /** @brief dtor */ - ~AllOrAnyPredicate(); + ~AllOrAnyPredicate() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the * ALL or ANY predicate */ - virtual std::string getPredicateString() const; + std::string getPredicateString() const override; std::string fScalarExpression; std::string fOperator; @@ -900,16 +898,16 @@ class ExistanceTestPredicate : public Predicate /** @brief dtor */ - ~ExistanceTestPredicate(); + ~ExistanceTestPredicate() override; /** @brief dump to stdout */ - virtual std::ostream& put(std::ostream& os) const; + std::ostream& put(std::ostream& os) const override; /** @brief get the string representation of the EXISTS * predicate */ - virtual std::string getPredicateString() const; + std::string getPredicateString() const override; QuerySpec* fSubQuerySpecPtr; }; diff --git a/dbcon/dmlpackage/dmltable.h b/dbcon/dmlpackage/dmltable.h index 0bb7ece3c..9b8592234 100644 --- a/dbcon/dmlpackage/dmltable.h +++ b/dbcon/dmlpackage/dmltable.h @@ -44,7 +44,7 @@ class DMLTable : public DMLObject /** @brief dtor */ - ~DMLTable(); + ~DMLTable() override; /** @brief get the schema name */ @@ -85,7 +85,7 @@ class DMLTable : public DMLObject * * @param bytestream the ByteStream to read from */ - int read(messageqcpp::ByteStream& bytestream); + int read(messageqcpp::ByteStream& bytestream) override; /** @brief read a DMLTable metadata from a ByteStream * @@ -103,7 +103,7 @@ class DMLTable : public DMLObject * * @param bytestream the ByteStream to write to */ - int write(messageqcpp::ByteStream& bytestream); + int write(messageqcpp::ByteStream& bytestream) override; protected: private: diff --git a/dbcon/dmlpackage/insertdmlpackage.h b/dbcon/dmlpackage/insertdmlpackage.h index f5216696d..fc52d49b2 100644 --- a/dbcon/dmlpackage/insertdmlpackage.h +++ b/dbcon/dmlpackage/insertdmlpackage.h @@ -53,19 +53,19 @@ class InsertDMLPackage : public CalpontDMLPackage /** @brief dtor */ - EXPORT virtual ~InsertDMLPackage(); + EXPORT ~InsertDMLPackage() override; /** @brief write a InsertDMLPackage to a ByteStream * * @param bytestream the ByteStream to write to */ - EXPORT int write(messageqcpp::ByteStream& bytestream); + EXPORT int write(messageqcpp::ByteStream& bytestream) override; /** @brief read InsertDMLPackage from bytestream * * @param bytestream the ByteStream to read from */ - EXPORT int read(messageqcpp::ByteStream& bytestream); + EXPORT int read(messageqcpp::ByteStream& bytestream) override; /** @brief read InsertDMLPackage metadata from bytestream * @@ -85,7 +85,7 @@ class InsertDMLPackage : public CalpontDMLPackage * @param columns the number of columns in the buffer * @param rows the number of rows in the buffer */ - EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows); + EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows) override; /** @brief build a InsertDMLPackage from MySQL buffer * @@ -95,13 +95,13 @@ class InsertDMLPackage : public CalpontDMLPackage * @param rows number of rows to be touched */ EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, - int rows, NullValuesBitset& nullValues); + int rows, NullValuesBitset& nullValues) override; /** @brief build a InsertDMLPackage from a InsertSqlStatement * * @param sqlStmt the InsertSqlStatement */ - EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement); + EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override; /** @brief Dump the InsertDMLPackage for debugging purposes */ diff --git a/dbcon/dmlpackage/row.h b/dbcon/dmlpackage/row.h index d115299d4..dbf94dda7 100644 --- a/dbcon/dmlpackage/row.h +++ b/dbcon/dmlpackage/row.h @@ -45,7 +45,7 @@ class Row : public DMLObject /** @brief dtor */ - EXPORT ~Row(); + EXPORT ~Row() override; /** @brief copy constructor */ @@ -55,13 +55,13 @@ class Row : public DMLObject * * @param bytestream the ByteStream to read from */ - EXPORT int read(messageqcpp::ByteStream& bytestream); + EXPORT int read(messageqcpp::ByteStream& bytestream) override; /** @brief write a Row to a ByteStream * * @param bytestream the ByteStream to write to */ - EXPORT int write(messageqcpp::ByteStream& bytestream); + EXPORT int write(messageqcpp::ByteStream& bytestream) override; /** @brief get the list of columns in the row */ diff --git a/dbcon/dmlpackage/updatedmlpackage.h b/dbcon/dmlpackage/updatedmlpackage.h index 5e5eacba6..ea4a3c9c4 100644 --- a/dbcon/dmlpackage/updatedmlpackage.h +++ b/dbcon/dmlpackage/updatedmlpackage.h @@ -53,19 +53,19 @@ class UpdateDMLPackage : public CalpontDMLPackage /** @brief dtor */ - EXPORT virtual ~UpdateDMLPackage(); + EXPORT ~UpdateDMLPackage() override; /** @brief write a UpdateDMLPackage to a ByteStream * * @param bytestream the ByteStream to write to */ - EXPORT int write(messageqcpp::ByteStream& bytestream); + EXPORT int write(messageqcpp::ByteStream& bytestream) override; /** @brief read a UpdateDMLPackage from a ByteStream * * @param bytestream the ByteStream to read from */ - EXPORT int read(messageqcpp::ByteStream& bytestream); + EXPORT int read(messageqcpp::ByteStream& bytestream) override; /** @brief build a UpdateDMLPackage from a string buffer * @@ -73,13 +73,13 @@ class UpdateDMLPackage : public CalpontDMLPackage * @param columns the number of columns in the buffer * @param rows the number of rows in the buffer */ - EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows); + EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows) override; /** @brief build a UpdateDMLPackage from a parsed UpdateSqlStatement * * @param sqlStatement the parsed UpdateSqlStatement */ - EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement); + EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override; /** @brief build a InsertDMLPackage from MySQL buffer * @@ -87,7 +87,7 @@ class UpdateDMLPackage : public CalpontDMLPackage * @param rows the number of rows in the buffer */ EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, - int rows, NullValuesBitset& nullValues); + int rows, NullValuesBitset& nullValues) override; void buildUpdateFromMysqlBuffer(UpdateSqlStatement& updateStmt); protected: diff --git a/dbcon/dmlpackage/vendordmlstatement.h b/dbcon/dmlpackage/vendordmlstatement.h index a9d4dcffc..ca8efe3b9 100644 --- a/dbcon/dmlpackage/vendordmlstatement.h +++ b/dbcon/dmlpackage/vendordmlstatement.h @@ -23,10 +23,11 @@ /** @file */ #pragma once #include +#include #include #include #include -#include +#include #include "dmlpkg.h" #define EXPORT @@ -57,7 +58,7 @@ class VendorDMLStatement EXPORT VendorDMLStatement(std::string dmlstatement, int stmttype, std::string tName, std::string schema, int rows, int columns, ColNameList& colNameList, TableValuesMap& tableValuesMap, NullValuesBitset& nullValues, int sessionID); - + /** @brief destructor */ EXPORT ~VendorDMLStatement(); @@ -73,7 +74,7 @@ class VendorDMLStatement */ inline void set_TableName(std::string value) { - fTableName = value; + fTableName = std::move(value); } /** @brief Get the schema name @@ -87,7 +88,7 @@ class VendorDMLStatement */ inline void set_SchemaName(std::string value) { - fSchema = value; + fSchema = std::move(value); } /** @brief Get the DML statVendorDMLStatement classement type @@ -115,7 +116,7 @@ class VendorDMLStatement */ inline void set_DMLStatement(std::string dmlStatement) { - fDMLStatement = dmlStatement; + fDMLStatement = std::move(dmlStatement); } /** @brief Get the number of rows @@ -157,7 +158,7 @@ class VendorDMLStatement */ inline void set_DataBuffer(std::string value) { - fDataBuffer = value; + fDataBuffer = std::move(value); } /** @brief Get the session ID */ diff --git a/dbcon/dmlpackageproc/autoincrementdata.h b/dbcon/dmlpackageproc/autoincrementdata.h index 7dcd2a200..51506cf4f 100644 --- a/dbcon/dmlpackageproc/autoincrementdata.h +++ b/dbcon/dmlpackageproc/autoincrementdata.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include @@ -48,4 +48,3 @@ class AutoincrementData OIDNextValue fOidNextValueMap; boost::mutex fOIDnextvalLock; }; - diff --git a/dbcon/execplan/aggregatecolumn.h b/dbcon/execplan/aggregatecolumn.h index 6ead28c20..a0607e814 100644 --- a/dbcon/execplan/aggregatecolumn.h +++ b/dbcon/execplan/aggregatecolumn.h @@ -94,7 +94,7 @@ class AggregateColumn : public ReturnedColumn /** * ctor */ - AggregateColumn(const uint32_t sessionID); + explicit AggregateColumn(const uint32_t sessionID); /** * ctor @@ -109,9 +109,7 @@ class AggregateColumn : public ReturnedColumn /** * Destructors */ - virtual ~AggregateColumn() - { - } + ~AggregateColumn() override = default; /** * Accessor Methods @@ -167,7 +165,7 @@ class AggregateColumn : public ReturnedColumn * * deep copy of this pointer and return the copy */ - inline virtual AggregateColumn* clone() const override + inline AggregateColumn* clone() const override { return new AggregateColumn(*this); } @@ -190,14 +188,14 @@ class AggregateColumn : public ReturnedColumn /** * ASC flag */ - inline virtual bool asc() const override + inline bool asc() const override { return fAsc; } /** * ASC flag */ - inline virtual void asc(const bool asc) override + inline void asc(const bool asc) override { fAsc = asc; } @@ -205,7 +203,7 @@ class AggregateColumn : public ReturnedColumn /** * fData: SQL representation of this object */ - virtual const std::string data() const override + const std::string data() const override { return fData; } @@ -221,24 +219,24 @@ class AggregateColumn : public ReturnedColumn /** * Overloaded stream operator */ - virtual const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + const std::string toString() const override; + std::string toCppCode(IncludeSet& includes) const override; /** * Serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; + void serialize(messageqcpp::ByteStream&) const override; /** * Serialize interface */ - virtual void unserialize(messageqcpp::ByteStream&) override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -253,7 +251,7 @@ class AggregateColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -309,8 +307,8 @@ class AggregateColumn : public ReturnedColumn static AggOp agname2num(const std::string&); using ReturnedColumn::hasAggregate; - virtual bool hasAggregate() override; - virtual bool hasWindowFunc() override + bool hasAggregate() override; + bool hasWindowFunc() override { return false; } @@ -357,7 +355,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { bool localIsNull = false; evaluate(row, localIsNull); @@ -368,7 +366,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getIntVal(); @@ -377,7 +375,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getUintVal(); @@ -386,7 +384,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override + float getFloatVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getFloatVal(); @@ -395,7 +393,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override + double getDoubleVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDoubleVal(); @@ -404,7 +402,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override + long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getLongDoubleVal(); @@ -413,7 +411,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDecimalVal(); @@ -421,7 +419,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override + int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDateIntVal(); @@ -429,7 +427,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getTimeIntVal(); @@ -437,7 +435,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDatetimeIntVal(); @@ -445,7 +443,7 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getTimestampIntVal(); diff --git a/dbcon/execplan/arithmeticcolumn.h b/dbcon/execplan/arithmeticcolumn.h index ffb899204..a2b8fa923 100644 --- a/dbcon/execplan/arithmeticcolumn.h +++ b/dbcon/execplan/arithmeticcolumn.h @@ -51,7 +51,7 @@ class ArithmeticColumn : public ReturnedColumn ArithmeticColumn(); ArithmeticColumn(const std::string& sql, const uint32_t sessionID = 0); ArithmeticColumn(const ArithmeticColumn& rhs, const uint32_t sessionID = 0); - virtual ~ArithmeticColumn(); + ~ArithmeticColumn() override; inline ParseTree* expression() const { @@ -102,7 +102,7 @@ class ArithmeticColumn : public ReturnedColumn /** * get SQL representation of this object */ - virtual const std::string data() const override + const std::string data() const override { return fData; } @@ -110,7 +110,7 @@ class ArithmeticColumn : public ReturnedColumn /** * set SQL representation of this object */ - virtual void data(const std::string data) override + void data(const std::string data) override { fData = data; } @@ -118,13 +118,13 @@ class ArithmeticColumn : public ReturnedColumn /** * virtual stream method */ - virtual const std::string toString() const override; + const std::string toString() const override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual ArithmeticColumn* clone() const override + inline ArithmeticColumn* clone() const override { return new ArithmeticColumn(*this); } @@ -132,15 +132,15 @@ class ArithmeticColumn : public ReturnedColumn /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -154,7 +154,7 @@ class ArithmeticColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -164,16 +164,16 @@ class ArithmeticColumn : public ReturnedColumn bool operator!=(const ArithmeticColumn& t) const; using ReturnedColumn::hasAggregate; - virtual bool hasAggregate() override; - virtual bool hasWindowFunc() override; + bool hasAggregate() override; + bool hasWindowFunc() override; - virtual void setDerivedTable() override; - virtual void replaceRealCol(std::vector&) override; - virtual const std::vector& simpleColumnList() const override + void setDerivedTable() override; + void replaceRealCol(std::vector&) override; + const std::vector& simpleColumnList() const override { return fSimpleColumnList; } - virtual void setSimpleColumnList() override; + void setSimpleColumnList() override; /** * Return the table that the column arguments belong to. @@ -181,13 +181,13 @@ class ArithmeticColumn : public ReturnedColumn * @return tablename, if all arguments belong to one table * empty string "", if multiple tables are involved in this func */ - virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override; + bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: std::string fTableAlias; // table alias for this column - bool fAsc = false; // asc flag for order by column + bool fAsc = false; // asc flag for order by column std::string fData; /** build expression tree @@ -211,62 +211,62 @@ class ArithmeticColumn : public ReturnedColumn * F&E framework * ***********************************************************/ public: - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getStrVal(row, isNull); } - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getIntVal(row, isNull); } - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getUintVal(row, isNull); } - virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override + float getFloatVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getFloatVal(row, isNull); } - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override + double getDoubleVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getDoubleVal(row, isNull); } - virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override + long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getLongDoubleVal(row, isNull); } - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getDecimalVal(row, isNull); } - virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override + int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getDateIntVal(row, isNull); } - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getDatetimeIntVal(row, isNull); } - virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getTimestampIntVal(row, isNull); } - virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getTimeIntVal(row, isNull); } - virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override + bool getBoolVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getBoolVal(row, isNull); } diff --git a/dbcon/execplan/arithmeticoperator.h b/dbcon/execplan/arithmeticoperator.h index 974ac35c9..f83b6c5da 100644 --- a/dbcon/execplan/arithmeticoperator.h +++ b/dbcon/execplan/arithmeticoperator.h @@ -46,16 +46,16 @@ class ArithmeticOperator : public Operator public: ArithmeticOperator(); - ArithmeticOperator(const std::string& operatorName); + explicit ArithmeticOperator(const std::string& operatorName); ArithmeticOperator(const ArithmeticOperator& rhs); - virtual ~ArithmeticOperator(); + ~ArithmeticOperator() override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual ArithmeticOperator* clone() const override + inline ArithmeticOperator* clone() const override { return new ArithmeticOperator(*this); } @@ -72,15 +72,15 @@ class ArithmeticOperator : public Operator /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -94,7 +94,7 @@ class ArithmeticOperator : public Operator * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -107,11 +107,11 @@ class ArithmeticOperator : public Operator * F&E framework * ***********************************************************/ using Operator::evaluate; - inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override; + inline void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override; using Operator::getStrVal; - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, - ParseTree* rop) override + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, + ParseTree* rop) override { bool localIsNull = false; evaluate(row, localIsNull, lop, rop); @@ -119,38 +119,37 @@ class ArithmeticOperator : public Operator return localIsNull ? fResult.strVal.dropString() : TreeNode::getStrVal(fTimeZone); } using Operator::getIntVal; - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getIntVal(); } using Operator::getUintVal; - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getUintVal(); } using Operator::getFloatVal; - virtual float getFloatVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + float getFloatVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getFloatVal(); } using Operator::getDoubleVal; - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + double getDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getDoubleVal(); } using Operator::getLongDoubleVal; - virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, - ParseTree* rop) override + long double getLongDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getLongDoubleVal(); } using Operator::getDecimalVal; - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); @@ -169,32 +168,31 @@ class ArithmeticOperator : public Operator return TreeNode::getDecimalVal(); } using Operator::getDateIntVal; - virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + int32_t getDateIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getDateIntVal(); } using Operator::getDatetimeIntVal; - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getDatetimeIntVal(); } using Operator::getTimestampIntVal; - virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, - ParseTree* rop) override + int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getTimestampIntVal(); } using Operator::getTimeIntVal; - virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getTimeIntVal(); } using Operator::getBoolVal; - virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { evaluate(row, isNull, lop, rop); return TreeNode::getBoolVal(); @@ -209,7 +207,7 @@ class ArithmeticOperator : public Operator fDecimalOverflowCheck = check; } - inline virtual std::string toCppCode(IncludeSet& includes) const override + inline std::string toCppCode(IncludeSet& includes) const override { includes.insert("arithmeticoperator.h"); std::stringstream ss; diff --git a/dbcon/execplan/blocksize.h b/dbcon/execplan/blocksize.h index 2151369cd..aa4e35729 100644 --- a/dbcon/execplan/blocksize.h +++ b/dbcon/execplan/blocksize.h @@ -23,6 +23,6 @@ // # of bytes in a block const uint64_t BLOCK_SIZE = 8192; -// lobgical_block_rids is the # of rows 1-byter-column in a block +// logical_block_rids is the # of rows 1-byter-column in a block // its value is the same as block_size, but different unit const uint64_t LOGICAL_BLOCK_RIDS = BLOCK_SIZE; diff --git a/dbcon/execplan/calpontselectexecutionplan.cpp b/dbcon/execplan/calpontselectexecutionplan.cpp index 693f8367b..6845cf9fd 100644 --- a/dbcon/execplan/calpontselectexecutionplan.cpp +++ b/dbcon/execplan/calpontselectexecutionplan.cpp @@ -25,13 +25,13 @@ using namespace std; #include +#include #include "bytestream.h" using namespace messageqcpp; #include "calpontselectexecutionplan.h" #include "objectreader.h" -#include "filter.h" #include "returnedcolumn.h" #include "simplecolumn.h" #include "querystats.h" @@ -63,10 +63,10 @@ CalpontSelectExecutionPlan::ColumnMap CalpontSelectExecutionPlan::fColMap; /** * Constructors/Destructors */ -CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(const int location) +CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(int location) : fLocalQuery(GLOBAL_QUERY) - , fFilters(0) - , fHaving(0) + , fFilters(nullptr) + , fHaving(nullptr) , fLocation(location) , fDependent(false) , fTxnID(-1) @@ -98,17 +98,18 @@ CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(const int location) fUuid = QueryTeleClient::genUUID(); } -CalpontSelectExecutionPlan::CalpontSelectExecutionPlan( - const ReturnedColumnList& returnedCols, ParseTree* filters, const SelectList& subSelects, - const GroupByColumnList& groupByCols, ParseTree* having, const OrderByColumnList& orderByCols, - const string alias, const int location, const bool dependent, const bool withRollup) - : fReturnedCols(returnedCols) +CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(ReturnedColumnList returnedCols, ParseTree* filters, + SelectList subSelects, GroupByColumnList groupByCols, + ParseTree* having, OrderByColumnList orderByCols, + string alias, int location, bool dependent, + bool withRollup) + : fReturnedCols(std::move(returnedCols)) , fFilters(filters) - , fSubSelects(subSelects) - , fGroupByCols(groupByCols) + , fSubSelects(std::move(subSelects)) + , fGroupByCols(std::move(groupByCols)) , fHaving(having) - , fOrderByCols(orderByCols) - , fTableAlias(alias) + , fOrderByCols(std::move(orderByCols)) + , fTableAlias(std::move(alias)) , fLocation(location) , fDependent(dependent) , fPriority(querystats::DEFAULT_USER_PRIORITY_LEVEL) @@ -118,23 +119,18 @@ CalpontSelectExecutionPlan::CalpontSelectExecutionPlan( } CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(string data) - : fData(data) - , fPriority(querystats::DEFAULT_USER_PRIORITY_LEVEL) - , fWithRollup(false) + : fData(std::move(data)), fPriority(querystats::DEFAULT_USER_PRIORITY_LEVEL), fWithRollup(false) { fUuid = QueryTeleClient::genUUID(); } CalpontSelectExecutionPlan::~CalpontSelectExecutionPlan() { - if (fFilters != NULL) - delete fFilters; + delete fFilters; + delete fHaving; - if (fHaving != NULL) - delete fHaving; - - fFilters = NULL; - fHaving = NULL; + fFilters = nullptr; + fHaving = nullptr; if (!fDynamicParseTreeVec.empty()) { @@ -145,11 +141,11 @@ CalpontSelectExecutionPlan::~CalpontSelectExecutionPlan() // 'delete fFilters;' above has already deleted objects pointed // to by parseTree->left()/right()/data(), so we set the // pointers to NULL here before calling 'delete parseTree;' - parseTree->left((ParseTree*)(NULL)); - parseTree->right((ParseTree*)(NULL)); - parseTree->data((TreeNode*)(NULL)); + parseTree->left((ParseTree*)(nullptr)); + parseTree->right((ParseTree*)(nullptr)); + parseTree->data((TreeNode*)(nullptr)); delete parseTree; - parseTree = NULL; + parseTree = nullptr; } } @@ -265,7 +261,7 @@ string CalpontSelectExecutionPlan::toString() const // Filters output << ">>Filters" << endl; - if (filters() != 0) + if (filters() != nullptr) filters()->walk(ParseTree::print, output); else output << "empty filter tree" << endl; @@ -282,7 +278,7 @@ string CalpontSelectExecutionPlan::toString() const } // Having - if (having() != 0) + if (having() != nullptr) { output << ">>Having" << endl; having()->walk(ParseTree::print, output); @@ -496,16 +492,16 @@ void CalpontSelectExecutionPlan::unserialize(messageqcpp::ByteStream& b) fDerivedTableList.clear(); fSelectSubList.clear(); - if (fFilters != 0) + if (fFilters != nullptr) { delete fFilters; - fFilters = 0; + fFilters = nullptr; } - if (fHaving != 0) + if (fHaving != nullptr) { delete fHaving; - fHaving = 0; + fHaving = nullptr; } if (!fDynamicParseTreeVec.empty()) @@ -517,11 +513,11 @@ void CalpontSelectExecutionPlan::unserialize(messageqcpp::ByteStream& b) // 'delete fFilters;' above has already deleted objects pointed // to by parseTree->left()/right()/data(), so we set the // pointers to NULL here before calling 'delete parseTree;' - parseTree->left((ParseTree*)(NULL)); - parseTree->right((ParseTree*)(NULL)); - parseTree->data((TreeNode*)(NULL)); + parseTree->left((ParseTree*)(nullptr)); + parseTree->right((ParseTree*)(nullptr)); + parseTree->data((TreeNode*)(nullptr)); delete parseTree; - parseTree = NULL; + parseTree = nullptr; } } @@ -699,12 +695,12 @@ bool CalpontSelectExecutionPlan::operator==(const CalpontSelectExecutionPlan& t) return false; // fFilters - if (fFilters != NULL && t.fFilters != NULL) + if (fFilters != nullptr && t.fFilters != nullptr) { if (*fFilters != *t.fFilters) return false; } - else if (fFilters != NULL || t.fFilters != NULL) + else if (fFilters != nullptr || t.fFilters != nullptr) return false; // fSubSelects @@ -725,12 +721,12 @@ bool CalpontSelectExecutionPlan::operator==(const CalpontSelectExecutionPlan& t) return false; // fHaving - if (fHaving != NULL && t.fHaving != NULL) + if (fHaving != nullptr && t.fHaving != nullptr) { if (*fHaving != *t.fHaving) return false; } - else if (fHaving != NULL || t.fHaving != NULL) + else if (fHaving != nullptr || t.fHaving != nullptr) return false; // fOrderByCols @@ -795,7 +791,7 @@ bool CalpontSelectExecutionPlan::operator==(const CalpontExecutionPlan* t) const ac = dynamic_cast(t); - if (ac == NULL) + if (ac == nullptr) return false; return *this == *ac; diff --git a/dbcon/execplan/calpontselectexecutionplan.h b/dbcon/execplan/calpontselectexecutionplan.h index 7ced677c8..0fa8cec96 100644 --- a/dbcon/execplan/calpontselectexecutionplan.h +++ b/dbcon/execplan/calpontselectexecutionplan.h @@ -146,19 +146,18 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan /** * Constructors */ - CalpontSelectExecutionPlan(const int location = MAIN); + explicit CalpontSelectExecutionPlan(int location = MAIN); - CalpontSelectExecutionPlan(const ReturnedColumnList& returnedCols, ParseTree* filters, - const SelectList& subSelects, const GroupByColumnList& groupByCols, - ParseTree* having, const OrderByColumnList& orderByCols, const std::string alias, - const int location, const bool dependent, const bool withRollup); + CalpontSelectExecutionPlan(ReturnedColumnList returnedCols, ParseTree* filters, SelectList subSelects, + GroupByColumnList groupByCols, ParseTree* having, OrderByColumnList orderByCols, + std::string alias, int location, bool dependent, bool withRollup); - CalpontSelectExecutionPlan(const std::string data); + explicit CalpontSelectExecutionPlan(std::string data); /** * Destructors */ - virtual ~CalpontSelectExecutionPlan(); + ~CalpontSelectExecutionPlan() override; /** * Access and mutator methods @@ -366,13 +365,13 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan /** sql representation of this select query * */ - const std::string data() const + const std::string& data() const { return fData; } - void data(const std::string data) + void data(std::string data) { - fData = data; + fData = std::move(data); } /** session id @@ -679,7 +678,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan { fDJSSmallSideLimit = l; } - uint64_t djsSmallSideLimit() + uint64_t djsSmallSideLimit() const { return fDJSSmallSideLimit; } @@ -688,7 +687,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan { fDJSLargeSideLimit = l; } - uint64_t djsLargeSideLimit() + uint64_t djsLargeSideLimit() const { return fDJSLargeSideLimit; } @@ -697,7 +696,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan { fDJSPartitionSize = l; } - uint64_t djsPartitionSize() + uint64_t djsPartitionSize() const { return fDJSPartitionSize; } @@ -715,7 +714,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan { fDJSForceRun = b; } - bool djsForceRun() + bool djsForceRun() const { return fDJSForceRun; } @@ -724,7 +723,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan { fMaxPmJoinResultCount = value; } - uint32_t maxPmJoinResultCount() + uint32_t maxPmJoinResultCount() const { return fMaxPmJoinResultCount; } @@ -733,7 +732,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan { fUMMemLimit = l; } - int64_t umMemLimit() + int64_t umMemLimit() const { return fUMMemLimit; } @@ -742,7 +741,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan { fIsDML = b; } - bool isDML() + bool isDML() const { return fIsDML; } @@ -762,15 +761,15 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan /** * @note Serialize() assumes that none of the vectors contain NULL pointers. */ - virtual void serialize(messageqcpp::ByteStream&) const; - virtual void unserialize(messageqcpp::ByteStream&); + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const CalpontExecutionPlan* t) const; + bool operator==(const CalpontExecutionPlan* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -784,7 +783,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const CalpontExecutionPlan* t) const; + bool operator!=(const CalpontExecutionPlan* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -863,7 +862,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan /** * A tree of Filter objects */ - ParseTree* fFilters = nullptr; + ParseTree* fFilters{nullptr}; /** * A list of CalpontExecutionPlan objects */ @@ -875,7 +874,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan /** * A tree of having clause condition associated with group by clause */ - ParseTree* fHaving; + ParseTree* fHaving{nullptr}; /** * A list of order by columns */ @@ -955,7 +954,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan // Derived table involved in the query. For derived table optimization std::vector fSubSelectList; - boost::uuids::uuid fUuid; + boost::uuids::uuid fUuid{}; /* Disk-based join vars */ uint64_t fDJSSmallSideLimit = 0; diff --git a/dbcon/execplan/calpontsystemcatalog.h b/dbcon/execplan/calpontsystemcatalog.h index a3fc1ed24..6dffbdde8 100644 --- a/dbcon/execplan/calpontsystemcatalog.h +++ b/dbcon/execplan/calpontsystemcatalog.h @@ -139,9 +139,8 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog { } DictOID(const DictOID& rhs) - : dictOID(rhs.dictOID), listOID(rhs.listOID), treeOID(rhs.treeOID), compressionType(rhs.compressionType) - { - } + + = default; OID dictOID; OID listOID; OID treeOID; @@ -176,7 +175,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog // If we used an unorderedmap, we might improve performance. // Maybe. NJLSysDataVector sysDataVec; - NJLSysDataList(){}; + NJLSysDataList() = default; ~NJLSysDataList(); NJLSysDataVector::const_iterator begin() const { @@ -439,9 +438,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog */ struct TableName { - TableName() - { - } + TableName() = default; TableName(std::string sch, std::string tb) : schema(sch), table(tb) { } @@ -873,7 +870,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog private: /** Constuctors */ - explicit CalpontSystemCatalog(const CalpontSystemCatalog& rhs); + CalpontSystemCatalog(const CalpontSystemCatalog& rhs); CalpontSystemCatalog& operator=(const CalpontSystemCatalog& rhs); diff --git a/dbcon/execplan/clientrotator.h b/dbcon/execplan/clientrotator.h index 273863c53..e2616247e 100644 --- a/dbcon/execplan/clientrotator.h +++ b/dbcon/execplan/clientrotator.h @@ -56,7 +56,7 @@ class ClientRotator } } - /** @brief connnect + /** @brief connect * * Try connecting to client based on session id. If no connection, * try connectList. @@ -79,7 +79,7 @@ class ClientRotator { fClient->shutdown(); delete fClient; - fClient = 0; + fClient = nullptr; } } @@ -140,7 +140,7 @@ class ClientRotator */ bool exeConnect(const std::string& clientName); - /** @brief connnect to list + /** @brief connect to list * * Try connecting to next client on list * until timeout lapses. Then throw exception. diff --git a/dbcon/execplan/constantcolumn.h b/dbcon/execplan/constantcolumn.h index e8fdf3812..3094f8b8d 100644 --- a/dbcon/execplan/constantcolumn.h +++ b/dbcon/execplan/constantcolumn.h @@ -67,22 +67,23 @@ class ConstantColumn : public ReturnedColumn /** * ctor */ - ConstantColumn(const std::string& sql, TYPE type = LITERAL); + explicit ConstantColumn(const std::string& sql, TYPE type = LITERAL); /** * ctor */ - ConstantColumn(const int64_t val, TYPE type = NUM); // deprecate + explicit ConstantColumn(const int64_t val, TYPE type = NUM); // deprecate /** * ctor */ - ConstantColumn(const uint64_t val, TYPE type = NUM, int8_t scale = 0, uint8_t precision = 0); // deprecate + explicit ConstantColumn(const uint64_t val, TYPE type = NUM, int8_t scale = 0, + uint8_t precision = 0); // deprecate // There are more ctors below... /** * dtor */ - virtual ~ConstantColumn(); + ~ConstantColumn() override; /* * Accessor Methods @@ -144,25 +145,25 @@ class ConstantColumn : public ReturnedColumn /** * accessor */ - virtual const std::string data() const override; + const std::string data() const override; /** * accessor */ - virtual void data(const std::string data) override + void data(const std::string data) override { fData = data; } /** * accessor */ - virtual const std::string toString() const override; + const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual ConstantColumn* clone() const override + inline ConstantColumn* clone() const override { return new ConstantColumn(*this); } @@ -173,18 +174,18 @@ class ConstantColumn : public ReturnedColumn /** * serialize */ - virtual void serialize(messageqcpp::ByteStream&) const override; + void serialize(messageqcpp::ByteStream&) const override; /** * unserialize */ - virtual void unserialize(messageqcpp::ByteStream&) override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -198,7 +199,7 @@ class ConstantColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -207,13 +208,13 @@ class ConstantColumn : public ReturnedColumn */ bool operator!=(const ConstantColumn& t) const; - virtual bool hasWindowFunc() override + bool hasWindowFunc() override { return false; } /** Constant column on the filte can always be moved into derived table */ - virtual void setDerivedTable() override + void setDerivedTable() override { fDerivedTable = std::string("*"); } @@ -267,7 +268,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override + bool getBoolVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return TreeNode::getBoolVal(); @@ -275,7 +276,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return fResult.strVal; @@ -283,7 +284,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return fResult.intVal; @@ -291,7 +292,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return fResult.uintVal; @@ -299,7 +300,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override + float getFloatVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return fResult.floatVal; @@ -307,7 +308,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override + double getDoubleVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return fResult.doubleVal; @@ -315,7 +316,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return fResult.decimalVal; @@ -323,7 +324,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override + int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); @@ -338,7 +339,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); @@ -354,7 +355,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); @@ -370,7 +371,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); @@ -409,7 +410,7 @@ class ConstantColumnNull : public ConstantColumn class ConstantColumnString : public ConstantColumn { public: - ConstantColumnString(const std::string& str) : ConstantColumn(str, ConstantColumn::LITERAL) + explicit ConstantColumnString(const std::string& str) : ConstantColumn(str, ConstantColumn::LITERAL) { } }; @@ -471,7 +472,6 @@ std::ostream& operator<<(std::ostream& output, const ConstantColumn& rhs); class RollupMarkColumn : public ReturnedColumn { public: - /** * ctor */ @@ -483,7 +483,7 @@ class RollupMarkColumn : public ReturnedColumn /** * dtor */ - virtual ~RollupMarkColumn(); + ~RollupMarkColumn() override; /** * accessor @@ -502,26 +502,26 @@ class RollupMarkColumn : public ReturnedColumn /** * accessor */ - virtual const std::string data() const override + const std::string data() const override { return ""; } /** * accessor */ - virtual void data(const std::string data) override + void data(const std::string data) override { idbassert(0); } /** * accessor */ - virtual const std::string toString() const override + const std::string toString() const override { return "RollupMarkColumn"; } - virtual std::string toCppCode(IncludeSet& includes) const override + std::string toCppCode(IncludeSet& includes) const override { idbassert(0); } @@ -529,7 +529,7 @@ class RollupMarkColumn : public ReturnedColumn * * deep copy of this pointer and return the copy */ - inline virtual RollupMarkColumn* clone() const override + inline RollupMarkColumn* clone() const override { return new RollupMarkColumn(); } @@ -540,18 +540,18 @@ class RollupMarkColumn : public ReturnedColumn /** * serialize */ - virtual void serialize(messageqcpp::ByteStream&) const override; + void serialize(messageqcpp::ByteStream&) const override; /** * unserialize */ - virtual void unserialize(messageqcpp::ByteStream&) override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override + bool operator==(const TreeNode* t) const override { return false; } @@ -571,7 +571,7 @@ class RollupMarkColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override + bool operator!=(const TreeNode* t) const override { return true; } @@ -586,13 +586,13 @@ class RollupMarkColumn : public ReturnedColumn return false; } - virtual bool hasWindowFunc() override + bool hasWindowFunc() override { return false; } /** Constant column on the filte can always be moved into derived table */ - virtual void setDerivedTable() override + void setDerivedTable() override { fDerivedTable = std::string("*"); } @@ -617,18 +617,18 @@ class RollupMarkColumn : public ReturnedColumn /** * F&E */ - virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override + bool getBoolVal(rowgroup::Row& row, bool& isNull) override { return true; } /** * F&E */ - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; /** * F&E */ - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull) override { isNull = false; return 0x12340000UL; @@ -636,28 +636,28 @@ class RollupMarkColumn : public ReturnedColumn /** * F&E */ - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override { return getIntVal(row, isNull); } /** * F&E */ - virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override + float getFloatVal(rowgroup::Row& row, bool& isNull) override { return getIntVal(row, isNull); } /** * F&E */ - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override + double getDoubleVal(rowgroup::Row& row, bool& isNull) override { return getIntVal(row, isNull); } /** * F&E */ - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override { isNull = false; return fResult.decimalVal; @@ -665,7 +665,7 @@ class RollupMarkColumn : public ReturnedColumn /** * F&E */ - virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override + int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override { isNull = false; @@ -680,7 +680,7 @@ class RollupMarkColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override { isNull = false; @@ -696,7 +696,7 @@ class RollupMarkColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override { isNull = false; @@ -712,7 +712,7 @@ class RollupMarkColumn : public ReturnedColumn /** * F&E */ - virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override { isNull = false; diff --git a/dbcon/execplan/constantfilter.h b/dbcon/execplan/constantfilter.h index 5a3c49063..0174604f0 100644 --- a/dbcon/execplan/constantfilter.h +++ b/dbcon/execplan/constantfilter.h @@ -64,7 +64,7 @@ class ConstantFilter : public Filter */ ConstantFilter(); ConstantFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs); - ConstantFilter(SimpleFilter* sf); + explicit ConstantFilter(SimpleFilter* sf); // for code generation purposes only ConstantFilter(const SOP& op, const FilterList& filterList, const SRCP& col, const std::string& functionName, const std::string& data); @@ -75,7 +75,7 @@ class ConstantFilter : public Filter /** * Destructors */ - virtual ~ConstantFilter(); + ~ConstantFilter() override; /** * Accessor Methods @@ -114,20 +114,20 @@ class ConstantFilter : public Filter } // virtual const std::string data() const; - virtual const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + const std::string toString() const override; + std::string toCppCode(IncludeSet& includes) const override; /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -141,7 +141,7 @@ class ConstantFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -188,17 +188,17 @@ class ConstantFilter : public Filter FilterList fFilterList; /// vector of simple filters SRCP fCol; /// the common column std::string fFunctionName; /// function name - /*********************************************************** - * F&E framework * - ***********************************************************/ + /*********************************************************** + * F&E framework * + ***********************************************************/ public: ConstantFilter(const ConstantFilter& rhs); - inline virtual ConstantFilter* clone() const override + inline ConstantFilter* clone() const override { return new ConstantFilter(*this); } - inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override; + inline bool getBoolVal(rowgroup::Row& row, bool& isNull) override; // get all simple columns involved in this column const std::vector& simpleColumnList(); diff --git a/dbcon/execplan/existsfilter.h b/dbcon/execplan/existsfilter.h index 89cb6e627..f807c2f5a 100644 --- a/dbcon/execplan/existsfilter.h +++ b/dbcon/execplan/existsfilter.h @@ -49,9 +49,9 @@ class ExistsFilter : public Filter * Constructors */ ExistsFilter(); - ExistsFilter(const SCSEP& sub, const bool existsFlag = false, const bool correlated = false); + explicit ExistsFilter(const SCSEP& sub, const bool existsFlag = false, const bool correlated = false); ExistsFilter(const ExistsFilter& rhs); - virtual ~ExistsFilter(); + ~ExistsFilter() override; /** * Accessor Methods @@ -87,19 +87,19 @@ class ExistsFilter : public Filter * Overloaded stream operator */ // virtual std::ostream& operator<< (std::ostream& output); - virtual const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + const std::string toString() const override; + std::string toCppCode(IncludeSet& includes) const override; /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual ExistsFilter* clone() const override + inline ExistsFilter* clone() const override { return new ExistsFilter(*this); } @@ -109,7 +109,7 @@ class ExistsFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -123,7 +123,7 @@ class ExistsFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * diff --git a/dbcon/execplan/expressionparser.h b/dbcon/execplan/expressionparser.h index 5a9af0d16..611a28eb6 100644 --- a/dbcon/execplan/expressionparser.h +++ b/dbcon/execplan/expressionparser.h @@ -53,12 +53,12 @@ struct Token TreeNode* value; bool is_operator() const { - if (value == 0) + if (value == nullptr) return false; return (typeid(*value) == typeid(Operator)); } - Token() : value(0) + Token() : value(nullptr) { } Token(TreeNode* v) : value(v) diff --git a/dbcon/execplan/filter.h b/dbcon/execplan/filter.h index 7558971a4..cba6df5fb 100644 --- a/dbcon/execplan/filter.h +++ b/dbcon/execplan/filter.h @@ -60,14 +60,14 @@ class Filter : public TreeNode * Constructors */ Filter(); - Filter(const std::string& sql); + explicit Filter(const std::string& sql); // not needed yet // Filter(const Filter& rhs); /** * Destructors */ - virtual ~Filter(); + ~Filter() override; /** * Accessor Methods */ @@ -75,15 +75,15 @@ class Filter : public TreeNode /** * Operations */ - virtual const std::string toString() const override; + const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; - virtual const std::string data() const override + const std::string data() const override { return fData; } - virtual void data(const std::string data) override + void data(const std::string data) override { fData = data; } @@ -92,7 +92,7 @@ class Filter : public TreeNode * * deep copy of this pointer and return the copy */ - inline virtual Filter* clone() const override + inline Filter* clone() const override { return new Filter(*this); } @@ -100,15 +100,15 @@ class Filter : public TreeNode /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -122,7 +122,7 @@ class Filter : public TreeNode * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -133,9 +133,9 @@ class Filter : public TreeNode /** @brief test if this filter can be combined with the argument filter * This is for operation combine optimization - * @param f the filter that this fiter tries to combine with + * @param f the filter that this filter tries to combine with * @param op the operator that connects the two filters. if one or both of the - * two filters is constantFilter, need to make sure operator is consistant. + * two filters is constantFilter, need to make sure operator is consistent. * @return a filter(constantfilter) if successfully combined. otherwise * return NULL * For Oracle front end. Deprecated now. diff --git a/dbcon/execplan/functioncolumn.h b/dbcon/execplan/functioncolumn.h index 57843828c..cf7a3519b 100644 --- a/dbcon/execplan/functioncolumn.h +++ b/dbcon/execplan/functioncolumn.h @@ -51,11 +51,11 @@ class FunctionColumn : public ReturnedColumn { public: FunctionColumn(); - FunctionColumn(std::string& funcName); + explicit FunctionColumn(std::string& funcName); FunctionColumn(const std::string& functionName, const std::string& funcParmsInString, const uint32_t sessionID = 0); FunctionColumn(const FunctionColumn& rhs, const uint32_t sessionID = 0); - virtual ~FunctionColumn(); + ~FunctionColumn() override; /** get function name * @@ -131,19 +131,19 @@ class FunctionColumn : public ReturnedColumn fTimeZone = timeZone; } - virtual const std::string data() const override; - virtual void data(const std::string data) override + const std::string data() const override; + void data(const std::string data) override { fData = data; } - virtual const std::string toString() const override; + const std::string toString() const override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual FunctionColumn* clone() const override + inline FunctionColumn* clone() const override { return new FunctionColumn(*this); } @@ -151,20 +151,20 @@ class FunctionColumn : public ReturnedColumn /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; using ReturnedColumn::hasAggregate; - virtual bool hasAggregate() override; - virtual bool hasWindowFunc() override; - virtual void setDerivedTable() override; - virtual void replaceRealCol(std::vector&) override; + bool hasAggregate() override; + bool hasWindowFunc() override; + void setDerivedTable() override; + void replaceRealCol(std::vector&) override; virtual const std::vector& simpleColumnList() const override { return fSimpleColumnList; } - virtual void setSimpleColumnList() override; + void setSimpleColumnList() override; /** * Return the tableAlias name of the table that the column arguments belong to. * @@ -172,9 +172,9 @@ class FunctionColumn : public ReturnedColumn * @return true, if all arguments belong to one table * false, if multiple tables are involved in the function */ - virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override; + bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: /** @@ -190,7 +190,7 @@ class FunctionColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -204,7 +204,7 @@ class FunctionColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -217,7 +217,7 @@ class FunctionColumn : public ReturnedColumn * F&E framework * ***********************************************************/ public: - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); fResult.strVal.dropString(); @@ -228,32 +228,32 @@ class FunctionColumn : public ReturnedColumn } return fResult.strVal; } - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getIntVal(row, fFunctionParms, isNull, fOperationType); } - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getUintVal(row, fFunctionParms, isNull, fOperationType); } - virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override + float getFloatVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getFloatVal(row, fFunctionParms, isNull, fOperationType); } - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override + double getDoubleVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getDoubleVal(row, fFunctionParms, isNull, fOperationType); } - virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override + long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getLongDoubleVal(row, fFunctionParms, isNull, fOperationType); } - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); IDB_Decimal decimal = fFunctor->getDecimalVal(row, fFunctionParms, isNull, fOperationType); @@ -290,36 +290,37 @@ class FunctionColumn : public ReturnedColumn if (fResultType.scale > decimal.scale) decimal.value *= IDB_pow[fResultType.scale - decimal.scale]; else - decimal.value = (int64_t)( - decimal.value > 0 ? (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] + 0.5 - : (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] - 0.5); + decimal.value = + (int64_t)(decimal.value > 0 + ? (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] + 0.5 + : (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] - 0.5); } decimal.scale = fResultType.scale; decimal.precision = std::max(fResultType.precision, static_cast(decimal.precision)); return decimal; } - virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override + bool getBoolVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getBoolVal(row, fFunctionParms, isNull, fOperationType); } - virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override + int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getDateIntVal(row, fFunctionParms, isNull, fOperationType); } - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getDatetimeIntVal(row, fFunctionParms, isNull, fOperationType); } - virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getTimestampIntVal(row, fFunctionParms, isNull, fOperationType); } - virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); return fFunctor->getTimeIntVal(row, fFunctionParms, isNull, fOperationType); @@ -332,8 +333,8 @@ class FunctionColumn : public ReturnedColumn private: funcexp::FunctionParm fFunctionParms; - funcexp::Func* fFunctor; /// functor to execute this function - funcexp::Func* fDynamicFunctor = NULL; // for rand encode decode + funcexp::Func* fFunctor; /// functor to execute this function + funcexp::Func* fDynamicFunctor = nullptr; // for rand encode decode bool fFixed = false; }; diff --git a/dbcon/execplan/groupconcatcolumn.h b/dbcon/execplan/groupconcatcolumn.h index af65ff08c..70bc6b660 100644 --- a/dbcon/execplan/groupconcatcolumn.h +++ b/dbcon/execplan/groupconcatcolumn.h @@ -52,25 +52,25 @@ class GroupConcatColumn : public AggregateColumn */ GroupConcatColumn(); - GroupConcatColumn(const uint32_t sessionID); + explicit GroupConcatColumn(const uint32_t sessionID); GroupConcatColumn(const GroupConcatColumn& rhs, const uint32_t sessionID = 0); /** * Destructors */ - virtual ~GroupConcatColumn(); + ~GroupConcatColumn() override; /** * Overloaded stream operator */ - virtual const std::string toString() const override; + const std::string toString() const override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - virtual GroupConcatColumn* clone() const override + GroupConcatColumn* clone() const override { return new GroupConcatColumn(*this); } @@ -98,8 +98,8 @@ class GroupConcatColumn : public AggregateColumn /** * Serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -107,7 +107,7 @@ class GroupConcatColumn : public AggregateColumn * @return true iff every member of t is a duplicate copy of every member of this; * false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -124,7 +124,7 @@ class GroupConcatColumn : public AggregateColumn * @return false iff every member of t is a duplicate copy of every member of this; * true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -135,7 +135,7 @@ class GroupConcatColumn : public AggregateColumn using AggregateColumn::operator!=; virtual bool operator!=(const GroupConcatColumn& t) const; - virtual string toCppCode(IncludeSet& includes) const override; + string toCppCode(IncludeSet& includes) const override; private: std::vector fOrderCols; diff --git a/dbcon/execplan/intervalcolumn.h b/dbcon/execplan/intervalcolumn.h index 7c8ffe376..3017de68a 100644 --- a/dbcon/execplan/intervalcolumn.h +++ b/dbcon/execplan/intervalcolumn.h @@ -79,9 +79,7 @@ class IntervalColumn : public ReturnedColumn IntervalColumn(); IntervalColumn(SRCP&, int); IntervalColumn(const IntervalColumn& rhs, const uint32_t sessionID = 0); - virtual ~IntervalColumn() - { - } + ~IntervalColumn() override = default; const SRCP& val() const { return fVal; @@ -99,22 +97,22 @@ class IntervalColumn : public ReturnedColumn fIntervalType = intervalType; } const std::string toString() const override; - inline virtual IntervalColumn* clone() const override + inline IntervalColumn* clone() const override { return new IntervalColumn(*this); } using ReturnedColumn::hasAggregate; - virtual bool hasAggregate() override + bool hasAggregate() override { return false; } - virtual bool hasWindowFunc() override + bool hasWindowFunc() override { return false; } - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: /** @@ -124,12 +122,12 @@ class IntervalColumn : public ReturnedColumn int fIntervalType; // okay to be private for now. - virtual bool operator==(const TreeNode* t) const override + bool operator==(const TreeNode* t) const override { return false; } bool operator==(const IntervalColumn& t) const; - virtual bool operator!=(const TreeNode* t) const override + bool operator!=(const TreeNode* t) const override { return false; } diff --git a/dbcon/execplan/jsonarrayaggcolumn.h b/dbcon/execplan/jsonarrayaggcolumn.h index 980ca1549..edafd3d0b 100644 --- a/dbcon/execplan/jsonarrayaggcolumn.h +++ b/dbcon/execplan/jsonarrayaggcolumn.h @@ -47,25 +47,25 @@ class JsonArrayAggColumn : public AggregateColumn */ JsonArrayAggColumn(); - JsonArrayAggColumn(const uint32_t sessionID); + explicit JsonArrayAggColumn(const uint32_t sessionID); JsonArrayAggColumn(const JsonArrayAggColumn& rhs, const uint32_t sessionID = 0); /** * Destructors */ - virtual ~JsonArrayAggColumn(); + ~JsonArrayAggColumn() override; /** * Overloaded stream operator */ - virtual const std::string toString() const override; + const std::string toString() const override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - virtual JsonArrayAggColumn* clone() const override + JsonArrayAggColumn* clone() const override { return new JsonArrayAggColumn(*this); } @@ -93,8 +93,8 @@ class JsonArrayAggColumn : public AggregateColumn /** * Serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -102,7 +102,7 @@ class JsonArrayAggColumn : public AggregateColumn * @return true iff every member of t is a duplicate copy of every member of this; * false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -119,7 +119,7 @@ class JsonArrayAggColumn : public AggregateColumn * @return false iff every member of t is a duplicate copy of every member of this; * true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -130,7 +130,7 @@ class JsonArrayAggColumn : public AggregateColumn using AggregateColumn::operator!=; virtual bool operator!=(const JsonArrayAggColumn& t) const; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: std::vector fOrderCols; diff --git a/dbcon/execplan/logicoperator.h b/dbcon/execplan/logicoperator.h index 13a0126ff..3bc9d4cab 100644 --- a/dbcon/execplan/logicoperator.h +++ b/dbcon/execplan/logicoperator.h @@ -27,7 +27,7 @@ #include #include -//#include "expressionparser.h" +// #include "expressionparser.h" #include "operator.h" #include "parsetree.h" @@ -64,13 +64,13 @@ class LogicOperator : public Operator * Constructors */ LogicOperator(); - LogicOperator(const std::string& operatorName); + explicit LogicOperator(const std::string& operatorName); LogicOperator(const LogicOperator& rhs); /** * Destructors */ - virtual ~LogicOperator(); + ~LogicOperator() override; /** * Accessor Methods @@ -80,7 +80,7 @@ class LogicOperator : public Operator * * deep copy of this pointer and return the copy */ - inline virtual LogicOperator* clone() const override + inline LogicOperator* clone() const override { return new LogicOperator(*this); } @@ -88,15 +88,15 @@ class LogicOperator : public Operator /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -110,7 +110,7 @@ class LogicOperator : public Operator * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -123,7 +123,7 @@ class LogicOperator : public Operator // F&E framework using Operator::getBoolVal; - inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + inline bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { switch (fOp) { @@ -165,12 +165,12 @@ class LogicOperator : public Operator } using TreeNode::evaluate; - inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + inline void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { fResult.boolVal = getBoolVal(row, isNull, lop, rop); } - inline virtual std::string toCppCode(IncludeSet& includes) const override + inline std::string toCppCode(IncludeSet& includes) const override { includes.insert("logicoperator.h"); std::stringstream ss; diff --git a/dbcon/execplan/mcsanalyzetableexecutionplan.h b/dbcon/execplan/mcsanalyzetableexecutionplan.h index 5dc6d8270..a33dfe504 100644 --- a/dbcon/execplan/mcsanalyzetableexecutionplan.h +++ b/dbcon/execplan/mcsanalyzetableexecutionplan.h @@ -54,7 +54,7 @@ class MCSAnalyzeTableExecutionPlan : public CalpontExecutionPlan { } - virtual ~MCSAnalyzeTableExecutionPlan() = default; + ~MCSAnalyzeTableExecutionPlan() override = default; const ReturnedColumnList& returnedCols() const { @@ -232,16 +232,16 @@ class MCSAnalyzeTableExecutionPlan : public CalpontExecutionPlan return ((fSessionID & 0x80000000) != 0); } - virtual void serialize(messageqcpp::ByteStream& bs) const; + void serialize(messageqcpp::ByteStream& bs) const override; - virtual void unserialize(messageqcpp::ByteStream& bs); + void unserialize(messageqcpp::ByteStream& bs) override; // TODO: Why do we need this? - virtual bool operator==(const CalpontExecutionPlan* t) const + bool operator==(const CalpontExecutionPlan* t) const override { return false; } - virtual bool operator!=(const CalpontExecutionPlan* t) const + bool operator!=(const CalpontExecutionPlan* t) const override { return false; } diff --git a/dbcon/execplan/objectreader.h b/dbcon/execplan/objectreader.h index 1bcd359c2..07c15fb3b 100644 --- a/dbcon/execplan/objectreader.h +++ b/dbcon/execplan/objectreader.h @@ -28,7 +28,7 @@ #include #include -#include +#include namespace messageqcpp { @@ -53,9 +53,9 @@ class ObjectReader class UnserializeException : public std::exception { public: - UnserializeException(std::string) throw(); - virtual ~UnserializeException() throw(); - virtual const char* what() const throw(); + explicit UnserializeException(std::string) noexcept; + ~UnserializeException() noexcept override; + const char* what() const noexcept override; private: std::string fWhat; diff --git a/dbcon/execplan/operator.h b/dbcon/execplan/operator.h index e1598fbe0..63b14be52 100644 --- a/dbcon/execplan/operator.h +++ b/dbcon/execplan/operator.h @@ -70,23 +70,23 @@ class Operator : public TreeNode { public: Operator(); - Operator(const std::string& operatorName); + explicit Operator(const std::string& operatorName); Operator(const Operator& rhs); - virtual ~Operator(); + ~Operator() override; - virtual const std::string toString() const override; - virtual const std::string data() const override + const std::string toString() const override; + const std::string data() const override { return fData; } - virtual void data(const std::string data) override; + void data(const std::string data) override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual Operator* clone() const override + inline Operator* clone() const override { return new Operator(*this); } @@ -101,15 +101,15 @@ class Operator : public TreeNode /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -123,7 +123,7 @@ class Operator : public TreeNode * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -139,7 +139,7 @@ class Operator : public TreeNode */ virtual void reverseOp(); - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; protected: std::string fData; @@ -231,11 +231,11 @@ class Operator : public TreeNode virtual void setOpType(Type& l, Type& r) { } - virtual void operationType(const Type& ot) override + void operationType(const Type& ot) override { fOperationType = ot; } - virtual const Type& operationType() const override + const Type& operationType() const override { return fOperationType; } diff --git a/dbcon/execplan/outerjoinonfilter.h b/dbcon/execplan/outerjoinonfilter.h index 1ba6ea3ae..9315aad22 100644 --- a/dbcon/execplan/outerjoinonfilter.h +++ b/dbcon/execplan/outerjoinonfilter.h @@ -49,9 +49,9 @@ class OuterJoinOnFilter : public Filter * Constructors */ OuterJoinOnFilter(); - OuterJoinOnFilter(const SPTP& pt); + explicit OuterJoinOnFilter(const SPTP& pt); OuterJoinOnFilter(const OuterJoinOnFilter& rhs); - virtual ~OuterJoinOnFilter(); + ~OuterJoinOnFilter() override; /** * Accessor Methods @@ -69,19 +69,19 @@ class OuterJoinOnFilter : public Filter * Overloaded stream operator */ // virtual std::ostream& operator<< (std::ostream& output); - virtual const std::string toString() const override; + const std::string toString() const override; /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual OuterJoinOnFilter* clone() const override + inline OuterJoinOnFilter* clone() const override { return new OuterJoinOnFilter(*this); } @@ -91,7 +91,7 @@ class OuterJoinOnFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -105,7 +105,7 @@ class OuterJoinOnFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -113,7 +113,8 @@ class OuterJoinOnFilter : public Filter * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ bool operator!=(const OuterJoinOnFilter& t) const; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; + private: // default okay? // OuterJoinOnFilter& operator=(const OuterJoinOnFilter& rhs); diff --git a/dbcon/execplan/parsetree.h b/dbcon/execplan/parsetree.h index c9c9f2b24..5c190fdc0 100644 --- a/dbcon/execplan/parsetree.h +++ b/dbcon/execplan/parsetree.h @@ -59,7 +59,7 @@ class ParseTree * Constructor / Destructor */ inline ParseTree(); - inline ParseTree(TreeNode* data); + inline explicit ParseTree(TreeNode* data); inline ParseTree(TreeNode* data, ParseTree* left, ParseTree* right); inline ParseTree(const ParseTree& rhs); inline virtual ~ParseTree(); @@ -210,9 +210,9 @@ class ParseTree inline static void deleter(ParseTree*& n) { delete n->fData; - n->fData = 0; + n->fData = nullptr; delete n; - n = 0; + n = nullptr; } inline void derivedTable(const std::string& derivedTable) @@ -238,7 +238,7 @@ class ParseTree { ParseTree* node; GoTo direction; - StackFrame(ParseTree* node_, GoTo direction_ = GoTo::Left) : node(node_), direction(direction_) + explicit StackFrame(ParseTree* node_, GoTo direction_ = GoTo::Left) : node(node_), direction(direction_) { } }; @@ -370,11 +370,11 @@ namespace execplan /** * Class Definition */ -inline ParseTree::ParseTree() : fData(0), fLeft(0), fRight(0), fDerivedTable("") +inline ParseTree::ParseTree() : fData(nullptr), fLeft(nullptr), fRight(nullptr), fDerivedTable("") { } -inline ParseTree::ParseTree(TreeNode* data) : fData(data), fLeft(0), fRight(0) +inline ParseTree::ParseTree(TreeNode* data) : fData(data), fLeft(nullptr), fRight(nullptr) { // bug5984. Need to validate data to be not null if (data) @@ -389,7 +389,7 @@ inline ParseTree::ParseTree(TreeNode* data, ParseTree* left, ParseTree* right) } inline ParseTree::ParseTree(const ParseTree& rhs) - : fData(0), fLeft(0), fRight(0), fDerivedTable(rhs.fDerivedTable) + : fData(nullptr), fLeft(nullptr), fRight(nullptr), fDerivedTable(rhs.fDerivedTable) { copyTree(rhs); } @@ -613,22 +613,22 @@ inline ParseTree& ParseTree::operator=(const ParseTree& rhs) inline void ParseTree::copyTree(const ParseTree& src) { - if (fLeft != NULL) + if (fLeft != nullptr) delete fLeft; - if (fRight != NULL) + if (fRight != nullptr) delete fRight; - fLeft = NULL; - fRight = NULL; + fLeft = nullptr; + fRight = nullptr; - if (src.left() != NULL) + if (src.left() != nullptr) { fLeft = new ParseTree(); fLeft->copyTree(*(src.left())); } - if (src.right() != NULL) + if (src.right() != nullptr) { fRight = new ParseTree(); fRight->copyTree(*(src.right())); @@ -636,29 +636,29 @@ inline void ParseTree::copyTree(const ParseTree& src) delete fData; - if (src.data() == NULL) - fData = NULL; + if (src.data() == nullptr) + fData = nullptr; else fData = src.data()->clone(); } inline void ParseTree::destroyTree(ParseTree* root) { - if (root == NULL) + if (root == nullptr) return; - if (root->left() != NULL) + if (root->left() != nullptr) { destroyTree(root->fLeft); } - if (root->right() != NULL) + if (root->right() != nullptr) { destroyTree(root->fRight); } delete root; - root = 0; + root = nullptr; } inline void ParseTree::draw(const ParseTree* n, std::ostream& dotFile) @@ -668,13 +668,11 @@ inline void ParseTree::draw(const ParseTree* n, std::ostream& dotFile) l = n->left(); r = n->right(); - if (l != 0) - dotFile << "n" << (void*)n << " -> " - << "n" << (void*)l << std::endl; + if (l != nullptr) + dotFile << "n" << (void*)n << " -> " << "n" << (void*)l << std::endl; - if (r != 0) - dotFile << "n" << (void*)n << " -> " - << "n" << (void*)r << std::endl; + if (r != nullptr) + dotFile << "n" << (void*)n << " -> " << "n" << (void*)r << std::endl; auto& node = *(n->data()); dotFile << "n" << (void*)n << " [label=\"" << n->data()->data() << " (" << n << ") " diff --git a/dbcon/execplan/predicateoperator.h b/dbcon/execplan/predicateoperator.h index 8e3827e77..434c2c768 100644 --- a/dbcon/execplan/predicateoperator.h +++ b/dbcon/execplan/predicateoperator.h @@ -27,7 +27,7 @@ #include #include -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) #include #else #include @@ -52,15 +52,15 @@ class PredicateOperator : public Operator { public: PredicateOperator(); - PredicateOperator(const std::string& operatorName); + explicit PredicateOperator(const std::string& operatorName); PredicateOperator(const PredicateOperator& rhs); - virtual ~PredicateOperator(); + ~PredicateOperator() override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual PredicateOperator* clone() const override + inline PredicateOperator* clone() const override { return new PredicateOperator(*this); } @@ -68,15 +68,15 @@ class PredicateOperator : public Operator /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -90,7 +90,7 @@ class PredicateOperator : public Operator * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -107,10 +107,10 @@ class PredicateOperator : public Operator * F&E framework * ***********************************************************/ using Operator::getBoolVal; - virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedColumn* lop, ReturnedColumn* rop) override; + bool getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedColumn* lop, ReturnedColumn* rop) override; void setOpType(Type& l, Type& r) override; - inline virtual std::string toCppCode(IncludeSet& includes) const override + inline std::string toCppCode(IncludeSet& includes) const override { includes.insert("predicateoperator.h"); std::stringstream ss; diff --git a/dbcon/execplan/pseudocolumn.h b/dbcon/execplan/pseudocolumn.h index 661d3269b..0f55e4844 100644 --- a/dbcon/execplan/pseudocolumn.h +++ b/dbcon/execplan/pseudocolumn.h @@ -62,7 +62,7 @@ class PseudoColumn : public SimpleColumn * Constructors */ PseudoColumn(); - PseudoColumn(const uint32_t pseudoType); + explicit PseudoColumn(const uint32_t pseudoType); PseudoColumn(const std::string& token, const uint32_t pseudoType, const uint32_t sessionID = 0); PseudoColumn(const std::string& schema, const std::string& table, const std::string& col, const uint32_t pseudoType, const uint32_t sessionID = 0); @@ -74,13 +74,13 @@ class PseudoColumn : public SimpleColumn /** * Destructor */ - virtual ~PseudoColumn(); + ~PseudoColumn() override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual PseudoColumn* clone() const override + inline PseudoColumn* clone() const override { return new PseudoColumn(*this); } @@ -106,17 +106,17 @@ class PseudoColumn : public SimpleColumn /** * The serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; - virtual const std::string toString() const override; + const std::string toString() const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -130,7 +130,7 @@ class PseudoColumn : public SimpleColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -141,7 +141,7 @@ class PseudoColumn : public SimpleColumn static uint32_t pseudoNameToType(std::string& name); - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: /** diff --git a/dbcon/execplan/returnedcolumn.h b/dbcon/execplan/returnedcolumn.h index 2f77e7e1c..00031de8d 100644 --- a/dbcon/execplan/returnedcolumn.h +++ b/dbcon/execplan/returnedcolumn.h @@ -83,20 +83,20 @@ class ReturnedColumn : public TreeNode * Constructors */ ReturnedColumn(); - ReturnedColumn(const std::string& sql); - ReturnedColumn(const uint32_t sessionID, const bool returnAll = false); + explicit ReturnedColumn(const std::string& sql); + explicit ReturnedColumn(const uint32_t sessionID, const bool returnAll = false); ReturnedColumn(const ReturnedColumn& rhs, const uint32_t sessionID = 0); /** * Destructors */ - virtual ~ReturnedColumn(); + ~ReturnedColumn() override; /** * Accessor Methods */ - virtual const std::string data() const override; - virtual void data(const std::string data) override + const std::string data() const override; + void data(const std::string data) override { fData = data; } @@ -231,22 +231,22 @@ class ReturnedColumn : public TreeNode /** * Operations */ - virtual ReturnedColumn* clone() const override = 0; + ReturnedColumn* clone() const override = 0; /** * The serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; - virtual const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + const std::string toString() const override; + std::string toCppCode(IncludeSet& includes) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -261,7 +261,7 @@ class ReturnedColumn : public TreeNode * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * diff --git a/dbcon/execplan/rowcolumn.h b/dbcon/execplan/rowcolumn.h index 94fb666db..73e80b4b7 100644 --- a/dbcon/execplan/rowcolumn.h +++ b/dbcon/execplan/rowcolumn.h @@ -56,13 +56,13 @@ class RowColumn : public ReturnedColumn /** * Constructors */ - RowColumn(const uint32_t sessionID = 0); + explicit RowColumn(const uint32_t sessionID = 0); RowColumn(const RowColumn& rhs, const uint32_t sessionID = 0); - RowColumn(const std::vector& columnVec, const uint32_t sessionID = 0); + explicit RowColumn(const std::vector& columnVec, const uint32_t sessionID = 0); /** * Destructor */ - virtual ~RowColumn(); + ~RowColumn() override; /** * Accessor Methods @@ -80,7 +80,7 @@ class RowColumn : public ReturnedColumn * * deep copy of this pointer and return the copy */ - inline virtual RowColumn* clone() const override + inline RowColumn* clone() const override { return new RowColumn(*this); } @@ -95,20 +95,20 @@ class RowColumn : public ReturnedColumn // virtual void serialize(messageqcpp::ByteStream&) const; // virtual void unserialize(messageqcpp::ByteStream&); - virtual const std::string toString() const override; + const std::string toString() const override; /** * Serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -122,7 +122,7 @@ class RowColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -131,16 +131,16 @@ class RowColumn : public ReturnedColumn */ bool operator!=(const RowColumn& t) const; using ReturnedColumn::hasAggregate; - virtual bool hasAggregate() override + bool hasAggregate() override { return false; } - virtual bool hasWindowFunc() override + bool hasWindowFunc() override { return false; } - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: /** @@ -156,23 +156,21 @@ class SubSelect : public ReturnedColumn SubSelect() : ReturnedColumn() { } - ~SubSelect() - { - } + ~SubSelect() override = default; SubSelect* clone() const override { return new SubSelect(); } using ReturnedColumn::hasAggregate; - virtual bool hasAggregate() override + bool hasAggregate() override { return false; } - virtual bool hasWindowFunc() override + bool hasWindowFunc() override { return false; } - virtual const std::string toString() const override; + const std::string toString() const override; }; /** diff --git a/dbcon/execplan/selectfilter.h b/dbcon/execplan/selectfilter.h index d920e282c..712550333 100644 --- a/dbcon/execplan/selectfilter.h +++ b/dbcon/execplan/selectfilter.h @@ -63,7 +63,7 @@ class SelectFilter : public Filter /** * Destructors */ - virtual ~SelectFilter(); + ~SelectFilter() override; /** * Accessor Methods @@ -107,13 +107,13 @@ class SelectFilter : public Filter fCorrelated = correlated; } - virtual const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; - virtual inline const std::string data() const override + const std::string toString() const override; + std::string toCppCode(IncludeSet& includes) const override; + inline const std::string data() const override { return fData; } - virtual inline void data(const std::string data) override + inline void data(const std::string data) override { fData = data; } @@ -130,14 +130,14 @@ class SelectFilter : public Filter /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual SelectFilter* clone() const override + inline SelectFilter* clone() const override { return new SelectFilter(*this); } @@ -147,7 +147,7 @@ class SelectFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -161,7 +161,7 @@ class SelectFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * diff --git a/dbcon/execplan/sessionmanager.h b/dbcon/execplan/sessionmanager.h index b7e4c9685..0ea6a5b1a 100644 --- a/dbcon/execplan/sessionmanager.h +++ b/dbcon/execplan/sessionmanager.h @@ -67,7 +67,7 @@ namespace execplan * immediately, causing all subsequent references to fail. This only affects * 'leakcheck'. */ -//#define DESTROYSHMSEG +// #define DESTROYSHMSEG class SessionManager { @@ -94,7 +94,7 @@ class SessionManager * and no operation other than reset() should be performed on a * SessionManager instantiated with this. */ - SessionManager(bool nolock); + explicit SessionManager(bool nolock); /** @brief Destructor * @@ -211,4 +211,3 @@ class SessionManager }; } // namespace execplan - diff --git a/dbcon/execplan/sessionmonitor.h b/dbcon/execplan/sessionmonitor.h index 90a093367..1b1ba541e 100644 --- a/dbcon/execplan/sessionmonitor.h +++ b/dbcon/execplan/sessionmonitor.h @@ -36,7 +36,7 @@ #include "shmkeys.h" #include "brmtypes.h" -//#define SM_DEBUG +// #define SM_DEBUG namespace execplan { @@ -132,7 +132,7 @@ class SessionMonitor { txnCount = 0; verID = 0; - activeTxns = NULL; + activeTxns = nullptr; }; }; typedef struct SessionMonitorData_struct SessionMonitorData_t; diff --git a/dbcon/execplan/simplecolumn.h b/dbcon/execplan/simplecolumn.h index 836c927f5..241bb66e7 100644 --- a/dbcon/execplan/simplecolumn.h +++ b/dbcon/execplan/simplecolumn.h @@ -57,13 +57,15 @@ class SimpleColumn : public ReturnedColumn /** * Constructors */ - class ForTestPurposeWithoutOID{}; + class ForTestPurposeWithoutOID + { + }; SimpleColumn(); SimpleColumn(const std::string& token, ForTestPurposeWithoutOID); - SimpleColumn(const std::string& token, const uint32_t sessionID = 0); + explicit SimpleColumn(const std::string& token, const uint32_t sessionID = 0); SimpleColumn(const std::string& schema, const std::string& table, const std::string& col, const uint32_t sessionID = 0, const int lower_case_table_names = 0); @@ -75,7 +77,7 @@ class SimpleColumn : public ReturnedColumn /** * Destructor */ - virtual ~SimpleColumn(); + ~SimpleColumn() override; /** * Accessor Methods @@ -124,8 +126,8 @@ class SimpleColumn : public ReturnedColumn fOid = oid; } - virtual const std::string data() const override; - virtual void data(const std::string data) override + const std::string data() const override; + void data(const std::string data) override { fData = data; } @@ -179,7 +181,7 @@ class SimpleColumn : public ReturnedColumn * * deep copy of this pointer and return the copy */ - inline virtual SimpleColumn* clone() const override + inline SimpleColumn* clone() const override { return new SimpleColumn(*this); } @@ -191,17 +193,17 @@ class SimpleColumn : public ReturnedColumn /** * The serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; - virtual const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + const std::string toString() const override; + std::string toCppCode(IncludeSet& includes) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -217,7 +219,7 @@ class SimpleColumn : public ReturnedColumn * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -227,7 +229,7 @@ class SimpleColumn : public ReturnedColumn bool operator!=(const SimpleColumn& t) const; /** @brief check if this column is the same as the argument */ - virtual bool sameColumn(const ReturnedColumn* rc) const override; + bool sameColumn(const ReturnedColumn* rc) const override; /** @brief return column type of this column (could be of any engine type) */ const CalpontSystemCatalog::ColType& colType() const @@ -238,7 +240,7 @@ class SimpleColumn : public ReturnedColumn /** @brief set the column's OID from the syscat */ void setOID(); - virtual bool hasWindowFunc() override + bool hasWindowFunc() override { return false; } @@ -252,7 +254,7 @@ class SimpleColumn : public ReturnedColumn * @return true, if all arguments belong to one table * false, if multiple tables are involved in the function */ - virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override; + bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override; protected: /** @@ -282,13 +284,13 @@ class SimpleColumn : public ReturnedColumn * F&E framework * ***********************************************************/ public: - virtual void evaluate(rowgroup::Row& row, bool& isNull) override; - virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override + void evaluate(rowgroup::Row& row, bool& isNull) override; + bool getBoolVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getBoolVal(); } - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { bool localIsNull = false; evaluate(row, localIsNull); @@ -301,37 +303,37 @@ class SimpleColumn : public ReturnedColumn return TreeNode::getStrVal(fTimeZone); } - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getIntVal(); } - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getUintVal(); } - virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override + float getFloatVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getFloatVal(); } - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override + double getDoubleVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDoubleVal(); } - virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override + long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getLongDoubleVal(); } - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); diff --git a/dbcon/execplan/simplecolumn_decimal.h b/dbcon/execplan/simplecolumn_decimal.h index 8d4fd388b..2693962de 100644 --- a/dbcon/execplan/simplecolumn_decimal.h +++ b/dbcon/execplan/simplecolumn_decimal.h @@ -54,35 +54,33 @@ class SimpleColumn_Decimal : public SimpleColumn public: /** Constructors */ SimpleColumn_Decimal(); - SimpleColumn_Decimal(const std::string& token, const uint32_t sessionID = 0); + explicit SimpleColumn_Decimal(const std::string& token, const uint32_t sessionID = 0); SimpleColumn_Decimal(const std::string& schema, const std::string& table, const std::string& col, const bool isColumnStore, const uint32_t sessionID = 0); - SimpleColumn_Decimal(const SimpleColumn& rhs, const uint32_t sessionID = 0); + explicit SimpleColumn_Decimal(const SimpleColumn& rhs, const uint32_t sessionID = 0); /** Destructor */ - virtual ~SimpleColumn_Decimal() - { - } + ~SimpleColumn_Decimal() override = default; - inline virtual SimpleColumn_Decimal* clone() const override + inline SimpleColumn_Decimal* clone() const override { return new SimpleColumn_Decimal(*this); } /** Evaluate methods */ - virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; - virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; - virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; - virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; - virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; - virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override; + inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; + inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; + inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; + inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override; /** The serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; uint64_t fNullVal; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: void setNullVal(); diff --git a/dbcon/execplan/simplecolumn_int.h b/dbcon/execplan/simplecolumn_int.h index 0533c3596..2ceb78ec5 100644 --- a/dbcon/execplan/simplecolumn_int.h +++ b/dbcon/execplan/simplecolumn_int.h @@ -53,36 +53,34 @@ class SimpleColumn_INT : public SimpleColumn public: /** Constructors */ SimpleColumn_INT(); - SimpleColumn_INT(const std::string& token, const uint32_t sessionID = 0); + explicit SimpleColumn_INT(const std::string& token, const uint32_t sessionID = 0); SimpleColumn_INT(const std::string& schema, const std::string& table, const std::string& col, const bool isColumnStore, const uint32_t sessionID = 0); - SimpleColumn_INT(const SimpleColumn& rhs, const uint32_t sessionID = 0); + explicit SimpleColumn_INT(const SimpleColumn& rhs, const uint32_t sessionID = 0); /** Destructor */ - virtual ~SimpleColumn_INT() - { - } + ~SimpleColumn_INT() override = default; - inline virtual SimpleColumn_INT* clone() const override + inline SimpleColumn_INT* clone() const override { return new SimpleColumn_INT(*this); } /** Evaluate methods */ - virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; - virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; - virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override; - virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; - virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; - virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; - virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override; + inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; + inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; + inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override; + inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; + inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override; /** The serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; uint64_t fNullVal; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: void setNullVal(); @@ -93,8 +91,8 @@ std::string SimpleColumn_INT::toCppCode(IncludeSet& includes) const { includes.insert("simplecolumn_int.h"); std::stringstream ss; - ss << "SimpleColumn_INT<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) << ", " << - std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")"; + ss << "SimpleColumn_INT<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) + << ", " << std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")"; return ss.str(); } @@ -146,7 +144,7 @@ void SimpleColumn_INT::setNullVal() } template -inline const utils::NullString & SimpleColumn_INT::getStrVal(rowgroup::Row& row, bool& isNull) +inline const utils::NullString& SimpleColumn_INT::getStrVal(rowgroup::Row& row, bool& isNull) { if (row.equals(fNullVal, fInputIndex)) { diff --git a/dbcon/execplan/simplecolumn_uint.h b/dbcon/execplan/simplecolumn_uint.h index 2e5b67ab0..4fa6fb5a7 100644 --- a/dbcon/execplan/simplecolumn_uint.h +++ b/dbcon/execplan/simplecolumn_uint.h @@ -53,36 +53,34 @@ class SimpleColumn_UINT : public SimpleColumn public: /** Constructors */ SimpleColumn_UINT(); - SimpleColumn_UINT(const std::string& token, const uint32_t sessionID = 0); + explicit SimpleColumn_UINT(const std::string& token, const uint32_t sessionID = 0); SimpleColumn_UINT(const std::string& schema, const std::string& table, const std::string& col, const bool isColumnStore, const uint32_t sessionID = 0); - SimpleColumn_UINT(const SimpleColumn& rhs, const uint32_t sessionID = 0); + explicit SimpleColumn_UINT(const SimpleColumn& rhs, const uint32_t sessionID = 0); /** Destructor */ - virtual ~SimpleColumn_UINT() - { - } + ~SimpleColumn_UINT() override = default; - inline virtual SimpleColumn_UINT* clone() const override + inline SimpleColumn_UINT* clone() const override { return new SimpleColumn_UINT(*this); } /** Evaluate methods */ - virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; - virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; - virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override; - virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; - virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; - virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; - virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override; + inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; + inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; + inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override; + inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; + inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override; /** The serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; uint64_t fNullVal; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: void setNullVal(); diff --git a/dbcon/execplan/simplefilter.h b/dbcon/execplan/simplefilter.h index bc478ad0a..a732e5762 100644 --- a/dbcon/execplan/simplefilter.h +++ b/dbcon/execplan/simplefilter.h @@ -65,17 +65,19 @@ class SimpleFilter : public Filter SEMI }; - struct ForTestPurposesWithoutColumnsOIDS{}; + struct ForTestPurposesWithoutColumnsOIDS + { + }; SimpleFilter(); - SimpleFilter(const std::string& sql); + explicit SimpleFilter(const std::string& sql); SimpleFilter(const std::string& sql, ForTestPurposesWithoutColumnsOIDS); SimpleFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs, const long timeZone = 0); SimpleFilter(const SimpleFilter& rhs); - virtual ~SimpleFilter(); + ~SimpleFilter() override; - inline virtual SimpleFilter* clone() const override + inline SimpleFilter* clone() const override { return new SimpleFilter(*this); } @@ -106,7 +108,7 @@ class SimpleFilter : public Filter } using Filter::data; - virtual const std::string data() const override; + const std::string data() const override; /** assign fLhs * @@ -129,20 +131,20 @@ class SimpleFilter : public Filter */ void rhs(ReturnedColumn* rhs); - virtual const std::string toString() const override; + const std::string toString() const override; /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true if every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -160,7 +162,6 @@ class SimpleFilter : public Filter bool operator<(const SimpleFilter& t) const; - bool semanticEq(const SimpleFilter& t) const; /** @brief Do a deep, strict (as opposed to semantic) equivalence test @@ -168,7 +169,7 @@ class SimpleFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return false if every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -221,7 +222,7 @@ class SimpleFilter : public Filter static std::string escapeString(const std::string& input); - virtual string toCppCode(IncludeSet& includes) const override; + string toCppCode(IncludeSet& includes) const override; private: SOP fOp; /// operator @@ -237,10 +238,10 @@ class SimpleFilter : public Filter * F&E framework * ***********************************************************/ public: - inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override; - inline virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; - inline virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override; - inline virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline bool getBoolVal(rowgroup::Row& row, bool& isNull) override; + inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; + inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; + inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override; // get all simple columns involved in this column const std::vector& simpleColumnList(); diff --git a/dbcon/execplan/simplescalarfilter.h b/dbcon/execplan/simplescalarfilter.h index c7a37a193..dc2e6f3d2 100644 --- a/dbcon/execplan/simplescalarfilter.h +++ b/dbcon/execplan/simplescalarfilter.h @@ -65,7 +65,7 @@ class SimpleScalarFilter : public Filter /** * Destructors */ - virtual ~SimpleScalarFilter(); + ~SimpleScalarFilter() override; /** * Accessor Methods @@ -100,13 +100,13 @@ class SimpleScalarFilter : public Filter fSub = sub; } - virtual const std::string toString() const override; + const std::string toString() const override; - virtual inline const std::string data() const override + inline const std::string data() const override { return fData; } - virtual inline void data(const std::string data) override + inline void data(const std::string data) override { fData = data; } @@ -114,14 +114,14 @@ class SimpleScalarFilter : public Filter /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - inline virtual SimpleScalarFilter* clone() const override + inline SimpleScalarFilter* clone() const override { return new SimpleScalarFilter(*this); } @@ -131,7 +131,7 @@ class SimpleScalarFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -145,7 +145,7 @@ class SimpleScalarFilter : public Filter * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -154,7 +154,7 @@ class SimpleScalarFilter : public Filter */ bool operator!=(const SimpleScalarFilter& t) const; - virtual string toCppCode(IncludeSet& includes) const override; + string toCppCode(IncludeSet& includes) const override; private: // default okay? diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index 710c82eaa..25ee452b5 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -269,7 +269,9 @@ class TreeNode ***********************************************************************/ virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) { - isNull = isNull || fResult.strVal.isNull(); // XXX: NullString returns isNull, we should remove that parameter altogether. + isNull = isNull || + fResult.strVal + .isNull(); // XXX: NullString returns isNull, we should remove that parameter altogether. return fResult.strVal; } virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) @@ -475,19 +477,20 @@ inline const utils::NullString& TreeNode::getStrVal(const long timeZone) case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) { - const char *intAsChar = (const char*) (&fResult.origIntVal); + const char* intAsChar = (const char*)(&fResult.origIntVal); fResult.strVal.assign((const uint8_t*)intAsChar, strlen(intAsChar)); } break; case CalpontSystemCatalog::CHAR: - case CalpontSystemCatalog::VARBINARY: // XXX: TODO: we don't have varbinary support now, but it may be handled just like varchar. + case CalpontSystemCatalog::VARBINARY: // XXX: TODO: we don't have varbinary support now, but it may be + // handled just like varchar. case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: if (fResultType.colWidth <= 8) { - const char *intAsChar = (const char*) (&fResult.origIntVal); + const char* intAsChar = (const char*)(&fResult.origIntVal); fResult.strVal.assign((const uint8_t*)intAsChar, strlen(intAsChar)); } @@ -865,27 +868,27 @@ inline double TreeNode::getDoubleVal() { case CalpontSystemCatalog::CHAR: if (fResultType.colWidth <= 8) - return strtod((char*)(&fResult.origIntVal), NULL); + return strtod((char*)(&fResult.origIntVal), nullptr); idbassert(fResult.strVal.str()); - return strtod(fResult.strVal.str(), NULL); + return strtod(fResult.strVal.str(), nullptr); case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) - return strtod((char*)(&fResult.origIntVal), NULL); + return strtod((char*)(&fResult.origIntVal), nullptr); idbassert(fResult.strVal.str()); - return strtod(fResult.strVal.str(), NULL); + return strtod(fResult.strVal.str(), nullptr); // FIXME: ??? case CalpontSystemCatalog::VARBINARY: case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: if (fResultType.colWidth <= 7) - return strtod((char*)(&fResult.origIntVal), NULL); + return strtod((char*)(&fResult.origIntVal), nullptr); - //idbassert(fResult.strVal.str()); - return strtod(fResult.strVal.safeString("").c_str(), NULL); + // idbassert(fResult.strVal.str()); + return strtod(fResult.strVal.safeString("").c_str(), nullptr); case CalpontSystemCatalog::BIGINT: case CalpontSystemCatalog::TINYINT: @@ -936,27 +939,27 @@ inline long double TreeNode::getLongDoubleVal() { case CalpontSystemCatalog::CHAR: if (fResultType.colWidth <= 8) - return strtold((char*)(&fResult.origIntVal), NULL); + return strtold((char*)(&fResult.origIntVal), nullptr); idbassert(fResult.strVal.str()); - return strtold(fResult.strVal.str(), NULL); + return strtold(fResult.strVal.str(), nullptr); case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) - return strtold((char*)(&fResult.origIntVal), NULL); + return strtold((char*)(&fResult.origIntVal), nullptr); idbassert(fResult.strVal.str()); - return strtold(fResult.strVal.str(), NULL); + return strtold(fResult.strVal.str(), nullptr); // FIXME: ??? case CalpontSystemCatalog::VARBINARY: case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: if (fResultType.colWidth <= 7) - return strtold((char*)(&fResult.origIntVal), NULL); + return strtold((char*)(&fResult.origIntVal), nullptr); idbassert(fResult.strVal.str()); - return strtold(fResult.strVal.str(), NULL); + return strtold(fResult.strVal.str(), nullptr); case CalpontSystemCatalog::BIGINT: case CalpontSystemCatalog::TINYINT: diff --git a/dbcon/execplan/treenodeimpl.h b/dbcon/execplan/treenodeimpl.h index bae434ff6..bf98495f7 100644 --- a/dbcon/execplan/treenodeimpl.h +++ b/dbcon/execplan/treenodeimpl.h @@ -50,14 +50,14 @@ class TreeNodeImpl : public TreeNode * Constructors */ TreeNodeImpl(); - TreeNodeImpl(const std::string& sql); + explicit TreeNodeImpl(const std::string& sql); // not needed yet // TreeNodeImpl(const TreeNodeImpl& rhs); /** * Destructors */ - virtual ~TreeNodeImpl(); + ~TreeNodeImpl() override; /** * Accessor Methods */ @@ -65,13 +65,13 @@ class TreeNodeImpl : public TreeNode /** * Operations */ - virtual const std::string toString() const override; + const std::string toString() const override; - virtual const std::string data() const override + const std::string data() const override { return fData; } - virtual void data(const std::string data) override + void data(const std::string data) override { fData = data; } @@ -80,7 +80,7 @@ class TreeNodeImpl : public TreeNode * * deep copy of this pointer and return the copy */ - inline virtual TreeNodeImpl* clone() const override + inline TreeNodeImpl* clone() const override { return new TreeNodeImpl(*this); } @@ -88,15 +88,15 @@ class TreeNodeImpl : public TreeNode /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * * Do a deep, strict (as opposed to semantic) equivalence test. * @return true iff every member of t is a duplicate copy of every member of this; false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -110,7 +110,7 @@ class TreeNodeImpl : public TreeNode * Do a deep, strict (as opposed to semantic) equivalence test. * @return false iff every member of t is a duplicate copy of every member of this; true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -119,7 +119,8 @@ class TreeNodeImpl : public TreeNode */ bool operator!=(const TreeNodeImpl& t) const; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; + private: // default okay // TreeNodeImpl& operator=(const TreeNodeImpl& rhs); diff --git a/dbcon/execplan/udafcolumn.h b/dbcon/execplan/udafcolumn.h index 95191ddac..4691d0aa0 100644 --- a/dbcon/execplan/udafcolumn.h +++ b/dbcon/execplan/udafcolumn.h @@ -48,25 +48,25 @@ class UDAFColumn : public AggregateColumn */ UDAFColumn(); - UDAFColumn(const uint32_t sessionID); + explicit UDAFColumn(const uint32_t sessionID); UDAFColumn(const UDAFColumn& rhs, const uint32_t sessionID = 0); /** * Destructors */ - virtual ~UDAFColumn(); + ~UDAFColumn() override; /** * Overloaded stream operator */ - virtual const std::string toString() const override; + const std::string toString() const override; /** return a copy of this pointer * * deep copy of this pointer and return the copy */ - virtual UDAFColumn* clone() const override + UDAFColumn* clone() const override { return new UDAFColumn(*this); } @@ -82,8 +82,8 @@ class UDAFColumn : public AggregateColumn /** * Serialize interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -91,7 +91,7 @@ class UDAFColumn : public AggregateColumn * @return true iff every member of t is a duplicate copy of every member of this; * false otherwise */ - virtual bool operator==(const TreeNode* t) const override; + bool operator==(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -108,7 +108,7 @@ class UDAFColumn : public AggregateColumn * @return false iff every member of t is a duplicate copy of every member of this; * true otherwise */ - virtual bool operator!=(const TreeNode* t) const override; + bool operator!=(const TreeNode* t) const override; /** @brief Do a deep, strict (as opposed to semantic) equivalence test * @@ -119,7 +119,7 @@ class UDAFColumn : public AggregateColumn using AggregateColumn::operator!=; virtual bool operator!=(const UDAFColumn& t) const; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: mcsv1sdk::mcsv1Context context; diff --git a/dbcon/execplan/wf_frame.h b/dbcon/execplan/wf_frame.h index a4280c7cf..bb67270c8 100644 --- a/dbcon/execplan/wf_frame.h +++ b/dbcon/execplan/wf_frame.h @@ -43,15 +43,11 @@ enum WF_FRAME struct WF_Boundary { - WF_Boundary() - { - } - WF_Boundary(WF_FRAME frame) : fFrame(frame) - { - } - ~WF_Boundary() + WF_Boundary() = default; + explicit WF_Boundary(WF_FRAME frame) : fFrame(frame) { } + ~WF_Boundary() = default; const std::string toString() const; void serialize(messageqcpp::ByteStream&) const; void unserialize(messageqcpp::ByteStream&); @@ -67,9 +63,7 @@ struct WF_Frame fStart.fFrame = WF_UNBOUNDED_PRECEDING; fEnd.fFrame = WF_UNBOUNDED_FOLLOWING; } - ~WF_Frame() - { - } + ~WF_Frame() = default; const std::string toString() const; void serialize(messageqcpp::ByteStream&) const; void unserialize(messageqcpp::ByteStream&); @@ -83,13 +77,11 @@ struct WF_Frame */ struct WF_OrderBy { - WF_OrderBy() + WF_OrderBy() = default; + explicit WF_OrderBy(std::vector orders) : fOrders(orders) { } - WF_OrderBy(std::vector orders) : fOrders(orders) - { - } - ~WF_OrderBy(){}; + ~WF_OrderBy() = default; const std::string toString() const; void serialize(messageqcpp::ByteStream&) const; void unserialize(messageqcpp::ByteStream&); diff --git a/dbcon/execplan/windowfunctioncolumn.h b/dbcon/execplan/windowfunctioncolumn.h index 67f90e885..213ba0abb 100644 --- a/dbcon/execplan/windowfunctioncolumn.h +++ b/dbcon/execplan/windowfunctioncolumn.h @@ -54,14 +54,12 @@ class WindowFunctionColumn : public ReturnedColumn { public: WindowFunctionColumn(); - WindowFunctionColumn(const std::string& functionName, const uint32_t sessionID = 0); + explicit WindowFunctionColumn(const std::string& functionName, const uint32_t sessionID = 0); WindowFunctionColumn(const std::string& functionName, const std::vector& functionParms, const std::vector& partitions, WF_OrderBy& orderby, const uint32_t sessionID = 0); WindowFunctionColumn(const WindowFunctionColumn& rhs, const uint32_t sessionID = 0); - virtual ~WindowFunctionColumn() - { - } + ~WindowFunctionColumn() override = default; /** get function name */ inline const std::string& functionName() const @@ -112,7 +110,7 @@ class WindowFunctionColumn : public ReturnedColumn } /** make a clone of this window function */ - inline virtual WindowFunctionColumn* clone() const override + inline WindowFunctionColumn* clone() const override { return new WindowFunctionColumn(*this); } @@ -122,22 +120,22 @@ class WindowFunctionColumn : public ReturnedColumn /** output the function for debug purpose */ const std::string toString() const override; - virtual std::string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; /** * The serialization interface */ - virtual void serialize(messageqcpp::ByteStream&) const override; - virtual void unserialize(messageqcpp::ByteStream&) override; + void serialize(messageqcpp::ByteStream&) const override; + void unserialize(messageqcpp::ByteStream&) override; // util function for connector to use. void addToPartition(std::vector& groupByList); using ReturnedColumn::hasAggregate; - virtual bool hasAggregate() override + bool hasAggregate() override { return false; } - virtual bool hasWindowFunc() override; + bool hasWindowFunc() override; void adjustResultType(); // UDAnF support @@ -170,12 +168,12 @@ class WindowFunctionColumn : public ReturnedColumn WF_OrderBy fOrderBy; /// order by clause // not support for window functions for now. - virtual bool operator==(const TreeNode* t) const override + bool operator==(const TreeNode* t) const override { return false; } bool operator==(const WindowFunctionColumn& t) const; - virtual bool operator!=(const TreeNode* t) const override + bool operator!=(const TreeNode* t) const override { return false; } @@ -190,7 +188,7 @@ class WindowFunctionColumn : public ReturnedColumn ***********************************************************/ public: using TreeNode::getStrVal; - virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override + const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { bool localIsNull = false; evaluate(row, localIsNull); @@ -198,57 +196,57 @@ class WindowFunctionColumn : public ReturnedColumn return localIsNull ? fResult.strVal.dropString() : TreeNode::getStrVal(fTimeZone); } - virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getIntVal(); } - virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override + uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getUintVal(); } - virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override + float getFloatVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getFloatVal(); } - virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override + double getDoubleVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDoubleVal(); } - virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override + long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getLongDoubleVal(); } - virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override + IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDecimalVal(); } - virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override + int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDateIntVal(); } - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getDatetimeIntVal(); } - virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getTimestampIntVal(); } - virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override + int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override { evaluate(row, isNull); return TreeNode::getTimeIntVal(); diff --git a/dbcon/joblist/bandeddl.h b/dbcon/joblist/bandeddl.h index 6f85eb5f4..e27177974 100644 --- a/dbcon/joblist/bandeddl.h +++ b/dbcon/joblist/bandeddl.h @@ -29,7 +29,7 @@ #include #include "largedatalist.h" -//#include "bucketdl.h" +// #include "bucketdl.h" #include @@ -68,9 +68,9 @@ class BandedDL : public LargeDataList, element_t> protected: private: - explicit BandedDL(){}; - explicit BandedDL(const BandedDL&){}; - BandedDL& operator=(const BandedDL&){}; + explicit BandedDL() = default; + BandedDL(const BandedDL&){}; + BandedDL& operator=(const BandedDL&) {}; // vars to support the WSDL-like next() fcn boost::condition nextSetLoaded; diff --git a/dbcon/joblist/bucketdl.h b/dbcon/joblist/bucketdl.h index 3af942da2..714f2d537 100644 --- a/dbcon/joblist/bucketdl.h +++ b/dbcon/joblist/bucketdl.h @@ -161,7 +161,7 @@ class BucketDL : public DataList private: // Declare default constructors but don't define to disable their use explicit BucketDL(); - explicit BucketDL(const BucketDL&); + BucketDL(const BucketDL&); BucketDL& operator=(const BucketDL&); ResourceManager* fRm; diff --git a/dbcon/joblist/columncommand-jl.h b/dbcon/joblist/columncommand-jl.h index 037022581..096dbaa19 100644 --- a/dbcon/joblist/columncommand-jl.h +++ b/dbcon/joblist/columncommand-jl.h @@ -40,18 +40,17 @@ namespace joblist class ColumnCommandJL : public CommandJL { public: - ColumnCommandJL(const pColScanStep&, std::vector lastLBID, - bool hasAuxCol_, const std::vector& extentsAux_, - execplan::CalpontSystemCatalog::OID oidAux); - ColumnCommandJL(const pColStep&); + ColumnCommandJL(const pColScanStep&, std::vector lastLBID, bool hasAuxCol_, + const std::vector& extentsAux_, execplan::CalpontSystemCatalog::OID oidAux); + explicit ColumnCommandJL(const pColStep&); ColumnCommandJL(const ColumnCommandJL&, const DictStepJL&); - virtual ~ColumnCommandJL(); + ~ColumnCommandJL() override; - virtual void createCommand(messageqcpp::ByteStream& bs) const override; - virtual void runCommand(messageqcpp::ByteStream& bs) const override; + void createCommand(messageqcpp::ByteStream& bs) const override; + void runCommand(messageqcpp::ByteStream& bs) const override; void setLBID(uint64_t rid, uint32_t dbroot) override; uint8_t getTableColumnType() override; - virtual std::string toString() override; + std::string toString() override; uint16_t getWidth() override; CommandType getCommandType() override { diff --git a/dbcon/joblist/crossenginestep.h b/dbcon/joblist/crossenginestep.h index 1037269d7..b72c4d753 100644 --- a/dbcon/joblist/crossenginestep.h +++ b/dbcon/joblist/crossenginestep.h @@ -60,76 +60,76 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep /** @brief CrossEngineStep destructor */ - ~CrossEngineStep(); + ~CrossEngineStep() override; /** @brief virtual void Run method */ - void run(); + void run() override; /** @brief virtual void join method */ - void join(); + void join() override; /** @brief virtual string toString method */ - const std::string toString() const; + const std::string toString() const override; // from BatchPrimitive - bool getFeederFlag() const + bool getFeederFlag() const override { return false; } - uint64_t getLastTupleId() const + uint64_t getLastTupleId() const override { return 0; } - uint32_t getStepCount() const + uint32_t getStepCount() const override { return 1; } - void setBPP(JobStep* jobStep); - void setFirstStepType(PrimitiveStepType firstStepType) + void setBPP(JobStep* jobStep) override; + void setFirstStepType(PrimitiveStepType firstStepType) override { } - void setIsProjectionOnly() + void setIsProjectionOnly() override { } - void setLastTupleId(uint64_t id) + void setLastTupleId(uint64_t id) override { } - void setOutputType(BPSOutputType outputType) + void setOutputType(BPSOutputType outputType) override { } - void setProjectBPP(JobStep* jobStep1, JobStep* jobStep2); - void setStepCount() + void setProjectBPP(JobStep* jobStep1, JobStep* jobStep2) override; + void setStepCount() override { } - void setSwallowRows(const bool swallowRows) + void setSwallowRows(const bool swallowRows) override { } - void setBppStep() + void setBppStep() override { } - void dec(DistributedEngineComm* dec) + void dec(DistributedEngineComm* dec) override { } - const OIDVector& getProjectOids() const + const OIDVector& getProjectOids() const override { return fOIDVector; } - uint64_t blksSkipped() const + uint64_t blksSkipped() const override { return 0; } - bool wasStepRun() const + bool wasStepRun() const override { return fRunExecuted; } - BPSOutputType getOutputType() const + BPSOutputType getOutputType() const override { return ROW_GROUP; } - uint64_t getRows() const + uint64_t getRows() const override { return fRowsReturned; } @@ -145,27 +145,27 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep { return fAlias; } - void setJobInfo(const JobInfo* jobInfo) + void setJobInfo(const JobInfo* jobInfo) override { } - void setOutputRowGroup(const rowgroup::RowGroup&); - const rowgroup::RowGroup& getOutputRowGroup() const; + void setOutputRowGroup(const rowgroup::RowGroup&) override; + const rowgroup::RowGroup& getOutputRowGroup() const override; // from DECEventListener - void newPMOnline(uint32_t) + void newPMOnline(uint32_t) override { } - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; - uint32_t nextBand(messageqcpp::ByteStream& bs); + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; - void addFcnJoinExp(const std::vector&); - void addFcnExpGroup1(const boost::shared_ptr&); - void setFE1Input(const rowgroup::RowGroup&); - void setFcnExpGroup3(const std::vector&); - void setFE23Output(const rowgroup::RowGroup&); + void addFcnJoinExp(const std::vector&) override; + void addFcnExpGroup1(const boost::shared_ptr&) override; + void setFE1Input(const rowgroup::RowGroup&) override; + void setFcnExpGroup3(const std::vector&) override; + void setFE23Output(const rowgroup::RowGroup&) override; void addFilter(JobStep* jobStep); void addProject(JobStep* jobStep); @@ -201,7 +201,7 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep class Runner { public: - Runner(CrossEngineStep* step) : fStep(step) + explicit Runner(CrossEngineStep* step) : fStep(step) { } void operator()() @@ -248,4 +248,3 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep }; } // namespace joblist - diff --git a/dbcon/joblist/datalist.h b/dbcon/joblist/datalist.h index 669d52931..6c1b253d4 100644 --- a/dbcon/joblist/datalist.h +++ b/dbcon/joblist/datalist.h @@ -161,9 +161,10 @@ DataList::DataList() , consumersFinished(0) , fElemDiskFirstSize(sizeof(uint64_t)) , fElemDiskSecondSize(sizeof(uint64_t)) - , fOID(0){ - // pthread_mutex_init(&mutex, NULL); - }; + , fOID(0) +{ + // pthread_mutex_init(&mutex, NULL); +} template DataList::DataList(const DataList& dl) @@ -174,12 +175,13 @@ DataList::DataList(const DataList& dl) consumersFinished = dl.consumersFinished; fElemDiskFirstSize = dl.fElemDiskFirstSize; fElemDiskSecondSize = dl.fElemDiskSecondSize; -}; +} template -DataList::~DataList(){ - // pthread_mutex_destroy(&mutex); -}; +DataList::~DataList() +{ + // pthread_mutex_destroy(&mutex); +} template DataList& DataList::operator=(const DataList& dl) @@ -189,25 +191,25 @@ DataList& DataList::operator=(const DataList& d consumersFinished = dl.consumersFinished; fElemDiskFirstSize = dl.fElemDiskFirstSize; fElemDiskSecondSize = dl.fElemDiskSecondSize; -}; +} template void DataList::endOfInput() { noMoreInput = true; -}; +} template void DataList::lock() { mutex.lock(); // pthread_mutex_lock(&mutex); -}; +} template void DataList::unlock() { mutex.unlock(); // pthread_mutex_unlock(&mutex); -}; +} template void DataList::setDiskElemSize(uint32_t size1st, uint32_t size2nd) diff --git a/dbcon/joblist/datalistimpl.h b/dbcon/joblist/datalistimpl.h index eb07ce64f..b408104d9 100644 --- a/dbcon/joblist/datalistimpl.h +++ b/dbcon/joblist/datalistimpl.h @@ -44,17 +44,17 @@ template class DataListImpl : public DataList { public: - DataListImpl(uint32_t numConsumers); + explicit DataListImpl(uint32_t numConsumers); DataListImpl(const DataListImpl& dl); - virtual ~DataListImpl(); + ~DataListImpl() override; DataListImpl& operator=(const DataListImpl& dl); // derived classes need to lock around these fcns - virtual void insert(const element_t& e); - virtual void insert(const std::vector& v); - virtual uint64_t getIterator(); - virtual bool next(uint64_t it, element_t* e); + void insert(const element_t& e) override; + void insert(const std::vector& v) override; + uint64_t getIterator() override; + bool next(uint64_t it, element_t* e) override; virtual void setNumConsumers(uint32_t); virtual uint32_t getNumConsumers() const; @@ -141,20 +141,24 @@ DataListImpl::DataListImpl(const DataListImpl DataListImpl::~DataListImpl() { delete c; delete[] cIterators; -}; +} // lock at a higher level template DataListImpl& DataListImpl::operator=( const DataListImpl& dl) { + if (&dl == this) + { + return *this; + } uint64_t i; static_cast >(*this) = static_cast >(dl); @@ -170,7 +174,7 @@ DataListImpl& DataListImpl::oper cIterators[i] = dl.cIterators[i]; return *this; -}; +} template uint64_t DataListImpl::getIterator() @@ -178,8 +182,8 @@ uint64_t DataListImpl::getIterator() if (itIndex >= numConsumers) { std::ostringstream oss; - oss << "DataListImpl::getIterator(): caller attempted to grab too many iterators: " - << "have " << numConsumers << " asked for " << (itIndex + 1); + oss << "DataListImpl::getIterator(): caller attempted to grab too many iterators: " << "have " + << numConsumers << " asked for " << (itIndex + 1); throw std::logic_error(oss.str().c_str()); } @@ -198,7 +202,7 @@ inline void DataListImpl::insert(const std::vector)) { - std::vector* vc = (std::vector*)c; + auto* vc = (std::vector*)c; vc->insert(vc->end(), v.begin(), v.end()); } else @@ -245,7 +249,7 @@ void DataListImpl::eraseUpTo(uint64_t id) #endif c->erase(c->begin(), cIterators[id]); -}; +} template void DataListImpl::reset() diff --git a/dbcon/joblist/dictstep-jl.h b/dbcon/joblist/dictstep-jl.h index 5fe0c618e..195048039 100644 --- a/dbcon/joblist/dictstep-jl.h +++ b/dbcon/joblist/dictstep-jl.h @@ -40,26 +40,27 @@ class DictStepJL : public CommandJL { public: DictStepJL(); - DictStepJL(const pDictionaryStep&); - virtual ~DictStepJL(); + explicit DictStepJL(const pDictionaryStep&); + ~DictStepJL() override; - void setLBID(uint64_t data, uint32_t dbroot); // converts a rid or dictionary token to an LBID. For - // ColumnCommandJL it's a RID, for a DictStep it's a token. - uint8_t getTableColumnType(); - std::string toString(); + void setLBID(uint64_t data, + uint32_t dbroot) override; // converts a rid or dictionary token to an LBID. For + // ColumnCommandJL it's a RID, for a DictStep it's a token. + uint8_t getTableColumnType() override; + std::string toString() override; /* XXXPAT: The width is only valid for projection steps and the output type is TUPLE at the moment. */ void setWidth(uint16_t); - uint16_t getWidth(); + uint16_t getWidth() override; - CommandType getCommandType() + CommandType getCommandType() override { return DICT_STEP; } - void createCommand(messageqcpp::ByteStream&) const; - void runCommand(messageqcpp::ByteStream&) const; + void createCommand(messageqcpp::ByteStream&) const override; + void runCommand(messageqcpp::ByteStream&) const override; messageqcpp::ByteStream getFilterString() const { diff --git a/dbcon/joblist/diskjoinstep.h b/dbcon/joblist/diskjoinstep.h index 1756fb46d..76e760fd3 100644 --- a/dbcon/joblist/diskjoinstep.h +++ b/dbcon/joblist/diskjoinstep.h @@ -33,11 +33,11 @@ class DiskJoinStep : public JobStep public: DiskJoinStep(); DiskJoinStep(TupleHashJoinStep*, int djsIndex, int joinerIndex, bool lastOne); - virtual ~DiskJoinStep(); + ~DiskJoinStep() override; - void run(); - void join(); - const std::string toString() const; + void run() override; + void join() override; + const std::string toString() const override; void loadExistingData(std::vector& data); uint32_t getIterationCount() @@ -73,7 +73,7 @@ class DiskJoinStep : public JobStep void mainRunner(); struct Runner { - Runner(DiskJoinStep* d) : djs(d) + explicit Runner(DiskJoinStep* d) : djs(d) { } void operator()() diff --git a/dbcon/joblist/distributedenginecomm.h b/dbcon/joblist/distributedenginecomm.h index d5c687b87..2c6c6ac86 100644 --- a/dbcon/joblist/distributedenginecomm.h +++ b/dbcon/joblist/distributedenginecomm.h @@ -77,7 +77,7 @@ constexpr uint32_t defaultLocalConnectionId() class DECEventListener { public: - virtual ~DECEventListener(){}; + virtual ~DECEventListener() = default; /* Do whatever needs to be done to init the new PM */ virtual void newPMOnline(uint32_t newConnectionNumber) = 0; @@ -140,7 +140,7 @@ class DistributedEngineComm /** reads queuesize/divisor msgs */ EXPORT void read_some(uint32_t key, uint32_t divisor, std::vector& v, - bool* flowControlOn = NULL); + bool* flowControlOn = nullptr); /** @brief Write a primitive message * diff --git a/dbcon/joblist/elementtype.h b/dbcon/joblist/elementtype.h index a281fe68b..2033728df 100644 --- a/dbcon/joblist/elementtype.h +++ b/dbcon/joblist/elementtype.h @@ -147,9 +147,7 @@ struct RowWrapper et[i] = rg.et[i]; } - ~RowWrapper() - { - } + ~RowWrapper() = default; inline RowWrapper& operator=(const RowWrapper& rg) { @@ -170,7 +168,7 @@ struct RIDElementType uint64_t first; RIDElementType(); - RIDElementType(uint64_t f); + explicit RIDElementType(uint64_t f); const char* getHashString(uint64_t mode, uint64_t* len) const { @@ -194,9 +192,7 @@ struct TupleType { uint64_t first; char* second; - TupleType() - { - } + TupleType() = default; TupleType(uint64_t f, char* s) : first(f), second(s) { } @@ -244,14 +240,14 @@ extern std::ostream& operator<<(std::ostream& out, const TupleType& rhs); #ifndef NO_DATALISTS -//#include "bandeddl.h" -//#include "wsdl.h" +// #include "bandeddl.h" +// #include "wsdl.h" #include "fifo.h" -//#include "bucketdl.h" -//#include "constantdatalist.h" -//#include "swsdl.h" -//#include "zdl.h" -//#include "deliverywsdl.h" +// #include "bucketdl.h" +// #include "constantdatalist.h" +// #include "swsdl.h" +// #include "zdl.h" +// #include "deliverywsdl.h" namespace joblist { @@ -350,7 +346,6 @@ class AnyDataList ~AnyDataList() = default; - inline void rowGroupDL(boost::shared_ptr dl) { fDatalist = dl; @@ -368,8 +363,6 @@ class AnyDataList return fDatalist.get(); } - - enum DataListTypes { UNKNOWN_DATALIST, /*!< 0 Unknown DataList */ @@ -408,8 +401,8 @@ class AnyDataList // bool operator==(const AnyDataList& rhs); private: - AnyDataList(const AnyDataList& rhs); - AnyDataList& operator=(const AnyDataList& rhs); + AnyDataList(const AnyDataList& rhs) = delete; + AnyDataList& operator=(const AnyDataList& rhs) = delete; boost::shared_ptr fDatalist; bool fDisown; }; @@ -435,4 +428,3 @@ extern std::ostream& omitOidInDL(std::ostream& strm); } // namespace joblist #endif - diff --git a/dbcon/joblist/errorinfo.h b/dbcon/joblist/errorinfo.h index 62b404daa..35699a572 100644 --- a/dbcon/joblist/errorinfo.h +++ b/dbcon/joblist/errorinfo.h @@ -38,7 +38,7 @@ struct ErrorInfo uint32_t errCode; std::string errMsg; // for backward compat - ErrorInfo(uint16_t v) : errCode(v) + explicit ErrorInfo(uint16_t v) : errCode(v) { } ErrorInfo& operator=(uint16_t v) @@ -51,4 +51,3 @@ struct ErrorInfo typedef boost::shared_ptr SErrorInfo; } // namespace joblist - diff --git a/dbcon/joblist/expressionstep.h b/dbcon/joblist/expressionstep.h index 8cc223cb1..7e7778ec2 100644 --- a/dbcon/joblist/expressionstep.h +++ b/dbcon/joblist/expressionstep.h @@ -23,7 +23,7 @@ #pragma once -//#define NDEBUG +// #define NDEBUG #include "jobstep.h" #include "filter.h" @@ -48,35 +48,35 @@ class ExpressionStep : public JobStep public: // constructors ExpressionStep(); - ExpressionStep(const JobInfo&); + explicit ExpressionStep(const JobInfo&); // destructor constructors - virtual ~ExpressionStep(); + ~ExpressionStep() override; // inherited methods - void run(); - void join(); - const std::string toString() const; + void run() override; + void join() override; + const std::string toString() const override; - execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return 0; } - execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOids.empty() ? 0 : fTableOids.front(); } using JobStep::alias; - std::string alias() const + std::string alias() const override { return fAliases.empty() ? "" : fAliases.front(); } using JobStep::view; - std::string view() const + std::string view() const override { return fViews.empty() ? "" : fViews.front(); } using JobStep::schema; - std::string schema() const + std::string schema() const override { return fSchemas.empty() ? "" : fSchemas.front(); } diff --git a/dbcon/joblist/fifo.h b/dbcon/joblist/fifo.h index 46ebf9922..8d9e0a0dd 100644 --- a/dbcon/joblist/fifo.h +++ b/dbcon/joblist/fifo.h @@ -45,7 +45,7 @@ template class FIFO : public DataListImpl, element_t> { private: - typedef DataListImpl, element_t> base; + using base = DataListImpl, element_t>; public: enum ElementMode @@ -55,15 +55,15 @@ class FIFO : public DataListImpl, element_t> }; FIFO(uint32_t numConsumers, uint32_t maxElements); - virtual ~FIFO(); + ~FIFO() override; /* DataList interface */ - inline void insert(const element_t& e); - inline void insert(const std::vector& v); - inline bool next(uint64_t it, element_t* e); - uint64_t getIterator(); - void endOfInput(); - void setMultipleProducers(bool b); + inline void insert(const element_t& e) override; + inline void insert(const std::vector& v) override; + inline bool next(uint64_t it, element_t* e) override; + uint64_t getIterator() override; + void endOfInput() override; + void setMultipleProducers(bool b) override; /* Use this insert() to detect when insertion fills up buffer. */ /* When this happens, call waitTillReadyForInserts() before resuming*/ @@ -72,16 +72,16 @@ class FIFO : public DataListImpl, element_t> inline void waitTillReadyForInserts(); inline bool isOutputBlocked() const; - void OID(execplan::CalpontSystemCatalog::OID oid) + void OID(execplan::CalpontSystemCatalog::OID oid) override { base::OID(oid); } - execplan::CalpontSystemCatalog::OID OID() const + execplan::CalpontSystemCatalog::OID OID() const override { return base::OID(); } - inline void dropToken(){}; + inline void dropToken() {}; inline void dropToken(uint32_t){}; // Counters that reflect how many many times this FIFO blocked on reads/writes @@ -89,7 +89,7 @@ class FIFO : public DataListImpl, element_t> uint64_t blockedReadCount() const; // @bug 653 set number of consumers when it is empty. - void setNumConsumers(uint32_t nc); + void setNumConsumers(uint32_t nc) override; void inOrder(bool order) { @@ -109,7 +109,7 @@ class FIFO : public DataListImpl, element_t> { fTotSize = totSize; } - uint64_t totalSize() + uint64_t totalSize() override { return fTotSize; } @@ -495,14 +495,11 @@ void FIFO::maxElements(uint64_t max) { fMaxElements = max; - if (pBuffer) - delete[] pBuffer; + delete[] pBuffer; + delete[] cBuffer; - if (cBuffer) - delete[] cBuffer; - - pBuffer = 0; - cBuffer = 0; + pBuffer = nullptr; + cBuffer = nullptr; for (uint64_t i = 0; i < base::numConsumers; ++i) cpos[i] = fMaxElements; @@ -528,4 +525,3 @@ void FIFO::totalFileCounts(uint64_t& numFiles, uint64_t& numBytes) co } } // namespace joblist - diff --git a/dbcon/joblist/filtercommand-jl.h b/dbcon/joblist/filtercommand-jl.h index 7526e1d1a..2bbe3eccd 100644 --- a/dbcon/joblist/filtercommand-jl.h +++ b/dbcon/joblist/filtercommand-jl.h @@ -34,16 +34,16 @@ namespace joblist class FilterCommandJL : public CommandJL { public: - FilterCommandJL(const FilterStep&); - virtual ~FilterCommandJL(); + explicit FilterCommandJL(const FilterStep&); + ~FilterCommandJL() override; - void setLBID(uint64_t rid, uint32_t dbroot); - uint8_t getTableColumnType(); - CommandType getCommandType(); - std::string toString(); - void createCommand(messageqcpp::ByteStream& bs) const; - void runCommand(messageqcpp::ByteStream& bs) const; - uint16_t getWidth(); + void setLBID(uint64_t rid, uint32_t dbroot) override; + uint8_t getTableColumnType() override; + CommandType getCommandType() override; + std::string toString() override; + void createCommand(messageqcpp::ByteStream& bs) const override; + void runCommand(messageqcpp::ByteStream& bs) const override; + uint16_t getWidth() override; uint8_t getBOP() const { return fBOP; diff --git a/dbcon/joblist/groupconcat.h b/dbcon/joblist/groupconcat.h index 9f9ba9e0e..705b691ef 100644 --- a/dbcon/joblist/groupconcat.h +++ b/dbcon/joblist/groupconcat.h @@ -26,7 +26,6 @@ #include #include - #include "returnedcolumn.h" // SRCP #include "rowgroup.h" // RowGroup #include "rowaggregation.h" // SP_GroupConcat @@ -48,7 +47,7 @@ class GroupConcatInfo virtual ~GroupConcatInfo(); void prepGroupConcat(JobInfo&); - void mapColumns(const rowgroup::RowGroup&); + virtual void mapColumns(const rowgroup::RowGroup&); std::set& columns() { @@ -59,11 +58,11 @@ class GroupConcatInfo return fGroupConcat; } - const std::string toString() const; + virtual const std::string toString() const; protected: - uint32_t getColumnKey(const execplan::SRCP& srcp, JobInfo& jobInfo); - std::shared_ptr makeMapping(const rowgroup::RowGroup&, const rowgroup::RowGroup&); + virtual uint32_t getColumnKey(const execplan::SRCP& srcp, JobInfo& jobInfo); + virtual std::shared_ptr makeMapping(const rowgroup::RowGroup&, const rowgroup::RowGroup&); std::set fColumns; std::vector fGroupConcat; @@ -72,22 +71,22 @@ class GroupConcatInfo class GroupConcatAgUM : public rowgroup::GroupConcatAg { public: - EXPORT GroupConcatAgUM(rowgroup::SP_GroupConcat&); - EXPORT ~GroupConcatAgUM(); + EXPORT explicit GroupConcatAgUM(rowgroup::SP_GroupConcat&); + EXPORT ~GroupConcatAgUM() override; using rowgroup::GroupConcatAg::merge; - void initialize(); - void processRow(const rowgroup::Row&); - EXPORT void merge(const rowgroup::Row&, int64_t); + void initialize() override; + void processRow(const rowgroup::Row&) override; + EXPORT virtual void merge(const rowgroup::Row&, int64_t); boost::scoped_ptr& concator() { return fConcator; } - EXPORT uint8_t* getResult(); + EXPORT uint8_t* getResult() override; protected: - void applyMapping(const std::shared_ptr&, const rowgroup::Row&); + virtual void applyMapping(const std::shared_ptr&, const rowgroup::Row&); boost::scoped_ptr fConcator; boost::scoped_array fData; @@ -133,17 +132,17 @@ class GroupConcatNoOrder : public GroupConcator { public: GroupConcatNoOrder(); - virtual ~GroupConcatNoOrder(); + ~GroupConcatNoOrder() override; - void initialize(const rowgroup::SP_GroupConcat&); - void processRow(const rowgroup::Row&); + void initialize(const rowgroup::SP_GroupConcat&) override; + void processRow(const rowgroup::Row&) override; - void merge(GroupConcator*); + void merge(GroupConcator*) override; using GroupConcator::getResult; - uint8_t* getResultImpl(const std::string& sep); - //uint8_t* getResult(const std::string& sep); + uint8_t* getResultImpl(const std::string& sep) override; + // uint8_t* getResult(const std::string& sep); - const std::string toString() const; + const std::string toString() const override; protected: rowgroup::RowGroup fRowGroup; @@ -163,19 +162,19 @@ class GroupConcatOrderBy : public GroupConcator, public ordering::IdbOrderBy { public: GroupConcatOrderBy(); - virtual ~GroupConcatOrderBy(); + ~GroupConcatOrderBy() override; using ordering::IdbOrderBy::initialize; - void initialize(const rowgroup::SP_GroupConcat&); - void processRow(const rowgroup::Row&); - uint64_t getKeyLength() const; + void initialize(const rowgroup::SP_GroupConcat&) override; + void processRow(const rowgroup::Row&) override; + uint64_t getKeyLength() const override; - void merge(GroupConcator*); + void merge(GroupConcator*) override; using GroupConcator::getResult; - uint8_t* getResultImpl(const std::string& sep); - //uint8_t* getResult(const std::string& sep); + uint8_t* getResultImpl(const std::string& sep) override; + // uint8_t* getResult(const std::string& sep); - const std::string toString() const; + const std::string toString() const override; protected: }; diff --git a/dbcon/joblist/jlf_common.h b/dbcon/joblist/jlf_common.h index a0c03548a..befba9a94 100644 --- a/dbcon/joblist/jlf_common.h +++ b/dbcon/joblist/jlf_common.h @@ -73,15 +73,14 @@ const int32_t CNX_EXP_TABLE_ID = 999; struct TupleInfo { - TupleInfo(uint32_t w = 0, uint32_t o = 0, uint32_t k = -1, uint32_t t = -1, uint32_t s = 0, uint32_t p = 0, - execplan::CalpontSystemCatalog::ColDataType dt = execplan::CalpontSystemCatalog::BIT, - uint32_t csn = 8) + explicit TupleInfo(uint32_t w = 0, uint32_t o = 0, uint32_t k = -1, uint32_t t = -1, uint32_t s = 0, + uint32_t p = 0, + execplan::CalpontSystemCatalog::ColDataType dt = execplan::CalpontSystemCatalog::BIT, + uint32_t csn = 8) : width(w), oid(o), key(k), tkey(t), scale(s), precision(p), dtype(dt), csNum(csn) { } - ~TupleInfo() - { - } + ~TupleInfo() = default; uint32_t width; uint32_t oid; @@ -146,7 +145,7 @@ struct UniqId : fId(i), fTable(t), fSchema(s), fView(v), fPseudo(pi), fSubId(l) { } - UniqId(const execplan::SimpleColumn* sc); + explicit UniqId(const execplan::SimpleColumn* sc); UniqId(int o, const execplan::SimpleColumn* sc); std::string toString() const; @@ -193,7 +192,7 @@ struct TupleKeyInfo //------------------------------------------------------------------------------ struct JobInfo { - JobInfo(ResourceManager* r) + explicit JobInfo(ResourceManager* r) : rm(r) , sessionId(0) , txnId(0) @@ -204,7 +203,7 @@ struct JobInfo , fifoSize(rm->getJlFifoSize()) , logger(new Logger()) , traceFlags(0) - , projectingTableOID(0) + , projectingTableOID(nullptr) , isExeMgr(false) , trace(false) , tryTuples(false) @@ -219,7 +218,7 @@ struct JobInfo , subLevel(0) , subNum(0) , subId(0) - , pJobInfo(NULL) + , pJobInfo(nullptr) , constantFalse(false) , cntStarPos(-1) , stringScanThreshold(1) diff --git a/dbcon/joblist/joblist.h b/dbcon/joblist/joblist.h index e20b34a4f..52b935a69 100644 --- a/dbcon/joblist/joblist.h +++ b/dbcon/joblist/joblist.h @@ -217,10 +217,10 @@ class JobList class TupleJobList : public JobList { public: - TupleJobList(bool isEM = false); - virtual ~TupleJobList(); + explicit TupleJobList(bool isEM = false); + ~TupleJobList() override; - EXPORT uint32_t projectTable(execplan::CalpontSystemCatalog::OID, messageqcpp::ByteStream&); + EXPORT uint32_t projectTable(execplan::CalpontSystemCatalog::OID, messageqcpp::ByteStream&) override; EXPORT const rowgroup::RowGroup& getOutputRowGroup() const; TupleDeliveryStep* getDeliveryStep() { @@ -231,7 +231,7 @@ class TupleJobList : public JobList return fQuery; } void setDeliveryFlag(bool f); - void abort(); + void abort() override; /** Does some light validation on the final joblist * @@ -239,7 +239,7 @@ class TupleJobList : public JobList * there's one and only one projection step, and that its fake table OID is 100. * @note The fake OID check is disabled atm because it's not always 100 although it's supposed to be. */ - EXPORT void validate() const; + EXPORT void validate() const override; private: // defaults okay @@ -255,4 +255,3 @@ typedef boost::shared_ptr STJLP; } // namespace joblist #undef EXPORT - diff --git a/dbcon/joblist/jobstep.h b/dbcon/joblist/jobstep.h index 3796524b5..48e1c8946 100644 --- a/dbcon/joblist/jobstep.h +++ b/dbcon/joblist/jobstep.h @@ -60,12 +60,8 @@ namespace joblist class JobStepAssociation { public: - JobStepAssociation() - { - } - virtual ~JobStepAssociation() - { - } + JobStepAssociation() = default; + virtual ~JobStepAssociation() = default; void inAdd(const AnyDataListSPtr& spdl) __attribute__((deprecated)) { @@ -127,10 +123,8 @@ class JobStep public: /** constructor */ - JobStep() - { - } - JobStep(const JobInfo&); + JobStep() = default; + explicit JobStep(const JobInfo&); /** destructor */ virtual ~JobStep() @@ -508,12 +502,8 @@ class JobStep class TupleJobStep { public: - TupleJobStep() - { - } - virtual ~TupleJobStep() - { - } + TupleJobStep() = default; + virtual ~TupleJobStep() = default; virtual void setOutputRowGroup(const rowgroup::RowGroup&) = 0; virtual void setFcnExpGroup3(const std::vector&) { @@ -527,9 +517,7 @@ class TupleJobStep class TupleDeliveryStep : public TupleJobStep { public: - virtual ~TupleDeliveryStep() - { - } + ~TupleDeliveryStep() override = default; virtual uint32_t nextBand(messageqcpp::ByteStream& bs) = 0; virtual const rowgroup::RowGroup& getDeliveredRowGroup() const = 0; virtual void deliverStringTableRowGroup(bool b) = 0; @@ -541,17 +529,17 @@ class NullStep : public JobStep public: /** @brief virtual void Run method */ - virtual void run() + void run() override { } /** @brief virtual void join method */ - virtual void join() + void join() override { } /** @brief virtual string toString method */ - virtual const std::string toString() const + const std::string toString() const override { return "NullStep"; } @@ -566,4 +554,3 @@ typedef boost::shared_ptr JobStepAssociationSPtr; typedef boost::shared_ptr SJSTEP; } // namespace joblist - diff --git a/dbcon/joblist/jsonarrayagg.h b/dbcon/joblist/jsonarrayagg.h index 77319c0b9..72ca5361d 100644 --- a/dbcon/joblist/jsonarrayagg.h +++ b/dbcon/joblist/jsonarrayagg.h @@ -24,7 +24,6 @@ #include #include - #include "groupconcat.h" #define EXPORT @@ -39,31 +38,31 @@ class JsonArrayInfo : public GroupConcatInfo { public: void prepJsonArray(JobInfo&); - void mapColumns(const rowgroup::RowGroup&); + void mapColumns(const rowgroup::RowGroup&) override; - const std::string toString() const; + const std::string toString() const override; protected: - uint32_t getColumnKey(const execplan::SRCP& srcp, JobInfo& jobInfo); - std::shared_ptr makeMapping(const rowgroup::RowGroup&, const rowgroup::RowGroup&); + uint32_t getColumnKey(const execplan::SRCP& srcp, JobInfo& jobInfo) override; + std::shared_ptr makeMapping(const rowgroup::RowGroup&, const rowgroup::RowGroup&) override; }; class JsonArrayAggregatAgUM : public GroupConcatAgUM { public: - EXPORT JsonArrayAggregatAgUM(rowgroup::SP_GroupConcat&); - EXPORT ~JsonArrayAggregatAgUM(); + EXPORT explicit JsonArrayAggregatAgUM(rowgroup::SP_GroupConcat&); + EXPORT ~JsonArrayAggregatAgUM() override; using rowgroup::GroupConcatAg::merge; - void initialize(); - void processRow(const rowgroup::Row&); - EXPORT void merge(const rowgroup::Row&, int64_t); + void initialize() override; + void processRow(const rowgroup::Row&) override; + EXPORT void merge(const rowgroup::Row&, int64_t) override; EXPORT void getResult(uint8_t*); - EXPORT uint8_t* getResult(); + EXPORT uint8_t* getResult() override; protected: - void applyMapping(const std::shared_ptr&, const rowgroup::Row&); + void applyMapping(const std::shared_ptr&, const rowgroup::Row&) override; }; // JSON_ARRAYAGG base @@ -71,17 +70,17 @@ class JsonArrayAggregator : public GroupConcator { public: JsonArrayAggregator(); - virtual ~JsonArrayAggregator(); + ~JsonArrayAggregator() override; - virtual void initialize(const rowgroup::SP_GroupConcat&); - virtual void processRow(const rowgroup::Row&) = 0; + void initialize(const rowgroup::SP_GroupConcat&) override; + void processRow(const rowgroup::Row&) override = 0; - virtual const std::string toString() const; + const std::string toString() const override; protected: - virtual bool concatColIsNull(const rowgroup::Row&); - virtual void outputRow(std::ostringstream&, const rowgroup::Row&); - virtual int64_t lengthEstimate(const rowgroup::Row&); + bool concatColIsNull(const rowgroup::Row&) override; + void outputRow(std::ostringstream&, const rowgroup::Row&) override; + int64_t lengthEstimate(const rowgroup::Row&) override; }; // For JSON_ARRAYAGG withour distinct or orderby @@ -89,17 +88,17 @@ class JsonArrayAggNoOrder : public JsonArrayAggregator { public: JsonArrayAggNoOrder(); - virtual ~JsonArrayAggNoOrder(); + ~JsonArrayAggNoOrder() override; - void initialize(const rowgroup::SP_GroupConcat&); - void processRow(const rowgroup::Row&); + void initialize(const rowgroup::SP_GroupConcat&) override; + void processRow(const rowgroup::Row&) override; using GroupConcator::merge; - void merge(GroupConcator*); + void merge(GroupConcator*) override; using GroupConcator::getResult; - uint8_t* getResultImpl(const std::string& sep); + uint8_t* getResultImpl(const std::string& sep) override; - const std::string toString() const; + const std::string toString() const override; protected: rowgroup::RowGroup fRowGroup; @@ -118,19 +117,19 @@ class JsonArrayAggOrderBy : public JsonArrayAggregator, public ordering::IdbOrde { public: JsonArrayAggOrderBy(); - virtual ~JsonArrayAggOrderBy(); + ~JsonArrayAggOrderBy() override; using ordering::IdbOrderBy::initialize; - void initialize(const rowgroup::SP_GroupConcat&); - void processRow(const rowgroup::Row&); - uint64_t getKeyLength() const; + void initialize(const rowgroup::SP_GroupConcat&) override; + void processRow(const rowgroup::Row&) override; + uint64_t getKeyLength() const override; using GroupConcator::merge; - void merge(GroupConcator*); + void merge(GroupConcator*) override; using GroupConcator::getResult; - uint8_t* getResultImpl(const std::string& sep); + uint8_t* getResultImpl(const std::string& sep) override; - const std::string toString() const; + const std::string toString() const override; protected: }; diff --git a/dbcon/joblist/largedatalist.h b/dbcon/joblist/largedatalist.h index cd794a832..9ab607520 100644 --- a/dbcon/joblist/largedatalist.h +++ b/dbcon/joblist/largedatalist.h @@ -89,7 +89,7 @@ struct DiskIoInfo bool fWrite; // c: byte count; b: is write operation? - DiskIoInfo(bool b = false) : fBytes(0), fWrite(b) + explicit DiskIoInfo(bool b = false) : fBytes(0), fWrite(b) { } }; @@ -205,7 +205,7 @@ LargeDataList::LargeDataList(uint32_t nc, uint32_t eleme , fTraceOn(false) , fReUse(false) , fSaveForReuse(false) - , fRestoreInfo(NULL) + , fRestoreInfo(nullptr) { loadedSet = 0; setCount = 1; diff --git a/dbcon/joblist/largehashjoin.h b/dbcon/joblist/largehashjoin.h index a61faf879..dd1a96280 100644 --- a/dbcon/joblist/largehashjoin.h +++ b/dbcon/joblist/largehashjoin.h @@ -256,9 +256,7 @@ class HashJoin }; template -HashJoin::HashJoin() -{ -} +HashJoin::HashJoin() = default; template HashJoin::HashJoin(joblist::BDLWrapper& set1, joblist::BDLWrapper& set2, diff --git a/dbcon/joblist/limitedorderby.h b/dbcon/joblist/limitedorderby.h index 40b1ac005..ff0daafd2 100644 --- a/dbcon/joblist/limitedorderby.h +++ b/dbcon/joblist/limitedorderby.h @@ -38,17 +38,17 @@ class LimitedOrderBy : public ordering::IdbOrderBy { public: LimitedOrderBy(); - virtual ~LimitedOrderBy(); + ~LimitedOrderBy() override; using ordering::IdbOrderBy::initialize; void initialize(const rowgroup::RowGroup&, const JobInfo&, bool invertRules = false, bool isMultiThreded = false); - void processRow(const rowgroup::Row&); - uint64_t getKeyLength() const; + void processRow(const rowgroup::Row&) override; + uint64_t getKeyLength() const override; uint64_t getLimitCount() const { return fCount; } - const std::string toString() const; + const std::string toString() const override; void finalize(); diff --git a/dbcon/joblist/passthrucommand-jl.h b/dbcon/joblist/passthrucommand-jl.h index 965c51bab..ea7c93bb3 100644 --- a/dbcon/joblist/passthrucommand-jl.h +++ b/dbcon/joblist/passthrucommand-jl.h @@ -41,18 +41,19 @@ class PassThruStep; class PassThruCommandJL : public CommandJL { public: - PassThruCommandJL(const PassThruStep&); - virtual ~PassThruCommandJL(); + explicit PassThruCommandJL(const PassThruStep&); + ~PassThruCommandJL() override; - void setLBID(uint64_t data, uint32_t dbroot); // converts a rid or dictionary token to an LBID. For - // ColumnCommandJL it's a RID, for a DictStep it's a token. - uint8_t getTableColumnType(); - std::string toString(); + void setLBID(uint64_t data, + uint32_t dbroot) override; // converts a rid or dictionary token to an LBID. For + // ColumnCommandJL it's a RID, for a DictStep it's a token. + uint8_t getTableColumnType() override; + std::string toString() override; - void createCommand(messageqcpp::ByteStream&) const; - void runCommand(messageqcpp::ByteStream&) const; - uint16_t getWidth(); - CommandType getCommandType() + void createCommand(messageqcpp::ByteStream&) const override; + void runCommand(messageqcpp::ByteStream&) const override; + uint16_t getWidth() override; + CommandType getCommandType() override { return PASS_THRU; } diff --git a/dbcon/joblist/primitivemsg.h b/dbcon/joblist/primitivemsg.h index f06a7e99c..0d3cdaccc 100644 --- a/dbcon/joblist/primitivemsg.h +++ b/dbcon/joblist/primitivemsg.h @@ -35,7 +35,6 @@ #pragma pack(push, 1) - // from blocksize.h const int32_t DATA_BLOCK_SIZE = BLOCK_SIZE; @@ -65,7 +64,7 @@ using utils::ConstString; class StringComparator : public datatypes::Charset { public: - StringComparator(const Charset& cs) : Charset(cs) + explicit StringComparator(const Charset& cs) : Charset(cs) { } bool op(int* error, uint8_t COP, const ConstString& str1, const ConstString& str2) const @@ -74,7 +73,8 @@ class StringComparator : public datatypes::Charset return like(COP & COMPARE_NOT, str1, str2); if (COP == COMPARE_NULLEQ) - return str1.isNull() == str2.isNull(); // XXX: TODO: I do not know the logic here, so it is temporary solution. + return str1.isNull() == + str2.isNull(); // XXX: TODO: I do not know the logic here, so it is temporary solution. int cmp = strnncollsp(str1, str2); @@ -335,7 +335,7 @@ struct ColRequestHeaderDataType : public datatypes::Charset ColRequestHeaderDataType() : Charset(my_charset_bin), CompType(0), DataSize(0), DataType(0) { } - ColRequestHeaderDataType(const execplan::CalpontSystemCatalog::ColType& rhs) + explicit ColRequestHeaderDataType(const execplan::CalpontSystemCatalog::ColType& rhs) : Charset(rhs.charsetNumber) , CompType(rhs.compressionType) , DataSize(rhs.colWidth) @@ -633,7 +633,7 @@ struct TokenByScanResultHeader uint16_t Pad1; uint32_t CacheIO; // I/O count from buffer cache uint32_t PhysicalIO; // Physical I/O count from disk -}; // what follows is NVALS Tokens or DataValues. +}; // what follows is NVALS Tokens or DataValues. // DICT_SIGNATURE @@ -889,5 +889,4 @@ struct LbidAtVer uint32_t Ver; }; - #pragma pack(pop) diff --git a/dbcon/joblist/primitivestep.h b/dbcon/joblist/primitivestep.h index 4b94dd453..008a0e81f 100644 --- a/dbcon/joblist/primitivestep.h +++ b/dbcon/joblist/primitivestep.h @@ -102,26 +102,26 @@ class pColStep : public JobStep pColStep(execplan::CalpontSystemCatalog::OID oid, execplan::CalpontSystemCatalog::OID tableOid, const execplan::CalpontSystemCatalog::ColType& ct, const JobInfo& jobInfo); - pColStep(const pColScanStep& rhs); + explicit pColStep(const pColScanStep& rhs); - pColStep(const PassThruStep& rhs); + explicit pColStep(const PassThruStep& rhs); - virtual ~pColStep(){}; + ~pColStep() override = default; /** @brief Starts processing. Set at least the RID list before calling. * * Starts processing. Set at least the RID list before calling this. */ - virtual void run() {}; + void run() override {}; /** @brief Sync's the caller with the end of execution. * * Does nothing. Returns when this instance is finished. */ - virtual void join() {}; + void join() override {}; - virtual const std::string toString() const; + const std::string toString() const override; - virtual bool isDictCol() const + bool isDictCol() const override { return fIsDict; } @@ -186,12 +186,12 @@ class pColStep : public JobStep return fSwallowRows; } - virtual execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return fOid; } - virtual execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } @@ -222,15 +222,15 @@ class pColStep : public JobStep { isFilterFeeder = filterFeeder; } - virtual uint64_t msgsRcvdCount() const + uint64_t msgsRcvdCount() const override { return msgsRecvd; } - virtual uint64_t msgBytesIn() const + uint64_t msgBytesIn() const override { return fMsgBytesIn; } - virtual uint64_t msgBytesOut() const + uint64_t msgBytesOut() const override { return fMsgBytesOut; } @@ -336,16 +336,14 @@ class pColScanStep : public JobStep pColScanStep(execplan::CalpontSystemCatalog::OID oid, execplan::CalpontSystemCatalog::OID tableOid, const execplan::CalpontSystemCatalog::ColType& ct, const JobInfo& jobInfo); - pColScanStep(const pColStep& rhs); - ~pColScanStep() - { - } + explicit pColScanStep(const pColStep& rhs); + ~pColScanStep() override = default; /** @brief Starts processing. * * Starts processing. */ - virtual void run() + void run() override { } @@ -353,11 +351,11 @@ class pColScanStep : public JobStep * * Does nothing. Returns when this instance is finished. */ - virtual void join() + void join() override { } - virtual bool isDictCol() const + bool isDictCol() const override { return fIsDict; }; @@ -413,14 +411,14 @@ class pColScanStep : public JobStep return fFilterCount; } - virtual const std::string toString() const; + const std::string toString() const override; - virtual execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return fOid; } - virtual execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } @@ -433,11 +431,11 @@ class pColScanStep : public JobStep return fRm; } - virtual uint64_t msgBytesIn() const + uint64_t msgBytesIn() const override { return fMsgBytesIn; } - virtual uint64_t msgBytesOut() const + uint64_t msgBytesOut() const override { return fMsgBytesOut; } @@ -479,7 +477,6 @@ class pColScanStep : public JobStep return fFilters; } - private: // defaults okay? // pColScanStep(const pColScanStep& rhs); @@ -545,16 +542,14 @@ class pDictionaryStep : public JobStep pDictionaryStep(execplan::CalpontSystemCatalog::OID oid, execplan::CalpontSystemCatalog::OID tabelOid, const execplan::CalpontSystemCatalog::ColType& ct, const JobInfo& jobInfo); - virtual ~pDictionaryStep() - { - } + ~pDictionaryStep() override = default; /** @brief virtual void Run method */ - virtual void run() + void run() override { } - virtual void join() + void join() override { } // void setOutList(StringDataList* rids); @@ -568,7 +563,7 @@ class pDictionaryStep : public JobStep fBOP = b; } - virtual const std::string toString() const; + const std::string toString() const override; execplan::CalpontSystemCatalog::ColType& colType() { @@ -579,23 +574,23 @@ class pDictionaryStep : public JobStep return fColType; } - virtual execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return fOid; } - virtual execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } - virtual uint64_t msgsRcvdCount() const + uint64_t msgsRcvdCount() const override { return msgsRecvd; } - virtual uint64_t msgBytesIn() const + uint64_t msgBytesIn() const override { return fMsgBytesIn; } - virtual uint64_t msgBytesOut() const + uint64_t msgBytesOut() const override { return fMsgBytesOut; } @@ -677,18 +672,18 @@ class pDictionaryScan : public JobStep pDictionaryScan(execplan::CalpontSystemCatalog::OID oid, execplan::CalpontSystemCatalog::OID tableOid, const execplan::CalpontSystemCatalog::ColType& ct, const JobInfo& jobInfo); - ~pDictionaryScan(); + ~pDictionaryScan() override; /** @brief virtual void Run method */ - virtual void run(); - virtual void join(); + void run() override; + void join() override; void setInputList(DataList_t* rids); void setBOP(int8_t b); void sendPrimitiveMessages(); void receivePrimitiveMessages(); void setSingleThread(); - virtual const std::string toString() const; + const std::string toString() const override; void setRidList(DataList* rids); @@ -713,32 +708,32 @@ class pDictionaryScan : public JobStep fDec->addQueue(uniqueID); } - virtual execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return fOid; } - virtual execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } - uint64_t phyIOCount() const + uint64_t phyIOCount() const override { return fPhysicalIO; } - uint64_t cacheIOCount() const + uint64_t cacheIOCount() const override { return fCacheIO; } - uint64_t msgsRcvdCount() const + uint64_t msgsRcvdCount() const override { return msgsRecvd; } - uint64_t msgBytesIn() const + uint64_t msgBytesIn() const override { return fMsgBytesIn; } - uint64_t msgBytesOut() const + uint64_t msgBytesOut() const override { return fMsgBytesOut; } @@ -781,7 +776,7 @@ class pDictionaryScan : public JobStep } void appendFilter(const messageqcpp::ByteStream& filter, unsigned count); - virtual void abort(); + void abort() override; const execplan::CalpontSystemCatalog::ColType& colType() const { @@ -859,7 +854,7 @@ class pDictionaryScan : public JobStep class BatchPrimitive : public JobStep, public DECEventListener { public: - BatchPrimitive(const JobInfo& jobInfo) : JobStep(jobInfo) + explicit BatchPrimitive(const JobInfo& jobInfo) : JobStep(jobInfo) { } virtual bool getFeederFlag() const = 0; @@ -922,20 +917,20 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep TupleBPS(const pDictionaryStep& rhs, const JobInfo& jobInfo); TupleBPS(const pDictionaryScan& rhs, const JobInfo& jobInfo); TupleBPS(const PassThruStep& rhs, const JobInfo& jobInfo); - virtual ~TupleBPS(); + ~TupleBPS() override; /** @brief Starts processing. * * Starts processing. */ - virtual void run(); + void run() override; /** @brief Sync's the caller with the end of execution. * * Does nothing. Returns when this instance is finished. */ - virtual void join(); + void join() override; - void abort(); + void abort() override; void abort_nolock(); /** @brief The main loop for the send-side thread @@ -960,11 +955,11 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep * Add a filter when the column is anything but a 4-byte float type, including * 8-byte doubles. */ - void setBPP(JobStep* jobStep); - void setProjectBPP(JobStep* jobStep1, JobStep* jobStep2); + void setBPP(JobStep* jobStep) override; + void setProjectBPP(JobStep* jobStep1, JobStep* jobStep2) override; bool scanit(uint64_t rid); void storeCasualPartitionInfo(const bool estimateRowCounts); - bool getFeederFlag() const + bool getFeederFlag() const override { return isFilterFeeder; } @@ -972,7 +967,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep { isFilterFeeder = filterFeeder; } - void setSwallowRows(const bool swallowRows) + void setSwallowRows(const bool swallowRows) override { fSwallowRows = swallowRows; } @@ -982,25 +977,25 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep } /* Base class interface fcn that can go away */ - void setOutputType(BPSOutputType) + void setOutputType(BPSOutputType) override { } // Can't change the ot of a TupleBPS - BPSOutputType getOutputType() const + BPSOutputType getOutputType() const override { return ROW_GROUP; } - void setBppStep() + void setBppStep() override { } - void setIsProjectionOnly() + void setIsProjectionOnly() override { } - uint64_t getRows() const + uint64_t getRows() const override { return ridsReturned; } - void setFirstStepType(PrimitiveStepType firstStepType) + void setFirstStepType(PrimitiveStepType firstStepType) override { ffirstStepType = firstStepType; } @@ -1008,19 +1003,19 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep { return ffirstStepType; } - void setStepCount() + void setStepCount() override { fStepCount++; } - uint32_t getStepCount() const + uint32_t getStepCount() const override { return fStepCount; } - void setLastTupleId(uint64_t id) + void setLastTupleId(uint64_t id) override { fLastTupleId = id; } - uint64_t getLastTupleId() const + uint64_t getLastTupleId() const override { return fLastTupleId; } @@ -1029,20 +1024,20 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep * * Set the DistributedEngineComm object this instance should use */ - void dec(DistributedEngineComm* dec); + void dec(DistributedEngineComm* dec) override; - virtual void stepId(uint16_t stepId); - virtual uint16_t stepId() const + void stepId(uint16_t stepId) override; + uint16_t stepId() const override { return fStepId; } - virtual const std::string toString() const; + const std::string toString() const override; - virtual execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return fOid; } - virtual execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } @@ -1050,40 +1045,40 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep { return fColType; } - const OIDVector& getProjectOids() const + const OIDVector& getProjectOids() const override { return projectOids; } - virtual uint64_t phyIOCount() const + uint64_t phyIOCount() const override { return fPhysicalIO; } - virtual uint64_t cacheIOCount() const + uint64_t cacheIOCount() const override { return fCacheIO; } - virtual uint64_t msgsRcvdCount() const + uint64_t msgsRcvdCount() const override { return msgsRecvd; } - virtual uint64_t msgBytesIn() const + uint64_t msgBytesIn() const override { return fMsgBytesIn; } - virtual uint64_t msgBytesOut() const + uint64_t msgBytesOut() const override { return fMsgBytesOut; } - virtual uint64_t blockTouched() const + uint64_t blockTouched() const override { return fBlockTouched; } - uint32_t nextBand(messageqcpp::ByteStream& bs); + uint32_t nextBand(messageqcpp::ByteStream& bs) override; //...Currently only supported by pColStep and pColScanStep, so didn't bother //...to define abstract method in base class, but if start adding to other //...classes, then should consider adding pure virtual method to JobStep. - uint64_t blksSkipped() const + uint64_t blksSkipped() const override { return fNumBlksSkipped; } @@ -1094,17 +1089,17 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep } void useJoiner(std::shared_ptr); void useJoiners(const std::vector>&); - bool wasStepRun() const + bool wasStepRun() const override { return fRunExecuted; } // DEC event listener interface - void newPMOnline(uint32_t connectionNumber); + void newPMOnline(uint32_t connectionNumber) override; void setInputRowGroup(const rowgroup::RowGroup& rg); - void setOutputRowGroup(const rowgroup::RowGroup& rg); - const rowgroup::RowGroup& getOutputRowGroup() const; + void setOutputRowGroup(const rowgroup::RowGroup& rg) override; + const rowgroup::RowGroup& getOutputRowGroup() const override; void setAggregateStep(const rowgroup::SP_ROWAGG_PM_t& agg, const rowgroup::RowGroup& rg); @@ -1118,7 +1113,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep return bop; } - void setJobInfo(const JobInfo* jobInfo); + void setJobInfo(const JobInfo* jobInfo) override; // @bug 2123. Added getEstimatedRowCount function. /* @brief estimates the number of rows that will be returned for use in determining the @@ -1141,9 +1136,9 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep JLF should register that object with the TBPS for that table. If it's cross-table, then JLF should register it with the join step. */ - void addFcnJoinExp(const std::vector& fe); - void addFcnExpGroup1(const boost::shared_ptr& fe); - void setFE1Input(const rowgroup::RowGroup& feInput); + void addFcnJoinExp(const std::vector& fe) override; + void addFcnExpGroup1(const boost::shared_ptr& fe) override; + void setFE1Input(const rowgroup::RowGroup& feInput) override; /* for use by the THJS only... */ void setFcnExpGroup2(const boost::shared_ptr& fe2, @@ -1152,17 +1147,17 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep /* Functions & Expressions in select and groupby clause. JLF should use these only if there isn't a join. If there is, call the equivalent fcn on THJS instead */ - void setFcnExpGroup3(const std::vector& fe); - void setFE23Output(const rowgroup::RowGroup& rg); + void setFcnExpGroup3(const std::vector& fe) override; + void setFE23Output(const rowgroup::RowGroup& rg) override; bool hasFcnExpGroup3() { return (fe2 != NULL); } // rowgroup to connector - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; /* Interface for adding add'l predicates for casual partitioning. * This fcn checks for any intersection between the values in vals @@ -1185,7 +1180,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep void reloadExtentLists(); void initExtentMarkers(); // need a better name for this - virtual bool stringTableFriendly() + bool stringTableFriendly() override { return true; } @@ -1486,16 +1481,16 @@ class FilterStep : public JobStep { public: FilterStep(const execplan::CalpontSystemCatalog::ColType& colType, const JobInfo& jobInfo); - ~FilterStep(); + ~FilterStep() override; /** @brief virtual void Run method */ - void run(); - void join(); + void run() override; + void join() override; - const std::string toString() const; + const std::string toString() const override; - execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOID; } @@ -1526,7 +1521,7 @@ class FilterStep : public JobStep private: // This i/f is not meaningful in this step - execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return 0; } @@ -1562,31 +1557,31 @@ class PassThruStep : public JobStep PassThruStep(execplan::CalpontSystemCatalog::OID oid, execplan::CalpontSystemCatalog::OID tableOid, const execplan::CalpontSystemCatalog::ColType& colType, const JobInfo& jobInfo); - PassThruStep(const pColStep& rhs); - PassThruStep(const PseudoColStep& rhs); + explicit PassThruStep(const pColStep& rhs); + explicit PassThruStep(const PseudoColStep& rhs); - virtual ~PassThruStep(); + ~PassThruStep() override; /** @brief Starts processing. Set at least the RID list before calling. * * Starts processing. Set at least the RID list before calling this. */ - virtual void run(); + void run() override; /** @brief Sync's the caller with the end of execution. * * Does nothing. Returns when this instance is finished. */ - virtual void join(); + void join() override; - virtual const std::string toString() const; + const std::string toString() const override; - virtual execplan::CalpontSystemCatalog::OID oid() const + execplan::CalpontSystemCatalog::OID oid() const override { return fOid; } - virtual execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } @@ -1595,7 +1590,7 @@ class PassThruStep : public JobStep { return colWidth; } - bool isDictCol() const + bool isDictCol() const override { return isDictColumn; } @@ -1663,13 +1658,11 @@ class PseudoColStep : public pColStep { } - PseudoColStep(const PassThruStep& rhs) : pColStep(rhs), fPseudoColumnId(rhs.pseudoType()) + explicit PseudoColStep(const PassThruStep& rhs) : pColStep(rhs), fPseudoColumnId(rhs.pseudoType()) { } - virtual ~PseudoColStep() - { - } + ~PseudoColStep() override = default; uint32_t pseudoColumnId() const { @@ -1686,8 +1679,8 @@ class PseudoColStep : public pColStep private: /** @brief disabled constuctor */ - PseudoColStep(const pColScanStep&); - PseudoColStep(const pColStep&); + explicit PseudoColStep(const pColScanStep&); + explicit PseudoColStep(const pColStep&); }; } // namespace joblist diff --git a/dbcon/joblist/pseudocc-jl.h b/dbcon/joblist/pseudocc-jl.h index efba4f304..04cf13ef7 100644 --- a/dbcon/joblist/pseudocc-jl.h +++ b/dbcon/joblist/pseudocc-jl.h @@ -24,12 +24,12 @@ namespace joblist class PseudoCCJL : public ColumnCommandJL { public: - PseudoCCJL(const PseudoColStep&); - virtual ~PseudoCCJL(); + explicit PseudoCCJL(const PseudoColStep&); + ~PseudoCCJL() override; - virtual void createCommand(messageqcpp::ByteStream&) const; - virtual void runCommand(messageqcpp::ByteStream&) const; - virtual std::string toString(); + void createCommand(messageqcpp::ByteStream&) const override; + void runCommand(messageqcpp::ByteStream&) const override; + std::string toString() override; uint32_t getFunction() const { return function; diff --git a/dbcon/joblist/resourcedistributor.h b/dbcon/joblist/resourcedistributor.h index 8feb4e36b..6a04bdbd1 100644 --- a/dbcon/joblist/resourcedistributor.h +++ b/dbcon/joblist/resourcedistributor.h @@ -58,7 +58,7 @@ extern const unsigned maxSessionsDefault; class LockedSessionMap { public: - LockedSessionMap(uint64_t resource, unsigned maxSessions = maxSessionsDefault) + explicit LockedSessionMap(uint64_t resource, unsigned maxSessions = maxSessionsDefault) : fResourceBlock(resource), fMaxSessions(maxSessions) { } @@ -93,9 +93,7 @@ class ResourceDistributor { } - virtual ~ResourceDistributor() - { - } + virtual ~ResourceDistributor() = default; typedef std::map SessionMap; diff --git a/dbcon/joblist/resourcemanager.h b/dbcon/joblist/resourcemanager.h index 733539d3a..0bf5a9c7f 100644 --- a/dbcon/joblist/resourcemanager.h +++ b/dbcon/joblist/resourcemanager.h @@ -100,9 +100,9 @@ const uint64_t defaultRowsPerBatch = 10000; /* HJ CP feedback, see bug #1465 */ const uint32_t defaultHjCPUniqueLimit = 100; -const constexpr uint64_t defaultFlowControlEnableBytesThresh = 50000000; // ~50Mb +const constexpr uint64_t defaultFlowControlEnableBytesThresh = 50000000; // ~50Mb const constexpr uint64_t defaultFlowControlDisableBytesThresh = 10000000; // ~10 MB -const constexpr uint64_t defaultBPPSendThreadBytesThresh = 250000000; // ~250 MB +const constexpr uint64_t defaultBPPSendThreadBytesThresh = 250000000; // ~250 MB const constexpr uint64_t BPPSendThreadMsgThresh = 100; const bool defaultAllowDiskAggregation = false; @@ -117,7 +117,7 @@ class ResourceManager /** @brief ctor * */ - ResourceManager(bool runningInExeMgr = false, config::Config* aConfig = nullptr); + explicit ResourceManager(bool runningInExeMgr = false, config::Config* aConfig = nullptr); static ResourceManager* instance(bool runningInExeMgr = false, config::Config* aConfig = nullptr); config::Config* getConfig() { @@ -126,9 +126,7 @@ class ResourceManager /** @brief dtor */ - virtual ~ResourceManager() - { - } + virtual ~ResourceManager() = default; typedef std::map MemMap; @@ -286,12 +284,14 @@ class ResourceManager uint64_t getDECEnableBytesThresh() const { - return getUintVal(FlowControlStr, "DECFlowControlEnableBytesThresh(", defaultFlowControlEnableBytesThresh); + return getUintVal(FlowControlStr, "DECFlowControlEnableBytesThresh(", + defaultFlowControlEnableBytesThresh); } uint32_t getDECDisableBytesThresh() const { - return getUintVal(FlowControlStr, "DECFlowControlDisableBytesThresh", defaultFlowControlDisableBytesThresh); + return getUintVal(FlowControlStr, "DECFlowControlDisableBytesThresh", + defaultFlowControlDisableBytesThresh); } uint32_t getBPPSendThreadBytesThresh() const diff --git a/dbcon/joblist/rtscommand-jl.h b/dbcon/joblist/rtscommand-jl.h index 3c114fb05..c92fc6926 100644 --- a/dbcon/joblist/rtscommand-jl.h +++ b/dbcon/joblist/rtscommand-jl.h @@ -42,24 +42,25 @@ class RTSCommandJL : public CommandJL public: RTSCommandJL(const pColStep&, const pDictionaryStep&); RTSCommandJL(const PassThruStep&, const pDictionaryStep&); - virtual ~RTSCommandJL(); + ~RTSCommandJL() override; - void setLBID(uint64_t data, uint32_t dbroot); // converts a rid or dictionary token to an LBID. For - // ColumnCommandJL it's a RID, for a DictStep it's a token. - uint8_t getTableColumnType(); - std::string toString(); + void setLBID(uint64_t data, + uint32_t dbroot) override; // converts a rid or dictionary token to an LBID. For + // ColumnCommandJL it's a RID, for a DictStep it's a token. + uint8_t getTableColumnType() override; + std::string toString() override; bool isPassThru() { return (passThru != 0); } - uint16_t getWidth(); - CommandType getCommandType() + uint16_t getWidth() override; + CommandType getCommandType() override { return RID_TO_STRING; } - void createCommand(messageqcpp::ByteStream&) const; - void runCommand(messageqcpp::ByteStream&) const; + void createCommand(messageqcpp::ByteStream&) const override; + void runCommand(messageqcpp::ByteStream&) const override; private: RTSCommandJL(); diff --git a/dbcon/joblist/subquerystep.h b/dbcon/joblist/subquerystep.h index d39572b40..ad81ca360 100644 --- a/dbcon/joblist/subquerystep.h +++ b/dbcon/joblist/subquerystep.h @@ -40,28 +40,28 @@ class SubQueryStep : public JobStep public: /** @brief SubQueryStep constructor */ - SubQueryStep(const JobInfo&); + explicit SubQueryStep(const JobInfo&); /** @brief SubQueryStep destructor */ - ~SubQueryStep(); + ~SubQueryStep() override; /** @brief virtual void run method */ - void run(); + void run() override; /** @brief virtual void join method */ - void join(); + void join() override; /** @brief virtual void abort method */ - void abort(); + void abort() override; /** @brief virtual get table OID * @returns OID */ - execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } @@ -76,7 +76,7 @@ class SubQueryStep : public JobStep /** @brief virtual output info to a string * @returns string */ - const std::string toString() const; + const std::string toString() const override; /** @brief virtual set the output rowgroup */ @@ -128,24 +128,24 @@ class SubAdapterStep : public JobStep, public TupleDeliveryStep /** @brief SubAdapterStep destructor */ - ~SubAdapterStep(); + ~SubAdapterStep() override; /** @brief virtual void run method */ - void run(); + void run() override; /** @brief virtual void join method */ - void join(); + void join() override; /** @brief virtual void abort method */ - void abort(); + void abort() override; /** @brief virtual get table OID * @returns OID */ - execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOid; } @@ -160,16 +160,16 @@ class SubAdapterStep : public JobStep, public TupleDeliveryStep /** @brief virtual output info to a string * @returns string */ - const std::string toString() const; + const std::string toString() const override; /** @brief virtual set the output rowgroup */ - void setOutputRowGroup(const rowgroup::RowGroup& rg); + void setOutputRowGroup(const rowgroup::RowGroup& rg) override; /** @brief virtual get the output rowgroup * @returns RowGroup */ - const rowgroup::RowGroup& getOutputRowGroup() const + const rowgroup::RowGroup& getOutputRowGroup() const override { return fRowGroupOut; } @@ -177,24 +177,24 @@ class SubAdapterStep : public JobStep, public TupleDeliveryStep /** @brief TupleDeliveryStep's pure virtual methods nextBand * @returns row count */ - uint32_t nextBand(messageqcpp::ByteStream& bs); + uint32_t nextBand(messageqcpp::ByteStream& bs) override; /** @brief Delivered Row Group * @returns RowGroup */ - const rowgroup::RowGroup& getDeliveredRowGroup() const + const rowgroup::RowGroup& getDeliveredRowGroup() const override { return fRowGroupDeliver; } /** @brief Turn on/off string table delivery */ - void deliverStringTableRowGroup(bool b); + void deliverStringTableRowGroup(bool b) override; /** @brief Check useStringTable flag on delivered RowGroup * @returns boolean */ - bool deliverStringTableRowGroup() const; + bool deliverStringTableRowGroup() const override; /** @brief set the rowgroup for FE to work on */ @@ -255,7 +255,7 @@ class SubAdapterStep : public JobStep, public TupleDeliveryStep class Runner { public: - Runner(SubAdapterStep* step) : fStep(step) + explicit Runner(SubAdapterStep* step) : fStep(step) { } void operator()() @@ -272,4 +272,3 @@ class SubAdapterStep : public JobStep, public TupleDeliveryStep }; } // namespace joblist - diff --git a/dbcon/joblist/subquerytransformer.h b/dbcon/joblist/subquerytransformer.h index 5f9ea4e86..1d973e81a 100644 --- a/dbcon/joblist/subquerytransformer.h +++ b/dbcon/joblist/subquerytransformer.h @@ -176,15 +176,15 @@ class SimpleScalarTransformer : public SubQueryTransformer /** @brief SimpleScalarTransformer constructor * @param SubQueryTransformer */ - SimpleScalarTransformer(const SubQueryTransformer& rhs); + explicit SimpleScalarTransformer(const SubQueryTransformer& rhs); /** @brief SimpleScalarTransformer destructor */ - virtual ~SimpleScalarTransformer(); + ~SimpleScalarTransformer() override; /** @brief virtual void run method */ - void run(); + void run() override; /** @brief virtual get scalar result * @param jobInfo @@ -222,4 +222,3 @@ class SimpleScalarTransformer : public SubQueryTransformer }; } // namespace joblist - diff --git a/dbcon/joblist/threadsafequeue.h b/dbcon/joblist/threadsafequeue.h index 36958ba14..71d6ca44c 100644 --- a/dbcon/joblist/threadsafequeue.h +++ b/dbcon/joblist/threadsafequeue.h @@ -28,8 +28,6 @@ #include #include - - namespace joblist { struct TSQSize_t @@ -56,7 +54,7 @@ class ThreadSafeQueue * * @warning this class takes ownership of the passed-in pointers. */ - ThreadSafeQueue(boost::mutex* pimplLock = 0, boost::condition* pimplCond = 0) + ThreadSafeQueue(boost::mutex* pimplLock = nullptr, boost::condition* pimplCond = nullptr) : fShutdown(false), bytes(0), zeroCount(0) { fPimplLock.reset(pimplLock); @@ -113,7 +111,7 @@ class ThreadSafeQueue */ T& front() { - if (fPimplLock == 0 || fPimplCond == 0) + if (fPimplLock == nullptr || fPimplCond == nullptr) throw std::runtime_error("TSQ: front(): no sync!"); boost::mutex::scoped_lock lk(*fPimplLock); @@ -140,7 +138,7 @@ class ThreadSafeQueue { TSQSize_t ret = {0, 0}; - if (fPimplLock == 0 || fPimplCond == 0) + if (fPimplLock == nullptr || fPimplCond == nullptr) throw std::runtime_error("TSQ: push(): no sync!"); if (fShutdown) @@ -161,7 +159,7 @@ class ThreadSafeQueue { TSQSize_t ret = {0, 0}; - if (fPimplLock == 0) + if (fPimplLock == nullptr) throw std::runtime_error("TSQ: pop(): no sync!"); if (fShutdown) @@ -213,7 +211,7 @@ class ThreadSafeQueue uint32_t curSize, workSize; TSQSize_t ret = {0, 0}; - if (fPimplLock == 0) + if (fPimplLock == nullptr) throw std::runtime_error("TSQ: pop_some(): no sync!"); t.clear(); @@ -268,7 +266,7 @@ class ThreadSafeQueue */ bool empty() const { - if (fPimplLock == 0) + if (fPimplLock == nullptr) throw std::runtime_error("TSQ: empty(): no sync!"); boost::mutex::scoped_lock lk(*fPimplLock); @@ -281,7 +279,7 @@ class ThreadSafeQueue { TSQSize_t ret; - if (fPimplLock == 0) + if (fPimplLock == nullptr) throw std::runtime_error("TSQ: size(): no sync!"); boost::mutex::scoped_lock lk(*fPimplLock); @@ -298,15 +296,13 @@ class ThreadSafeQueue { fShutdown = true; - if (fPimplCond != 0) + if (fPimplCond != nullptr) fPimplCond->notify_all(); - - return; } void clear() { - if (fPimplLock == 0) + if (fPimplLock == nullptr) throw std::runtime_error("TSQ: clear(): no sync!"); boost::mutex::scoped_lock lk(*fPimplLock); @@ -315,7 +311,6 @@ class ThreadSafeQueue fImpl.pop(); bytes = 0; - return; } private: diff --git a/dbcon/joblist/timestamp.h b/dbcon/joblist/timestamp.h index 2aa188d34..20597fb4f 100644 --- a/dbcon/joblist/timestamp.h +++ b/dbcon/joblist/timestamp.h @@ -33,27 +33,27 @@ class JSTimeStamp { public: JSTimeStamp(); - ~JSTimeStamp(){}; + ~JSTimeStamp() = default; inline void setFirstInsertTime() { - gettimeofday(&fFirstInsertTime, 0); + gettimeofday(&fFirstInsertTime, nullptr); } inline void setLastInsertTime() { - gettimeofday(&fLastInsertTime, 0); + gettimeofday(&fLastInsertTime, nullptr); } inline void setEndOfInputTime() { - gettimeofday(&fEndofInputTime, 0); + gettimeofday(&fEndofInputTime, nullptr); } inline void setFirstReadTime() { - gettimeofday(&fFirstReadTime, 0); + gettimeofday(&fFirstReadTime, nullptr); } inline void setLastReadTime() { - gettimeofday(&fLastReadTime, 0); + gettimeofday(&fLastReadTime, nullptr); } inline void setFirstInsertTime(const struct timeval& t) diff --git a/dbcon/joblist/tupleaggregatestep.h b/dbcon/joblist/tupleaggregatestep.h index 18dc22a91..3a816cd3f 100644 --- a/dbcon/joblist/tupleaggregatestep.h +++ b/dbcon/joblist/tupleaggregatestep.h @@ -103,21 +103,21 @@ class TupleAggregateStep : public JobStep, public TupleDeliveryStep /** @brief TupleAggregateStep destructor */ - ~TupleAggregateStep(); + ~TupleAggregateStep() override; /** @brief virtual void Run method */ - void run(); - void join(); + void run() override; + void join() override; - const std::string toString() const; + const std::string toString() const override; - void setOutputRowGroup(const rowgroup::RowGroup&); - const rowgroup::RowGroup& getOutputRowGroup() const; - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; - uint32_t nextBand(messageqcpp::ByteStream& bs); + void setOutputRowGroup(const rowgroup::RowGroup&) override; + const rowgroup::RowGroup& getOutputRowGroup() const override; + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; uint32_t nextBand_singleThread(messageqcpp::ByteStream& bs); bool setPmHJAggregation(JobStep* step); void savePmHJData(rowgroup::SP_ROWAGG_t&, rowgroup::SP_ROWAGG_t&, rowgroup::RowGroup&); @@ -167,9 +167,10 @@ class TupleAggregateStep : public JobStep, public TupleDeliveryStep template static bool tryToFindEqualFunctionColumnByTupleKey(JobInfo& jobInfo, GroupByMap& groupByMap, const uint32_t tupleKey, uint32_t& foundTypleKey); - // This functions are workaround for the function above. For some reason different parts of the code with same - // semantics use different containers. - static uint32_t getTupleKeyFromTuple(const boost::tuple*>& tuple); + // This functions are workaround for the function above. For some reason different parts of the code with + // same semantics use different containers. + static uint32_t getTupleKeyFromTuple( + const boost::tuple*>& tuple); static uint32_t getTupleKeyFromTuple(uint32_t key); boost::shared_ptr fCatalog; @@ -198,7 +199,7 @@ class TupleAggregateStep : public JobStep, public TupleDeliveryStep class Aggregator { public: - Aggregator(TupleAggregateStep* step) : fStep(step) + explicit Aggregator(TupleAggregateStep* step) : fStep(step) { } void operator()() diff --git a/dbcon/joblist/tupleannexstep.h b/dbcon/joblist/tupleannexstep.h index 4443d3641..255306092 100644 --- a/dbcon/joblist/tupleannexstep.h +++ b/dbcon/joblist/tupleannexstep.h @@ -42,30 +42,30 @@ class TupleAnnexStep : public JobStep, public TupleDeliveryStep public: /** @brief TupleAnnexStep constructor */ - TupleAnnexStep(const JobInfo& jobInfo); + explicit TupleAnnexStep(const JobInfo& jobInfo); // Copy ctor to have a class mutex TupleAnnexStep(const TupleAnnexStep& copy); /** @brief TupleAnnexStep destructor */ - ~TupleAnnexStep(); + ~TupleAnnexStep() override; // inherited methods - void run(); - void join(); - const std::string toString() const; + void run() override; + void join() override; + const std::string toString() const override; /** @brief TupleJobStep's pure virtual methods */ - const rowgroup::RowGroup& getOutputRowGroup() const; - void setOutputRowGroup(const rowgroup::RowGroup&); + const rowgroup::RowGroup& getOutputRowGroup() const override; + void setOutputRowGroup(const rowgroup::RowGroup&) override; /** @brief TupleDeliveryStep's pure virtual methods */ - uint32_t nextBand(messageqcpp::ByteStream& bs); - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; void initialize(const rowgroup::RowGroup& rgIn, const JobInfo& jobInfo); @@ -95,7 +95,7 @@ class TupleAnnexStep : public JobStep, public TupleDeliveryStep fMaxThreads = number; } - virtual bool stringTableFriendly() + bool stringTableFriendly() override { return true; } @@ -132,7 +132,7 @@ class TupleAnnexStep : public JobStep, public TupleDeliveryStep class Runner { public: - Runner(TupleAnnexStep* step) : fStep(step), id(0) + explicit Runner(TupleAnnexStep* step) : fStep(step), id(0) { } Runner(TupleAnnexStep* step, uint32_t id) : fStep(step), id(id) @@ -178,7 +178,7 @@ class reservablePQ : private std::priority_queue { public: typedef typename std::priority_queue::size_type size_type; - reservablePQ(size_type capacity = 0) + explicit reservablePQ(size_type capacity = 0) { reserve(capacity); }; @@ -193,4 +193,3 @@ class reservablePQ : private std::priority_queue }; } // namespace joblist - diff --git a/dbcon/joblist/tupleconstantstep.h b/dbcon/joblist/tupleconstantstep.h index ad36b5c9a..3f92470ab 100644 --- a/dbcon/joblist/tupleconstantstep.h +++ b/dbcon/joblist/tupleconstantstep.h @@ -32,34 +32,34 @@ class TupleConstantStep : public JobStep, public TupleDeliveryStep public: /** @brief TupleConstantStep constructor */ - TupleConstantStep(const JobInfo& jobInfo); + explicit TupleConstantStep(const JobInfo& jobInfo); /** @brief TupleConstantStep destructor */ - ~TupleConstantStep(); + ~TupleConstantStep() override; /** @brief virtual void Run method */ - void run(); + void run() override; /** @brief virtual void join method */ - void join(); + void join() override; /** @brief virtual string toString method */ - const std::string toString() const; + const std::string toString() const override; - void setOutputRowGroup(const rowgroup::RowGroup&); - const rowgroup::RowGroup& getOutputRowGroup() const; - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; - uint32_t nextBand(messageqcpp::ByteStream& bs); + void setOutputRowGroup(const rowgroup::RowGroup&) override; + const rowgroup::RowGroup& getOutputRowGroup() const override; + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; virtual void initialize(const JobInfo& jobInfo, const rowgroup::RowGroup* rgIn); virtual void fillInConstants(const rowgroup::Row& rowIn, rowgroup::Row& rowOut); - static SJSTEP addConstantStep(const JobInfo& jobInfo, const rowgroup::RowGroup* rg = NULL); + static SJSTEP addConstantStep(const JobInfo& jobInfo, const rowgroup::RowGroup* rg = nullptr); protected: virtual void execute(); @@ -93,7 +93,7 @@ class TupleConstantStep : public JobStep, public TupleDeliveryStep class Runner { public: - Runner(TupleConstantStep* step) : fStep(step) + explicit Runner(TupleConstantStep* step) : fStep(step) { } void operator()() @@ -114,26 +114,26 @@ class TupleConstantOnlyStep : public TupleConstantStep public: /** @brief TupleConstantOnlyStep constructor */ - TupleConstantOnlyStep(const JobInfo& jobInfo); + explicit TupleConstantOnlyStep(const JobInfo& jobInfo); /** @brief TupleConstantOnlyStep destructor */ - ~TupleConstantOnlyStep(); + ~TupleConstantOnlyStep() override; /** @brief virtual void Run method */ - void run(); + void run() override; /** @brief virtual void initialize method */ - virtual void initialize(const JobInfo& jobInfo, const rowgroup::RowGroup* rgIn); + void initialize(const JobInfo& jobInfo, const rowgroup::RowGroup* rgIn) override; - const std::string toString() const; - uint32_t nextBand(messageqcpp::ByteStream& bs); + const std::string toString() const override; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; protected: using TupleConstantStep::fillInConstants; - void fillInConstants(); + void fillInConstants() override; }; class TupleConstantBooleanStep : public TupleConstantStep @@ -145,11 +145,11 @@ class TupleConstantBooleanStep : public TupleConstantStep /** @brief TupleConstantBooleanStep destructor */ - ~TupleConstantBooleanStep(); + ~TupleConstantBooleanStep() override; /** @brief virtual void Run method */ - void run(); + void run() override; /** @brief virtual void initialize method For some reason, this doesn't match the base class's virtual signature. @@ -159,8 +159,8 @@ class TupleConstantBooleanStep : public TupleConstantStep using TupleConstantStep::initialize; void initialize(const rowgroup::RowGroup& rgIn, const JobInfo& jobInfo); - const std::string toString() const; - uint32_t nextBand(messageqcpp::ByteStream& bs); + const std::string toString() const override; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; virtual void boolValue(bool b) { @@ -172,14 +172,14 @@ class TupleConstantBooleanStep : public TupleConstantStep } protected: - void execute() + void execute() override { } using TupleConstantStep::fillInConstants; - void fillInConstants() + void fillInConstants() override { } - void constructContanstRow(const JobInfo& jobInfo) + void constructContanstRow(const JobInfo& jobInfo) override { } @@ -188,4 +188,3 @@ class TupleConstantBooleanStep : public TupleConstantStep }; } // namespace joblist - diff --git a/dbcon/joblist/tuplehashjoin.h b/dbcon/joblist/tuplehashjoin.h index 1636ccd18..9b8adafe0 100644 --- a/dbcon/joblist/tuplehashjoin.h +++ b/dbcon/joblist/tuplehashjoin.h @@ -46,20 +46,20 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep /** * @param */ - TupleHashJoinStep(const JobInfo& jobInfo); - virtual ~TupleHashJoinStep(); + explicit TupleHashJoinStep(const JobInfo& jobInfo); + ~TupleHashJoinStep() override; void setLargeSideBPS(BatchPrimitive*); void setLargeSideStepsOut(const std::vector& largeSideSteps); void setSmallSideStepsOut(const std::vector& smallSideSteps); /* mandatory JobStep interface */ - void run(); - void join(); - const std::string toString() const; + void run() override; + void join() override; + const std::string toString() const override; /* These tableOID accessors can go away soon */ - execplan::CalpontSystemCatalog::OID tableOid() const + execplan::CalpontSystemCatalog::OID tableOid() const override { return fTableOID2; } @@ -178,7 +178,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep fCorrelatedSide = c; } using JobStep::tupleId; - uint64_t tupleId() const + uint64_t tupleId() const override { return fTupleId2; } @@ -212,11 +212,11 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep const std::vector>& smallkeys, const std::vector>& largekeys); - void setOutputRowGroup(const rowgroup::RowGroup& rg); + void setOutputRowGroup(const rowgroup::RowGroup& rg) override; - uint32_t nextBand(messageqcpp::ByteStream& bs); + uint32_t nextBand(messageqcpp::ByteStream& bs) override; - const rowgroup::RowGroup& getOutputRowGroup() const + const rowgroup::RowGroup& getOutputRowGroup() const override { return outputRG; } @@ -311,17 +311,17 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep void addFcnExpGroup2(const boost::shared_ptr& fe); bool hasFcnExpGroup2() { - return (fe2 != NULL); + return (fe2 != nullptr); } /* Functions & Expressions in select and groupby clause */ - void setFcnExpGroup3(const std::vector& fe); - void setFE23Output(const rowgroup::RowGroup& rg); + void setFcnExpGroup3(const std::vector& fe) override; + void setFE23Output(const rowgroup::RowGroup& rg) override; /* result rowgroup */ - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; // joinId void joinId(int64_t id) @@ -343,7 +343,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep boost::shared_ptr getJoinFilter(uint32_t index) const; void setJoinFilterInputRG(const rowgroup::RowGroup& rg); - virtual bool stringTableFriendly() + bool stringTableFriendly() override { return true; } @@ -367,7 +367,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep fFunctionJoinInfo = fji; } - void abort(); + void abort() override; void returnMemory() { if (fMemSizeForOutputRG > 0) @@ -462,7 +462,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep struct HJRunner { - HJRunner(TupleHashJoinStep* hj) : HJ(hj) + explicit HJRunner(TupleHashJoinStep* hj) : HJ(hj) { } void operator()() @@ -553,10 +553,10 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep rowgroup::Row& joinedRow, rowgroup::Row& baseRow, std::vector>& joinMatches, std::shared_ptr& smallRowTemplates, RowGroupDL* outputDL, - std::vector>* joiners = NULL, - std::shared_ptr[]>* rgMappings = NULL, - std::shared_ptr[]>* feMappings = NULL, - boost::scoped_array>* smallNullMem = NULL); + std::vector>* joiners = nullptr, + std::shared_ptr[]>* rgMappings = nullptr, + std::shared_ptr[]>* feMappings = nullptr, + boost::scoped_array>* smallNullMem = nullptr); void finishSmallOuterJoin(); void makeDupList(const rowgroup::RowGroup& rg); void processDupList(uint32_t threadID, rowgroup::RowGroup& ingrp, std::vector* rowData); @@ -587,7 +587,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep /* Disk-based join support */ std::vector> djs; - boost::scoped_array > fifos; + boost::scoped_array> fifos; void djsReaderFcn(int index); uint64_t djsReader; // thread handle from thread pool struct DJSReader @@ -608,7 +608,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep void djsRelayFcn(); struct DJSRelay { - DJSRelay(TupleHashJoinStep* hj) : HJ(hj) + explicit DJSRelay(TupleHashJoinStep* hj) : HJ(hj) { } void operator()() diff --git a/dbcon/joblist/tuplehavingstep.h b/dbcon/joblist/tuplehavingstep.h index b4c185e31..8e61ae6d0 100644 --- a/dbcon/joblist/tuplehavingstep.h +++ b/dbcon/joblist/tuplehavingstep.h @@ -39,36 +39,36 @@ class TupleHavingStep : public ExpressionStep, public TupleDeliveryStep public: /** @brief TupleHavingStep constructor */ - TupleHavingStep(const JobInfo& jobInfo); + explicit TupleHavingStep(const JobInfo& jobInfo); /** @brief TupleHavingStep destructor */ - ~TupleHavingStep(); + ~TupleHavingStep() override; /** @brief virtual void Run method */ - void run(); - void join(); + void run() override; + void join() override; - const std::string toString() const; + const std::string toString() const override; /** @brief TupleJobStep's pure virtual methods */ - const rowgroup::RowGroup& getOutputRowGroup() const; - void setOutputRowGroup(const rowgroup::RowGroup&); + const rowgroup::RowGroup& getOutputRowGroup() const override; + void setOutputRowGroup(const rowgroup::RowGroup&) override; /** @brief TupleDeliveryStep's pure virtual methods */ - uint32_t nextBand(messageqcpp::ByteStream& bs); - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; void initialize(const rowgroup::RowGroup& rgIn, const JobInfo& jobInfo); using ExpressionStep::expressionFilter; - void expressionFilter(const execplan::ParseTree* filter, JobInfo& jobInfo); + void expressionFilter(const execplan::ParseTree* filter, JobInfo& jobInfo) override; - virtual bool stringTableFriendly() + bool stringTableFriendly() override { return true; } @@ -93,7 +93,7 @@ class TupleHavingStep : public ExpressionStep, public TupleDeliveryStep class Runner { public: - Runner(TupleHavingStep* step) : fStep(step) + explicit Runner(TupleHavingStep* step) : fStep(step) { } void operator()() @@ -114,4 +114,3 @@ class TupleHavingStep : public ExpressionStep, public TupleDeliveryStep }; } // namespace joblist - diff --git a/dbcon/joblist/tupleunion.h b/dbcon/joblist/tupleunion.h index 9b9a0d75f..8ede13b49 100644 --- a/dbcon/joblist/tupleunion.h +++ b/dbcon/joblist/tupleunion.h @@ -37,37 +37,38 @@ namespace joblist { -using normalizeFunctionsT = std::vector>; +using normalizeFunctionsT = + std::vector>; class TupleUnion : public JobStep, public TupleDeliveryStep { public: TupleUnion(execplan::CalpontSystemCatalog::OID tableOID, const JobInfo& jobInfo); - ~TupleUnion(); + ~TupleUnion() override; - void run(); - void join(); + void run() override; + void join() override; - const std::string toString() const; - execplan::CalpontSystemCatalog::OID tableOid() const; + const std::string toString() const override; + execplan::CalpontSystemCatalog::OID tableOid() const override; void setInputRowGroups(const std::vector&); - void setOutputRowGroup(const rowgroup::RowGroup&); + void setOutputRowGroup(const rowgroup::RowGroup&) override; void setDistinctFlags(const std::vector&); - const rowgroup::RowGroup& getOutputRowGroup() const + const rowgroup::RowGroup& getOutputRowGroup() const override { return outputRG; } - const rowgroup::RowGroup& getDeliveredRowGroup() const + const rowgroup::RowGroup& getDeliveredRowGroup() const override { return outputRG; } - void deliverStringTableRowGroup(bool b) + void deliverStringTableRowGroup(bool b) override { outputRG.setUseStringTable(b); } - bool deliverStringTableRowGroup() const + bool deliverStringTableRowGroup() const override { return outputRG.usesStringTable(); } @@ -107,7 +108,7 @@ class TupleUnion : public JobStep, public TupleDeliveryStep fView2 = vw; } - uint32_t nextBand(messageqcpp::ByteStream& bs); + uint32_t nextBand(messageqcpp::ByteStream& bs) override; private: struct RowPosition @@ -115,12 +116,13 @@ class TupleUnion : public JobStep, public TupleDeliveryStep uint64_t group : 48; uint64_t row : 16; - inline RowPosition(uint64_t i = 0, uint64_t j = 0) : group(i), row(j){}; + inline explicit RowPosition(uint64_t i = 0, uint64_t j = 0) : group(i), row(j){}; static const uint64_t normalizedFlag = 0x800000000000ULL; // 48th bit is set }; void getOutput(rowgroup::RowGroup* rg, rowgroup::Row* row, rowgroup::RGData* data); - void addToOutput(rowgroup::Row* r, rowgroup::RowGroup* rg, bool keepit, rowgroup::RGData& data, uint32_t& tmpOutputRowCount); + void addToOutput(rowgroup::Row* r, rowgroup::RowGroup* rg, bool keepit, rowgroup::RGData& data, + uint32_t& tmpOutputRowCount); void normalize(const rowgroup::Row& in, rowgroup::Row* out, const normalizeFunctionsT& normalizeFunctions); void writeNull(rowgroup::Row* out, uint32_t col); void readInput(uint32_t); @@ -159,7 +161,7 @@ class TupleUnion : public JobStep, public TupleDeliveryStep { TupleUnion* ts; utils::Hasher_r h; - Hasher(TupleUnion* t) : ts(t) + explicit Hasher(TupleUnion* t) : ts(t) { } uint64_t operator()(const RowPosition&) const; @@ -167,13 +169,13 @@ class TupleUnion : public JobStep, public TupleDeliveryStep struct Eq { TupleUnion* ts; - Eq(TupleUnion* t) : ts(t) + explicit Eq(TupleUnion* t) : ts(t) { } bool operator()(const RowPosition&, const RowPosition&) const; }; - typedef std::tr1::unordered_set > Uniquer_t; + typedef std::tr1::unordered_set> Uniquer_t; boost::scoped_ptr uniquer; std::vector rowMemory; diff --git a/dbcon/joblist/unique32generator.h b/dbcon/joblist/unique32generator.h index 0881846ca..71e3d57be 100644 --- a/dbcon/joblist/unique32generator.h +++ b/dbcon/joblist/unique32generator.h @@ -49,12 +49,8 @@ class UniqueNumberGenerator uint64_t getUnique64(); // generate unique 64-bit int private: - UniqueNumberGenerator() - { - } - ~UniqueNumberGenerator() - { - } + UniqueNumberGenerator() = default; + ~UniqueNumberGenerator() = default; static UniqueNumberGenerator* fUnique32Generator; static boost::mutex fLock; diff --git a/dbcon/joblist/virtualtable.h b/dbcon/joblist/virtualtable.h index 9034feaba..10094f402 100644 --- a/dbcon/joblist/virtualtable.h +++ b/dbcon/joblist/virtualtable.h @@ -31,9 +31,7 @@ class VirtualTable { public: VirtualTable(); - virtual ~VirtualTable() - { - } + virtual ~VirtualTable() = default; virtual void initialize(); void addColumn(const execplan::SRCP& column); diff --git a/dbcon/joblist/windowfunctionstep.h b/dbcon/joblist/windowfunctionstep.h index 1f70fae27..f9367a9fb 100644 --- a/dbcon/joblist/windowfunctionstep.h +++ b/dbcon/joblist/windowfunctionstep.h @@ -58,7 +58,7 @@ struct RowPosition uint64_t fGroupId : 48; uint64_t fRowId : 16; - inline RowPosition(uint64_t i = 0, uint64_t j = 0) : fGroupId(i), fRowId(j){}; + inline explicit RowPosition(uint64_t i = 0, uint64_t j = 0) : fGroupId(i), fRowId(j){}; }; /** @brief class WindowFunctionStep @@ -71,23 +71,23 @@ class WindowFunctionStep : public JobStep, public TupleDeliveryStep * @param * @param */ - WindowFunctionStep(const JobInfo&); + explicit WindowFunctionStep(const JobInfo&); /** @brief WindowFunctionStep destructor */ - virtual ~WindowFunctionStep(); + ~WindowFunctionStep() override; /** @brief virtual methods */ - void run(); - void join(); - const std::string toString() const; - void setOutputRowGroup(const rowgroup::RowGroup&); - const rowgroup::RowGroup& getOutputRowGroup() const; - const rowgroup::RowGroup& getDeliveredRowGroup() const; - void deliverStringTableRowGroup(bool b); - bool deliverStringTableRowGroup() const; - uint32_t nextBand(messageqcpp::ByteStream& bs); + void run() override; + void join() override; + const std::string toString() const override; + void setOutputRowGroup(const rowgroup::RowGroup&) override; + const rowgroup::RowGroup& getOutputRowGroup() const override; + const rowgroup::RowGroup& getDeliveredRowGroup() const override; + void deliverStringTableRowGroup(bool b) override; + bool deliverStringTableRowGroup() const override; + uint32_t nextBand(messageqcpp::ByteStream& bs) override; /** @brief initialize methods */ @@ -146,7 +146,7 @@ class WindowFunctionStep : public JobStep, public TupleDeliveryStep class Runner { public: - Runner(WindowFunctionStep* step) : fStep(step) + explicit Runner(WindowFunctionStep* step) : fStep(step) { } void operator()() @@ -188,7 +188,7 @@ class WindowFunctionStep : public JobStep, public TupleDeliveryStep class WFunction { public: - WFunction(WindowFunctionStep* step) : fStep(step) + explicit WFunction(WindowFunctionStep* step) : fStep(step) { } void operator()() @@ -220,4 +220,3 @@ class WindowFunctionStep : public JobStep, public TupleDeliveryStep }; } // namespace joblist - diff --git a/dbcon/mysql/ha_mcs.h b/dbcon/mysql/ha_mcs.h index e93fa46e2..4050356e4 100644 --- a/dbcon/mysql/ha_mcs.h +++ b/dbcon/mysql/ha_mcs.h @@ -58,9 +58,7 @@ class ha_mcs : public handler public: ha_mcs(handlerton* hton, TABLE_SHARE* table_arg); - virtual ~ha_mcs() - { - } + virtual ~ha_mcs() = default; /** @brief The name that will be used for display purposes. @@ -121,22 +119,22 @@ class ha_mcs : public handler /** @brief Called in test_quick_select to determine if indexes should be used. */ - virtual IO_AND_CPU_COST scan_time() override - { - IO_AND_CPU_COST cost; - cost.io= 0.0; - /* - For now, assume all cost is CPU cost. - The numbers are also very inadequate for the new cost model. - */ - cost.cpu= (double)(stats.records + stats.deleted) / 20.0 + 10; - return cost; - } + virtual IO_AND_CPU_COST scan_time() override + { + IO_AND_CPU_COST cost; + cost.io = 0.0; + /* + For now, assume all cost is CPU cost. + The numbers are also very inadequate for the new cost model. + */ + cost.cpu = (double)(stats.records + stats.deleted) / 20.0 + 10; + return cost; + } #else /** @brief Called in test_quick_select to determine if indexes should be used. */ - virtual double scan_time() override + double scan_time() override { return (double)(stats.records + stats.deleted) / 20.0 + 10; } @@ -324,7 +322,7 @@ class ha_mcs_cache : public ha_mcs ha_mcs_cache_share* share; ha_mcs_cache(handlerton* hton, TABLE_SHARE* table_arg, MEM_ROOT* mem_root); - ~ha_mcs_cache(); + ~ha_mcs_cache() override; /* The following functions duplicates calls to derived handler and diff --git a/dbcon/mysql/ha_mcs_datatype.h b/dbcon/mysql/ha_mcs_datatype.h index 1eb1a04ce..3e588d86c 100644 --- a/dbcon/mysql/ha_mcs_datatype.h +++ b/dbcon/mysql/ha_mcs_datatype.h @@ -113,7 +113,7 @@ class StoreFieldMariaDB : public StoreField return m_field->store(static_cast(val), 1); } - int store_float(float dl) override + int store_float(float dl) { if (dl == std::numeric_limits::infinity()) { @@ -128,7 +128,7 @@ class StoreFieldMariaDB : public StoreField return m_field->store(dl); } - int store_double(double dl) override + int store_double(double dl) { if (dl == std::numeric_limits::infinity()) { @@ -461,11 +461,9 @@ class WriteBatchFieldMariaDB : public WriteBatchField } else { - int32_t tmp = ( - (*const_cast(buf) << 8) | - (*const_cast(buf+1) << 16) | - (*const_cast(buf+2) << 24) - ) >> 8; + int32_t tmp = ((*const_cast(buf) << 8) | (*const_cast(buf + 1) << 16) | + (*const_cast(buf + 2) << 24)) >> + 8; fprintf(ci.filePtr(), "%d%c", tmp, ci.delimiter()); } return 3; @@ -477,11 +475,8 @@ class WriteBatchFieldMariaDB : public WriteBatchField fprintf(ci.filePtr(), "%c", ci.delimiter()); else { - uint32_t tmp = ( - (*const_cast(buf)) | - (*const_cast(buf+1) << 8) | - (*const_cast(buf+2) << 16) - ); + uint32_t tmp = ((*const_cast(buf)) | (*const_cast(buf + 1) << 8) | + (*const_cast(buf + 2) << 16)); fprintf(ci.filePtr(), "%u%c", tmp, ci.delimiter()); } return 3; diff --git a/dbcon/mysql/ha_mcs_impl_if.h b/dbcon/mysql/ha_mcs_impl_if.h index 3ab43564e..d1d29aaa3 100644 --- a/dbcon/mysql/ha_mcs_impl_if.h +++ b/dbcon/mysql/ha_mcs_impl_if.h @@ -205,14 +205,14 @@ struct gp_walk_info , internalDecimalScale(4) , thd(0) , subSelectType(uint64_t(-1)) - , subQuery(0) + , subQuery(nullptr) , clauseType(INIT) , implicitExplicitGroupBy(false) , disableWrapping(false) , aggOnSelect(false) , hasWindowFunc(false) , hasSubSelect(false) - , lastSub(0) + , lastSub(nullptr) , derivedTbCnt(0) , recursionLevel(-1) , recursionHWM(0) @@ -277,9 +277,7 @@ struct cal_group_info , groupByDistinct(false) { } - ~cal_group_info() - { - } + ~cal_group_info() = default; List* groupByFields; // MCOL-1052 SELECT TABLE_LIST* groupByTables; // MCOL-1052 FROM @@ -303,7 +301,7 @@ struct cal_connection_info ALTER_FIRST_RENAME }; cal_connection_info() - : cal_conn_hndl(0) + : cal_conn_hndl(nullptr) , queryState(0) , currentTable(0) , traceFlags(0) @@ -313,7 +311,7 @@ struct cal_connection_info , singleInsert(true) , isLoaddataInfile(false) , isCacheInsert(false) - , dmlProc(0) + , dmlProc(nullptr) , rowsHaveInserted(0) , rc(0) , tableOid(0) @@ -322,7 +320,7 @@ struct cal_connection_info , expressionId(0) , mysqld_pid(getpid()) , cpimport_pid(0) - , filePtr(0) + , filePtr(nullptr) , headerLength(0) , useXbit(false) , useCpimport(mcs_use_import_for_batchinsert_mode_t::ON) @@ -429,7 +427,7 @@ void setError(THD* thd, uint32_t errcode, const std::string errmsg); void gp_walk(const Item* item, void* arg); void clearDeleteStacks(gp_walk_info& gwi); void parse_item(Item* item, std::vector& field_vec, bool& hasNonSupportItem, uint16& parseInfo, - gp_walk_info* gwip = NULL); + gp_walk_info* gwip = nullptr); const std::string bestTableName(const Item_field* ifp); // execution plan util functions prototypes diff --git a/dbcon/mysql/ha_mcs_pushdown.h b/dbcon/mysql/ha_mcs_pushdown.h index 87ef0b826..d9a73a374 100644 --- a/dbcon/mysql/ha_mcs_pushdown.h +++ b/dbcon/mysql/ha_mcs_pushdown.h @@ -39,10 +39,10 @@ enum mcs_handler_types_t struct mcs_handler_info { - mcs_handler_info() : hndl_ptr(NULL), hndl_type(LEGACY){}; - mcs_handler_info(mcs_handler_types_t type) : hndl_ptr(NULL), hndl_type(type){}; + mcs_handler_info() : hndl_ptr(nullptr), hndl_type(LEGACY){}; + mcs_handler_info(mcs_handler_types_t type) : hndl_ptr(nullptr), hndl_type(type){}; mcs_handler_info(void* ptr, mcs_handler_types_t type) : hndl_ptr(ptr), hndl_type(type){}; - ~mcs_handler_info(){}; + ~mcs_handler_info() = default; void* hndl_ptr; mcs_handler_types_t hndl_type; }; diff --git a/dbcon/mysql/ha_subquery.h b/dbcon/mysql/ha_subquery.h index 8195c520e..31e6c29d9 100644 --- a/dbcon/mysql/ha_subquery.h +++ b/dbcon/mysql/ha_subquery.h @@ -26,7 +26,7 @@ #pragma once -//#undef LOG_INFO +// #undef LOG_INFO #include #include "idb_mysql.h" #include "ha_mcs_impl_if.h" @@ -48,9 +48,7 @@ class SubQuery next = *gwip.subQueriesChain; *gwip.subQueriesChain = this; } - virtual ~SubQuery() - { - } + virtual ~SubQuery() = default; virtual gp_walk_info& gwip() const { return fGwip; @@ -111,9 +109,7 @@ class WhereSubQuery : public SubQuery WhereSubQuery(gp_walk_info& gwip, Item_subselect* sub) : SubQuery(gwip), fSub(sub) { } // for exists - virtual ~WhereSubQuery() - { - } + ~WhereSubQuery() override = default; /** Accessors and mutators */ virtual Item_subselect* sub() const @@ -150,8 +146,8 @@ class ScalarSub : public WhereSubQuery ScalarSub(gp_walk_info& gwip, Item_func* func); ScalarSub(gp_walk_info& gwip, const execplan::SRCP& column, Item_subselect* sub, Item_func* func); ScalarSub(const ScalarSub& rhs); - ~ScalarSub(); - execplan::ParseTree* transform(); + ~ScalarSub() override; + execplan::ParseTree* transform() override; execplan::ParseTree* transform_between(); execplan::ParseTree* transform_in(); execplan::ParseTree* buildParseTree(execplan::PredicateOperator* op); @@ -177,10 +173,10 @@ class InSub : public WhereSubQuery InSub(gp_walk_info& gwip); InSub(gp_walk_info& gwip, Item_func* func); InSub(const InSub& rhs); - ~InSub(); - execplan::ParseTree* transform(); + ~InSub() override; + execplan::ParseTree* transform() override; void handleFunc(gp_walk_info* gwip, Item_func* func); - void handleNot(); + void handleNot() override; }; /** @@ -191,9 +187,9 @@ class ExistsSub : public WhereSubQuery public: ExistsSub(gp_walk_info&); // not complete. just for compile ExistsSub(gp_walk_info&, Item_subselect* sub); - ~ExistsSub(); - execplan::ParseTree* transform(); - void handleNot(); + ~ExistsSub() override; + execplan::ParseTree* transform() override; + void handleNot() override; }; /** @@ -211,7 +207,7 @@ class FromSubQuery : public SubQuery public: FromSubQuery(gp_walk_info&); FromSubQuery(gp_walk_info&, SELECT_LEX* fromSub); - ~FromSubQuery(); + ~FromSubQuery() override; const SELECT_LEX* fromSub() const { return fFromSub; @@ -240,7 +236,7 @@ class SelectSubQuery : public SubQuery public: SelectSubQuery(gp_walk_info&); SelectSubQuery(gp_walk_info&, Item_subselect* sel); - ~SelectSubQuery(); + ~SelectSubQuery() override; execplan::SCSEP transform(); Item_subselect* selSub() { diff --git a/dbcon/mysql/ha_view.h b/dbcon/mysql/ha_view.h index 46c6693c2..de395efe6 100644 --- a/dbcon/mysql/ha_view.h +++ b/dbcon/mysql/ha_view.h @@ -25,7 +25,7 @@ #pragma once -//#undef LOG_INFO +// #undef LOG_INFO #include "ha_mcs_impl_if.h" #include "idb_mysql.h" @@ -42,9 +42,7 @@ class View View(SELECT_LEX& select, gp_walk_info* parentGwip) : fSelect(select), fParentGwip(parentGwip) { } - ~View() - { - } + ~View() = default; execplan::CalpontSystemCatalog::TableAliasName& viewName(); void viewName(execplan::CalpontSystemCatalog::TableAliasName& viewName); diff --git a/dbcon/mysql/sm.h b/dbcon/mysql/sm.h index 0e055f8e0..a8d081a1b 100644 --- a/dbcon/mysql/sm.h +++ b/dbcon/mysql/sm.h @@ -60,14 +60,14 @@ const int SQL_NOT_FOUND = -1000; const int SQL_KILLED = -1001; const int CALPONT_INTERNAL_ERROR = -1007; -//#if IDB_SM_DEBUG -// extern std::ofstream smlog; -//#define SMDEBUGLOG smlog -//#else +// #if IDB_SM_DEBUG +// extern std::ofstream smlog; +// #define SMDEBUGLOG smlog +// #else #define SMDEBUGLOG \ if (false) \ std::cout -//#endif +// #endif extern const std::string DEFAULT_SAVE_PATH; typedef uint64_t tableid_t; @@ -84,9 +84,7 @@ typedef struct Column Column() : tableID(-1) { } - ~Column() - { - } + ~Column() = default; int tableID; int colPos; int dataType; @@ -132,7 +130,14 @@ struct Profiler struct cpsm_tplsch_t { cpsm_tplsch_t() - : tableid(0), rowsreturned(0), rowGroup(0), traceFlags(0), bandID(0), saveFlag(0), bandsReturned(0), ctp(0) + : tableid(0) + , rowsreturned(0) + , rowGroup(nullptr) + , traceFlags(0) + , bandID(0) + , saveFlag(0) + , bandsReturned(0) + , ctp(0) { } ~cpsm_tplsch_t() @@ -172,7 +177,7 @@ struct cpsm_tplsch_t uint16_t getStatus() { - idbassert(rowGroup != 0); + idbassert(rowGroup != nullptr); return rowGroup->getStatus(); } @@ -295,7 +300,7 @@ extern status_t sm_cleanup(cpsm_conhdl_t*); extern status_t tpl_open(tableid_t, sp_cpsm_tplh_t&, cpsm_conhdl_t*); extern status_t tpl_scan_open(tableid_t, sp_cpsm_tplsch_t&, cpsm_conhdl_t*); -extern status_t tpl_scan_fetch(sp_cpsm_tplsch_t&, cpsm_conhdl_t*, int* k = 0); +extern status_t tpl_scan_fetch(sp_cpsm_tplsch_t&, cpsm_conhdl_t*, int* k = nullptr); extern status_t tpl_scan_close(sp_cpsm_tplsch_t&); extern status_t tpl_close(sp_cpsm_tplh_t&, cpsm_conhdl_t**, querystats::QueryStats& stats, bool ask_4_stats, bool clear_scan_ctx = false); diff --git a/ddlproc/ddlprocessor.h b/ddlproc/ddlprocessor.h index 82bf22d2c..18a364b1e 100644 --- a/ddlproc/ddlprocessor.h +++ b/ddlproc/ddlprocessor.h @@ -35,6 +35,7 @@ namespace ddlprocessor class DDLProcessor { public: + DDLProcessor() = delete; /** @brief ctor * * @param packageMaxThreads the maximum number of threads to process ddl packages @@ -75,12 +76,7 @@ class DDLProcessor fPackageWorkQueueSize = workQueueSize; } - protected: private: - /** @brief ctor - */ - DDLProcessor(); - /** @brief the thread pool for processing ddl packages */ threadpool::ThreadPool fDdlPackagepool; diff --git a/dmlproc/batchinsertprocessor.h b/dmlproc/batchinsertprocessor.h index a8d9ef82c..a950b0986 100644 --- a/dmlproc/batchinsertprocessor.h +++ b/dmlproc/batchinsertprocessor.h @@ -22,7 +22,7 @@ #pragma once -#include +#include #include #include @@ -45,6 +45,7 @@ class BatchInsertProc typedef std::queue pkg_type; typedef boost::shared_ptr SP_PKG; typedef std::vector BulkSetHWMArgs; + BatchInsertProc() = delete; BatchInsertProc(bool isAutocommitOn, uint32_t tableOid, execplan::CalpontSystemCatalog::SCN txnId, BRM::DBRM* aDbrm); BatchInsertProc(const BatchInsertProc& rhs); diff --git a/primitives/blockcache/blockrequestprocessor.h b/primitives/blockcache/blockrequestprocessor.h index 0970c40d5..bbd66cda0 100644 --- a/primitives/blockcache/blockrequestprocessor.h +++ b/primitives/blockcache/blockrequestprocessor.h @@ -31,7 +31,7 @@ #include "fileblockrequestqueue.h" #include "filebuffermgr.h" #include "iomanager.h" -#include +#include /** @author Jason Rodriguez diff --git a/primitives/primproc/activestatementcounter.h b/primitives/primproc/activestatementcounter.h index 87e7163aa..550819123 100644 --- a/primitives/primproc/activestatementcounter.h +++ b/primitives/primproc/activestatementcounter.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include @@ -35,9 +35,7 @@ class ActiveStatementCounter { } - virtual ~ActiveStatementCounter() - { - } + virtual ~ActiveStatementCounter() = default; void incr(bool& counted); void decr(bool& counted); @@ -61,4 +59,3 @@ class ActiveStatementCounter boost::condition condvar; BRM::VSS fVss; }; - diff --git a/primitives/primproc/batchprimitiveprocessor.h b/primitives/primproc/batchprimitiveprocessor.h index 012f84467..f686ecc15 100644 --- a/primitives/primproc/batchprimitiveprocessor.h +++ b/primitives/primproc/batchprimitiveprocessor.h @@ -66,7 +66,7 @@ typedef boost::shared_ptr SBPP; class scalar_exception : public std::exception { - const char* what() const throw() + const char* what() const noexcept override { return "Not a scalar subquery."; } @@ -231,7 +231,7 @@ class BatchPrimitiveProcessor /* Common space for primitive data */ alignas(utils::MAXCOLUMNWIDTH) uint8_t blockData[BLOCK_SIZE * utils::MAXCOLUMNWIDTH]; uint8_t blockDataAux[BLOCK_SIZE * execplan::AUX_COL_WIDTH]; - std::unique_ptr outputMsg; + std::unique_ptr outputMsg; uint32_t outMsgSize; std::vector filterSteps; diff --git a/primitives/primproc/bppseeder.h b/primitives/primproc/bppseeder.h index c8896e8bc..b3c8eec7e 100644 --- a/primitives/primproc/bppseeder.h +++ b/primitives/primproc/bppseeder.h @@ -46,13 +46,14 @@ namespace primitiveprocessor class BPPSeeder : public threadpool::FairThreadPool::Functor { public: + BPPSeeder() = delete; BPPSeeder(const messageqcpp::SBS&, const SP_UM_MUTEX& wLock, const SP_UM_IOSOCK& ios, const int pmThreads, const bool trace = false); BPPSeeder(const BPPSeeder& b); - virtual ~BPPSeeder(); + ~BPPSeeder() override; - int operator()(); + int operator()() override; bool isSysCat(); boost::shared_ptr spof; @@ -74,7 +75,6 @@ class BPPSeeder : public threadpool::FairThreadPool::Functor } private: - BPPSeeder(); void catchHandler(const std::string& s, uint32_t uniqueID, uint32_t step); void flushSyscatOIDs(); diff --git a/primitives/primproc/bppsendthread.h b/primitives/primproc/bppsendthread.h index 88f71456c..7f2028917 100644 --- a/primitives/primproc/bppsendthread.h +++ b/primitives/primproc/bppsendthread.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "threadnaming.h" #include "fair_threadpool.h" @@ -49,19 +50,10 @@ class BPPSendThread Msg_t() : sockIndex(0) { } - Msg_t(const Msg_t& m) : msg(m.msg), sock(m.sock), sockLock(m.sockLock), sockIndex(m.sockIndex) - { - } - Msg_t& operator=(const Msg_t& m) - { - msg = m.msg; - sock = m.sock; - sockLock = m.sockLock; - sockIndex = m.sockIndex; - return *this; - } - Msg_t(const messageqcpp::SBS& m, const SP_UM_IOSOCK& so, const SP_UM_MUTEX& sl, int si) - : msg(m), sock(so), sockLock(sl), sockIndex(si) + Msg_t(const Msg_t& m) = default; + Msg_t& operator=(const Msg_t& m) = default; + Msg_t(messageqcpp::SBS m, SP_UM_IOSOCK so, SP_UM_MUTEX sl, int si) + : msg(std::move(m)), sock(std::move(so)), sockLock(std::move(sl)), sockIndex(si) { } }; @@ -87,7 +79,7 @@ class BPPSendThread } void setProcessorPool(boost::shared_ptr processorPool) { - fProcessorPool = processorPool; + fProcessorPool = std::move(processorPool); } private: @@ -127,7 +119,7 @@ class BPPSendThread /* Load balancing structures */ struct Connection_t { - Connection_t(const SP_UM_MUTEX& lock, const SP_UM_IOSOCK& so) : sockLock(lock), sock(so) + Connection_t(SP_UM_MUTEX lock, SP_UM_IOSOCK so) : sockLock(std::move(lock)), sock(std::move(so)) { } SP_UM_MUTEX sockLock; diff --git a/primitives/primproc/columncommand.h b/primitives/primproc/columncommand.h index be99261c4..3914debe9 100644 --- a/primitives/primproc/columncommand.h +++ b/primitives/primproc/columncommand.h @@ -45,9 +45,9 @@ class ColumnCommand : public Command public: ColumnCommand(); ColumnCommand(execplan::CalpontSystemCatalog::ColType& aColType); - virtual ~ColumnCommand(); + ~ColumnCommand() override; - inline uint64_t getLBID() + inline uint64_t getLBID() override { return lbid; } @@ -68,12 +68,12 @@ class ColumnCommand : public Command return colType; } - void execute(); + void execute() override; void execute(int64_t* vals); // used by RTSCommand to redirect values - virtual void prep(int8_t outputType, bool absRids); - void project(); - void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t pos); - void nextLBID(); + void prep(int8_t outputType, bool absRids) override; + void project() override; + void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t pos) override; + void nextLBID() override; bool isScan() { return _isScan; @@ -88,18 +88,18 @@ class ColumnCommand : public Command return lbidAux; } - void createCommand(messageqcpp::ByteStream&); + void createCommand(messageqcpp::ByteStream&) override; void createCommand(execplan::CalpontSystemCatalog::ColType& aColType, messageqcpp::ByteStream&); - void resetCommand(messageqcpp::ByteStream&); - void setMakeAbsRids(bool m) + void resetCommand(messageqcpp::ByteStream&) override; + void setMakeAbsRids(bool m) override { makeAbsRids = m; } bool willPrefetch(); int64_t getLastLbid(); - void getLBIDList(uint32_t loopCount, std::vector* lbids); + void getLBIDList(uint32_t loopCount, std::vector* lbids) override; - virtual SCommand duplicate(); + SCommand duplicate() override; bool operator==(const ColumnCommand&) const; bool operator!=(const ColumnCommand&) const; @@ -111,7 +111,7 @@ class ColumnCommand : public Command void disableFilters(); void enableFilters(); - int getCompType() const + int getCompType() const override { return colType.compressionType; } @@ -321,4 +321,3 @@ inline void ColumnCommand::fillEmptyBlock(uint } } // namespace primitiveprocessor - diff --git a/primitives/primproc/dictstep.h b/primitives/primproc/dictstep.h index 9c5120b98..cb07717bb 100644 --- a/primitives/primproc/dictstep.h +++ b/primitives/primproc/dictstep.h @@ -39,28 +39,28 @@ class DictStep : public Command { public: DictStep(); - virtual ~DictStep(); + ~DictStep() override; - void execute(); - void project(); + void execute() override; + void project() override; void project(int64_t* vals); // used by RTSCommand to redirect input - void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t row); + void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t row) override; void projectIntoRowGroup(rowgroup::RowGroup& rg, int64_t* vals, uint32_t col); - uint64_t getLBID(); + uint64_t getLBID() override; /* This doesn't do anything for this class... make it column-specific or not? */ - void nextLBID(); - void createCommand(messageqcpp::ByteStream&); - void resetCommand(messageqcpp::ByteStream&); + void nextLBID() override; + void createCommand(messageqcpp::ByteStream&) override; + void resetCommand(messageqcpp::ByteStream&) override; /* Put bootstrap code here (ie, build the template primitive msg) */ - void prep(int8_t outputType, bool makeAbsRids); + void prep(int8_t outputType, bool makeAbsRids) override; - SCommand duplicate(); + SCommand duplicate() override; bool operator==(const DictStep&) const; bool operator!=(const DictStep&) const; - int getCompType() const + int getCompType() const override { return compressionType; } @@ -78,13 +78,11 @@ class DictStep : public Command const uint8_t* ptr; unsigned len; - StringPtr() : ptr(NULL), len(0) + StringPtr() : ptr(nullptr), len(0) { - ; } StringPtr(const uint8_t* p, unsigned l) : ptr(p), len(l) { - ; } utils::ConstString getConstString() const { @@ -111,9 +109,7 @@ class DictStep : public Command OrderedToken() : inResult(false) { } - ~OrderedToken() - { - } + ~OrderedToken() = default; }; struct TokenSorter { diff --git a/primitives/primproc/filtercommand.h b/primitives/primproc/filtercommand.h index 0532196c1..3515c7c02 100644 --- a/primitives/primproc/filtercommand.h +++ b/primitives/primproc/filtercommand.h @@ -38,21 +38,21 @@ class FilterCommand : public Command { public: FilterCommand(); - virtual ~FilterCommand(); + ~FilterCommand() override; // returns a FilterCommand based on column types static Command* makeFilterCommand(messageqcpp::ByteStream&, std::vector& cmds); // virtuals from base class -- Command - void execute(); - void project(); - void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col); - uint64_t getLBID(); - void nextLBID(); - void createCommand(messageqcpp::ByteStream&); - void resetCommand(messageqcpp::ByteStream&); - SCommand duplicate(); - void prep(int8_t outputType, bool makeAbsRids); + void execute() override; + void project() override; + void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col) override; + uint64_t getLBID() override; + void nextLBID() override; + void createCommand(messageqcpp::ByteStream&) override; + void resetCommand(messageqcpp::ByteStream&) override; + SCommand duplicate() override; + void prep(int8_t outputType, bool makeAbsRids) override; void setColTypes(const execplan::CalpontSystemCatalog::ColType& left, const execplan::CalpontSystemCatalog::ColType& right); @@ -61,7 +61,7 @@ class FilterCommand : public Command bool operator==(const FilterCommand&) const; bool operator!=(const FilterCommand&) const; - int getCompType() const + int getCompType() const override { return 0; } @@ -96,8 +96,8 @@ class ScaledFilterCmd : public FilterCommand { public: ScaledFilterCmd(); - virtual ~ScaledFilterCmd(); - SCommand duplicate(); + ~ScaledFilterCmd() override; + SCommand duplicate() override; void setFactor(double); double factor(); @@ -108,7 +108,7 @@ class ScaledFilterCmd : public FilterCommand protected: // compare method, take the indices to the values array - bool compare(uint64_t, uint64_t); + bool compare(uint64_t, uint64_t) override; // value used in comparison; double fFactor; @@ -123,11 +123,11 @@ class StrFilterCmd : public FilterCommand { public: StrFilterCmd(); - virtual ~StrFilterCmd(); + ~StrFilterCmd() override; // override FilterCommand methods - void execute(); - SCommand duplicate(); + void execute() override; + SCommand duplicate() override; void setCompareFunc(uint32_t); void setCharLength(size_t); @@ -139,7 +139,7 @@ class StrFilterCmd : public FilterCommand protected: // compare method, take the indices to the values array - bool compare(uint64_t, uint64_t); + bool compare(uint64_t, uint64_t) override; // compare method for differernt column combination, c--char[], s--string // compare char[]-char[] is not the same as int-int due to endian issue. diff --git a/primitives/primproc/passthrucommand.h b/primitives/primproc/passthrucommand.h index 9dbbc7d2a..87e577872 100644 --- a/primitives/primproc/passthrucommand.h +++ b/primitives/primproc/passthrucommand.h @@ -38,21 +38,21 @@ class PassThruCommand : public Command { public: PassThruCommand(); - virtual ~PassThruCommand(); + ~PassThruCommand() override; - void prep(int8_t outputType, bool makeAbsRids); - void execute(); - void project(); - void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col); - uint64_t getLBID(); - void nextLBID(); - void createCommand(messageqcpp::ByteStream&); - void resetCommand(messageqcpp::ByteStream&); - SCommand duplicate(); + void prep(int8_t outputType, bool makeAbsRids) override; + void execute() override; + void project() override; + void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col) override; + uint64_t getLBID() override; + void nextLBID() override; + void createCommand(messageqcpp::ByteStream&) override; + void resetCommand(messageqcpp::ByteStream&) override; + SCommand duplicate() override; bool operator==(const PassThruCommand&) const; bool operator!=(const PassThruCommand&) const; - int getCompType() const + int getCompType() const override { return 0; } diff --git a/primitives/primproc/primitiveserver.cpp b/primitives/primproc/primitiveserver.cpp index ceac88fc5..1c93f7f29 100644 --- a/primitives/primproc/primitiveserver.cpp +++ b/primitives/primproc/primitiveserver.cpp @@ -45,6 +45,7 @@ using namespace std; #include #include +#include #include using namespace boost; #include "distributedenginecomm.h" @@ -110,7 +111,7 @@ using namespace threadpool; // make global for blockcache // static const char* statsName = {"pm"}; -dbbc::Stats* gPMStatsPtr = 0; +dbbc::Stats* gPMStatsPtr = nullptr; bool gPMProfOn = false; uint32_t gSession = 0; dbbc::Stats pmstats(statsName); @@ -141,8 +142,6 @@ int noVB = 0; BPPMap bppMap; boost::mutex bppLock; -#define DJLOCK_READ 0 -#define DJLOCK_WRITE 1 boost::mutex djMutex; // lock for djLock, lol. std::map djLock; // djLock synchronizes destroy and joiner msgs, see bug 2619 @@ -160,9 +159,7 @@ struct preFetchCond waiters = 0; } - ~preFetchCond() - { - } + ~preFetchCond() = default; }; typedef preFetchCond preFetchBlock_t; @@ -202,7 +199,7 @@ void waitForRetry(long count) timespec ts; ts.tv_sec = 5L * count / 10L; ts.tv_nsec = (5L * count % 10L) * 100000000L; - nanosleep(&ts, 0); + nanosleep(&ts, nullptr); } void prefetchBlocks(const uint64_t lbid, const int compType, uint32_t* rCount) @@ -234,7 +231,7 @@ void prefetchBlocks(const uint64_t lbid, const int compType, uint32_t* rCount) return; } - preFetchBlock_t* pfb = 0; + preFetchBlock_t* pfb = nullptr; pfb = new preFetchBlock_t(lowlbid); pfBlockMap[lowlbid] = pfb; @@ -304,7 +301,7 @@ void prefetchBlocks(const uint64_t lbid, const int compType, uint32_t* rCount) if (pfBlockMap.erase(lowlbid) > 0) delete pfb; - pfb = 0; + pfb = nullptr; pfbMutex.unlock(); throw; } @@ -326,7 +323,7 @@ cleanup: if (pfBlockMap.erase(lowlbid) > 0) delete pfb; - pfb = 0; + pfb = nullptr; pfbMutex.unlock(); } // prefetchBlocks() @@ -524,15 +521,15 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu boost::scoped_array uCmpBufSa; ptrdiff_t alignedBuffer = 0; - void* readBufferPtr = NULL; - char* cmpHdrBuf = NULL; - char* cmpBuf = NULL; - unsigned char* uCmpBuf = NULL; + void* readBufferPtr = nullptr; + char* cmpHdrBuf = nullptr; + char* cmpBuf = nullptr; + unsigned char* uCmpBuf = nullptr; uint64_t cmpBufLen = 0; int blockReadRetryCount = 0; unsigned idx = 0; int pageSize = getpagesize(); - IDBDataFile* fp = 0; + IDBDataFile* fp = nullptr; try { @@ -543,7 +540,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu int opts = directIOFlag ? IDBDataFile::USE_ODIRECT : 0; fp = IDBDataFile::open(IDBPolicy::getType(fileNamePtr, IDBPolicy::PRIMPROC), fileNamePtr, "r", opts); - if (fp == NULL) + if (fp == nullptr) { int errCode = errno; SUMMARY_INFO2("open failed: ", fileNamePtr); @@ -552,7 +549,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu // #if STRERROR_R_CHAR_P const char* p; - if ((p = strerror_r(errCode, errbuf, 80)) != 0) + if ((p = strerror_r(errCode, errbuf, 80)) != nullptr) errMsg = p; if (errCode == EINVAL) @@ -595,8 +592,8 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu cout << "pread2(" << fd << ", 0x" << hex << (ptrdiff_t)readBufferPtr << dec << ", " << DATA_BLOCK_SIZE << ", " << offset << ") = " << i << endl; } -#endif // IDB_COMP_POC_DEBUG - } // if (compType == 0) +#endif // IDB_COMP_POC_DEBUG + } // if (compType == 0) else // if (compType != 0) { // retry if file is out of sync -- compressed column file only. @@ -692,7 +689,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu uint64_t cmpBufOff = ptrList[idx].first; uint64_t cmpBufSz = ptrList[idx].second; - if (cmpBufSa.get() == NULL || cmpBufLen < cmpBufSz) + if (cmpBufSa.get() == nullptr || cmpBufLen < cmpBufSz) { cmpBufSa.reset(new char[cmpBufSz + pageSize]); cmpBufLen = cmpBufSz; @@ -759,12 +756,12 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu catch (...) { delete fp; - fp = 0; + fp = nullptr; throw; } delete fp; - fp = 0; + fp = nullptr; // log the retries if (blockReadRetryCount > 0) @@ -787,7 +784,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu return; } - FileBuffer* fbPtr = 0; + FileBuffer* fbPtr = nullptr; bool wasBlockInCache = false; fbPtr = bc.getBlockPtr(lbid, ver, flg); @@ -827,12 +824,12 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu struct AsynchLoader { - AsynchLoader(uint64_t l, const QueryContext& v, uint32_t t, int ct, uint32_t* cCount, uint32_t* rCount, - bool trace, uint32_t sesID, boost::mutex* m, uint32_t* loaderCount, + AsynchLoader(uint64_t l, QueryContext v, uint32_t t, int ct, uint32_t* cCount, uint32_t* rCount, bool trace, + uint32_t sesID, boost::mutex* m, uint32_t* loaderCount, boost::shared_ptr st, // sendThread for abort upon exception. VSSCache* vCache) : lbid(l) - , ver(v) + , ver(std::move(v)) , txn(t) , compType(ct) , LBIDTrace(trace) @@ -841,7 +838,7 @@ struct AsynchLoader , readCount(rCount) , busyLoaders(loaderCount) , mutex(m) - , sendThread(st) + , sendThread(std::move(st)) , vssCache(vCache) { } @@ -1016,10 +1013,10 @@ class DictScanJob : public threadpool::FairThreadPool::Functor { public: DictScanJob(SP_UM_IOSOCK ios, SBS bs, SP_UM_MUTEX writeLock); - virtual ~DictScanJob(); + ~DictScanJob() override; void write(const SBS); - int operator()(); + int operator()() override; void catchHandler(const std::string& ex, uint32_t id, uint16_t code = logging::primitiveServerErr); void sendErrorMsg(uint32_t id, uint16_t code); @@ -1031,14 +1028,12 @@ class DictScanJob : public threadpool::FairThreadPool::Functor }; DictScanJob::DictScanJob(SP_UM_IOSOCK ios, SBS bs, SP_UM_MUTEX writeLock) - : fIos(ios), fByteStream(bs), fWriteLock(writeLock) + : fIos(std::move(ios)), fByteStream(std::move(bs)), fWriteLock(std::move(writeLock)) { dieTime = posix_time::second_clock::universal_time() + posix_time::seconds(100); } -DictScanJob::~DictScanJob() -{ -} +DictScanJob::~DictScanJob() = default; void DictScanJob::write(const SBS sbs) { @@ -1215,9 +1210,8 @@ struct BPPHandler struct BPPHandlerFunctor : public FairThreadPool::Functor { - BPPHandlerFunctor(boost::shared_ptr r, SBS b) : bs(b) + BPPHandlerFunctor(boost::shared_ptr r, SBS b) : rt(std::move(r)), bs(std::move(b)) { - rt = r; dieTime = posix_time::second_clock::universal_time() + posix_time::seconds(100); } @@ -1228,10 +1222,10 @@ struct BPPHandler struct LastJoiner : public BPPHandlerFunctor { - LastJoiner(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(r, b) + LastJoiner(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b)) { } - int operator()() + int operator()() override { utils::setThreadName("PPHandLastJoiner"); return rt->lastJoinerMsg(*bs, dieTime); @@ -1240,10 +1234,10 @@ struct BPPHandler struct Create : public BPPHandlerFunctor { - Create(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(r, b) + Create(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b)) { } - int operator()() + int operator()() override { utils::setThreadName("PPHandCreate"); rt->createBPP(*bs); @@ -1253,10 +1247,10 @@ struct BPPHandler struct Destroy : public BPPHandlerFunctor { - Destroy(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(r, b) + Destroy(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b)) { } - int operator()() + int operator()() override { utils::setThreadName("PPHandDestroy"); return rt->destroyBPP(*bs, dieTime); @@ -1265,10 +1259,10 @@ struct BPPHandler struct AddJoiner : public BPPHandlerFunctor { - AddJoiner(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(r, b) + AddJoiner(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b)) { } - int operator()() + int operator()() override { utils::setThreadName("PPHandAddJoiner"); return rt->addJoinerToBPP(*bs, dieTime); @@ -1280,7 +1274,7 @@ struct BPPHandler Abort(boost::shared_ptr r, SBS b) : BPPHandlerFunctor(r, b) { } - int operator()() + int operator()() override { utils::setThreadName("PPHandAbort"); return rt->doAbort(*bs, dieTime); @@ -1667,12 +1661,12 @@ struct BPPHandler class DictionaryOp : public FairThreadPool::Functor { public: - DictionaryOp(SBS cmd) : bs(cmd) + DictionaryOp(SBS cmd) : bs(std::move(cmd)) { dieTime = posix_time::second_clock::universal_time() + posix_time::seconds(100); } virtual int execute() = 0; - int operator()() + int operator()() override { utils::setThreadName("PPDictOp"); int ret; @@ -1705,7 +1699,7 @@ class CreateEqualityFilter : public DictionaryOp CreateEqualityFilter(SBS cmd) : DictionaryOp(cmd) { } - int execute() + int execute() override { createEqualityFilter(); return 0; @@ -1739,10 +1733,10 @@ class CreateEqualityFilter : public DictionaryOp class DestroyEqualityFilter : public DictionaryOp { public: - DestroyEqualityFilter(SBS cmd) : DictionaryOp(cmd) + DestroyEqualityFilter(SBS cmd) : DictionaryOp(std::move(cmd)) { } - int execute() + int execute() override { return destroyEqualityFilter(); } @@ -2167,9 +2161,7 @@ struct ReadThread mlp->logMessage(logging::M0058, args, false); } - ~ReadThread() - { - } + ~ReadThread() = default; string fServerName; IOSocket fIos; PrimitiveServer* fPrimitiveServerPtr; diff --git a/primitives/primproc/primitiveserver.h b/primitives/primproc/primitiveserver.h index 2d8531d25..40c5f919f 100644 --- a/primitives/primproc/primitiveserver.h +++ b/primitives/primproc/primitiveserver.h @@ -87,16 +87,16 @@ extern BPPMap bppMap; void prefetchBlocks(uint64_t lbid, const int compType, uint32_t* rCount); void prefetchExtent(uint64_t lbid, uint32_t ver, uint32_t txn, uint32_t* rCount); void loadBlock(uint64_t lbid, BRM::QueryContext q, uint32_t txn, int compType, void* bufferPtr, - bool* pWasBlockInCache, uint32_t* rCount = NULL, bool LBIDTrace = false, - uint32_t sessionID = 0, bool doPrefetch = true, VSSCache* vssCache = NULL); + bool* pWasBlockInCache, uint32_t* rCount = nullptr, bool LBIDTrace = false, + uint32_t sessionID = 0, bool doPrefetch = true, VSSCache* vssCache = nullptr); void loadBlockAsync(uint64_t lbid, const BRM::QueryContext& q, uint32_t txn, int CompType, uint32_t* cCount, uint32_t* rCount, bool LBIDTrace, uint32_t sessionID, boost::mutex* m, uint32_t* busyLoaders, boost::shared_ptr sendThread, - VSSCache* vssCache = 0); + VSSCache* vssCache = nullptr); uint32_t loadBlocks(BRM::LBID_t* lbids, BRM::QueryContext q, BRM::VER_t txn, int compType, uint8_t** bufferPtrs, uint32_t* rCount, bool LBIDTrace, uint32_t sessionID, uint32_t blockCount, bool* wasVersioned, bool doPrefetch = true, - VSSCache* vssCache = NULL); + VSSCache* vssCache = nullptr); uint32_t cacheNum(uint64_t lbid); void buildFileName(BRM::OID_t oid, char* fileName); diff --git a/primitives/primproc/primitiveserverthreadpools.h b/primitives/primproc/primitiveserverthreadpools.h index db23d290c..fffdcf9a0 100644 --- a/primitives/primproc/primitiveserverthreadpools.h +++ b/primitives/primproc/primitiveserverthreadpools.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include "fair_threadpool.h" class PrimitiveServerThreadPools @@ -25,7 +26,7 @@ class PrimitiveServerThreadPools public: PrimitiveServerThreadPools() = default; PrimitiveServerThreadPools(boost::shared_ptr primServerThreadPool) - : fPrimServerThreadPool(primServerThreadPool) + : fPrimServerThreadPool(std::move(primServerThreadPool)) { } diff --git a/primitives/primproc/primproc.h b/primitives/primproc/primproc.h index 4fb757c1f..c82f32b3a 100644 --- a/primitives/primproc/primproc.h +++ b/primitives/primproc/primproc.h @@ -155,12 +155,12 @@ class ServicePrimProc : public Service, public Opt void LogErrno() override { - cerr << strerror(errno) << endl; + std::cerr << strerror(errno) << std::endl; } void ParentLogChildMessage(const std::string& str) override { - cout << str << endl; + std::cout << str << std::endl; } int Child() override; int Run() diff --git a/primitives/primproc/pseudocc.h b/primitives/primproc/pseudocc.h index b7e220aa9..e95fcf3b0 100644 --- a/primitives/primproc/pseudocc.h +++ b/primitives/primproc/pseudocc.h @@ -27,14 +27,14 @@ class PseudoCC : public ColumnCommand { public: PseudoCC(); - virtual ~PseudoCC(); + ~PseudoCC() override; - virtual SCommand duplicate(); - virtual void createCommand(messageqcpp::ByteStream&); - virtual void resetCommand(messageqcpp::ByteStream&); + SCommand duplicate() override; + void createCommand(messageqcpp::ByteStream&) override; + void resetCommand(messageqcpp::ByteStream&) override; protected: - virtual void loadData(); + void loadData() override; private: template @@ -102,7 +102,7 @@ template void PseudoCC::loadSegmentNum() { uint16_t segNum; - rowgroup::getLocationFromRid(bpp->baseRid, NULL, &segNum, NULL, NULL); + rowgroup::getLocationFromRid(bpp->baseRid, nullptr, &segNum, nullptr, nullptr); loadSingleValue(segNum); } @@ -110,7 +110,7 @@ template void PseudoCC::loadPartitionNum() { uint32_t partNum; - rowgroup::getLocationFromRid(bpp->baseRid, &partNum, NULL, NULL, NULL); + rowgroup::getLocationFromRid(bpp->baseRid, &partNum, nullptr, nullptr, nullptr); loadSingleValue(partNum); } diff --git a/primitives/primproc/rssmonfcn.h b/primitives/primproc/rssmonfcn.h index 341038e91..d43a29aa6 100644 --- a/primitives/primproc/rssmonfcn.h +++ b/primitives/primproc/rssmonfcn.h @@ -30,7 +30,7 @@ class RssMonFcn : public utils::MonitorProcMem { } - void operator()() const; + void operator()() const override; }; -} // namespace \ No newline at end of file +} // namespace exemgr \ No newline at end of file diff --git a/primitives/primproc/rtscommand.h b/primitives/primproc/rtscommand.h index 9ce53b5eb..e5c594a27 100644 --- a/primitives/primproc/rtscommand.h +++ b/primitives/primproc/rtscommand.h @@ -40,23 +40,23 @@ class RTSCommand : public Command { public: RTSCommand(); - virtual ~RTSCommand(); + ~RTSCommand() override; - void execute(); - void project(); - void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col); - uint64_t getLBID(); - void nextLBID(); - void createCommand(messageqcpp::ByteStream&); - void resetCommand(messageqcpp::ByteStream&); - SCommand duplicate(); + void execute() override; + void project() override; + void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col) override; + uint64_t getLBID() override; + void nextLBID() override; + void createCommand(messageqcpp::ByteStream&) override; + void resetCommand(messageqcpp::ByteStream&) override; + SCommand duplicate() override; bool operator==(const RTSCommand&) const; bool operator!=(const RTSCommand&) const; - void setBatchPrimitiveProcessor(BatchPrimitiveProcessor*); + void setBatchPrimitiveProcessor(BatchPrimitiveProcessor*) override; /* Put bootstrap code here (ie, build the template primitive msg) */ - void prep(int8_t outputType, bool makeAbsRids); + void prep(int8_t outputType, bool makeAbsRids) override; uint8_t isPassThru() { return passThru; @@ -65,10 +65,10 @@ class RTSCommand : public Command { absNull = a; } - void getLBIDList(uint32_t loopCount, std::vector* lbids); + void getLBIDList(uint32_t loopCount, std::vector* lbids) override; // TODO: do we need to reference either col or dict? - int getCompType() const + int getCompType() const override { return dict.getCompType(); } diff --git a/primitives/primproc/serviceexemgr.h b/primitives/primproc/serviceexemgr.h index d605d557d..5be609593 100644 --- a/primitives/primproc/serviceexemgr.h +++ b/primitives/primproc/serviceexemgr.h @@ -62,320 +62,324 @@ namespace exemgr { - using SharedPtrEMSock = boost::shared_ptr; - class Opt +using SharedPtrEMSock = boost::shared_ptr; +class Opt +{ + public: + int m_debug; + bool m_e; + bool m_fg; + Opt() : m_debug(0), m_e(false), m_fg(false){}; + Opt(int argc, char* argv[]) : m_debug(0), m_e(false), m_fg(false) { - public: - int m_debug; - bool m_e; - bool m_fg; - Opt() : m_debug(0), m_e(false), m_fg(false) {}; - Opt(int argc, char* argv[]) : m_debug(0), m_e(false), m_fg(false) + int c; + while ((c = getopt(argc, argv, "edf")) != EOF) { - int c; - while ((c = getopt(argc, argv, "edf")) != EOF) + switch (c) { - switch (c) - { - case 'd': m_debug++; break; + case 'd': m_debug++; break; - case 'e': m_e = true; break; + case 'e': m_e = true; break; - case 'f': m_fg = true; break; + case 'f': m_fg = true; break; - case '?': - default: break; - } + case '?': + default: break; } } - int getDebugLevel() const - { - return m_debug; - } - }; - - class ServiceExeMgr : public Service, public Opt + } + int getDebugLevel() const { - using SessionMemMap_t = std::map; - using ThreadCntPerSessionMap_t = std::map; - protected: - void log(logging::LOG_TYPE type, const std::string& str) - { - logging::LoggingID logid(16); - logging::Message::Args args; - logging::Message message(8); - args.add(strerror(errno)); - message.format(args); - logging::Logger logger(logid.fSubsysID); - logger.logMessage(type, message, logid); - } + return m_debug; + } +}; - public: - ServiceExeMgr(const Opt& opt) : Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16)) +class ServiceExeMgr : public Service, public Opt +{ + using SessionMemMap_t = std::map; + using ThreadCntPerSessionMap_t = std::map; + + protected: + void log(logging::LOG_TYPE type, const std::string& str) + { + logging::LoggingID logid(16); + logging::Message::Args args; + logging::Message message(8); + args.add(strerror(errno)); + message.format(args); + logging::Logger logger(logid.fSubsysID); + logger.logMessage(type, message, logid); + } + + public: + ServiceExeMgr(const Opt& opt) : Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16)) + { + bool runningWithExeMgr = true; + rm_ = joblist::ResourceManager::instance(runningWithExeMgr); + } + ServiceExeMgr(const Opt& opt, config::Config* aConfig) + : Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16)) + { + bool runningWithExeMgr = true; + rm_ = joblist::ResourceManager::instance(runningWithExeMgr, aConfig); + } + void LogErrno() override + { + log(logging::LOG_TYPE_CRITICAL, std::string(strerror(errno))); + } + void ParentLogChildMessage(const std::string& str) override + { + log(logging::LOG_TYPE_INFO, str); + } + int Child() override; + int Run() + { + return m_fg ? Child() : RunForking(); + } + static const constexpr unsigned logDefaultMsg = logging::M0000; + static const constexpr unsigned logDbProfStartStatement = logging::M0028; + static const constexpr unsigned logDbProfEndStatement = logging::M0029; + static const constexpr unsigned logStartSql = logging::M0041; + static const constexpr unsigned logEndSql = logging::M0042; + static const constexpr unsigned logRssTooBig = logging::M0044; + static const constexpr unsigned logDbProfQueryStats = logging::M0047; + static const constexpr unsigned logExeMgrExcpt = logging::M0055; + // If any flags other than the table mode flags are set, produce output to screeen + static const constexpr uint32_t flagsWantOutput = + (0xffffffff & ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH & + ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF); + logging::Logger& getLogger() + { + return msgLog_; + } + void updateSessionMap(const size_t pct) + { + std::lock_guard lk(sessionMemMapMutex_); + + for (auto mapIter = sessionMemMap_.begin(); mapIter != sessionMemMap_.end(); ++mapIter) { - bool runningWithExeMgr = true; - rm_ = joblist::ResourceManager::instance(runningWithExeMgr); + if (pct > mapIter->second) + { + mapIter->second = pct; + } } - ServiceExeMgr(const Opt& opt, config::Config* aConfig) : Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16)) - { - bool runningWithExeMgr = true; - rm_ = joblist::ResourceManager::instance(runningWithExeMgr, aConfig); - } - void LogErrno() override - { - log(logging::LOG_TYPE_CRITICAL, std::string(strerror(errno))); - } - void ParentLogChildMessage(const std::string& str) override - { - log(logging::LOG_TYPE_INFO, str); - } - int Child() override; - int Run() - { - return m_fg ? Child() : RunForking(); - } - static const constexpr unsigned logDefaultMsg = logging::M0000; - static const constexpr unsigned logDbProfStartStatement = logging::M0028; - static const constexpr unsigned logDbProfEndStatement = logging::M0029; - static const constexpr unsigned logStartSql = logging::M0041; - static const constexpr unsigned logEndSql = logging::M0042; - static const constexpr unsigned logRssTooBig = logging::M0044; - static const constexpr unsigned logDbProfQueryStats = logging::M0047; - static const constexpr unsigned logExeMgrExcpt = logging::M0055; - // If any flags other than the table mode flags are set, produce output to screeen - static const constexpr uint32_t flagsWantOutput = (0xffffffff & ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH & - ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF); - logging::Logger& getLogger() - { - return msgLog_; - } - void updateSessionMap(const size_t pct) + } + ThreadCntPerSessionMap_t& getThreadCntPerSessionMap() + { + return threadCntPerSessionMap_; + } + std::mutex& getThreadCntPerSessionMapMutex() + { + return threadCntPerSessionMapMutex_; + } + void initMaxMemPct(uint32_t sessionId) + { + if (sessionId < 0x80000000) { std::lock_guard lk(sessionMemMapMutex_); + auto mapIter = sessionMemMap_.find(sessionId); - for (auto mapIter = sessionMemMap_.begin(); mapIter != sessionMemMap_.end(); ++mapIter) + if (mapIter == sessionMemMap_.end()) { - if (pct > mapIter->second) - { - mapIter->second = pct; - } + sessionMemMap_[sessionId] = 0; } - } - ThreadCntPerSessionMap_t& getThreadCntPerSessionMap() - { - return threadCntPerSessionMap_; - } - std::mutex& getThreadCntPerSessionMapMutex() - { - return threadCntPerSessionMapMutex_; - } - void initMaxMemPct(uint32_t sessionId) - { - if (sessionId < 0x80000000) - { - std::lock_guard lk(sessionMemMapMutex_); - auto mapIter = sessionMemMap_.find(sessionId); - - if (mapIter == sessionMemMap_.end()) - { - sessionMemMap_[sessionId] = 0; - } - else - { - mapIter->second = 0; - } - } - } - uint64_t getMaxMemPct(const uint32_t sessionId) - { - uint64_t maxMemoryPct = 0; - if (sessionId < 0x80000000) - { - std::lock_guard lk(sessionMemMapMutex_); - auto mapIter = sessionMemMap_.find(sessionId); - - if (mapIter != sessionMemMap_.end()) - { - maxMemoryPct = (uint64_t)mapIter->second; - } - } - - return maxMemoryPct; - } - void deleteMaxMemPct(uint32_t sessionId) - { - if (sessionId < 0x80000000) - { - std::lock_guard lk(sessionMemMapMutex_); - auto mapIter = sessionMemMap_.find(sessionId); - - if (mapIter != sessionMemMap_.end()) - { - sessionMemMap_.erase(sessionId); - } - } - } - //...Increment the number of threads using the specified sessionId - void incThreadCntPerSession(uint32_t sessionId) - { - std::lock_guard lk(threadCntPerSessionMapMutex_); - auto mapIter = threadCntPerSessionMap_.find(sessionId); - - if (mapIter == threadCntPerSessionMap_.end()) - threadCntPerSessionMap_.insert(ThreadCntPerSessionMap_t::value_type(sessionId, 1)); else - mapIter->second++; - } - //...Decrement the number of threads using the specified sessionId. - //...When the thread count for a sessionId reaches 0, the corresponding - //...CalpontSystemCatalog objects are deleted. - //...The user query and its associated catalog query have a different - //...session Id where the highest bit is flipped. - //...The object with id(sessionId | 0x80000000) cannot be removed before - //...user query session completes because the sysdata may be used for - //...debugging/stats purpose, such as result graph, etc. - void decThreadCntPerSession(uint32_t sessionId) - { - std::lock_guard lk(threadCntPerSessionMapMutex_); - auto mapIter = threadCntPerSessionMap_.find(sessionId); - - if (mapIter != threadCntPerSessionMap_.end()) { - if (--mapIter->second == 0) + mapIter->second = 0; + } + } + } + uint64_t getMaxMemPct(const uint32_t sessionId) + { + uint64_t maxMemoryPct = 0; + if (sessionId < 0x80000000) + { + std::lock_guard lk(sessionMemMapMutex_); + auto mapIter = sessionMemMap_.find(sessionId); + + if (mapIter != sessionMemMap_.end()) + { + maxMemoryPct = (uint64_t)mapIter->second; + } + } + + return maxMemoryPct; + } + void deleteMaxMemPct(uint32_t sessionId) + { + if (sessionId < 0x80000000) + { + std::lock_guard lk(sessionMemMapMutex_); + auto mapIter = sessionMemMap_.find(sessionId); + + if (mapIter != sessionMemMap_.end()) + { + sessionMemMap_.erase(sessionId); + } + } + } + //...Increment the number of threads using the specified sessionId + void incThreadCntPerSession(uint32_t sessionId) + { + std::lock_guard lk(threadCntPerSessionMapMutex_); + auto mapIter = threadCntPerSessionMap_.find(sessionId); + + if (mapIter == threadCntPerSessionMap_.end()) + threadCntPerSessionMap_.insert(ThreadCntPerSessionMap_t::value_type(sessionId, 1)); + else + mapIter->second++; + } + //...Decrement the number of threads using the specified sessionId. + //...When the thread count for a sessionId reaches 0, the corresponding + //...CalpontSystemCatalog objects are deleted. + //...The user query and its associated catalog query have a different + //...session Id where the highest bit is flipped. + //...The object with id(sessionId | 0x80000000) cannot be removed before + //...user query session completes because the sysdata may be used for + //...debugging/stats purpose, such as result graph, etc. + void decThreadCntPerSession(uint32_t sessionId) + { + std::lock_guard lk(threadCntPerSessionMapMutex_); + auto mapIter = threadCntPerSessionMap_.find(sessionId); + + if (mapIter != threadCntPerSessionMap_.end()) + { + if (--mapIter->second == 0) + { + threadCntPerSessionMap_.erase(mapIter); + execplan::CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId); + execplan::CalpontSystemCatalog::removeCalpontSystemCatalog((sessionId ^ 0x80000000)); + } + } + } + ActiveStatementCounter* getStatementsRunningCount() + { + return statementsRunningCount_; + } + joblist::DistributedEngineComm* getDec() + { + return dec_; + } + int toInt(const std::string& val) + { + if (val.length() == 0) + return -1; + + return static_cast(config::Config::fromText(val)); + } + const std::string prettyPrintMiniInfo(const std::string& in); + + const std::string timeNow() + { + time_t outputTime = time(nullptr); + struct tm ltm; + char buf[32]; // ctime(3) says at least 26 + size_t len = 0; + asctime_r(localtime_r(&outputTime, <m), buf); + len = strlen(buf); + + if (len > 0) + --len; + + if (buf[len] == '\n') + buf[len] = 0; + + return buf; + } + querytele::QueryTeleServerParms& getTeleServerParms() + { + return teleServerParms_; + } + joblist::ResourceManager& getRm() + { + return *rm_; + } + bool isLocalNodeSock(SharedPtrEMSock& sock) const + { + for (auto& sin : localNetIfaceSins_) + { + if (sock->isSameAddr(sin)) + { + return true; + } + } + return false; + } + + private: + void setupSignalHandlers(); + int8_t setupCwd() + { + std::string workdir = rm_->getScWorkingDir(); + int8_t rc = chdir(workdir.c_str()); + + if (rc < 0 || access(".", W_OK) != 0) + rc = chdir("/tmp"); + + return (rc < 0) ? -5 : rc; + } + int setupResources() + { + struct rlimit rlim; + + if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) + { + return -1; + } + rlim.rlim_cur = rlim.rlim_max = 65536; + + if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) + { + return -2; + } + if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) + { + return -3; + } + if (rlim.rlim_cur != 65536) + { + return -4; + } + return 0; + } + void getLocalNetIfacesSins() + { + string ipAddress = "Unable to get IP Address"; + struct ifaddrs* netIfacesList = nullptr; + struct ifaddrs* ifaceListMembPtr = nullptr; + int success = 0; + // retrieve the current interfaces - returns 0 on success + success = getifaddrs(&netIfacesList); + if (success == 0) + { + ifaceListMembPtr = netIfacesList; + for (; ifaceListMembPtr; ifaceListMembPtr = ifaceListMembPtr->ifa_next) + { + if (ifaceListMembPtr->ifa_addr->sa_family == AF_INET) { - threadCntPerSessionMap_.erase(mapIter); - execplan::CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId); - execplan::CalpontSystemCatalog::removeCalpontSystemCatalog((sessionId ^ 0x80000000)); + localNetIfaceSins_.push_back(((struct sockaddr_in*)ifaceListMembPtr->ifa_addr)->sin_addr); } } } - ActiveStatementCounter* getStatementsRunningCount() - { - return statementsRunningCount_; - } - joblist::DistributedEngineComm* getDec() - { - return dec_; - } - int toInt(const std::string& val) - { - if (val.length() == 0) - return -1; - - return static_cast(config::Config::fromText(val)); - } - const std::string prettyPrintMiniInfo(const std::string& in); - - const std::string timeNow() - { - time_t outputTime = time(0); - struct tm ltm; - char buf[32]; // ctime(3) says at least 26 - size_t len = 0; - asctime_r(localtime_r(&outputTime, <m), buf); - len = strlen(buf); - - if (len > 0) - --len; - - if (buf[len] == '\n') - buf[len] = 0; - - return buf; - } - querytele::QueryTeleServerParms& getTeleServerParms() - { - return teleServerParms_; - } - joblist::ResourceManager& getRm() - { - return *rm_; - } - bool isLocalNodeSock(SharedPtrEMSock& sock) const - { - for (auto& sin : localNetIfaceSins_) - { - if (sock->isSameAddr(sin)) - { - return true; - } - } - return false; - } - private: - void setupSignalHandlers(); - int8_t setupCwd() - { - std::string workdir = rm_->getScWorkingDir(); - int8_t rc = chdir(workdir.c_str()); - - if (rc < 0 || access(".", W_OK) != 0) - rc = chdir("/tmp"); - - return (rc < 0) ? -5 : rc; - } - int setupResources() - { - struct rlimit rlim; - - if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) - { - return -1; - } - rlim.rlim_cur = rlim.rlim_max = 65536; - - if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) - { - return -2; - } - if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) - { - return -3; - } - if (rlim.rlim_cur != 65536) - { - return -4; - } - return 0; - } - void getLocalNetIfacesSins() - { - string ipAddress = "Unable to get IP Address"; - struct ifaddrs* netIfacesList = nullptr; - struct ifaddrs* ifaceListMembPtr = nullptr; - int success = 0; - // retrieve the current interfaces - returns 0 on success - success = getifaddrs(&netIfacesList); - if (success == 0) - { - ifaceListMembPtr = netIfacesList; - for (; ifaceListMembPtr; ifaceListMembPtr = ifaceListMembPtr->ifa_next) - { - if (ifaceListMembPtr->ifa_addr->sa_family == AF_INET) - { - localNetIfaceSins_.push_back(((struct sockaddr_in*)ifaceListMembPtr->ifa_addr)->sin_addr); - } - } - } - freeifaddrs(netIfacesList); - } - logging::Logger msgLog_; - SessionMemMap_t sessionMemMap_; // track memory% usage during a query - std::mutex sessionMemMapMutex_; - //...The FrontEnd may establish more than 1 connection (which results in - // more than 1 ExeMgr thread) per session. These threads will share - // the same CalpontSystemCatalog object for that session. Here, we - // define a std::map to track how many threads are sharing each session, so - // that we know when we can safely delete a CalpontSystemCatalog object - // shared by multiple threads per session. - ThreadCntPerSessionMap_t threadCntPerSessionMap_; - std::mutex threadCntPerSessionMapMutex_; - ActiveStatementCounter* statementsRunningCount_ = nullptr; - joblist::DistributedEngineComm* dec_ = nullptr; - joblist::ResourceManager* rm_ = nullptr; - // Its attributes are set in Child() - querytele::QueryTeleServerParms teleServerParms_; - std::vector localNetIfaceSins_; - }; - extern ServiceExeMgr* globServiceExeMgr; -} \ No newline at end of file + freeifaddrs(netIfacesList); + } + logging::Logger msgLog_; + SessionMemMap_t sessionMemMap_; // track memory% usage during a query + std::mutex sessionMemMapMutex_; + //...The FrontEnd may establish more than 1 connection (which results in + // more than 1 ExeMgr thread) per session. These threads will share + // the same CalpontSystemCatalog object for that session. Here, we + // define a std::map to track how many threads are sharing each session, so + // that we know when we can safely delete a CalpontSystemCatalog object + // shared by multiple threads per session. + ThreadCntPerSessionMap_t threadCntPerSessionMap_; + std::mutex threadCntPerSessionMapMutex_; + ActiveStatementCounter* statementsRunningCount_ = nullptr; + joblist::DistributedEngineComm* dec_ = nullptr; + joblist::ResourceManager* rm_ = nullptr; + // Its attributes are set in Child() + querytele::QueryTeleServerParms teleServerParms_; + std::vector localNetIfaceSins_; +}; +extern ServiceExeMgr* globServiceExeMgr; +} // namespace exemgr \ No newline at end of file diff --git a/primitives/primproc/umsocketselector.h b/primitives/primproc/umsocketselector.h index 63b042b73..2dd49cbe6 100644 --- a/primitives/primproc/umsocketselector.h +++ b/primitives/primproc/umsocketselector.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -80,7 +81,7 @@ class UmSocketSelector /** @brief UmSocketSelector destructor * */ - ~UmSocketSelector(){}; + ~UmSocketSelector() = default; /** @brief Accessor to total number of UM IP's in Columnstore.xml. * @@ -152,15 +153,15 @@ class UmModuleIPs * * @param moduleName (in) UM module name for this UmModuleIPs object. */ - explicit UmModuleIPs(const std::string& moduleName) - : fUmModuleName(moduleName), fNextUmIPSocketIdx(NEXT_IP_SOCKET_UNASSIGNED) + explicit UmModuleIPs(std::string moduleName) + : fUmModuleName(std::move(moduleName)), fNextUmIPSocketIdx(NEXT_IP_SOCKET_UNASSIGNED) { } /** @brief UmModuleIPs destructor. * */ - ~UmModuleIPs(){}; + ~UmModuleIPs() = default; /** @brief Accessor to number of IP's from Columnstore.xml for this UM. * @@ -258,15 +259,13 @@ class UmIPSocketConns /** @brief UmIPSocketConns destructor. * */ - ~UmIPSocketConns() - { - } + ~UmIPSocketConns() = default; /** @brief Accessor to the IP address for this UmIPSocketConns object. * * @return IP address (in network byte order). */ - in_addr_t ipAddress() + in_addr_t ipAddress() const { return fIpAddress; } diff --git a/storage-manager/src/AppendTask.cpp b/storage-manager/src/AppendTask.cpp index d30211524..19b5a1832 100644 --- a/storage-manager/src/AppendTask.cpp +++ b/storage-manager/src/AppendTask.cpp @@ -18,7 +18,7 @@ #include "AppendTask.h" #include "messageFormat.h" #include "SMLogging.h" -#include +#include using namespace std; @@ -50,7 +50,7 @@ bool AppendTask::run() success = read(cmdbuf, sizeof(append_cmd)); check_error("AppendTask read", false); - append_cmd* cmd = (append_cmd*)cmdbuf; + auto* cmd = (append_cmd*)cmdbuf; if (cmd->flen > 1023 - sizeof(*cmd)) { diff --git a/storage-manager/src/AppendTask.h b/storage-manager/src/AppendTask.h index fa027015b..ac34ab56e 100644 --- a/storage-manager/src/AppendTask.h +++ b/storage-manager/src/AppendTask.h @@ -24,13 +24,11 @@ namespace storagemanager class AppendTask : public PosixTask { public: + AppendTask() = delete; AppendTask(int sock, uint length); - virtual ~AppendTask(); + ~AppendTask() override; - bool run(); - - private: - AppendTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/Cache.h b/storage-manager/src/Cache.h index 01d8b54d8..305465b10 100644 --- a/storage-manager/src/Cache.h +++ b/storage-manager/src/Cache.h @@ -46,7 +46,7 @@ class Cache : public boost::noncopyable, public ConfigListener { public: static Cache* get(); - virtual ~Cache(); + ~Cache() override; // reading fcns // read() marks objects to be read s.t. they do not get flushed. @@ -98,7 +98,7 @@ class Cache : public boost::noncopyable, public ConfigListener void reset(); void validateCacheSize(); - virtual void configListener() override; + void configListener() override; private: Cache(); diff --git a/storage-manager/src/CloudStorage.h b/storage-manager/src/CloudStorage.h index c857f1b67..97d18a210 100644 --- a/storage-manager/src/CloudStorage.h +++ b/storage-manager/src/CloudStorage.h @@ -26,11 +26,12 @@ namespace storagemanager class CloudStorage { public: - virtual ~CloudStorage(){}; + virtual ~CloudStorage() = default; /* These behave like syscalls. return code -1 means an error, and errno is set */ - virtual int getObject(const std::string& sourceKey, const std::string& destFile, size_t* size = NULL) = 0; + virtual int getObject(const std::string& sourceKey, const std::string& destFile, + size_t* size = nullptr) = 0; virtual int getObject(const std::string& sourceKey, std::shared_ptr* data, - size_t* size = NULL) = 0; + size_t* size = nullptr) = 0; virtual int putObject(const std::string& sourceFile, const std::string& destKey) = 0; virtual int putObject(const std::shared_ptr data, size_t len, const std::string& destKey) = 0; virtual int deleteObject(const std::string& key) = 0; diff --git a/storage-manager/src/Config.h b/storage-manager/src/Config.h index b7e9a75b1..ba8e85bca 100644 --- a/storage-manager/src/Config.h +++ b/storage-manager/src/Config.h @@ -18,14 +18,14 @@ #pragma once #ifndef __clang__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include #ifndef __clang__ - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif #include @@ -41,7 +41,7 @@ namespace storagemanager class ConfigListener { public: - virtual ~ConfigListener(){}; + virtual ~ConfigListener() = default; virtual void configListener() = 0; }; @@ -61,7 +61,7 @@ class Config : public boost::noncopyable private: Config(); - Config(const std::string&); + explicit Config(const std::string&); bool reload(); void reloadThreadFcn(); diff --git a/storage-manager/src/CopyTask.cpp b/storage-manager/src/CopyTask.cpp index 7d6fe980e..4694c9834 100644 --- a/storage-manager/src/CopyTask.cpp +++ b/storage-manager/src/CopyTask.cpp @@ -54,10 +54,10 @@ bool CopyTask::run() success = read(buf, getLength()); check_error("CopyTask read", false); - copy_cmd* cmd = (copy_cmd*)buf; + auto* cmd = (copy_cmd*)buf; string filename1(cmd->file1.filename, cmd->file1.flen); // need to copy this in case it's not null terminated - f_name* filename2 = (f_name*)&buf[sizeof(copy_cmd) + cmd->file1.flen]; + auto* filename2 = (f_name*)&buf[sizeof(copy_cmd) + cmd->file1.flen]; #ifdef SM_TRACE logger->log(LOG_DEBUG, "copy %s to %s.", filename1.c_str(), filename2->filename); @@ -80,7 +80,7 @@ bool CopyTask::run() return true; } - sm_response* resp = (sm_response*)buf; + auto* resp = (sm_response*)buf; resp->returnCode = 0; return write(*resp, 0); } diff --git a/storage-manager/src/CopyTask.h b/storage-manager/src/CopyTask.h index 0745c8064..bbd2240e8 100644 --- a/storage-manager/src/CopyTask.h +++ b/storage-manager/src/CopyTask.h @@ -24,13 +24,11 @@ namespace storagemanager class CopyTask : public PosixTask { public: + CopyTask() = delete; CopyTask(int sock, uint length); - virtual ~CopyTask(); + ~CopyTask() override; - bool run(); - - private: - CopyTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/Downloader.cpp b/storage-manager/src/Downloader.cpp index 1a0897f9f..4e914ce61 100644 --- a/storage-manager/src/Downloader.cpp +++ b/storage-manager/src/Downloader.cpp @@ -19,9 +19,10 @@ #include "Config.h" #include "SMLogging.h" #include -#include +#include #include #include +#include using namespace std; namespace bf = boost::filesystem; @@ -135,14 +136,20 @@ const bf::path& Downloader::getTmpPath() const return tmpPath; } /* The helper fcns */ -Downloader::Download::Download(const string& source, const bf::path& _dlPath, boost::mutex* _lock, - Downloader* _dl) - : dlPath(_dlPath), key(source), dl_errno(0), size(0), lock(_lock), finished(false), itRan(false), dl(_dl) +Downloader::Download::Download(string source, bf::path _dlPath, boost::mutex* _lock, Downloader* _dl) + : dlPath(std::move(_dlPath)) + , key(std::move(source)) + , dl_errno(0) + , size(0) + , lock(_lock) + , finished(false) + , itRan(false) + , dl(_dl) { } -Downloader::Download::Download(const string& source) - : key(source), dl_errno(0), size(0), lock(NULL), finished(false), itRan(false), dl(NULL) +Downloader::Download::Download(string source) + : key(std::move(source)), dl_errno(0), size(0), lock(nullptr), finished(false), itRan(false), dl(nullptr) { } @@ -154,12 +161,12 @@ Downloader::Download::~Download() void Downloader::Download::operator()() { itRan = true; - CloudStorage* storage = CloudStorage::get(); + CloudStorage* stor = CloudStorage::get(); // download to a tmp path if (!bf::exists(dlPath / dl->getTmpPath())) bf::create_directories(dlPath / dl->getTmpPath()); bf::path tmpFile = dlPath / dl->getTmpPath() / key; - int err = storage->getObject(key, tmpFile.string(), &size); + int err = stor->getObject(key, tmpFile.string(), &size); if (err != 0) { dl_errno = errno; @@ -179,8 +186,10 @@ void Downloader::Download::operator()() lock->lock(); finished = true; - for (uint i = 0; i < listeners.size(); i++) - listeners[i]->downloadFinished(); + for (auto* listener : listeners) + { + listener->downloadFinished(); + } lock->unlock(); } @@ -217,7 +226,7 @@ void Downloader::configListener() { maxDownloads = 20; workers.setMaxThreads(maxDownloads); - logger->log(LOG_INFO, "max_concurrent_downloads = %u",maxDownloads); + logger->log(LOG_INFO, "max_concurrent_downloads = %u", maxDownloads); } if (stmp.empty()) { diff --git a/storage-manager/src/Downloader.h b/storage-manager/src/Downloader.h index d4919c6f2..1208ab345 100644 --- a/storage-manager/src/Downloader.h +++ b/storage-manager/src/Downloader.h @@ -38,7 +38,7 @@ class Downloader : public ConfigListener { public: Downloader(); - virtual ~Downloader(); + ~Downloader() override; // caller owns the memory for the strings. // errors are reported through errnos @@ -49,7 +49,7 @@ class Downloader : public ConfigListener void printKPIs() const; - virtual void configListener() override; + void configListener() override; private: uint maxDownloads; @@ -73,10 +73,10 @@ class Downloader : public ConfigListener */ struct Download : public ThreadPool::Job { - Download(const std::string& source, const boost::filesystem::path& _dlPath, boost::mutex*, Downloader*); - Download(const std::string& source); - virtual ~Download(); - void operator()(); + Download(std::string source, boost::filesystem::path _dlPath, boost::mutex*, Downloader*); + explicit Download(std::string source); + ~Download() override; + void operator()() override; boost::filesystem::path dlPath; const std::string key; int dl_errno; // to propagate errors from the download job to the caller diff --git a/storage-manager/src/IOCoordinator.h b/storage-manager/src/IOCoordinator.h index f499aad3e..131c79711 100644 --- a/storage-manager/src/IOCoordinator.h +++ b/storage-manager/src/IOCoordinator.h @@ -18,7 +18,7 @@ #pragma once #include -#include +#include #include #include #include @@ -58,7 +58,7 @@ class IOCoordinator : public boost::noncopyable // The shared logic for merging a journal file with its base file. // len should be set to the length of the data requested std::shared_ptr mergeJournal(const char* objectPath, const char* journalPath, off_t offset, - size_t len, size_t* sizeRead) const; + size_t len, size_t* sizeRead) const; // this version modifies object data in memory, given the journal filename. Processes the whole object // and whole journal file. diff --git a/storage-manager/src/ListDirectoryTask.h b/storage-manager/src/ListDirectoryTask.h index 183c6dad5..feea7c2ff 100644 --- a/storage-manager/src/ListDirectoryTask.h +++ b/storage-manager/src/ListDirectoryTask.h @@ -25,14 +25,13 @@ namespace storagemanager class ListDirectoryTask : public PosixTask { public: + ListDirectoryTask() = delete; ListDirectoryTask(int sock, uint length); - virtual ~ListDirectoryTask(); + ~ListDirectoryTask() override; - bool run(); + bool run() override; private: - ListDirectoryTask(); - bool writeString(uint8_t* buf, int* offset, int size, const std::string& str); }; diff --git a/storage-manager/src/LocalStorage.h b/storage-manager/src/LocalStorage.h index fc1f5a5d3..178efc76b 100644 --- a/storage-manager/src/LocalStorage.h +++ b/storage-manager/src/LocalStorage.h @@ -29,18 +29,19 @@ class LocalStorage : public CloudStorage { public: LocalStorage(); - virtual ~LocalStorage(); + ~LocalStorage() override; - int getObject(const std::string& sourceKey, const std::string& destFile, size_t* size = NULL); - int getObject(const std::string& sourceKey, std::shared_ptr* data, size_t* size = NULL); - int putObject(const std::string& sourceFile, const std::string& destKey); - int putObject(const std::shared_ptr data, size_t len, const std::string& destKey); - int deleteObject(const std::string& key); - int copyObject(const std::string& sourceKey, const std::string& destKey); - int exists(const std::string& key, bool* out); + int getObject(const std::string& sourceKey, const std::string& destFile, size_t* size = nullptr) override; + int getObject(const std::string& sourceKey, std::shared_ptr* data, + size_t* size = nullptr) override; + int putObject(const std::string& sourceFile, const std::string& destKey) override; + int putObject(const std::shared_ptr data, size_t len, const std::string& destKey) override; + int deleteObject(const std::string& key) override; + int copyObject(const std::string& sourceKey, const std::string& destKey) override; + int exists(const std::string& key, bool* out) override; const boost::filesystem::path& getPrefix() const; - void printKPIs() const; + void printKPIs() const override; protected: size_t bytesRead, bytesWritten; diff --git a/storage-manager/src/MetadataFile.h b/storage-manager/src/MetadataFile.h index f8115ae09..c30092df1 100644 --- a/storage-manager/src/MetadataFile.h +++ b/storage-manager/src/MetadataFile.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ namespace storagemanager struct metadataObject { metadataObject(); - metadataObject(uint64_t offset); // so we can search mObjects by integer + explicit metadataObject(uint64_t offset); // so we can search mObjects by integer metadataObject(uint64_t offset, uint64_t length, const std::string& key); uint64_t offset; mutable uint64_t length; @@ -51,7 +51,7 @@ class MetadataFile { }; MetadataFile(); - MetadataFile(const boost::filesystem::path& filename); + explicit MetadataFile(const boost::filesystem::path& filename); MetadataFile(const boost::filesystem::path& path, no_create_t, bool appendExt); // this one won't create it if it doesn't exist diff --git a/storage-manager/src/OpenTask.cpp b/storage-manager/src/OpenTask.cpp index 267d253ee..983a1c8e3 100644 --- a/storage-manager/src/OpenTask.cpp +++ b/storage-manager/src/OpenTask.cpp @@ -19,8 +19,7 @@ #include "messageFormat.h" #include "SMLogging.h" #include -#include -#include +#include using namespace std; @@ -30,9 +29,7 @@ OpenTask::OpenTask(int sock, uint len) : PosixTask(sock, len) { } -OpenTask::~OpenTask() -{ -} +OpenTask::~OpenTask() = default; bool OpenTask::run() { @@ -58,12 +55,12 @@ bool OpenTask::run() return false; } - open_cmd* cmd = (open_cmd*)buf; + auto* cmd = (open_cmd*)buf; #ifdef SM_TRACE logger->log(LOG_DEBUG, "open filename %s mode %o.", cmd->filename, cmd->openmode); #endif - sm_response* resp = (sm_response*)buf; + auto* resp = (sm_response*)buf; int err; try diff --git a/storage-manager/src/OpenTask.h b/storage-manager/src/OpenTask.h index 658d8e7ec..90403e831 100644 --- a/storage-manager/src/OpenTask.h +++ b/storage-manager/src/OpenTask.h @@ -24,13 +24,11 @@ namespace storagemanager class OpenTask : public PosixTask { public: + OpenTask() = delete; OpenTask(int sock, uint length); - virtual ~OpenTask(); + ~OpenTask() override; - bool run(); - - private: - OpenTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/Ownership.h b/storage-manager/src/Ownership.h index f3b6a2d97..1a229a420 100644 --- a/storage-manager/src/Ownership.h +++ b/storage-manager/src/Ownership.h @@ -62,7 +62,7 @@ class Ownership : public boost::noncopyable struct Monitor { - Monitor(Ownership*); + explicit Monitor(Ownership*); ~Monitor(); boost::thread thread; Ownership* owner; diff --git a/storage-manager/src/PingTask.cpp b/storage-manager/src/PingTask.cpp index 8451b7757..82018340e 100644 --- a/storage-manager/src/PingTask.cpp +++ b/storage-manager/src/PingTask.cpp @@ -17,7 +17,7 @@ #include "PingTask.h" #include "messageFormat.h" -#include +#include namespace storagemanager { @@ -25,9 +25,7 @@ PingTask::PingTask(int sock, uint len) : PosixTask(sock, len) { } -PingTask::~PingTask() -{ -} +PingTask::~PingTask() = default; bool PingTask::run() { @@ -49,7 +47,7 @@ bool PingTask::run() } // send generic success response - sm_response ret; + sm_response ret{}; ret.returnCode = 0; success = write(ret, 0); return success; diff --git a/storage-manager/src/PingTask.h b/storage-manager/src/PingTask.h index b9855e61d..aad7c84a4 100644 --- a/storage-manager/src/PingTask.h +++ b/storage-manager/src/PingTask.h @@ -24,13 +24,11 @@ namespace storagemanager class PingTask : public PosixTask { public: + PingTask() = delete; PingTask(int sock, uint length); - virtual ~PingTask(); + ~PingTask() override; - bool run(); - - private: - PingTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/PosixTask.cpp b/storage-manager/src/PosixTask.cpp index 2bd4dc790..f236653f6 100644 --- a/storage-manager/src/PosixTask.cpp +++ b/storage-manager/src/PosixTask.cpp @@ -18,10 +18,9 @@ #include "PosixTask.h" #include "messageFormat.h" #include "SMLogging.h" -#include #include #include -#include +#include #define min(x, y) (x < y ? x : y) @@ -53,7 +52,7 @@ void PosixTask::handleError(const char* name, int errCode) char buf[80]; // send an error response if possible - sm_response* resp = (sm_response*)buf; + auto* resp = (sm_response*)buf; resp->returnCode = -1; *((int*)resp->payload) = errCode; bool success = write(*resp, 4); @@ -67,7 +66,7 @@ uint PosixTask::getRemainingLength() return remainingLengthForCaller; } -uint PosixTask::getLength() +uint PosixTask::getLength() const { return totalLength; } @@ -152,7 +151,7 @@ void PosixTask::primeBuffer() } } -bool PosixTask::write(const uint8_t* buf, uint len) +bool PosixTask::write(const uint8_t* buf, uint len) const { int err; uint count = 0; @@ -167,11 +166,11 @@ bool PosixTask::write(const uint8_t* buf, uint len) return true; } -bool PosixTask::write(sm_response& resp, uint payloadLength) +bool PosixTask::write(sm_response& resp, uint payloadLength) const { int err; uint count = 0; - uint8_t* buf = (uint8_t*)&resp; + auto* buf = (uint8_t*)&resp; resp.header.type = SM_MSG_START; resp.header.flags = 0; diff --git a/storage-manager/src/PosixTask.h b/storage-manager/src/PosixTask.h index 5b0641a21..ad0d52253 100644 --- a/storage-manager/src/PosixTask.h +++ b/storage-manager/src/PosixTask.h @@ -29,6 +29,7 @@ namespace storagemanager class PosixTask { public: + PosixTask() = delete; PosixTask(int sock, uint length); virtual ~PosixTask(); @@ -39,18 +40,16 @@ class PosixTask protected: int read(uint8_t* buf, uint length); bool write(const std::vector& buf); - bool write(sm_response& resp, uint payloadLength); - bool write(const uint8_t* buf, uint length); + bool write(sm_response& resp, uint payloadLength) const; + bool write(const uint8_t* buf, uint length) const; void consumeMsg(); // drains the remaining portion of the message - uint getLength(); // returns the total length of the msg + uint getLength() const; // returns the total length of the msg uint getRemainingLength(); // returns the remaining length from the caller's perspective void handleError(const char* name, int errCode); IOCoordinator* ioc; private: - PosixTask(); - int sock; int totalLength; uint remainingLengthInStream; diff --git a/storage-manager/src/PrefixCache.h b/storage-manager/src/PrefixCache.h index bd29b513a..351d66e85 100644 --- a/storage-manager/src/PrefixCache.h +++ b/storage-manager/src/PrefixCache.h @@ -39,7 +39,8 @@ namespace storagemanager class PrefixCache : public boost::noncopyable { public: - PrefixCache(const boost::filesystem::path& prefix); + PrefixCache() = delete; + explicit PrefixCache(const boost::filesystem::path& prefix); virtual ~PrefixCache(); // reading fcns @@ -82,8 +83,6 @@ class PrefixCache : public boost::noncopyable void validateCacheSize(); private: - PrefixCache(); - boost::filesystem::path cachePrefix; boost::filesystem::path journalPrefix; boost::filesystem::path firstDir; diff --git a/storage-manager/src/ProcessTask.h b/storage-manager/src/ProcessTask.h index afc91b363..7734d0032 100644 --- a/storage-manager/src/ProcessTask.h +++ b/storage-manager/src/ProcessTask.h @@ -24,14 +24,13 @@ namespace storagemanager class ProcessTask : public ThreadPool::Job { public: + ProcessTask() = delete; ProcessTask(int sock, uint length); // _sock is the socket to read from - virtual ~ProcessTask(); + ~ProcessTask() override; - void operator()(); + void operator()() override; private: - ProcessTask(); - void handleError(int errCode); int sock; uint length; diff --git a/storage-manager/src/ReadTask.h b/storage-manager/src/ReadTask.h index 9bcd7a21c..0bd2b7717 100644 --- a/storage-manager/src/ReadTask.h +++ b/storage-manager/src/ReadTask.h @@ -24,13 +24,11 @@ namespace storagemanager class ReadTask : public PosixTask { public: + ReadTask() = delete; ReadTask(int sock, uint length); - virtual ~ReadTask(); + ~ReadTask() override; - bool run(); - - private: - ReadTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/Replicator.h b/storage-manager/src/Replicator.h index 165c60e45..334f949ea 100644 --- a/storage-manager/src/Replicator.h +++ b/storage-manager/src/Replicator.h @@ -17,11 +17,11 @@ #pragma once -//#include "ThreadPool.h" +// #include "ThreadPool.h" #include "MetadataFile.h" #include #include -#include +#include #define JOURNAL_ENTRY_HEADER_SIZE 16 diff --git a/storage-manager/src/S3Storage.h b/storage-manager/src/S3Storage.h index 96e412edf..cda369a18 100644 --- a/storage-manager/src/S3Storage.h +++ b/storage-manager/src/S3Storage.h @@ -36,8 +36,9 @@ class S3Storage : public CloudStorage ~S3Storage() override; - int getObject(const std::string& sourceKey, const std::string& destFile, size_t* size = NULL) override; - int getObject(const std::string& sourceKey, std::shared_ptr* data, size_t* size = NULL) override; + int getObject(const std::string& sourceKey, const std::string& destFile, size_t* size = nullptr) override; + int getObject(const std::string& sourceKey, std::shared_ptr* data, + size_t* size = nullptr) override; int putObject(const std::string& sourceFile, const std::string& destKey) override; int putObject(const std::shared_ptr data, size_t len, const std::string& destKey) override; int deleteObject(const std::string& key) override; @@ -77,7 +78,9 @@ class S3Storage : public CloudStorage struct Connection { - Connection(uint64_t id): id(id) {} + explicit Connection(uint64_t id) : id(id) + { + } uint64_t id; ms3_st* conn{nullptr}; timespec touchedAt{}; @@ -96,7 +99,8 @@ class S3Storage : public CloudStorage mutable boost::mutex connMutex; std::deque> freeConns; // using this as a stack to keep lru objects together - std::unordered_map> usedConns; // using this for displaying and killing tasks + std::unordered_map> + usedConns; // using this for displaying and killing tasks uint64_t nextConnId = 0; const time_t maxIdleSecs = 30; }; diff --git a/storage-manager/src/StatTask.cpp b/storage-manager/src/StatTask.cpp index b34e12fe2..82f10fff7 100644 --- a/storage-manager/src/StatTask.cpp +++ b/storage-manager/src/StatTask.cpp @@ -18,11 +18,10 @@ #include "StatTask.h" #include "messageFormat.h" #include "SMLogging.h" -#include +#include #include #include -#include -#include +#include using namespace std; diff --git a/storage-manager/src/StatTask.h b/storage-manager/src/StatTask.h index 6d4a480ac..c7b1da8a2 100644 --- a/storage-manager/src/StatTask.h +++ b/storage-manager/src/StatTask.h @@ -24,13 +24,11 @@ namespace storagemanager class StatTask : public PosixTask { public: + StatTask() = delete; StatTask(int sock, uint length); - virtual ~StatTask(); + ~StatTask() override; - bool run(); - - private: - StatTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/SyncTask.cpp b/storage-manager/src/SyncTask.cpp index b669d12d8..6b54b34e4 100644 --- a/storage-manager/src/SyncTask.cpp +++ b/storage-manager/src/SyncTask.cpp @@ -18,7 +18,7 @@ #include "SyncTask.h" #include "Synchronizer.h" #include "messageFormat.h" -#include +#include namespace storagemanager { @@ -26,9 +26,7 @@ SyncTask::SyncTask(int sock, uint len) : PosixTask(sock, len) { } -SyncTask::~SyncTask() -{ -} +SyncTask::~SyncTask() = default; bool SyncTask::run() { diff --git a/storage-manager/src/SyncTask.h b/storage-manager/src/SyncTask.h index 853d8b4ad..e6623f6b1 100644 --- a/storage-manager/src/SyncTask.h +++ b/storage-manager/src/SyncTask.h @@ -24,13 +24,11 @@ namespace storagemanager class SyncTask : public PosixTask { public: + SyncTask() = delete; SyncTask(int sock, uint length); - virtual ~SyncTask(); + ~SyncTask() override; - bool run(); - - private: - SyncTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/Synchronizer.h b/storage-manager/src/Synchronizer.h index 19244f892..82d21f61c 100644 --- a/storage-manager/src/Synchronizer.h +++ b/storage-manager/src/Synchronizer.h @@ -40,7 +40,7 @@ class Synchronizer : public boost::noncopyable, public ConfigListener { public: static Synchronizer* get(); - virtual ~Synchronizer(); + ~Synchronizer() override; // these take keys as parameters, not full path names, ex, pass in '12345' not // 'cache/12345'. @@ -61,7 +61,7 @@ class Synchronizer : public boost::noncopyable, public ConfigListener boost::filesystem::path getCachePath(); void printKPIs() const; - virtual void configListener() override; + void configListener() override; private: Synchronizer(); @@ -77,7 +77,7 @@ class Synchronizer : public boost::noncopyable, public ConfigListener // this struct kind of got sloppy. Need to clean it at some point. struct PendingOps { - PendingOps(int flags); + explicit PendingOps(int flags); ~PendingOps(); int opFlags; int waiters; @@ -89,9 +89,9 @@ class Synchronizer : public boost::noncopyable, public ConfigListener struct Job : public ThreadPool::Job { - virtual ~Job(){}; + ~Job() override = default; Job(Synchronizer* s, std::list::iterator i); - void operator()(); + void operator()() override; Synchronizer* sync; std::list::iterator it; }; diff --git a/storage-manager/src/ThreadPool.h b/storage-manager/src/ThreadPool.h index c39e5088b..e7d6d8758 100644 --- a/storage-manager/src/ThreadPool.h +++ b/storage-manager/src/ThreadPool.h @@ -37,7 +37,7 @@ class ThreadPool : public boost::noncopyable class Job { public: - virtual ~Job(){}; + virtual ~Job() = default; virtual void operator()() = 0; }; diff --git a/storage-manager/src/TruncateTask.h b/storage-manager/src/TruncateTask.h index 4497b2cc5..a52b14650 100644 --- a/storage-manager/src/TruncateTask.h +++ b/storage-manager/src/TruncateTask.h @@ -24,13 +24,11 @@ namespace storagemanager class TruncateTask : public PosixTask { public: + TruncateTask() = delete; TruncateTask(int sock, uint length); - virtual ~TruncateTask(); + ~TruncateTask() override; - bool run(); - - private: - TruncateTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/UnlinkTask.h b/storage-manager/src/UnlinkTask.h index fcc1e742b..44ee1dd3c 100644 --- a/storage-manager/src/UnlinkTask.h +++ b/storage-manager/src/UnlinkTask.h @@ -24,13 +24,11 @@ namespace storagemanager class UnlinkTask : public PosixTask { public: + UnlinkTask() = delete; UnlinkTask(int sock, uint length); - virtual ~UnlinkTask(); + ~UnlinkTask() override; - bool run(); - - private: - UnlinkTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/Utilities.h b/storage-manager/src/Utilities.h index eeba82059..186692a52 100644 --- a/storage-manager/src/Utilities.h +++ b/storage-manager/src/Utilities.h @@ -42,23 +42,23 @@ struct ScopedFileLock struct ScopedReadLock : public ScopedFileLock { ScopedReadLock(IOCoordinator* i, const std::string& k); - virtual ~ScopedReadLock(); - void lock(); - void unlock(); + ~ScopedReadLock() override; + void lock() override; + void unlock() override; }; struct ScopedWriteLock : public ScopedFileLock { ScopedWriteLock(IOCoordinator* i, const std::string& k); - virtual ~ScopedWriteLock(); - void lock(); - void unlock(); + ~ScopedWriteLock() override; + void lock() override; + void unlock() override; }; struct ScopedCloser { ScopedCloser(); - ScopedCloser(int f); + explicit ScopedCloser(int f); ~ScopedCloser(); int fd; }; diff --git a/storage-manager/src/WriteTask.h b/storage-manager/src/WriteTask.h index f06ebb3f4..d934426d1 100644 --- a/storage-manager/src/WriteTask.h +++ b/storage-manager/src/WriteTask.h @@ -24,13 +24,11 @@ namespace storagemanager class WriteTask : public PosixTask { public: + WriteTask() = delete; WriteTask(int sock, uint length); - virtual ~WriteTask(); + ~WriteTask() override; - bool run(); - - private: - WriteTask(); + bool run() override; }; } // namespace storagemanager diff --git a/storage-manager/src/main.cpp b/storage-manager/src/main.cpp index 6ca9be9df..a8a3e9309 100644 --- a/storage-manager/src/main.cpp +++ b/storage-manager/src/main.cpp @@ -15,15 +15,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include #include #include -#include -#include -#include -#include -#include -#include +#include using namespace std; @@ -54,7 +48,7 @@ class ServiceStorageManager : public Service, public Opt void setupChildSignalHandlers(); public: - ServiceStorageManager(const Opt& opt) : Service("StorageManager"), Opt(opt) + explicit ServiceStorageManager(const Opt& opt) : Service("StorageManager"), Opt(opt) { } void LogErrno() override @@ -74,14 +68,14 @@ class ServiceStorageManager : public Service, public Opt bool signalCaught = false; -void printCacheUsage(int sig) +void printCacheUsage(int /*sig*/) { Cache::get()->validateCacheSize(); cout << "Current cache size = " << Cache::get()->getCurrentCacheSize() << endl; cout << "Cache element count = " << Cache::get()->getCurrentCacheElementCount() << endl; } -void printKPIs(int sig) +void printKPIs(int /*sig*/) { IOCoordinator::get()->printKPIs(); Cache::get()->printKPIs(); @@ -120,29 +114,29 @@ void ServiceStorageManager::setupChildSignalHandlers() sa.sa_handler = shutdownSM; for (int sig : shutdownSignals) - sigaction(sig, &sa, NULL); + sigaction(sig, &sa, nullptr); sa.sa_handler = coreSM; for (int sig : coreSignals) - sigaction(sig, &sa, NULL); + sigaction(sig, &sa, nullptr); sa.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &sa, NULL); + sigaction(SIGPIPE, &sa, nullptr); sa.sa_handler = printCacheUsage; - sigaction(SIGUSR1, &sa, NULL); + sigaction(SIGUSR1, &sa, nullptr); sa.sa_handler = printKPIs; - sigaction(SIGUSR2, &sa, NULL); + sigaction(SIGUSR2, &sa, nullptr); } int ServiceStorageManager::Child() { SMLogging* logger = SMLogging::get(); - IOCoordinator* ioc = NULL; - Cache* cache = NULL; - Synchronizer* sync = NULL; - Replicator* rep = NULL; + IOCoordinator* ioc = nullptr; + Cache* cache = nullptr; + Synchronizer* sync = nullptr; + Replicator* rep = nullptr; /* Instantiate objects to have them verify config settings before continuing */ try diff --git a/utils/cacheutils/cacheutils.cpp b/utils/cacheutils/cacheutils.cpp index a0042e155..c94eb77c5 100644 --- a/utils/cacheutils/cacheutils.cpp +++ b/utils/cacheutils/cacheutils.cpp @@ -25,7 +25,7 @@ #include #include #include -//#define NDEBUG +// #define NDEBUG #include using namespace std; @@ -77,9 +77,7 @@ class CacheOpThread CacheOpThread(const string& svr, const ByteStream& outBs) : fServerName(svr), fOutBs(outBs) { } - ~CacheOpThread() - { - } + ~CacheOpThread() = default; void operator()() { struct timespec ts = {10, 0}; @@ -89,7 +87,7 @@ class CacheOpThread try { cl->write(fOutBs); - rc = extractRespCode(cl->read(&ts)); + rc = extractRespCode(*cl->read(&ts)); } catch (...) { @@ -343,7 +341,7 @@ int purgePrimProcFdCache(const std::vector files, const int pmId) oss << "PMS" << pmId; scoped_ptr cl(new MessageQueueClient(oss.str())); cl->write(bs); - rc = extractRespCode(cl->read(&ts)); + rc = extractRespCode(*cl->read(&ts)); } catch (...) { @@ -353,4 +351,3 @@ int purgePrimProcFdCache(const std::vector files, const int pmId) return rc; } } // namespace cacheutils - diff --git a/utils/cloudio/SMDataFile.h b/utils/cloudio/SMDataFile.h index 6f7965130..6e0539126 100644 --- a/utils/cloudio/SMDataFile.h +++ b/utils/cloudio/SMDataFile.h @@ -27,19 +27,19 @@ namespace idbdatafile class SMDataFile : public IDBDataFile { public: - virtual ~SMDataFile(); + ~SMDataFile() override; - ssize_t pread(void* ptr, off64_t offset, size_t count); - ssize_t read(void* ptr, size_t count); - ssize_t write(const void* ptr, size_t count); - int seek(off64_t offset, int whence); - int truncate(off64_t length); - int fallocate(int mode, off64_t offset, off64_t length); - off64_t size(); - off64_t tell(); - int flush(); - time_t mtime(); - int close(); + ssize_t pread(void* ptr, off64_t offset, size_t count) override; + ssize_t read(void* ptr, size_t count) override; + ssize_t write(const void* ptr, size_t count) override; + int seek(off64_t offset, int whence) override; + int truncate(off64_t length) override; + int fallocate(int mode, off64_t offset, off64_t length) override; + off64_t size() override; + off64_t tell() override; + int flush() override; + time_t mtime() override; + int close() override; // for testing only SMDataFile(const char* fname, int openmode, size_t fake_size); diff --git a/utils/cloudio/SMFileFactory.h b/utils/cloudio/SMFileFactory.h index b1e1313eb..02a1cc20b 100644 --- a/utils/cloudio/SMFileFactory.h +++ b/utils/cloudio/SMFileFactory.h @@ -25,7 +25,7 @@ namespace idbdatafile class SMFileFactory : public FileFactoryBase { public: - IDBDataFile* open(const char* fname, const char* mode, unsigned opts, unsigned colWidth); + IDBDataFile* open(const char* fname, const char* mode, unsigned opts, unsigned colWidth) override; }; } // namespace idbdatafile diff --git a/utils/cloudio/SMFileSystem.h b/utils/cloudio/SMFileSystem.h index 92c26d10c..cb5046ee8 100644 --- a/utils/cloudio/SMFileSystem.h +++ b/utils/cloudio/SMFileSystem.h @@ -28,20 +28,20 @@ class SMFileSystem : public IDBFileSystem, boost::noncopyable { public: SMFileSystem(); - virtual ~SMFileSystem(); + ~SMFileSystem() override; // why are some of these const and some not const in IDBFileSystem? - int mkdir(const char* pathname); - off64_t size(const char* path) const; - off64_t compressedSize(const char* path) const; - int remove(const char* pathname); - int rename(const char* oldpath, const char* newpath); - bool exists(const char* pathname) const; - int listDirectory(const char* pathname, std::list& contents) const; - bool isDir(const char* pathname) const; - int copyFile(const char* srcPath, const char* destPath) const; - bool filesystemIsUp() const; - bool filesystemSync() const; + int mkdir(const char* pathname) override; + off64_t size(const char* path) const override; + off64_t compressedSize(const char* path) const override; + int remove(const char* pathname) override; + int rename(const char* oldpath, const char* newpath) override; + bool exists(const char* pathname) const override; + int listDirectory(const char* pathname, std::list& contents) const override; + bool isDir(const char* pathname) const override; + int copyFile(const char* srcPath, const char* destPath) const override; + bool filesystemIsUp() const override; + bool filesystemSync() const override; }; } // namespace idbdatafile diff --git a/utils/cloudio/sm_exceptions.h b/utils/cloudio/sm_exceptions.h index 96b299f85..fecf55420 100644 --- a/utils/cloudio/sm_exceptions.h +++ b/utils/cloudio/sm_exceptions.h @@ -24,7 +24,7 @@ namespace idbdatafile class NotImplementedYet : public std::logic_error { public: - NotImplementedYet(const std::string& s); + explicit NotImplementedYet(const std::string& s); }; NotImplementedYet::NotImplementedYet(const std::string& s) : std::logic_error(s) diff --git a/utils/common/any.hpp b/utils/common/any.hpp index e511db3ed..fa63279f8 100644 --- a/utils/common/any.hpp +++ b/utils/common/any.hpp @@ -9,7 +9,7 @@ * http://www.boost.org/LICENSE_1_0.txt */ -#include +#include #include #include #include "mcs_basic_types.h" @@ -40,7 +40,7 @@ struct base_any_policy template struct typed_base_any_policy : base_any_policy { - virtual size_t get_size() + size_t get_size() override { return sizeof(T); } @@ -53,23 +53,23 @@ template struct small_any_policy : typed_base_any_policy { virtual ~small_any_policy() = default; - virtual void static_delete(void** x) + void static_delete(void** x) override { - *x = 0; + *x = nullptr; } - virtual void copy_from_value(void const* src, void** dest) + void copy_from_value(void const* src, void** dest) override { new (dest) T(*reinterpret_cast(src)); } - virtual void clone(void* const* src, void** dest) + void clone(void* const* src, void** dest) override { *dest = *src; } - virtual void move(void* const* src, void** dest) + void move(void* const* src, void** dest) override { *dest = *src; } - virtual void* get_value(void** src) + void* get_value(void** src) override { return reinterpret_cast(src); } @@ -79,26 +79,26 @@ template struct big_any_policy : typed_base_any_policy { virtual ~big_any_policy() = default; - virtual void static_delete(void** x) + void static_delete(void** x) override { if (*x) delete (*reinterpret_cast(x)); - *x = NULL; + *x = nullptr; } - virtual void copy_from_value(void const* src, void** dest) + void copy_from_value(void const* src, void** dest) override { *dest = new T(*reinterpret_cast(src)); } - virtual void clone(void* const* src, void** dest) + void clone(void* const* src, void** dest) override { *dest = new T(**reinterpret_cast(src)); } - virtual void move(void* const* src, void** dest) + void move(void* const* src, void** dest) override { (*reinterpret_cast(dest))->~T(); **reinterpret_cast(dest) = **reinterpret_cast(src); } - virtual void* get_value(void** src) + void* get_value(void** src) override { return *src; } @@ -181,24 +181,24 @@ class any public: /// Initializing constructor. template - any(const T& x) : policy(anyimpl::get_policy()), object(NULL) + any(const T& x) : policy(anyimpl::get_policy()), object(nullptr) { assign(x); } /// Empty constructor. - any() : policy(anyimpl::get_policy()), object(NULL) + any() : policy(anyimpl::get_policy()), object(nullptr) { } /// Special initializing constructor for string literals. - any(const char* x) : policy(anyimpl::get_policy()), object(NULL) + any(const char* x) : policy(anyimpl::get_policy()), object(nullptr) { assign(x); } /// Copy constructor. - any(const any& x) : policy(anyimpl::get_policy()), object(NULL) + any(const any& x) : policy(anyimpl::get_policy()), object(nullptr) { assign(x); } diff --git a/utils/funcexp/func_mod.cpp b/utils/funcexp/func_mod.cpp index dff1a4e07..11c542168 100644 --- a/utils/funcexp/func_mod.cpp +++ b/utils/funcexp/func_mod.cpp @@ -405,7 +405,7 @@ int64_t Func_mod::getIntVal(Row& row, FunctionParm& parm, bool& isNull, return mod; } -uint64_t Func_mod::getUIntVal(Row& row, FunctionParm& parm, bool& isNull, +uint64_t Func_mod::getUintVal(Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType& operationColType) { if (parm.size() < 2) diff --git a/utils/funcexp/funcexpwrapper.cpp b/utils/funcexp/funcexpwrapper.cpp index 9b400f4ca..4a5c572a7 100644 --- a/utils/funcexp/funcexpwrapper.cpp +++ b/utils/funcexp/funcexpwrapper.cpp @@ -60,12 +60,13 @@ FuncExpWrapper::FuncExpWrapper(const FuncExpWrapper& f) rcs[i].reset(f.rcs[i]->clone()); } -FuncExpWrapper::~FuncExpWrapper() -{ -} +FuncExpWrapper::~FuncExpWrapper() = default; -void FuncExpWrapper::operator=(const FuncExpWrapper& f) +FuncExpWrapper& FuncExpWrapper::operator=(const FuncExpWrapper& f) { + if (&f == this) + return *this; + uint32_t i; filters.resize(f.filters.size()); @@ -77,6 +78,7 @@ void FuncExpWrapper::operator=(const FuncExpWrapper& f) for (i = 0; i < f.rcs.size(); i++) rcs[i].reset(f.rcs[i]->clone()); + return *this; } void FuncExpWrapper::serialize(ByteStream& bs) const @@ -101,12 +103,12 @@ void FuncExpWrapper::deserialize(ByteStream& bs) bs >> rcsCount; for (i = 0; i < fCount; i++) - filters.push_back(boost::shared_ptr(ObjectReader::createParseTree(bs))); + filters.emplace_back(ObjectReader::createParseTree(bs)); for (i = 0; i < rcsCount; i++) { - ReturnedColumn* rc = (ReturnedColumn*)ObjectReader::createTreeNode(bs); - rcs.push_back(boost::shared_ptr(rc)); + auto* rc = (ReturnedColumn*)ObjectReader::createTreeNode(bs); + rcs.emplace_back(rc); } } @@ -133,4 +135,4 @@ void FuncExpWrapper::addReturnedColumn(const boost::shared_ptr& rcs.push_back(rc); } -}; // namespace funcexp +} // namespace funcexp diff --git a/utils/funcexp/funcexpwrapper.h b/utils/funcexp/funcexpwrapper.h index cca271fe9..4362f5a5c 100644 --- a/utils/funcexp/funcexpwrapper.h +++ b/utils/funcexp/funcexpwrapper.h @@ -47,12 +47,12 @@ class FuncExpWrapper : public messageqcpp::Serializeable public: FuncExpWrapper(); FuncExpWrapper(const FuncExpWrapper&); - virtual ~FuncExpWrapper(); + ~FuncExpWrapper() override; - void operator=(const FuncExpWrapper&); + FuncExpWrapper& operator=(const FuncExpWrapper&); - void serialize(messageqcpp::ByteStream&) const; - void deserialize(messageqcpp::ByteStream&); + void serialize(messageqcpp::ByteStream&) const override; + void deserialize(messageqcpp::ByteStream&) override; bool evaluate(rowgroup::Row*); inline bool evaluateFilter(uint32_t num, rowgroup::Row* r); diff --git a/utils/funcexp/funchelpers.h b/utils/funcexp/funchelpers.h index be65235d0..c0ef30cbd 100644 --- a/utils/funcexp/funchelpers.h +++ b/utils/funcexp/funchelpers.h @@ -28,7 +28,7 @@ #define __STDC_FORMAT_MACROS #endif -#include +#include #include #include @@ -40,9 +40,7 @@ #ifndef ULONGLONG_MAX #define ULONGLONG_MAX ulonglong_max #endif -namespace funcexp -{ -namespace helpers +namespace funcexp::helpers { // 10 ** i const int64_t powerOf10_c[] = {1ll, @@ -242,7 +240,7 @@ inline int16_t convert_mysql_mode_to_modeflags(int16_t mode) // // This is a mirror of calc_week, at a later date we should use sql_time.h inline uint32_t calc_mysql_week(uint32_t year, uint32_t month, uint32_t day, int16_t modeflags, - uint32_t* weekyear = 0) + uint32_t* weekyear = nullptr) { // need to make sure that the date is valid if (!dataconvert::isDateValid(day, month, year)) @@ -268,7 +266,7 @@ inline uint32_t calc_mysql_week(uint32_t year, uint32_t month, uint32_t day, int if (!week_year && ((first_weekday && weekday != 0) || (!first_weekday && weekday >= 4))) return 0; - week_year = 1; + week_year = true; if (weekyear) { @@ -360,12 +358,12 @@ inline bool calc_time_diff(int64_t time1, int64_t time2, int l_sign, long long* (long long)(1000000) + (long long)msec1 - l_sign * (long long)msec2; - neg = 0; + neg = false; if (microseconds < 0) { microseconds = -microseconds; - neg = 1; + neg = true; } *seconds_out = microseconds / 1000000L; @@ -485,7 +483,7 @@ inline int getNumbers(const std::string& expr, int64_t* array, execplan::OpType if (funcType == execplan::OP_SUB) funcNeg = -1; - if (expr.size() == 0) + if (expr.empty()) return 0; // @bug 4703 reworked this code to avoid use of incrementally @@ -496,10 +494,8 @@ inline int getNumbers(const std::string& expr, int64_t* array, execplan::OpType int64_t number = 0; int neg = 1; - for (unsigned int i = 0; i < expr.size(); i++) + for (auto value : expr) { - char value = expr[i]; - if ((value >= '0' && value <= '9')) { foundNumber = true; @@ -553,7 +549,7 @@ inline int getNumbers(const std::string& expr, int* array, execplan::OpType func if (funcType == execplan::OP_SUB) funcNeg = -1; - if (expr.size() == 0) + if (expr.empty()) return 0; // @bug 4703 reworked this code to avoid use of incrementally @@ -564,10 +560,8 @@ inline int getNumbers(const std::string& expr, int* array, execplan::OpType func int number = 0; int neg = 1; - for (unsigned int i = 0; i < expr.size(); i++) + for (char value : expr) { - char value = expr[i]; - if ((value >= '0' && value <= '9')) { foundNumber = true; @@ -614,56 +608,51 @@ inline int getNumbers(const std::string& expr, int* array, execplan::OpType func inline int dayOfWeek(std::string day) // Sunday = 0 { - int value = -1; boost::to_lower(day); if (day == "sunday" || day == "sun") { - value = 0; + return 0; } else if (day == "monday" || day == "mon") { - value = 1; + return 1; } else if (day == "tuesday" || day == "tue") { - value = 2; + return 2; } else if (day == "wednesday" || day == "wed") { - value = 3; + return 3; } else if (day == "thursday" || day == "thu") { - value = 4; + return 4; } else if (day == "friday" || day == "fri") { - value = 5; + return 5; } else if (day == "saturday" || day == "sat") { - value = 6; - } - else - { - value = -1; + return 6; } - return value; + return -1; } inline string intToString(int64_t i) { char buf[32]; - snprintf(buf, 32, "%" PRId64 "", i); + snprintf(buf, sizeof(buf), "%" PRId64 "", i); return buf; } inline string uintToString(uint64_t i) { char buf[32]; - snprintf(buf, 32, "%" PRIu64 "", i); + snprintf(buf, sizeof(buf), "%" PRIu64 "", i); return buf; } @@ -672,7 +661,7 @@ inline string doubleToString(double d) // double's can be *really* long to print out. Max mysql // is e308 so allow for 308 + 36 decimal places minimum. char buf[384]; - snprintf(buf, 384, "%f", d); + snprintf(buf, sizeof(buf), "%f", d); return buf; } @@ -681,7 +670,7 @@ inline string longDoubleToString(long double ld) // long double's can be *really* long to print out. Max mysql // is e308 so allow for 308 + 36 decimal places minimum. char buf[384]; - snprintf(buf, 384, "%Lf", ld); + snprintf(buf, sizeof(buf), "%Lf", ld); return buf; } @@ -691,5 +680,4 @@ const std::string IDB_date_format(const dataconvert::DateTime&, const std::strin const std::string timediff(int64_t, int64_t, bool isDateTime = true); const char* convNumToStr(int64_t, char*, int); -} // namespace helpers -} // namespace funcexp +} // namespace funcexp::helpers diff --git a/utils/funcexp/functor.h b/utils/funcexp/functor.h index ca4ad594e..19eea32f7 100644 --- a/utils/funcexp/functor.h +++ b/utils/funcexp/functor.h @@ -68,10 +68,8 @@ class Func { public: Func(); - Func(const std::string& funcName); - virtual ~Func() - { - } + explicit Func(const std::string& funcName); + virtual ~Func() = default; const std::string funcName() const { @@ -116,7 +114,7 @@ class Func virtual std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) = 0; utils::NullString getNullStrVal(rowgroup::Row& row, FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) { bool isNull; std::string val = getStrVal(row, fp, isNull, op_ct); @@ -220,10 +218,8 @@ class Func class ParmTSInt64 : public datatypes::TSInt64Null { public: - ParmTSInt64() - { - } - ParmTSInt64(rowgroup::Row& row, const execplan::SPTP& parm, const funcexp::Func& thisFunc, long timeZone) + ParmTSInt64() = default; + ParmTSInt64(rowgroup::Row& row, const execplan::SPTP& parm, const funcexp::Func&, long) : TSInt64Null(parm->data()->toTSInt64Null(row)) { } @@ -232,10 +228,8 @@ class ParmTSInt64 : public datatypes::TSInt64Null class ParmTUInt64 : public datatypes::TUInt64Null { public: - ParmTUInt64() - { - } - ParmTUInt64(rowgroup::Row& row, const execplan::SPTP& parm, const funcexp::Func& thisFunc, long timeZone) + ParmTUInt64() = default; + ParmTUInt64(rowgroup::Row& row, const execplan::SPTP& parm, const funcexp::Func&, long) : TUInt64Null(parm->data()->toTUInt64Null(row)) { } diff --git a/utils/funcexp/functor_all.h b/utils/funcexp/functor_all.h index c67297d4f..825f015d0 100644 --- a/utils/funcexp/functor_all.h +++ b/utils/funcexp/functor_all.h @@ -35,15 +35,11 @@ namespace funcexp class Func_All : public Func { public: - Func_All() - { - } - Func_All(const std::string& funcName) : Func(funcName) - { - } - virtual ~Func_All() + Func_All() = default; + explicit Func_All(const std::string& funcName) : Func(funcName) { } + ~Func_All() override = default; /* int64_t getIntVal(rowgroup::Row& row, @@ -71,42 +67,40 @@ class Func_simple_case : public Func_All Func_simple_case() : Func_All("case_simple") { } - virtual ~Func_simple_case() - { - } + ~Func_simple_case() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; class Func_decode_oracle : public Func_All @@ -115,42 +109,40 @@ class Func_decode_oracle : public Func_All Func_decode_oracle() : Func_All("decode_oracle") { } - virtual ~Func_decode_oracle() - { - } + ~Func_decode_oracle() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_searched_case class @@ -161,42 +153,40 @@ class Func_searched_case : public Func_All Func_searched_case() : Func_All("case_searched") { } - virtual ~Func_searched_case() - { - } + ~Func_searched_case() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_if class @@ -207,39 +197,37 @@ class Func_if : public Func_All Func_if() : Func_All("Func_if") { } - virtual ~Func_if() - { - } + ~Func_if() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_ifnull class @@ -250,42 +238,40 @@ class Func_ifnull : public Func_All Func_ifnull() : Func_All("ifnull") { } - virtual ~Func_ifnull() - { - } + ~Func_ifnull() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_greatest class @@ -296,42 +282,40 @@ class Func_greatest : public Func_All Func_greatest() : Func_All("greatest") { } - virtual ~Func_greatest() - { - } + ~Func_greatest() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_least class @@ -342,39 +326,37 @@ class Func_least : public Func_All Func_least() : Func_All("least") { } - virtual ~Func_least() - { - } + ~Func_least() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_coalesce class @@ -385,39 +367,37 @@ class Func_coalesce : public Func_All Func_coalesce() : Func_All("coalesce") { } - virtual ~Func_coalesce() - { - } + ~Func_coalesce() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_nullif class @@ -428,42 +408,40 @@ class Func_nullif : public Func_All Func_nullif() : Func_All("nullif") { } - virtual ~Func_nullif() - { - } + ~Func_nullif() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; } // namespace funcexp diff --git a/utils/funcexp/functor_bool.h b/utils/funcexp/functor_bool.h index 8ce3986b2..b237449bc 100644 --- a/utils/funcexp/functor_bool.h +++ b/utils/funcexp/functor_bool.h @@ -34,15 +34,11 @@ namespace funcexp class Func_Bool : public Func { public: - Func_Bool() - { - } - Func_Bool(const std::string& funcName) : Func(funcName) - { - } - virtual ~Func_Bool() + Func_Bool() = default; + explicit Func_Bool(const std::string& funcName) : Func(funcName) { } + ~Func_Bool() override = default; /* virtual bool getBoolVal(rowgroup::Row& row, @@ -53,58 +49,58 @@ class Func_Bool : public Func */ int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (getBoolVal(row, fp, isNull, op_ct) ? 1 : 0); } double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (getBoolVal(row, fp, isNull, op_ct) ? 1.0 : 0.0); } long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (getBoolVal(row, fp, isNull, op_ct) ? 1.0 : 0.0); } std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (getBoolVal(row, fp, isNull, op_ct) ? "1" : "0"); } execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return execplan::IDB_Decimal(getIntVal(row, fp, isNull, op_ct), 0, 0); } int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { isNull = true; return 0; } int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { isNull = true; return 0; } int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { isNull = true; return 0; } int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { isNull = true; return 0; @@ -119,15 +115,13 @@ class Func_between : public Func_Bool Func_between() : Func_Bool("between") { } - virtual ~Func_between() - { - } + ~Func_between() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_notbetween class @@ -138,15 +132,13 @@ class Func_notbetween : public Func_Bool Func_notbetween() : Func_Bool("notbetween") { } - virtual ~Func_notbetween() - { - } + ~Func_notbetween() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_in class @@ -157,15 +149,13 @@ class Func_in : public Func_Bool Func_in() : Func_Bool("in") { } - virtual ~Func_in() - { - } + ~Func_in() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_notin class @@ -176,15 +166,13 @@ class Func_notin : public Func_Bool Func_notin() : Func_Bool("notin") { } - virtual ~Func_notin() - { - } + ~Func_notin() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_regexp class @@ -195,15 +183,13 @@ class Func_regexp : public Func_Bool Func_regexp() : Func_Bool("regexp") { } - virtual ~Func_regexp() - { - } + ~Func_regexp() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_isnull class @@ -217,24 +203,22 @@ class Func_isnull : public Func_Bool Func_isnull() : fIsNotNull(false) { } - Func_isnull(bool isnotnull) : fIsNotNull(isnotnull) + explicit Func_isnull(bool isnotnull) : fIsNotNull(isnotnull) { } /* * Destructor. isnull does not need to do anything here to clean up. */ - virtual ~Func_isnull() - { - } + ~Func_isnull() override = default; /** * Decide on the function's operation type */ - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; private: bool fIsNotNull; @@ -250,19 +234,17 @@ class Func_Truth : public Func_Bool { } - virtual ~Func_Truth() - { - } + ~Func_Truth() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType) + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override { assert(fp.size() == 1); return fp[0]->data()->resultType(); } bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { bool val = fp[0]->data()->getBoolVal(row, isNull); @@ -292,9 +274,7 @@ class Func_IsTrue : public Func_Truth Func_IsTrue() : Func_Truth("istrue", true, true) { } - ~Func_IsTrue() - { - } + ~Func_IsTrue() override = default; }; /** @brief Func_IsNotTrue class @@ -305,9 +285,7 @@ class Func_IsNotTrue : public Func_Truth Func_IsNotTrue() : Func_Truth("isnottrue", true, false) { } - ~Func_IsNotTrue() - { - } + ~Func_IsNotTrue() override = default; }; /** @brief Func_IsFalse class @@ -318,9 +296,7 @@ class Func_IsFalse : public Func_Truth Func_IsFalse() : Func_Truth("isfalse", false, true) { } - ~Func_IsFalse() - { - } + ~Func_IsFalse() override = default; }; /** @brief Func_IsNotFalse class @@ -331,9 +307,7 @@ class Func_IsNotFalse : public Func_Truth Func_IsNotFalse() : Func_Truth("isnotfalse", false, false) { } - ~Func_IsNotFalse() - { - } + ~Func_IsNotFalse() override = default; }; } // namespace funcexp diff --git a/utils/funcexp/functor_dtm.h b/utils/funcexp/functor_dtm.h index 179687708..1838a6a6f 100644 --- a/utils/funcexp/functor_dtm.h +++ b/utils/funcexp/functor_dtm.h @@ -36,15 +36,11 @@ namespace funcexp class Func_Dtm : public Func { public: - Func_Dtm() - { - } - Func_Dtm(const std::string& funcName) : Func(funcName) - { - } - virtual ~Func_Dtm() + Func_Dtm() = default; + explicit Func_Dtm(const std::string& funcName) : Func(funcName) { } + ~Func_Dtm() override = default; /* int64_t getIntVal(rowgroup::Row& row, @@ -54,13 +50,13 @@ class Func_Dtm : public Func */ double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (double)getIntVal(row, fp, isNull, op_ct); } long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (long double)getIntVal(row, fp, isNull, op_ct); } @@ -81,18 +77,16 @@ class Func_date : public Func_Dtm Func_date() : Func_Dtm("date") { } - virtual ~Func_date() - { - } + ~Func_date() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_time class @@ -103,21 +97,19 @@ class Func_time : public Func_Dtm Func_time() : Func_Dtm("time") { } - virtual ~Func_time() - { - } + ~Func_time() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_timediff class @@ -128,30 +120,28 @@ class Func_timediff : public Func_Dtm Func_timediff() : Func_Dtm("timediff") { } - virtual ~Func_timediff() - { - } + ~Func_timediff() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_date_add class @@ -162,18 +152,16 @@ class Func_date_add : public Func_Dtm Func_date_add() : Func_Dtm("date_add") { } - virtual ~Func_date_add() - { - } + ~Func_date_add() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cast_date class @@ -184,33 +172,31 @@ class Func_cast_date : public Func_Dtm Func_cast_date() : Func_Dtm("cast_date") { } - virtual ~Func_cast_date() - { - } + ~Func_cast_date() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cast_datetime class @@ -221,33 +207,31 @@ class Func_cast_datetime : public Func_Dtm Func_cast_datetime() : Func_Dtm("cast_datetime") { } - virtual ~Func_cast_datetime() - { - } + ~Func_cast_datetime() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_from_days class @@ -258,24 +242,22 @@ class Func_from_days : public Func_Dtm Func_from_days() : Func_Dtm("from_days") { } - virtual ~Func_from_days() - { - } + ~Func_from_days() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_add_time class @@ -286,30 +268,28 @@ class Func_add_time : public Func_Dtm Func_add_time() : Func_Dtm("add_time") { } - virtual ~Func_add_time() - { - } + ~Func_add_time() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_timestampdiff class @@ -320,30 +300,28 @@ class Func_timestampdiff : public Func_Dtm Func_timestampdiff() : Func_Dtm("timestamp_diff") { } - virtual ~Func_timestampdiff() - { - } + ~Func_timestampdiff() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_sysdate class @@ -354,30 +332,28 @@ class Func_sysdate : public Func_Dtm Func_sysdate() : Func_Dtm("sysdate") { } - virtual ~Func_sysdate() - { - } + ~Func_sysdate() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_from_unixtime @@ -388,32 +364,30 @@ class Func_from_unixtime : public Func_Dtm Func_from_unixtime() : Func_Dtm("from_unixtime") { } - virtual ~Func_from_unixtime() - { - } - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + ~Func_from_unixtime() override = default; + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_str_to_date class @@ -424,30 +398,28 @@ class Func_str_to_date : public Func_Dtm Func_str_to_date() : Func_Dtm("str_to_date") { } - virtual ~Func_str_to_date() - { - } + ~Func_str_to_date() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_makedate class @@ -458,18 +430,16 @@ class Func_makedate : public Func_Dtm Func_makedate() : Func_Dtm("makedate") { } - virtual ~Func_makedate() - { - } + ~Func_makedate() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; class Func_convert_tz : public Func_Dtm @@ -478,24 +448,22 @@ class Func_convert_tz : public Func_Dtm Func_convert_tz() : Func_Dtm("convert_tz") { } - virtual ~Func_convert_tz() - { - } + ~Func_convert_tz() override = default; // bool from_tz_cached, to_tz_cached; // Time_zone *from_tz, *to_tz; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, - execplan::CalpontSystemCatalog::ColType& ct); + execplan::CalpontSystemCatalog::ColType& ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; } // namespace funcexp diff --git a/utils/funcexp/functor_export.h b/utils/funcexp/functor_export.h index 77c45f819..59a104d17 100644 --- a/utils/funcexp/functor_export.h +++ b/utils/funcexp/functor_export.h @@ -38,31 +38,29 @@ class Func_rand : public Func Func_rand() : Func("rand"), fSeed1(0), fSeed2(0), fSeedSet(false) { } - virtual ~Func_rand() - { - } + ~Func_rand() override = default; double getRand(); - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return ((int64_t)getDoubleVal(row, fp, isNull, op_ct)); } double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (long double)getDoubleVal(row, fp, isNull, op_ct); } std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return doubleToString(getDoubleVal(row, fp, isNull, op_ct)); } diff --git a/utils/funcexp/functor_int.h b/utils/funcexp/functor_int.h index ae5333a9f..d2bc7cd19 100644 --- a/utils/funcexp/functor_int.h +++ b/utils/funcexp/functor_int.h @@ -34,15 +34,11 @@ namespace funcexp class Func_Int : public Func { public: - Func_Int() - { - } - Func_Int(const std::string& funcName) : Func(funcName) - { - } - virtual ~Func_Int() + Func_Int() = default; + explicit Func_Int(const std::string& funcName) : Func(funcName) { } + ~Func_Int() override = default; /* int64_t getIntVal(rowgroup::Row& row, @@ -52,19 +48,19 @@ class Func_Int : public Func */ double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return ((double)getIntVal(row, fp, isNull, op_ct)); } long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return ((long double)getIntVal(row, fp, isNull, op_ct)); } std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return intToString(getIntVal(row, fp, isNull, op_ct)); } @@ -73,7 +69,7 @@ class Func_Int : public Func class Func_BitOp : public Func_Int { public: - Func_BitOp(const std::string& funcName) : Func_Int(funcName) + explicit Func_BitOp(const std::string& funcName) : Func_Int(funcName) { } execplan::CalpontSystemCatalog::ColType operationType( @@ -109,15 +105,13 @@ class Func_instr : public Func_Int Func_instr() : Func_Int("instr") { } - virtual ~Func_instr() - { - } + ~Func_instr() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_length class @@ -128,15 +122,13 @@ class Func_length : public Func_Int Func_length() : Func_Int("length") { } - virtual ~Func_length() - { - } + ~Func_length() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_sign class @@ -147,18 +139,16 @@ class Func_sign : public Func_Int Func_sign() : Func_Int("sign") { } - virtual ~Func_sign() - { - } + ~Func_sign() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_day class @@ -169,15 +159,13 @@ class Func_day : public Func_Int Func_day() : Func_Int("day") { } - virtual ~Func_day() - { - } + ~Func_day() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_minute class @@ -188,15 +176,13 @@ class Func_minute : public Func_Int Func_minute() : Func_Int("minute") { } - virtual ~Func_minute() - { - } + ~Func_minute() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_month class @@ -207,15 +193,13 @@ class Func_month : public Func_Int Func_month() : Func_Int("month") { } - virtual ~Func_month() - { - } + ~Func_month() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_week class @@ -226,15 +210,13 @@ class Func_week : public Func_Int Func_week() : Func_Int("week") { } - virtual ~Func_week() - { - } + ~Func_week() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_year class @@ -245,15 +227,13 @@ class Func_year : public Func_Int Func_year() : Func_Int("year") { } - virtual ~Func_year() - { - } + ~Func_year() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_to_days class @@ -264,15 +244,13 @@ class Func_to_days : public Func_Int Func_to_days() : Func_Int("to_days") { } - virtual ~Func_to_days() - { - } + ~Func_to_days() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_char_length class @@ -283,15 +261,13 @@ class Func_char_length : public Func_Int Func_char_length() : Func_Int("length") { } - virtual ~Func_char_length() - { - } + ~Func_char_length() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_extract class @@ -302,15 +278,13 @@ class Func_extract : public Func_Int Func_extract() : Func_Int("extract") { } - virtual ~Func_extract() - { - } + ~Func_extract() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cast_signed class @@ -321,15 +295,13 @@ class Func_cast_signed : public Func_Int Func_cast_signed() : Func_Int("cast_signed") { } - virtual ~Func_cast_signed() - { - } + ~Func_cast_signed() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cast_unsigned class @@ -340,21 +312,19 @@ class Func_cast_unsigned : public Func_Int Func_cast_unsigned() : Func_Int("cast_unsigned") { } - virtual ~Func_cast_unsigned() - { - } + ~Func_cast_unsigned() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return (int64_t)(getUintVal(row, fp, isNull, op_ct)); } uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_bitand class @@ -365,9 +335,7 @@ class Func_bitand : public Func_BitOp Func_bitand() : Func_BitOp("bitand") { } - virtual ~Func_bitand() - { - } + ~Func_bitand() override = default; bool fix(execplan::FunctionColumn& col) const override; }; @@ -379,9 +347,7 @@ class Func_bitor : public Func_BitOp Func_bitor() : Func_BitOp("bitor") { } - virtual ~Func_bitor() - { - } + ~Func_bitor() override = default; bool fix(execplan::FunctionColumn& col) const override; @@ -397,9 +363,7 @@ class Func_bitxor : public Func_BitOp Func_bitxor() : Func_BitOp("bitxor") { } - virtual ~Func_bitxor() - { - } + ~Func_bitxor() override = default; bool fix(execplan::FunctionColumn& col) const override; }; @@ -411,9 +375,7 @@ class Func_bit_count : public Func_BitOp Func_bit_count() : Func_BitOp("bit_count") { } - virtual ~Func_bit_count() - { - } + ~Func_bit_count() override = default; bool fix(execplan::FunctionColumn& col) const override; }; @@ -425,15 +387,13 @@ class Func_hour : public Func_Int Func_hour() : Func_Int("hour") { } - virtual ~Func_hour() - { - } + ~Func_hour() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_second class @@ -444,15 +404,13 @@ class Func_second : public Func_Int Func_second() : Func_Int("second") { } - virtual ~Func_second() - { - } + ~Func_second() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_dayofweek class @@ -463,15 +421,13 @@ class Func_dayofweek : public Func_Int Func_dayofweek() : Func_Int("dayofweek") { } - virtual ~Func_dayofweek() - { - } + ~Func_dayofweek() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_dayofyear class @@ -482,15 +438,13 @@ class Func_dayofyear : public Func_Int Func_dayofyear() : Func_Int("dayofyear") { } - virtual ~Func_dayofyear() - { - } + ~Func_dayofyear() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_leftshift class @@ -501,9 +455,7 @@ class Func_leftshift : public Func_BitOp Func_leftshift() : Func_BitOp("leftshift") { } - virtual ~Func_leftshift() - { - } + ~Func_leftshift() override = default; bool fix(execplan::FunctionColumn& col) const override; }; @@ -515,9 +467,7 @@ class Func_rightshift : public Func_BitOp Func_rightshift() : Func_BitOp("rightshift") { } - virtual ~Func_rightshift() - { - } + ~Func_rightshift() override = default; bool fix(execplan::FunctionColumn& col) const override; }; @@ -529,15 +479,13 @@ class Func_quarter : public Func_Int Func_quarter() : Func_Int("quarter") { } - virtual ~Func_quarter() - { - } + ~Func_quarter() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_ascii class @@ -548,15 +496,13 @@ class Func_ascii : public Func_Int Func_ascii() : Func_Int("ascii") { } - virtual ~Func_ascii() - { - } + ~Func_ascii() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_dayname class @@ -567,18 +513,16 @@ class Func_dayname : public Func_Int Func_dayname() : Func_Int("dayname") { } - virtual ~Func_dayname() - { - } + ~Func_dayname() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_weekday class @@ -589,15 +533,13 @@ class Func_weekday : public Func_Int Func_weekday() : Func_Int("weekday") { } - virtual ~Func_weekday() - { - } + ~Func_weekday() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_yearweek class @@ -608,15 +550,13 @@ class Func_yearweek : public Func_Int Func_yearweek() : Func_Int("yearweek") { } - virtual ~Func_yearweek() - { - } + ~Func_yearweek() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_last_day class @@ -627,15 +567,13 @@ class Func_last_day : public Func_Int Func_last_day() : Func_Int("last_day") { } - virtual ~Func_last_day() - { - } + ~Func_last_day() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_time_to_sec class @@ -646,15 +584,13 @@ class Func_time_to_sec : public Func_Int Func_time_to_sec() : Func_Int("time_to_sec") { } - virtual ~Func_time_to_sec() - { - } + ~Func_time_to_sec() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_microsecond class @@ -665,15 +601,13 @@ class Func_microsecond : public Func_Int Func_microsecond() : Func_Int("microsecond") { } - virtual ~Func_microsecond() - { - } + ~Func_microsecond() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_crc32 class @@ -684,15 +618,13 @@ class Func_crc32 : public Func_Int Func_crc32() : Func_Int("crc32") { } - virtual ~Func_crc32() - { - } + ~Func_crc32() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_period_add class @@ -703,15 +635,13 @@ class Func_period_add : public Func_Int Func_period_add() : Func_Int("period_add") { } - virtual ~Func_period_add() - { - } + ~Func_period_add() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_period_diff class @@ -722,15 +652,13 @@ class Func_period_diff : public Func_Int Func_period_diff() : Func_Int("period_diff") { } - virtual ~Func_period_diff() - { - } + ~Func_period_diff() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_strcmp class @@ -741,18 +669,16 @@ class Func_strcmp : public Func_Int Func_strcmp() : Func_Int("strcmp") { } - virtual ~Func_strcmp() - { - } + ~Func_strcmp() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_unix_timestamp class @@ -763,18 +689,16 @@ class Func_unix_timestamp : public Func_Int Func_unix_timestamp() : Func_Int("unix_timestamp") { } - virtual ~Func_unix_timestamp() - { - } + ~Func_unix_timestamp() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_strcmp class @@ -785,22 +709,20 @@ class Func_find_in_set : public Func_Int Func_find_in_set() : Func_Int("find_in_set") { } - virtual ~Func_find_in_set() - { - } + ~Func_find_in_set() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; } // namespace funcexp diff --git a/utils/funcexp/functor_json.h b/utils/funcexp/functor_json.h index 1d12df584..0c1b0d9a2 100644 --- a/utils/funcexp/functor_json.h +++ b/utils/funcexp/functor_json.h @@ -28,7 +28,7 @@ struct JSONPath JSONPath() : constant(false), parsed(false), currStep(nullptr) { } - json_path_t p; + json_path_t p{}; bool constant; // check if the argument is constant bool parsed; // check if the argument is parsed json_path_step_t* currStep; @@ -52,10 +52,9 @@ class JSONEgWrapper : public json_engine_t class JSONPathWrapper : public JSONPath { protected: - virtual ~JSONPathWrapper() - { - } + virtual ~JSONPathWrapper() = default; virtual bool checkAndGetValue(JSONEgWrapper* je, std::string& ret, int* error) = 0; + public: bool extract(std::string& ret, rowgroup::Row& row, execplan::SPTP& funcParmJS, execplan::SPTP& funcParmPath); @@ -68,15 +67,13 @@ class Func_json_valid : public Func_Bool Func_json_valid() : Func_Bool("json_valid") { } - ~Func_json_valid() - { - } + ~Func_json_valid() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_depth class @@ -87,15 +84,13 @@ class Func_json_depth : public Func_Int Func_json_depth() : Func_Int("json_depth") { } - virtual ~Func_json_depth() - { - } + ~Func_json_depth() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_length class @@ -109,15 +104,13 @@ class Func_json_length : public Func_Int Func_json_length() : Func_Int("json_length") { } - virtual ~Func_json_length() - { - } + ~Func_json_length() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_equals class @@ -128,15 +121,13 @@ class Func_json_equals : public Func_Bool Func_json_equals() : Func_Bool("json_equals") { } - ~Func_json_equals() - { - } + ~Func_json_equals() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_normalize class @@ -147,15 +138,13 @@ class Func_json_normalize : public Func_Str Func_json_normalize() : Func_Str("json_normalize") { } - virtual ~Func_json_normalize() - { - } + ~Func_json_normalize() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_type class @@ -166,15 +155,13 @@ class Func_json_type : public Func_Str Func_json_type() : Func_Str("json_type") { } - virtual ~Func_json_type() - { - } + ~Func_json_type() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_object class @@ -185,15 +172,13 @@ class Func_json_object : public Func_Str Func_json_object() : Func_Str("json_object") { } - virtual ~Func_json_object() - { - } + ~Func_json_object() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_array class @@ -204,15 +189,13 @@ class Func_json_array : public Func_Str Func_json_array() : Func_Str("json_array") { } - virtual ~Func_json_array() - { - } + ~Func_json_array() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_keys class */ @@ -225,15 +208,13 @@ class Func_json_keys : public Func_Str Func_json_keys() : Func_Str("json_keys") { } - virtual ~Func_json_keys() - { - } + ~Func_json_keys() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_exists class */ @@ -246,15 +227,13 @@ class Func_json_exists : public Func_Bool Func_json_exists() : Func_Bool("json_exists") { } - ~Func_json_exists() - { - } + ~Func_json_exists() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_quote class @@ -268,15 +247,13 @@ class Func_json_quote : public Func_Str Func_json_quote() : Func_Str("json_quote") { } - virtual ~Func_json_quote() - { - } + ~Func_json_quote() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_unquote class @@ -290,15 +267,13 @@ class Func_json_unquote : public Func_Str Func_json_unquote() : Func_Str("json_unquote") { } - virtual ~Func_json_unquote() - { - } + ~Func_json_unquote() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_format class @@ -321,7 +296,7 @@ class Func_json_format : public Func_Str Func_json_format() : Func_Str("json_detailed"), fmt(DETAILED) { } - Func_json_format(FORMATS format) : fmt(format) + explicit Func_json_format(FORMATS format) : fmt(format) { assert(format != NONE); switch (format) @@ -332,15 +307,13 @@ class Func_json_format : public Func_Str default: break; } } - virtual ~Func_json_format() - { - } + ~Func_json_format() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_merge_preserve class */ @@ -350,15 +323,13 @@ class Func_json_merge : public Func_Str Func_json_merge() : Func_Str("json_merge_preserve") { } - virtual ~Func_json_merge() - { - } + ~Func_json_merge() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_merge_patch class @@ -369,15 +340,13 @@ class Func_json_merge_patch : public Func_Str Func_json_merge_patch() : Func_Str("json_merge_patch") { } - virtual ~Func_json_merge_patch() - { - } + ~Func_json_merge_patch() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_value class @@ -388,9 +357,7 @@ class Func_json_value : public Func_Str Func_json_value() : Func_Str("json_value") { } - virtual ~Func_json_value() - { - } + ~Func_json_value() override = default; execplan::CalpontSystemCatalog::ColType operationType( FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; @@ -407,9 +374,7 @@ class Func_json_query : public Func_Str Func_json_query() : Func_Str("json_query") { } - virtual ~Func_json_query() - { - } + ~Func_json_query() override = default; execplan::CalpontSystemCatalog::ColType operationType( FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; @@ -431,15 +396,13 @@ class Func_json_contains : public Func_Bool Func_json_contains() : Func_Bool("json_contains"), arg2Const(false), arg2Parsed(false), arg2Val("") { } - virtual ~Func_json_contains() - { - } + ~Func_json_contains() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_array_append class */ @@ -452,15 +415,13 @@ class Func_json_array_append : public Func_Str Func_json_array_append() : Func_Str("json_array_append") { } - virtual ~Func_json_array_append() - { - } + ~Func_json_array_append() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; private: static const int padding = 8; @@ -476,15 +437,13 @@ class Func_json_array_insert : public Func_Str Func_json_array_insert() : Func_Str("json_array_insert") { } - virtual ~Func_json_array_insert() - { - } + ~Func_json_array_insert() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_insert class @@ -508,7 +467,7 @@ class Func_json_insert : public Func_Str Func_json_insert() : Func_Str("json_insert"), mode(INSERT) { } - Func_json_insert(MODE m) : mode(m) + explicit Func_json_insert(MODE m) : mode(m) { assert(m != NONE); switch (m) @@ -519,20 +478,18 @@ class Func_json_insert : public Func_Str default: break; } } - virtual ~Func_json_insert() - { - } + ~Func_json_insert() override = default; MODE getMode() const { return mode; } - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_remove class */ @@ -545,15 +502,13 @@ class Func_json_remove : public Func_Str Func_json_remove() : Func_Str("json_remove") { } - virtual ~Func_json_remove() - { - } + ~Func_json_remove() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_contains_path class @@ -572,15 +527,13 @@ class Func_json_contains_path : public Func_Bool : Func_Bool("json_contains_path"), isModeOne(false), isModeConst(false), isModeParsed(false) { } - virtual ~Func_json_contains_path() - { - } + ~Func_json_contains_path() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_overlaps class @@ -594,15 +547,13 @@ class Func_json_overlaps : public Func_Bool Func_json_overlaps() : Func_Bool("json_overlaps") { } - virtual ~Func_json_overlaps() - { - } + ~Func_json_overlaps() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; }; /** @brief Func_json_search class */ @@ -620,15 +571,13 @@ class Func_json_search : public Func_Str : Func_Str("json_search"), isModeParsed(false), isModeConst(false), isModeOne(false), escape('\\') { } - virtual ~Func_json_search() - { - } + ~Func_json_search() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; private: int cmpJSValWild(json_engine_t* jsEg, const utils::NullString& cmpStr, const CHARSET_INFO* cs); @@ -644,24 +593,22 @@ class Func_json_extract : public Func_Str Func_json_extract() : Func_Str("json_extract") { } - virtual ~Func_json_extract() - { - } + ~Func_json_extract() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type); + execplan::CalpontSystemCatalog::ColType& type) override; private: int doExtract(rowgroup::Row& row, FunctionParm& fp, json_value_types* type, std::string& retJS, diff --git a/utils/funcexp/functor_real.h b/utils/funcexp/functor_real.h index fbdf25964..a2f0e608d 100644 --- a/utils/funcexp/functor_real.h +++ b/utils/funcexp/functor_real.h @@ -35,36 +35,32 @@ namespace funcexp class Func_Real : public Func { public: - Func_Real() - { - } - Func_Real(const std::string& funcName) : Func(funcName) - { - } - virtual ~Func_Real() + Func_Real() = default; + explicit Func_Real(const std::string& funcName) : Func(funcName) { } + ~Func_Real() override = default; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return ((int64_t)getDoubleVal(row, fp, isNull, op_ct)); } uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return ((uint64_t)getDoubleVal(row, fp, isNull, op_ct)); } long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return ((long double)getDoubleVal(row, fp, isNull, op_ct)); } std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return doubleToString(getDoubleVal(row, fp, isNull, op_ct)); } @@ -78,27 +74,25 @@ class Func_abs : public Func_Real Func_abs() : Func_Real("abs") { } - virtual ~Func_abs() - { - } + ~Func_abs() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_exp class @@ -109,18 +103,16 @@ class Func_exp : public Func_Real Func_exp() : Func_Real("exp") { } - virtual ~Func_exp() - { - } + ~Func_exp() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_pow class @@ -131,18 +123,16 @@ class Func_pow : public Func_Real Func_pow() : Func_Real("pow") { } - virtual ~Func_pow() - { - } + ~Func_pow() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_round class @@ -153,39 +143,37 @@ class Func_round : public Func_Real Func_round() : Func_Real("round") { } - virtual ~Func_round() - { - } + ~Func_round() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); - + execplan::CalpontSystemCatalog::ColType& op_ct) override; + int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_truncate class @@ -196,39 +184,37 @@ class Func_truncate : public Func_Real Func_truncate() : Func_Real("truncate") { } - virtual ~Func_truncate() - { - } + ~Func_truncate() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_ceil class @@ -239,30 +225,28 @@ class Func_ceil : public Func_Real Func_ceil() : Func_Real("ceil") { } - virtual ~Func_ceil() - { - } + ~Func_ceil() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_floor class @@ -273,30 +257,28 @@ class Func_floor : public Func_Real Func_floor() : Func_Real("floor") { } - virtual ~Func_floor() - { - } + ~Func_floor() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cast_decimal class @@ -307,24 +289,22 @@ class Func_cast_decimal : public Func_Real Func_cast_decimal() : Func_Real("cast_decimal") { } - virtual ~Func_cast_decimal() - { - } + ~Func_cast_decimal() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cast_double class @@ -335,21 +315,19 @@ class Func_cast_double : public Func_Real Func_cast_double() : Func_Real("cast_double") { } - virtual ~Func_cast_double() - { - } + ~Func_cast_double() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_mod class @@ -360,30 +338,28 @@ class Func_mod : public Func_Real Func_mod() : Func_Real("mod") { } - virtual ~Func_mod() - { - } + ~Func_mod() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, - execplan::CalpontSystemCatalog::ColType& operationColType); + execplan::CalpontSystemCatalog::ColType& operationColType) override; - uint64_t getUIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, - execplan::CalpontSystemCatalog::ColType& operationColType); + uint64_t getUintVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, + execplan::CalpontSystemCatalog::ColType& operationColType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; private: template @@ -418,15 +394,13 @@ class Func_acos : public Func_Real Func_acos() : Func_Real("acos") { } - virtual ~Func_acos() - { - } + ~Func_acos() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_asin class @@ -437,15 +411,13 @@ class Func_asin : public Func_Real Func_asin() : Func_Real("asin") { } - virtual ~Func_asin() - { - } + ~Func_asin() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_atan class @@ -456,15 +428,13 @@ class Func_atan : public Func_Real Func_atan() : Func_Real("atan") { } - virtual ~Func_atan() - { - } + ~Func_atan() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cos class @@ -475,15 +445,13 @@ class Func_cos : public Func_Real Func_cos() : Func_Real("cos") { } - virtual ~Func_cos() - { - } + ~Func_cos() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cot class @@ -494,15 +462,13 @@ class Func_cot : public Func_Real Func_cot() : Func_Real("cot") { } - virtual ~Func_cot() - { - } + ~Func_cot() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_log class @@ -513,15 +479,13 @@ class Func_log : public Func_Real Func_log() : Func_Real("log") { } - virtual ~Func_log() - { - } + ~Func_log() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_log2 class @@ -532,15 +496,13 @@ class Func_log2 : public Func_Real Func_log2() : Func_Real("log2") { } - virtual ~Func_log2() - { - } + ~Func_log2() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_log10 class @@ -551,15 +513,13 @@ class Func_log10 : public Func_Real Func_log10() : Func_Real("log10") { } - virtual ~Func_log10() - { - } + ~Func_log10() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_sin class @@ -570,15 +530,13 @@ class Func_sin : public Func_Real Func_sin() : Func_Real("sin") { } - virtual ~Func_sin() - { - } + ~Func_sin() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_sqrt class @@ -589,15 +547,13 @@ class Func_sqrt : public Func_Real Func_sqrt() : Func_Real("sqrt") { } - virtual ~Func_sqrt() - { - } + ~Func_sqrt() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_tan class @@ -608,15 +564,13 @@ class Func_tan : public Func_Real Func_tan() : Func_Real("tan") { } - virtual ~Func_tan() - { - } + ~Func_tan() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_radians class @@ -627,15 +581,13 @@ class Func_radians : public Func_Real Func_radians() : Func_Real("radians") { } - virtual ~Func_radians() - { - } + ~Func_radians() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_div class @@ -646,24 +598,22 @@ class Func_div : public Func_Real Func_div() : Func_Real("DIV") { } - virtual ~Func_div() - { - } + ~Func_div() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; uint64_t getUintVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_inet_aton class to convert ascii IP address to big-endian @@ -675,39 +625,37 @@ class Func_inet_aton : public Func_Real Func_inet_aton() : Func_Real("inet_aton") { } - virtual ~Func_inet_aton() - { - } + ~Func_inet_aton() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; private: int64_t convertAton(const std::string& ipString, bool& isNull); @@ -721,15 +669,13 @@ class Func_degrees : public Func_Real Func_degrees() : Func_Real("degrees") { } - virtual ~Func_degrees() - { - } + ~Func_degrees() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; -} // namespace funcexp +} // namespace funcexp \ No newline at end of file diff --git a/utils/funcexp/functor_str.h b/utils/funcexp/functor_str.h index 17b8adea8..c671c1a65 100644 --- a/utils/funcexp/functor_str.h +++ b/utils/funcexp/functor_str.h @@ -35,32 +35,28 @@ namespace funcexp class Func_Str : public Func { public: - Func_Str() - { - } - Func_Str(const std::string& funcName) : Func(funcName) - { - } - virtual ~Func_Str() + Func_Str() = default; + explicit Func_Str(const std::string& funcName) : Func(funcName) { } + ~Func_Str() override = default; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return atoll(getStrVal(row, fp, isNull, op_ct).c_str()); } double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { - return strtod(getStrVal(row, fp, isNull, op_ct).c_str(), NULL); + return strtod(getStrVal(row, fp, isNull, op_ct).c_str(), nullptr); } long double getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { - return strtold(getStrVal(row, fp, isNull, op_ct).c_str(), NULL); + return strtold(getStrVal(row, fp, isNull, op_ct).c_str(), nullptr); } #if 0 @@ -71,34 +67,34 @@ class Func_Str : public Func #endif execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { return execplan::IDB_Decimal(atoll(getStrVal(row, fp, isNull, op_ct).c_str()), 0, 0); } int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { auto str = getStrVal(row, fp, isNull, op_ct); - return (isNull ? 0 : stringToDate(str)); + return isNull ? 0 : stringToDate(str); } int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { auto str = getStrVal(row, fp, isNull, op_ct); - return (isNull ? 0 : stringToDatetime(str)); + return isNull ? 0 : stringToDatetime(str); } int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { auto str = getStrVal(row, fp, isNull, op_ct); return (isNull ? 0 : stringToTimestamp(str, op_ct.getTimeZone())); } int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct) + execplan::CalpontSystemCatalog::ColType& op_ct) override { auto str = getStrVal(row, fp, isNull, op_ct); return (isNull ? 0 : stringToTime(str)); @@ -124,10 +120,7 @@ class Func_Str : public Func case execplan::CalpontSystemCatalog::FLOAT: floatVal = fp->data()->getFloatVal(row, isNull); break; - default: - fFloatStr = fp->data()->getStrVal(row, isNull).safeString(""); - return; - break; + default: fFloatStr = fp->data()->getStrVal(row, isNull).safeString(""); return; } if (isNull) @@ -140,14 +133,14 @@ class Func_Str : public Func if (std::isnan(exponent) || std::isnan(base)) { - snprintf(buf, 20, "%Lf", floatVal); - fFloatStr = execplan::removeTrailing0(buf, 20); + snprintf(buf, sizeof(buf), "%Lf", floatVal); + fFloatStr = execplan::removeTrailing0(buf, sizeof(buf)); } else { - snprintf(buf, 20, "%.5Lf", base); - fFloatStr = execplan::removeTrailing0(buf, 20); - snprintf(buf, 20, "e%02d", exponent); + snprintf(buf, sizeof(buf), "%.5Lf", base); + fFloatStr = execplan::removeTrailing0(buf, sizeof(buf)); + snprintf(buf, sizeof(buf), "e%02d", exponent); fFloatStr += buf; } } @@ -161,15 +154,13 @@ class Func_concat : public Func_Str Func_concat() : Func_Str("concat") { } - virtual ~Func_concat() - { - } + ~Func_concat() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_concat_oracle class @@ -180,15 +171,13 @@ class Func_concat_oracle : public Func_Str Func_concat_oracle() : Func_Str("concat_operator_oracle") { } - virtual ~Func_concat_oracle() - { - } + ~Func_concat_oracle() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_substr class @@ -199,15 +188,13 @@ class Func_substr : public Func_Str Func_substr() : Func_Str("substr") { } - virtual ~Func_substr() - { - } + ~Func_substr() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_date_format class @@ -218,24 +205,22 @@ class Func_date_format : public Func_Str Func_date_format() : Func_Str("date_format") { } - virtual ~Func_date_format() - { - } + ~Func_date_format() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_lcase class @@ -246,15 +231,13 @@ class Func_lcase : public Func_Str Func_lcase() : Func_Str("lcase") { } - virtual ~Func_lcase() - { - } + ~Func_lcase() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_ucase class @@ -265,15 +248,13 @@ class Func_ucase : public Func_Str Func_ucase() : Func_Str("ucase") { } - virtual ~Func_ucase() - { - } + ~Func_ucase() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_left class @@ -284,15 +265,13 @@ class Func_left : public Func_Str Func_left() : Func_Str("left") { } - virtual ~Func_left() - { - } + ~Func_left() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_ltrim class @@ -303,15 +282,13 @@ class Func_ltrim : public Func_Str Func_ltrim() : Func_Str("ltrim") { } - virtual ~Func_ltrim() - { - } + ~Func_ltrim() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_rtrim class @@ -322,15 +299,13 @@ class Func_rtrim : public Func_Str Func_rtrim() : Func_Str("rtrim") { } - virtual ~Func_rtrim() - { - } + ~Func_rtrim() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_trim class @@ -341,15 +316,13 @@ class Func_trim : public Func_Str Func_trim() : Func_Str("trim") { } - virtual ~Func_trim() - { - } + ~Func_trim() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_ltrim class @@ -360,15 +333,13 @@ class Func_ltrim_oracle : public Func_Str Func_ltrim_oracle() : Func_Str("ltrim_oracle") { } - virtual ~Func_ltrim_oracle() - { - } + ~Func_ltrim_oracle() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_rtrim class @@ -379,15 +350,13 @@ class Func_rtrim_oracle : public Func_Str Func_rtrim_oracle() : Func_Str("rtrim_oracle") { } - virtual ~Func_rtrim_oracle() - { - } + ~Func_rtrim_oracle() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_trim class @@ -398,15 +367,13 @@ class Func_trim_oracle : public Func_Str Func_trim_oracle() : Func_Str("trim_oracle") { } - virtual ~Func_trim_oracle() - { - } + ~Func_trim_oracle() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_lpad class @@ -419,15 +386,13 @@ class Func_lpad : public Func_Str Func_lpad() : Func_Str("lpad") { } - virtual ~Func_lpad() - { - } + ~Func_lpad() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_rpad class @@ -440,15 +405,13 @@ class Func_rpad : public Func_Str Func_rpad() : Func_Str("rpad") { } - virtual ~Func_rpad() - { - } + ~Func_rpad() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_replace class @@ -459,15 +422,13 @@ class Func_replace : public Func_Str Func_replace() : Func_Str("replace") { } - virtual ~Func_replace() - { - } + ~Func_replace() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; class Func_regexp_replace : public Func_Str @@ -476,70 +437,58 @@ class Func_regexp_replace : public Func_Str Func_regexp_replace() : Func_Str("regexp_replace") { } - virtual ~Func_regexp_replace() - { - } + ~Func_regexp_replace() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; - class Func_regexp_instr : public Func_Str { public: Func_regexp_instr() : Func_Str("regexp_instr") { } - virtual ~Func_regexp_instr() - { - } + ~Func_regexp_instr() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; - class Func_regexp_substr : public Func_Str { public: Func_regexp_substr() : Func_Str("regexp_substr") { } - virtual ~Func_regexp_substr() - { - } + ~Func_regexp_substr() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; - - class Func_replace_oracle : public Func_Str { public: Func_replace_oracle() : Func_Str("replace_oracle") { } - virtual ~Func_replace_oracle() - { - } + ~Func_replace_oracle() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_right class @@ -550,15 +499,13 @@ class Func_right : public Func_Str Func_right() : Func_Str("right") { } - virtual ~Func_right() - { - } + ~Func_right() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_char class @@ -569,15 +516,13 @@ class Func_char : public Func_Str Func_char() : Func_Str("char") { } - virtual ~Func_char() - { - } + ~Func_char() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_cast_char class @@ -588,15 +533,13 @@ class Func_cast_char : public Func_Str Func_cast_char() : Func_Str("char") { } - virtual ~Func_cast_char() - { - } + ~Func_cast_char() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_format class @@ -607,15 +550,13 @@ class Func_format : public Func_Str Func_format() : Func_Str("format") { } - virtual ~Func_format() - { - } + ~Func_format() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_conv class @@ -626,15 +567,13 @@ class Func_conv : public Func_Str Func_conv() : Func_Str("conv") { } - virtual ~Func_conv() - { - } + ~Func_conv() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_md5 class @@ -645,15 +584,13 @@ class Func_md5 : public Func_Str Func_md5() : Func_Str("md5") { } - virtual ~Func_md5() - { - } + ~Func_md5() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_unhex class @@ -664,15 +601,13 @@ class Func_unhex : public Func_Str Func_unhex() : Func_Str("unhex") { } - virtual ~Func_unhex() - { - } + ~Func_unhex() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_concat_ws class @@ -683,15 +618,13 @@ class Func_concat_ws : public Func_Str Func_concat_ws() : Func_Str("concat_ws") { } - virtual ~Func_concat_ws() - { - } + ~Func_concat_ws() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_monthname class @@ -702,35 +635,33 @@ class Func_monthname : public Func_Str Func_monthname() : Func_Str("monthname") { } - virtual ~Func_monthname() - { - } + ~Func_monthname() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getIntValInternal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct); double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_time_format class @@ -741,15 +672,13 @@ class Func_time_format : public Func_Str Func_time_format() : Func_Str("time_format") { } - virtual ~Func_time_format() - { - } + ~Func_time_format() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_sec_to_time class @@ -760,24 +689,22 @@ class Func_sec_to_time : public Func_Str Func_sec_to_time() : Func_Str("sec_to_time") { } - virtual ~Func_sec_to_time() - { - } + ~Func_sec_to_time() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_substring_index class @@ -788,15 +715,13 @@ class Func_substring_index : public Func_Str Func_substring_index() : Func_Str("substring_index") { } - virtual ~Func_substring_index() - { - } + ~Func_substring_index() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_hex class @@ -807,15 +732,13 @@ class Func_hex : public Func_Str Func_hex() : Func_Str("hex") { } - virtual ~Func_hex() - { - } + ~Func_hex() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_repeat class @@ -826,15 +749,13 @@ class Func_repeat : public Func_Str Func_repeat() : Func_Str("repeat") { } - virtual ~Func_repeat() - { - } + ~Func_repeat() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_inet_ntoa class to convert big-indian (network ordered) int to @@ -846,39 +767,37 @@ class Func_inet_ntoa : public Func_Str Func_inet_ntoa() : Func_Str("inet_ntoa") { } - virtual ~Func_inet_ntoa() - { - } + ~Func_inet_ntoa() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; double getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; bool getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; private: void convertNtoa(int64_t ipNum, std::string& ipString); @@ -892,15 +811,13 @@ class Func_reverse : public Func_Str Func_reverse() : Func_Str("reverse") { } - virtual ~Func_reverse() - { - } + ~Func_reverse() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_insert class @@ -911,15 +828,13 @@ class Func_insert : public Func_Str Func_insert() : Func_Str("insert") { } - virtual ~Func_insert() - { - } + ~Func_insert() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_maketime class @@ -930,15 +845,13 @@ class Func_maketime : public Func_Str Func_maketime() : Func_Str("maketime") { } - virtual ~Func_maketime() - { - } + ~Func_maketime() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_get_format class @@ -949,15 +862,13 @@ class Func_get_format : public Func_Str Func_get_format() : Func_Str("get_format") { } - virtual ~Func_get_format() - { - } + ~Func_get_format() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_elt class @@ -968,15 +879,13 @@ class Func_elt : public Func_Str Func_elt() : Func_Str("elt") { } - virtual ~Func_elt() - { - } + ~Func_elt() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_sha class @@ -987,15 +896,13 @@ class Func_sha : public Func_Str Func_sha() : Func_Str("sha") { } - virtual ~Func_sha() - { - } + ~Func_sha() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_idbpartition class @@ -1006,15 +913,13 @@ class Func_idbpartition : public Func_Str Func_idbpartition() : Func_Str("idbpartition") { } - virtual ~Func_idbpartition() - { - } + ~Func_idbpartition() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_space class @@ -1025,15 +930,13 @@ class Func_space : public Func_Str Func_space() : Func_Str("space") { } - virtual ~Func_space() - { - } + ~Func_space() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_quote class @@ -1044,15 +947,13 @@ class Func_quote : public Func_Str Func_quote() : Func_Str("quote") { } - virtual ~Func_quote() - { - } + ~Func_quote() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @brief Func_encode class @@ -1064,15 +965,13 @@ class Func_encode : public Func_Str Func_encode() : Func_Str("encode"), fSeeded(false), fSeeds{0, 0} { } - virtual ~Func_encode() - { - } + ~Func_encode() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; void resetSeed() { @@ -1097,15 +996,13 @@ class Func_decode : public Func_Str Func_decode() : Func_Str("decode"), fSeeded(false), fSeeds{0, 0} { } - virtual ~Func_decode() - { - } + ~Func_decode() override = default; - execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::CalpontSystemCatalog::ColType& op_ct) override; void resetSeed() { diff --git a/utils/funcexp/jsonhelpers.h b/utils/funcexp/jsonhelpers.h index ca8b62a66..7e11c574f 100644 --- a/utils/funcexp/jsonhelpers.h +++ b/utils/funcexp/jsonhelpers.h @@ -8,7 +8,7 @@ #include #include #include -//#include +// #include #include "collation.h" #include "functor_json.h" @@ -21,9 +21,7 @@ #include "json_lib.h" -namespace funcexp -{ -namespace helpers +namespace funcexp::helpers { static const int NO_WILDCARD_ALLOWED = 1; @@ -35,7 +33,8 @@ static const int NO_WILDCARD_ALLOWED = 1; int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const string_view& str, bool wildcards); // Return true if err occur, let the outer function handle the exception -bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const utils::NullString& js, const CHARSET_INFO* jsCS); +bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const utils::NullString& js, + const CHARSET_INFO* jsCS); bool appendJSKeyName(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm); bool appendJSValue(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm); @@ -97,12 +96,11 @@ int parseJSPath(JSONPath& path, rowgroup::Row& row, execplan::SPTP& parm, bool w inline void initJSPaths(vector& paths, FunctionParm& fp, const int start, const int step) { - if (paths.size() == 0) + if (paths.empty()) for (size_t i = start; i < fp.size(); i += step) - paths.push_back(JSONPath{}); + paths.emplace_back(); } bool matchJSPath(const vector& paths, const json_path_t* p, json_value_types valType, const int* arrayCounter = nullptr, bool exact = true); -} // namespace helpers -} // namespace funcexp +} // namespace funcexp::helpers diff --git a/utils/funcexp/sql_crypt.h b/utils/funcexp/sql_crypt.h index 8984b7d74..b625b4c67 100644 --- a/utils/funcexp/sql_crypt.h +++ b/utils/funcexp/sql_crypt.h @@ -1,6 +1,6 @@ #pragma once -//#include "my_global.h" +// #include "my_global.h" /* Macros to make switching between C and C++ mode easier */ #ifdef __cplusplus #define C_MODE_START \ @@ -22,16 +22,12 @@ class SQL_CRYPT uint shift; public: - SQL_CRYPT() - { - } - SQL_CRYPT(ulong* seed) + SQL_CRYPT() = default; + explicit SQL_CRYPT(ulong* seed) { init(seed); } - ~SQL_CRYPT() - { - } + ~SQL_CRYPT() = default; void init(ulong* seed); void reinit() { diff --git a/utils/funcexp/timeextract.h b/utils/funcexp/timeextract.h index 181ae5021..96aa21663 100644 --- a/utils/funcexp/timeextract.h +++ b/utils/funcexp/timeextract.h @@ -32,7 +32,6 @@ class TimeExtractor public: TimeExtractor() : dayOfWeek(-1), dayOfYear(-1), weekOfYear(-1), sundayFirst(false) { - ; } /** diff --git a/utils/funcexp/utf8/checked.h b/utils/funcexp/utf8/checked.h index 65a4f8efe..064077bdc 100644 --- a/utils/funcexp/utf8/checked.h +++ b/utils/funcexp/utf8/checked.h @@ -42,10 +42,10 @@ class invalid_code_point : public exception uint32_t cp; public: - invalid_code_point(uint32_t cp) : cp(cp) + explicit invalid_code_point(uint32_t cp) : cp(cp) { } - virtual const char* what() const throw() + const char* what() const noexcept override { return "Invalid code point"; } @@ -60,10 +60,10 @@ class invalid_utf8 : public exception uint8_t u8; public: - invalid_utf8(uint8_t u) : u8(u) + explicit invalid_utf8(uint8_t u) : u8(u) { } - virtual const char* what() const throw() + const char* what() const noexcept override { return "Invalid UTF-8"; } @@ -78,10 +78,10 @@ class invalid_utf16 : public exception uint16_t u16; public: - invalid_utf16(uint16_t u) : u16(u) + explicit invalid_utf16(uint16_t u) : u16(u) { } - virtual const char* what() const throw() + const char* what() const noexcept override { return "Invalid UTF-16"; } @@ -94,7 +94,7 @@ class invalid_utf16 : public exception class not_enough_room : public exception { public: - virtual const char* what() const throw() + const char* what() const noexcept override { return "Not enough space"; } @@ -336,9 +336,7 @@ class iterator : public std::iterator octet_iterator range_end; public: - iterator() - { - } + iterator() = default; explicit iterator(const octet_iterator& octet_it, const octet_iterator& range_start, const octet_iterator& range_end) : it(octet_it), range_start(range_start), range_end(range_end) diff --git a/utils/funcexp/utf8/unchecked.h b/utils/funcexp/utf8/unchecked.h index 4995671b2..2faaa6857 100644 --- a/utils/funcexp/utf8/unchecked.h +++ b/utils/funcexp/utf8/unchecked.h @@ -28,9 +28,7 @@ DEALINGS IN THE SOFTWARE. #include "core.h" -namespace utf8 -{ -namespace unchecked +namespace utf8::unchecked { template octet_iterator append(uint32_t cp, octet_iterator result) @@ -201,9 +199,7 @@ class iterator : public std::iterator octet_iterator it; public: - iterator() - { - } + iterator() = default; explicit iterator(const octet_iterator& octet_it) : it(octet_it) { } @@ -249,5 +245,4 @@ class iterator : public std::iterator } }; // class iterator -} // namespace unchecked -} // namespace utf8 +} // namespace utf8::unchecked diff --git a/utils/idbdatafile/BufferedFile.h b/utils/idbdatafile/BufferedFile.h index e153c524b..ad1100e12 100644 --- a/utils/idbdatafile/BufferedFile.h +++ b/utils/idbdatafile/BufferedFile.h @@ -22,7 +22,6 @@ #include "IDBDataFile.h" #include - namespace idbdatafile { /** @@ -34,22 +33,22 @@ class BufferedFile : public IDBDataFile, boost::noncopyable { public: BufferedFile(const char* fname, const char* mode, unsigned opts); - /* virtual */ ~BufferedFile(); + /* virtual */ ~BufferedFile() override; - /* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count); - /* virtual */ ssize_t read(void* ptr, size_t count); - /* virtual */ ssize_t write(const void* ptr, size_t count); - /* virtual */ int seek(off64_t offset, int whence); - /* virtual */ int truncate(off64_t length); - /* virtual */ off64_t size(); - /* virtual */ off64_t tell(); - /* virtual */ int flush(); - /* virtual */ time_t mtime(); - /* virtual */ int fallocate(int mode, off64_t offset, off64_t length); + /* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count) override; + /* virtual */ ssize_t read(void* ptr, size_t count) override; + /* virtual */ ssize_t write(const void* ptr, size_t count) override; + /* virtual */ int seek(off64_t offset, int whence) override; + /* virtual */ int truncate(off64_t length) override; + /* virtual */ off64_t size() override; + /* virtual */ off64_t tell() override; + /* virtual */ int flush() override; + /* virtual */ time_t mtime() override; + /* virtual */ int fallocate(int mode, off64_t offset, off64_t length) override; protected: /* virtual */ - int close(); + int close() override; private: void applyOptions(unsigned opts); diff --git a/utils/idbdatafile/BufferedFileFactory.h b/utils/idbdatafile/BufferedFileFactory.h index 74355d61a..a061750dd 100644 --- a/utils/idbdatafile/BufferedFileFactory.h +++ b/utils/idbdatafile/BufferedFileFactory.h @@ -27,7 +27,7 @@ class BufferedFileFactory : public FileFactoryBase { public: /* virtual */ - IDBDataFile* open(const char* fname, const char* mode, unsigned opts, unsigned colWidth); + IDBDataFile* open(const char* fname, const char* mode, unsigned opts, unsigned colWidth) override; }; inline IDBDataFile* BufferedFileFactory::open(const char* fname, const char* mode, unsigned opts, diff --git a/utils/idbdatafile/IDBDataFile.h b/utils/idbdatafile/IDBDataFile.h index c8cd4a210..ece8d6e95 100644 --- a/utils/idbdatafile/IDBDataFile.h +++ b/utils/idbdatafile/IDBDataFile.h @@ -201,7 +201,7 @@ class IDBDataFile * Constructor - takes the filename to be stored in a member variable * for logging purposes */ - IDBDataFile(const char* fname); + explicit IDBDataFile(const char* fname); /** * The close() method closes the file. It is defined as protected @@ -226,9 +226,7 @@ inline IDBDataFile::IDBDataFile(const char* fname) : m_fname(fname), m_fColWidth { } -inline IDBDataFile::~IDBDataFile() -{ -} +inline IDBDataFile::~IDBDataFile() = default; inline const std::string& IDBDataFile::name() const { diff --git a/utils/idbdatafile/IDBFileSystem.h b/utils/idbdatafile/IDBFileSystem.h index 9a9267e2f..78f405230 100644 --- a/utils/idbdatafile/IDBFileSystem.h +++ b/utils/idbdatafile/IDBFileSystem.h @@ -142,7 +142,7 @@ class IDBFileSystem } protected: - IDBFileSystem(Types type); + explicit IDBFileSystem(Types type); private: Types m_type; diff --git a/utils/idbdatafile/PosixFileSystem.h b/utils/idbdatafile/PosixFileSystem.h index 46f9423f3..8a1ceec52 100644 --- a/utils/idbdatafile/PosixFileSystem.h +++ b/utils/idbdatafile/PosixFileSystem.h @@ -25,7 +25,7 @@ class PosixFileSystem : public IDBFileSystem { public: PosixFileSystem(); - ~PosixFileSystem(); + ~PosixFileSystem() override; int mkdir(const char* pathname) override; off64_t size(const char* path) const override; diff --git a/utils/idbdatafile/UnbufferedFile.h b/utils/idbdatafile/UnbufferedFile.h index cd100c95b..3c809464c 100644 --- a/utils/idbdatafile/UnbufferedFile.h +++ b/utils/idbdatafile/UnbufferedFile.h @@ -34,22 +34,22 @@ class UnbufferedFile : public IDBDataFile, boost::noncopyable { public: UnbufferedFile(const char* fname, const char* mode, unsigned opts); - /* virtual */ ~UnbufferedFile(); + /* virtual */ ~UnbufferedFile() override; - /* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count); - /* virtual */ ssize_t read(void* ptr, size_t count); - /* virtual */ ssize_t write(const void* ptr, size_t count); - /* virtual */ int seek(off64_t offset, int whence); - /* virtual */ int truncate(off64_t length); - /* virtual */ off64_t size(); - /* virtual */ off64_t tell(); - /* virtual */ int flush(); - /* virtual */ time_t mtime(); - /* virtual */ int fallocate(int mode, off64_t offset, off64_t length); + /* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count) override; + /* virtual */ ssize_t read(void* ptr, size_t count) override; + /* virtual */ ssize_t write(const void* ptr, size_t count) override; + /* virtual */ int seek(off64_t offset, int whence) override; + /* virtual */ int truncate(off64_t length) override; + /* virtual */ off64_t size() override; + /* virtual */ off64_t tell() override; + /* virtual */ int flush() override; + /* virtual */ time_t mtime() override; + /* virtual */ int fallocate(int mode, off64_t offset, off64_t length) override; protected: /* virtual */ - int close(); + int close() override; private: int m_fd; diff --git a/utils/idbdatafile/UnbufferedFileFactory.h b/utils/idbdatafile/UnbufferedFileFactory.h index 4933fc469..5e4313994 100644 --- a/utils/idbdatafile/UnbufferedFileFactory.h +++ b/utils/idbdatafile/UnbufferedFileFactory.h @@ -27,7 +27,7 @@ class UnbufferedFileFactory : public FileFactoryBase { public: /* virtual */ - IDBDataFile* open(const char* fname, const char* mode, unsigned opts, unsigned colWidth); + IDBDataFile* open(const char* fname, const char* mode, unsigned opts, unsigned colWidth) override; }; inline IDBDataFile* UnbufferedFileFactory::open(const char* fname, const char* mode, unsigned opts, diff --git a/utils/messageqcpp/bytestream.h b/utils/messageqcpp/bytestream.h index ff9606298..84256cf0f 100644 --- a/utils/messageqcpp/bytestream.h +++ b/utils/messageqcpp/bytestream.h @@ -81,7 +81,7 @@ class ByteStream : public Serializeable /** * ctor with a uint8_t array and len initializer */ - inline ByteStream(const uint8_t* bp, const BSSizeType len); + inline ByteStream(const uint8_t* bp, BSSizeType len); /** * copy ctor */ @@ -98,40 +98,40 @@ class ByteStream : public Serializeable /** * dtor */ - inline virtual ~ByteStream(); + inline ~ByteStream() override; /** * push a int8_t onto the end of the stream */ - EXPORT ByteStream& operator<<(const int8_t b); + EXPORT ByteStream& operator<<(int8_t b); /** * push a uint8_t onto the end of the stream */ - EXPORT ByteStream& operator<<(const uint8_t b); + EXPORT ByteStream& operator<<(uint8_t b); /** * push a int16_t onto the end of the stream. The byte order is whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const int16_t d); + EXPORT ByteStream& operator<<(int16_t d); /** * push a uint16_t onto the end of the stream. The byte order is whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const uint16_t d); + EXPORT ByteStream& operator<<(uint16_t d); /** * push a int32_t onto the end of the stream. The byte order is whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const int32_t q); + EXPORT ByteStream& operator<<(int32_t q); /** * push a uint32_t onto the end of the stream. The byte order is whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const uint32_t q); + EXPORT ByteStream& operator<<(uint32_t q); /** * push an int64_t onto the end of the stream. The byte order is whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const int64_t o); + EXPORT ByteStream& operator<<(int64_t o); /** * push an uint64_t onto the end of the stream. The byte order is whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const uint64_t o); + EXPORT ByteStream& operator<<(uint64_t o); /** * push an int128_t onto the end of the stream. The byte order is whatever the native byte order is. */ @@ -145,17 +145,17 @@ class ByteStream : public Serializeable * push a float onto the end of the stream. The byte order is * whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const float f); + EXPORT ByteStream& operator<<(float f); /** * push a double onto the end of the stream. The byte order is * whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const double d); + EXPORT ByteStream& operator<<(double d); /** * push a long double onto the end of the stream. The byte * order is whatever the native byte order is. */ - EXPORT ByteStream& operator<<(const long double d); + EXPORT ByteStream& operator<<(long double d); /** * push a std::string onto the end of the stream. */ @@ -428,12 +428,12 @@ class ByteStream : public Serializeable /** * Serializeable interface */ - EXPORT void serialize(ByteStream& bs) const; + EXPORT void serialize(ByteStream& bs) const override; /** * Serializeable interface */ - EXPORT void deserialize(ByteStream& bs); + EXPORT void deserialize(ByteStream& bs) override; /** * memory allocation chunk size @@ -455,7 +455,7 @@ class ByteStream : public Serializeable /** * pushes one uint8_t onto the end of the stream */ - void add(const uint8_t b); + void add(uint8_t b); /** * adds another BlockSize bytes to the internal buffer */ @@ -527,7 +527,7 @@ static const uint8_t BS_BLOB = 9; static const uint8_t BS_SERIALIZABLE = 10; static const uint8_t BS_UUID = 11; -inline ByteStream::ByteStream(const uint8_t* bp, const BSSizeType len) : fBuf(0), fMaxLen(0) +inline ByteStream::ByteStream(const uint8_t* bp, BSSizeType len) : fBuf(nullptr), fMaxLen(0) { load(bp, len); } @@ -560,7 +560,7 @@ inline void ByteStream::reset() { delete[] fBuf; fMaxLen = 0; - fCurInPtr = fCurOutPtr = fBuf = 0; + fCurInPtr = fCurOutPtr = fBuf = nullptr; } inline void ByteStream::restart() { @@ -669,7 +669,6 @@ void deserializeVector(ByteStream& bs, std::vector& v) } } - template void serializeInlineVector(ByteStream& bs, const std::vector& v) { @@ -703,7 +702,6 @@ void deserializeInlineVector(ByteStream& bs, std::vector& v) } } - inline void deserializeVector(ByteStream& bs, std::vector& v) { deserializeInlineVector(bs, v); diff --git a/utils/messageqcpp/compressed_iss.h b/utils/messageqcpp/compressed_iss.h index e86291414..ff839bb87 100644 --- a/utils/messageqcpp/compressed_iss.h +++ b/utils/messageqcpp/compressed_iss.h @@ -39,16 +39,16 @@ class CompressedInetStreamSocket : public InetStreamSocket public: CompressedInetStreamSocket(); CompressedInetStreamSocket(const CompressedInetStreamSocket&) = default; - virtual ~CompressedInetStreamSocket(){}; + ~CompressedInetStreamSocket() override = default; using InetStreamSocket::operator=; - virtual Socket* clone() const; - virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL, - Stats* stats = NULL) const; - virtual void write(const ByteStream& msg, Stats* stats = NULL); - virtual void write(SBS msg, Stats* stats = NULL); - virtual const IOSocket accept(const struct timespec* timeout); - virtual void connect(const sockaddr* addr); + Socket* clone() const override; + const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr, + Stats* stats = nullptr) const override; + void write(const ByteStream& msg, Stats* stats = nullptr) override; + void write(SBS msg, Stats* stats = nullptr) override; + const IOSocket accept(const struct timespec* timeout) override; + void connect(const sockaddr* addr) override; private: std::shared_ptr alg; diff --git a/utils/messageqcpp/inetstreamsocket.cpp b/utils/messageqcpp/inetstreamsocket.cpp index 7df141192..d42958c9a 100644 --- a/utils/messageqcpp/inetstreamsocket.cpp +++ b/utils/messageqcpp/inetstreamsocket.cpp @@ -73,8 +73,6 @@ using namespace std; #include using boost::scoped_array; - - #define INETSTREAMSOCKET_DLLEXPORT #include "inetstreamsocket.h" #undef INETSTREAMSOCKET_DLLEXPORT @@ -97,7 +95,6 @@ namespace // read(), so adding logic to retry after ERESTARTSYS the way we do for EINTR. // const int KERR_ERESTARTSYS = 512; - int in_cksum(unsigned short* buf, int sz) { int nleft = sz; @@ -135,9 +132,7 @@ InetStreamSocket::InetStreamSocket(size_t blocksize) fConnectionTimeout.tv_nsec = 0; } -InetStreamSocket::~InetStreamSocket() -{ -} +InetStreamSocket::~InetStreamSocket() = default; void InetStreamSocket::open() { @@ -172,7 +167,6 @@ void InetStreamSocket::open() throw runtime_error(msg); } - /* XXXPAT: If we have latency problems again, try these... bufferSizeSize = 4; bufferSize = 512000; @@ -379,9 +373,8 @@ bool InetStreamSocket::readToMagic(long msecs, bool* isTimeOut, Stats* stats) co } ostringstream oss; - oss << "InetStreamSocket::readToMagic(): I/O error2.1: " - << "err = " << err << " e = " << e << - ": " << strerror(e); + oss << "InetStreamSocket::readToMagic(): I/O error2.1: " << "err = " << err << " e = " << e << ": " + << strerror(e); throw runtime_error(oss.str()); } @@ -402,7 +395,7 @@ bool InetStreamSocket::readToMagic(long msecs, bool* isTimeOut, Stats* stats) co return true; } -bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, const size_t numberOfBytes, +bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, size_t numberOfBytes, const struct ::timespec* timeout, bool* isTimeOut, Stats* stats, int64_t msecs) const { @@ -412,7 +405,7 @@ bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, co ssize_t currentBytesRead; int err; - if (timeout != NULL) + if (timeout != nullptr) { pfd[0].revents = 0; err = poll(pfd, 1, msecs); @@ -438,7 +431,7 @@ bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, co if (currentBytesRead == 0) { - if (timeout == NULL) + if (timeout == nullptr) { logIoError("InetStreamSocket::read: timeout during first read", 0); return false; @@ -482,7 +475,7 @@ const SBS InetStreamSocket::read(const struct ::timespec* timeout, bool* isTimeO pfd[0].fd = fSocketParms.sd(); pfd[0].events = POLLIN; - if (timeout != 0) + if (timeout != nullptr) msecs = timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000; if (readToMagic(msecs, isTimeOut, stats) == false) // indicates a timeout or EOF @@ -707,7 +700,7 @@ const IOSocket InetStreamSocket::accept(const struct timespec* timeout) pfd[0].fd = socketParms().sd(); pfd[0].events = POLLIN; - if (timeout != 0) + if (timeout != nullptr) { msecs = timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000; @@ -771,7 +764,7 @@ const IOSocket InetStreamSocket::accept(const struct timespec* timeout) #if STRERROR_R_CHAR_P const char* p; - if ((p = strerror_r(e, blah, 80)) != 0) + if ((p = strerror_r(e, blah, 80)) != nullptr) os << "InetStreamSocket::accept sync: " << p; #else @@ -862,7 +855,7 @@ void InetStreamSocket::connect(const sockaddr* serv_addr) #if STRERROR_R_CHAR_P const char* p; - if ((p = strerror_r(e, blah, 80)) != 0) + if ((p = strerror_r(e, blah, 80)) != nullptr) os << "InetStreamSocket::connect: " << p; #else @@ -883,9 +876,9 @@ const string InetStreamSocket::toString() const ostringstream oss; char buf[INET_ADDRSTRLEN]; const SocketParms& sp = fSocketParms; - oss << "InetStreamSocket: sd: " << sp.sd() << - " inet: " << inet_ntop(AF_INET, &fSa.sin_addr, buf, INET_ADDRSTRLEN) << - " port: " << ntohs(fSa.sin_port); + oss << "InetStreamSocket: sd: " << sp.sd() + << " inet: " << inet_ntop(AF_INET, &fSa.sin_addr, buf, INET_ADDRSTRLEN) + << " port: " << ntohs(fSa.sin_port); return oss.str(); } @@ -1030,7 +1023,7 @@ int InetStreamSocket::ping(const std::string& ipaddr, const struct timespec* tim return -1; } - len = ::recvfrom(pingsock, pkt, pktlen, 0, 0, 0); + len = ::recvfrom(pingsock, pkt, pktlen, 0, nullptr, nullptr); if (len < 76) { @@ -1050,7 +1043,6 @@ int InetStreamSocket::ping(const std::string& ipaddr, const struct timespec* tim ::close(pingsock); - return 0; } diff --git a/utils/messageqcpp/inetstreamsocket.h b/utils/messageqcpp/inetstreamsocket.h index fa9a94915..e09b71a6e 100644 --- a/utils/messageqcpp/inetstreamsocket.h +++ b/utils/messageqcpp/inetstreamsocket.h @@ -58,7 +58,7 @@ class InetStreamSocket : public Socket /** dtor * */ - virtual ~InetStreamSocket(); + ~InetStreamSocket() override; /** copy ctor * @@ -68,37 +68,37 @@ class InetStreamSocket : public Socket /** assign op * */ - virtual InetStreamSocket& operator=(const InetStreamSocket& rhs); + InetStreamSocket& operator=(const InetStreamSocket& rhs); /** fSocket mutator * */ - inline virtual void socketParms(const SocketParms& socket); + inline void socketParms(const SocketParms& socket) override; /** fSocket accessor * */ - inline virtual const SocketParms socketParms() const; + inline const SocketParms socketParms() const override; /** sockaddr mutator * */ - inline virtual void sa(const sockaddr* sa); + inline void sa(const sockaddr* sa) override; /** call socket() to get a sd * */ - virtual void open(); + void open() override; /** close the sd * */ - virtual void close(); + void close() override; /** test if this socket is open * */ - inline virtual bool isOpen() const; + inline bool isOpen() const override; /** read a message from the socket * @@ -114,44 +114,44 @@ class InetStreamSocket : public Socket * The behavior will be unpredictable and possibly fatal. * @note A fix is being reviewed but this is low-priority. */ - virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL, - Stats* stats = NULL) const; + const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr, + Stats* stats = nullptr) const override; /** write a message to the socket * * write a message to the socket */ - virtual void write(const ByteStream& msg, Stats* stats = NULL); - virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const; + void write(const ByteStream& msg, Stats* stats = nullptr) override; + void write_raw(const ByteStream& msg, Stats* stats = nullptr) const override; /** this version of write takes ownership of the bytestream */ - virtual void write(SBS msg, Stats* stats = NULL); + void write(SBS msg, Stats* stats = nullptr) override; /** bind to a port * */ - virtual void bind(const sockaddr* serv_addr); + void bind(const sockaddr* serv_addr) override; /** listen for connections * */ - virtual void listen(int backlog = 5); + void listen(int backlog = 5) override; /** return an (accepted) IOSocket ready for I/O * */ - virtual const IOSocket accept(const struct timespec* timeout = 0); + const IOSocket accept(const struct timespec* timeout = nullptr) override; /** connect to a server socket * */ - virtual void connect(const sockaddr* serv_addr); + void connect(const sockaddr* serv_addr) override; /** dynamically allocate a copy of this object * */ - virtual Socket* clone() const; + Socket* clone() const override; /** get a string rep of the object * @@ -161,7 +161,7 @@ class InetStreamSocket : public Socket /** set the connection timeout (in ms) * */ - virtual void connectionTimeout(const struct ::timespec* timeout) + void connectionTimeout(const struct ::timespec* timeout) override { if (timeout) fConnectionTimeout = *timeout; @@ -170,12 +170,12 @@ class InetStreamSocket : public Socket /** set the connection protocol to be synchronous * */ - virtual void syncProto(bool use) + void syncProto(bool use) override { fSyncProto = use; } - int getConnectionNum() const + int getConnectionNum() const override { return fSocketParms.sd(); } @@ -189,25 +189,25 @@ class InetStreamSocket : public Socket /** return the address as a string * */ - virtual const std::string addr2String() const; + const std::string addr2String() const override; /** compare 2 addresses * */ - virtual bool isSameAddr(const Socket* rhs) const; - virtual bool isSameAddr(const struct in_addr& ipv4Addr) const; + bool isSameAddr(const Socket* rhs) const override; + bool isSameAddr(const struct in_addr& ipv4Addr) const override; /** ping an ip address * */ - EXPORT static int ping(const std::string& ipaddr, const struct timespec* timeout = 0); + EXPORT static int ping(const std::string& ipaddr, const struct timespec* timeout = nullptr); // Check if we are still connected - virtual bool isConnected() const; + bool isConnected() const override; // Check if the socket still has data pending - virtual bool hasData() const; + bool hasData() const override; /* * allow test suite access to private data for OOB test @@ -231,9 +231,9 @@ class InetStreamSocket : public Socket */ virtual bool readToMagic(long msecs, bool* isTimeOut, Stats* stats) const; - void do_write(const ByteStream& msg, uint32_t magic, Stats* stats = NULL) const; + void do_write(const ByteStream& msg, uint32_t magic, Stats* stats = nullptr) const; ssize_t written(int fd, const uint8_t* ptr, size_t nbytes) const; - bool readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, const size_t numberOfBytes, + bool readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, size_t numberOfBytes, const struct ::timespec* timeout, bool* isTimeOut, Stats* stats, int64_t msec) const; SocketParms fSocketParms; /// The socket parms diff --git a/utils/messageqcpp/messagequeue.h b/utils/messageqcpp/messagequeue.h index 197a27e3b..c089070f2 100644 --- a/utils/messageqcpp/messagequeue.h +++ b/utils/messageqcpp/messagequeue.h @@ -76,7 +76,7 @@ class MessageQueueServer * * construct a server queue for thisEnd. Optionally specify a Config object to use. */ - EXPORT explicit MessageQueueServer(const std::string& thisEnd, config::Config* config = 0, + EXPORT explicit MessageQueueServer(const std::string& thisEnd, config::Config* config = nullptr, size_t blocksize = ByteStream::BlockSize, int backlog = 5, bool syncProto = true); @@ -101,7 +101,7 @@ class MessageQueueServer * is then free to wait again for another connection. The IOSocket is already open and ready for * read() and/or write(). The caller is responsible for calling close() when it is done. */ - EXPORT const IOSocket accept(const struct timespec* timeout = 0) const; + EXPORT const IOSocket accept(const struct timespec* timeout = nullptr) const; /** * @brief get a mutable pointer to the client IOSocket @@ -165,7 +165,7 @@ class MessageQueueClient * * construct a queue from this process to otherEnd. Optionally specify a Config object to use. */ - EXPORT explicit MessageQueueClient(const std::string& otherEnd, config::Config* config = 0, + EXPORT explicit MessageQueueClient(const std::string& otherEnd, config::Config* config = nullptr, bool syncProto = true); /** @@ -196,8 +196,8 @@ class MessageQueueClient * wait for and return a message from otherEnd. The deafult timeout waits forever. Note that * eventhough struct timespec has nanosecond resolution, this method only has milisecond resolution. */ - EXPORT const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL, - Stats* stats = NULL) const; + EXPORT const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr, + Stats* stats = nullptr) const; /** * @brief write a message to the queue @@ -205,7 +205,8 @@ class MessageQueueClient * write a message to otherEnd. If the socket is not open, the timeout parm (in ms) will be used * to establish a sync connection w/ the server */ - EXPORT void write(const ByteStream& msg, const struct timespec* timeout = 0, Stats* stats = NULL) const; + EXPORT void write(const ByteStream& msg, const struct timespec* timeout = nullptr, + Stats* stats = nullptr) const; /** * @brief shutdown the connection to the server diff --git a/utils/messageqcpp/samenodepseudosocket.h b/utils/messageqcpp/samenodepseudosocket.h index f977f02a2..df8ff72e3 100644 --- a/utils/messageqcpp/samenodepseudosocket.h +++ b/utils/messageqcpp/samenodepseudosocket.h @@ -33,56 +33,56 @@ class SameNodePseudoSocket : public Socket { public: explicit SameNodePseudoSocket(joblist::DistributedEngineComm* exeMgrDecPtr); - virtual ~SameNodePseudoSocket(); - virtual void write(SBS msg, Stats* stats = NULL); + ~SameNodePseudoSocket() override; + void write(SBS msg, Stats* stats = nullptr) override; private: - virtual void bind(const sockaddr* serv_addr); + void bind(const sockaddr* serv_addr) override; SameNodePseudoSocket(const SameNodePseudoSocket& rhs); virtual SameNodePseudoSocket& operator=(const SameNodePseudoSocket& rhs); - virtual void connectionTimeout(const struct ::timespec* timeout) + void connectionTimeout(const struct ::timespec* timeout) override { } - virtual void syncProto(bool use) + void syncProto(bool use) override { } - int getConnectionNum() const + int getConnectionNum() const override { return 1; } - inline virtual void socketParms(const SocketParms& socket) + inline void socketParms(const SocketParms& socket) override { } - inline virtual const SocketParms socketParms() const + inline const SocketParms socketParms() const override { return SocketParms(); } // all these virtual methods are to stay inaccessable. - inline virtual void sa(const sockaddr* sa); - virtual void open(); - virtual void close(); - inline virtual bool isOpen() const; - virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL, - Stats* stats = NULL) const; - virtual void write(const ByteStream& msg, Stats* stats = NULL); - virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const; - virtual void listen(int backlog = 5); - virtual const IOSocket accept(const struct timespec* timeout = 0); - virtual void connect(const sockaddr* serv_addr); - virtual Socket* clone() const; + inline void sa(const sockaddr* sa) override; + void open() override; + void close() override; + inline bool isOpen() const override; + const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr, + Stats* stats = nullptr) const override; + void write(const ByteStream& msg, Stats* stats = nullptr) override; + void write_raw(const ByteStream& msg, Stats* stats = nullptr) const override; + void listen(int backlog = 5) override; + const IOSocket accept(const struct timespec* timeout = nullptr) override; + void connect(const sockaddr* serv_addr) override; + Socket* clone() const override; virtual const std::string toString() const; - virtual const std::string addr2String() const; - virtual bool isSameAddr(const Socket* rhs) const; - virtual bool isSameAddr(const struct in_addr& ipv4Addr) const; - static int ping(const std::string& ipaddr, const struct timespec* timeout = 0); - virtual bool isConnected() const; - virtual bool hasData() const; + const std::string addr2String() const override; + bool isSameAddr(const Socket* rhs) const override; + bool isSameAddr(const struct in_addr& ipv4Addr) const override; + static int ping(const std::string& ipaddr, const struct timespec* timeout = nullptr); + bool isConnected() const override; + bool hasData() const override; joblist::DistributedEngineComm* dec_ = nullptr; }; diff --git a/utils/messageqcpp/socketclosed.h b/utils/messageqcpp/socketclosed.h index 4bc6e11e0..fb1a61fe6 100644 --- a/utils/messageqcpp/socketclosed.h +++ b/utils/messageqcpp/socketclosed.h @@ -24,6 +24,7 @@ #include #include +#include #pragma once @@ -35,23 +36,21 @@ namespace messageqcpp */ class SocketClosed : public std::exception { - std::string _M_msg; + std::string M_msg; public: /** Takes a character string describing the error. */ - explicit SocketClosed(const std::string& __arg) : _M_msg(__arg) + explicit SocketClosed(std::string _arg) : M_msg(std::move(_arg)) { } - virtual ~SocketClosed() throw() - { - } + ~SocketClosed() noexcept override = default; /** Returns a C-style character string describing the general cause of * the current error (the same string passed to the ctor). */ - virtual const char* what() const throw() + const char* what() const noexcept override { - return _M_msg.c_str(); + return M_msg.c_str(); } }; diff --git a/utils/querytele/QueryTeleService.h b/utils/querytele/QueryTeleService.h index ee02bb45e..a24068be3 100644 --- a/utils/querytele/QueryTeleService.h +++ b/utils/querytele/QueryTeleService.h @@ -9,15 +9,12 @@ #include #include "querytele_types.h" - namespace querytele { class QueryTeleServiceIf { public: - virtual ~QueryTeleServiceIf() - { - } + virtual ~QueryTeleServiceIf() = default; virtual void postQuery(const QueryTele& query) = 0; virtual void postStep(const StepTele& query) = 0; virtual void postImport(const ImportTele& query) = 0; @@ -28,9 +25,7 @@ class QueryTeleServiceIfFactory public: typedef QueryTeleServiceIf Handler; - virtual ~QueryTeleServiceIfFactory() - { - } + virtual ~QueryTeleServiceIfFactory() = default; virtual QueryTeleServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; virtual void releaseHandler(QueryTeleServiceIf* /* handler */) = 0; @@ -39,18 +34,17 @@ class QueryTeleServiceIfFactory class QueryTeleServiceIfSingletonFactory : virtual public QueryTeleServiceIfFactory { public: - QueryTeleServiceIfSingletonFactory(const std::shared_ptr& iface) : iface_(iface) - { - } - virtual ~QueryTeleServiceIfSingletonFactory() + explicit QueryTeleServiceIfSingletonFactory(const std::shared_ptr& iface) + : iface_(iface) { } + ~QueryTeleServiceIfSingletonFactory() override = default; - virtual QueryTeleServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) + QueryTeleServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) override { return iface_.get(); } - virtual void releaseHandler(QueryTeleServiceIf* /* handler */) + void releaseHandler(QueryTeleServiceIf* /* handler */) override { } @@ -61,18 +55,16 @@ class QueryTeleServiceIfSingletonFactory : virtual public QueryTeleServiceIfFact class QueryTeleServiceNull : virtual public QueryTeleServiceIf { public: - virtual ~QueryTeleServiceNull() - { - } - void postQuery(const QueryTele& /* query */) + ~QueryTeleServiceNull() override = default; + void postQuery(const QueryTele& /* query */) override { return; } - void postStep(const StepTele& /* query */) + void postStep(const StepTele& /* query */) override { return; } - void postImport(const ImportTele& /* query */) + void postImport(const ImportTele& /* query */) override { return; } @@ -89,13 +81,9 @@ typedef struct _QueryTeleService_postQuery_args__isset class QueryTeleService_postQuery_args { public: - QueryTeleService_postQuery_args() - { - } + QueryTeleService_postQuery_args() = default; - virtual ~QueryTeleService_postQuery_args() throw() - { - } + virtual ~QueryTeleService_postQuery_args() throw() = default; QueryTele query; @@ -127,9 +115,7 @@ class QueryTeleService_postQuery_args class QueryTeleService_postQuery_pargs { public: - virtual ~QueryTeleService_postQuery_pargs() throw() - { - } + virtual ~QueryTeleService_postQuery_pargs() throw() = default; const QueryTele* query; @@ -139,13 +125,9 @@ class QueryTeleService_postQuery_pargs class QueryTeleService_postQuery_result { public: - QueryTeleService_postQuery_result() - { - } + QueryTeleService_postQuery_result() = default; - virtual ~QueryTeleService_postQuery_result() throw() - { - } + virtual ~QueryTeleService_postQuery_result() throw() = default; bool operator==(const QueryTeleService_postQuery_result& /* rhs */) const { @@ -165,9 +147,7 @@ class QueryTeleService_postQuery_result class QueryTeleService_postQuery_presult { public: - virtual ~QueryTeleService_postQuery_presult() throw() - { - } + virtual ~QueryTeleService_postQuery_presult() throw() = default; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; @@ -183,13 +163,9 @@ typedef struct _QueryTeleService_postStep_args__isset class QueryTeleService_postStep_args { public: - QueryTeleService_postStep_args() - { - } + QueryTeleService_postStep_args() = default; - virtual ~QueryTeleService_postStep_args() throw() - { - } + virtual ~QueryTeleService_postStep_args() throw() = default; StepTele query; @@ -221,9 +197,7 @@ class QueryTeleService_postStep_args class QueryTeleService_postStep_pargs { public: - virtual ~QueryTeleService_postStep_pargs() throw() - { - } + virtual ~QueryTeleService_postStep_pargs() throw() = default; const StepTele* query; @@ -233,13 +207,9 @@ class QueryTeleService_postStep_pargs class QueryTeleService_postStep_result { public: - QueryTeleService_postStep_result() - { - } + QueryTeleService_postStep_result() = default; - virtual ~QueryTeleService_postStep_result() throw() - { - } + virtual ~QueryTeleService_postStep_result() throw() = default; bool operator==(const QueryTeleService_postStep_result& /* rhs */) const { @@ -259,9 +229,7 @@ class QueryTeleService_postStep_result class QueryTeleService_postStep_presult { public: - virtual ~QueryTeleService_postStep_presult() throw() - { - } + virtual ~QueryTeleService_postStep_presult() throw() = default; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; @@ -277,13 +245,9 @@ typedef struct _QueryTeleService_postImport_args__isset class QueryTeleService_postImport_args { public: - QueryTeleService_postImport_args() - { - } + QueryTeleService_postImport_args() = default; - virtual ~QueryTeleService_postImport_args() throw() - { - } + virtual ~QueryTeleService_postImport_args() throw() = default; ImportTele query; @@ -315,9 +279,7 @@ class QueryTeleService_postImport_args class QueryTeleService_postImport_pargs { public: - virtual ~QueryTeleService_postImport_pargs() throw() - { - } + virtual ~QueryTeleService_postImport_pargs() throw() = default; const ImportTele* query; @@ -327,13 +289,9 @@ class QueryTeleService_postImport_pargs class QueryTeleService_postImport_result { public: - QueryTeleService_postImport_result() - { - } + QueryTeleService_postImport_result() = default; - virtual ~QueryTeleService_postImport_result() throw() - { - } + virtual ~QueryTeleService_postImport_result() throw() = default; bool operator==(const QueryTeleService_postImport_result& /* rhs */) const { @@ -353,9 +311,7 @@ class QueryTeleService_postImport_result class QueryTeleService_postImport_presult { public: - virtual ~QueryTeleService_postImport_presult() throw() - { - } + virtual ~QueryTeleService_postImport_presult() throw() = default; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; @@ -363,7 +319,7 @@ class QueryTeleService_postImport_presult class QueryTeleServiceClient : virtual public QueryTeleServiceIf { public: - QueryTeleServiceClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) + explicit QueryTeleServiceClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : piprot_(prot), poprot_(prot) { iprot_ = prot.get(); @@ -384,13 +340,13 @@ class QueryTeleServiceClient : virtual public QueryTeleServiceIf { return poprot_; } - void postQuery(const QueryTele& query); + void postQuery(const QueryTele& query) override; void send_postQuery(const QueryTele& query); void recv_postQuery(); - void postStep(const StepTele& query); + void postStep(const StepTele& query) override; void send_postStep(const StepTele& query); void recv_postStep(); - void postImport(const ImportTele& query); + void postImport(const ImportTele& query) override; void send_postImport(const ImportTele& query); void recv_postImport(); @@ -405,9 +361,9 @@ class QueryTeleServiceProcessor : public ::apache::thrift::TDispatchProcessor { protected: std::shared_ptr iface_; - virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, - ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, - int32_t seqid, void* callContext); + bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, + ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, + void* callContext) override; private: typedef void (QueryTeleServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, @@ -422,28 +378,27 @@ class QueryTeleServiceProcessor : public ::apache::thrift::TDispatchProcessor ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - QueryTeleServiceProcessor(std::shared_ptr iface) : iface_(iface) + explicit QueryTeleServiceProcessor(std::shared_ptr iface) : iface_(iface) { processMap_["postQuery"] = &QueryTeleServiceProcessor::process_postQuery; processMap_["postStep"] = &QueryTeleServiceProcessor::process_postStep; processMap_["postImport"] = &QueryTeleServiceProcessor::process_postImport; } - virtual ~QueryTeleServiceProcessor() - { - } + ~QueryTeleServiceProcessor() override = default; }; class QueryTeleServiceProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - QueryTeleServiceProcessorFactory(const ::std::shared_ptr& handlerFactory) + explicit QueryTeleServiceProcessorFactory( + const ::std::shared_ptr& handlerFactory) : handlerFactory_(handlerFactory) { } ::std::shared_ptr< ::apache::thrift::TProcessor> getProcessor( - const ::apache::thrift::TConnectionInfo& connInfo); + const ::apache::thrift::TConnectionInfo& connInfo) override; protected: ::std::shared_ptr handlerFactory_; @@ -452,25 +407,22 @@ class QueryTeleServiceProcessorFactory : public ::apache::thrift::TProcessorFact class QueryTeleServiceMultiface : virtual public QueryTeleServiceIf { public: - QueryTeleServiceMultiface(std::vector >& ifaces) : ifaces_(ifaces) - { - } - virtual ~QueryTeleServiceMultiface() + explicit QueryTeleServiceMultiface(std::vector >& ifaces) + : ifaces_(ifaces) { } + ~QueryTeleServiceMultiface() override = default; protected: std::vector > ifaces_; - QueryTeleServiceMultiface() - { - } + QueryTeleServiceMultiface() = default; void add(std::shared_ptr iface) { ifaces_.push_back(iface); } public: - void postQuery(const QueryTele& query) + void postQuery(const QueryTele& query) override { size_t sz = ifaces_.size(); size_t i = 0; @@ -483,7 +435,7 @@ class QueryTeleServiceMultiface : virtual public QueryTeleServiceIf ifaces_[i]->postQuery(query); } - void postStep(const StepTele& query) + void postStep(const StepTele& query) override { size_t sz = ifaces_.size(); size_t i = 0; @@ -496,7 +448,7 @@ class QueryTeleServiceMultiface : virtual public QueryTeleServiceIf ifaces_[i]->postStep(query); } - void postImport(const ImportTele& query) + void postImport(const ImportTele& query) override { size_t sz = ifaces_.size(); size_t i = 0; diff --git a/utils/querytele/querystepparms.h b/utils/querytele/querystepparms.h index 656f86ede..222ae7b75 100644 --- a/utils/querytele/querystepparms.h +++ b/utils/querytele/querystepparms.h @@ -27,9 +27,7 @@ class QueryStepParms explicit QueryStepParms(StepTeleStats::StepType st = StepTeleStats::T_INVALID) : stepType(st) { } - ~QueryStepParms() - { - } + ~QueryStepParms() = default; StepTeleStats::StepType stepType; diff --git a/utils/querytele/querytele_types.h b/utils/querytele/querytele_types.h index e4d52e695..dfd2816e9 100644 --- a/utils/querytele/querytele_types.h +++ b/utils/querytele/querytele_types.h @@ -11,7 +11,6 @@ #include #include - namespace querytele { struct QTType @@ -176,9 +175,7 @@ class QueryTele { } - virtual ~QueryTele() throw() - { - } + virtual ~QueryTele() throw() = default; std::string query_uuid; QTType::type msg_type; @@ -569,9 +566,7 @@ class StepTele { } - virtual ~StepTele() throw() - { - } + virtual ~StepTele() throw() = default; std::string query_uuid; STType::type msg_type; @@ -807,9 +802,7 @@ class ImportTele { } - virtual ~ImportTele() throw() - { - } + virtual ~ImportTele() throw() = default; std::string job_uuid; std::string import_uuid; diff --git a/utils/querytele/queryteleclient.h b/utils/querytele/queryteleclient.h index c2d0fa9d5..9f9670be1 100644 --- a/utils/querytele/queryteleclient.h +++ b/utils/querytele/queryteleclient.h @@ -35,7 +35,7 @@ class QueryTeleProtoImpl; class QueryTeleClient { public: - QueryTeleClient() : fProtoImpl(0) + QueryTeleClient() : fProtoImpl(nullptr) { } EXPORT explicit QueryTeleClient(const QueryTeleServerParms&); diff --git a/utils/querytele/queryteleprotoimpl.cpp b/utils/querytele/queryteleprotoimpl.cpp index 0ced86620..d5b5e9e7e 100644 --- a/utils/querytele/queryteleprotoimpl.cpp +++ b/utils/querytele/queryteleprotoimpl.cpp @@ -23,12 +23,15 @@ using namespace std; #define BOOST_DISABLE_ASSERTS #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsuggest-override" #include "thrift/transport/TSocket.h" #include "thrift/transport/TBufferTransports.h" namespace att = apache::thrift::transport; #include "thrift/protocol/TBinaryProtocol.h" namespace atp = apache::thrift::protocol; +#pragma GCC diagnostic pop #include "atomicops.h" @@ -92,8 +95,7 @@ string get_trace_file() void log_query(const querytele::QueryTele& qtdata) { ofstream trace(get_trace_file().c_str(), ios::out | ios::app); - trace << "Query," << qtdata.query_uuid << "," - << ","; // skip step uuid + trace << "Query," << qtdata.query_uuid << "," << ","; // skip step uuid if (qtdata.msg_type == querytele::QTType::QT_SUMMARY) trace << "SUMMARY,"; diff --git a/utils/querytele/queryteleprotoimpl.h b/utils/querytele/queryteleprotoimpl.h index a5309eec0..34f31e452 100644 --- a/utils/querytele/queryteleprotoimpl.h +++ b/utils/querytele/queryteleprotoimpl.h @@ -25,9 +25,7 @@ class QueryTeleProtoImpl { public: explicit QueryTeleProtoImpl(const QueryTeleServerParms&); - ~QueryTeleProtoImpl() - { - } + ~QueryTeleProtoImpl() = default; int enqStepTele(const StepTele&); int enqImportTele(const ImportTele&); diff --git a/utils/querytele/queryteleserverparms.h b/utils/querytele/queryteleserverparms.h index f5c268816..fe09891b8 100644 --- a/utils/querytele/queryteleserverparms.h +++ b/utils/querytele/queryteleserverparms.h @@ -30,9 +30,7 @@ class QueryTeleServerParms QueryTeleServerParms(const std::string h, int p) : host(h), port(p) { } - ~QueryTeleServerParms() - { - } + ~QueryTeleServerParms() = default; std::string host; int port; diff --git a/utils/querytele/telestats.h b/utils/querytele/telestats.h index 23d207c34..026027c00 100644 --- a/utils/querytele/telestats.h +++ b/utils/querytele/telestats.h @@ -60,9 +60,7 @@ struct QueryTeleStats query_uuid = boost::uuids::nil_generator()(); } - ~QueryTeleStats() - { - } + ~QueryTeleStats() = default; boost::uuids::uuid query_uuid; QTType msg_type; @@ -138,9 +136,7 @@ struct StepTeleStats step_uuid = boost::uuids::nil_generator()(); } - ~StepTeleStats() - { - } + ~StepTeleStats() = default; boost::uuids::uuid query_uuid; STType msg_type; diff --git a/utils/regr/corr.h b/utils/regr/corr.h index 7a8bba083..7900c5444 100644 --- a/utils/regr/corr.h +++ b/utils/regr/corr.h @@ -50,19 +50,19 @@ class corr : public mcsv1_UDAF public: // Defaults OK corr() : mcsv1_UDAF(){}; - virtual ~corr(){}; + ~corr() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/covar_pop.h b/utils/regr/covar_pop.h index 43a9daecc..b8d5a0a50 100644 --- a/utils/regr/covar_pop.h +++ b/utils/regr/covar_pop.h @@ -50,19 +50,19 @@ class covar_pop : public mcsv1_UDAF public: // Defaults OK covar_pop() : mcsv1_UDAF(){}; - virtual ~covar_pop(){}; + ~covar_pop() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/covar_samp.h b/utils/regr/covar_samp.h index 0da83f2e2..d78d662c0 100644 --- a/utils/regr/covar_samp.h +++ b/utils/regr/covar_samp.h @@ -50,19 +50,19 @@ class covar_samp : public mcsv1_UDAF public: // Defaults OK covar_samp() : mcsv1_UDAF(){}; - virtual ~covar_samp(){}; + ~covar_samp() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/moda.h b/utils/regr/moda.h index 6d5916ac0..7f3641de7 100644 --- a/utils/regr/moda.h +++ b/utils/regr/moda.h @@ -55,7 +55,9 @@ namespace mcsv1sdk template struct hasher { - hasher(uint32_t cs_num){} + explicit hasher(uint32_t cs_num) + { + } inline size_t operator()(T val) const { @@ -70,7 +72,9 @@ struct hasher template <> struct hasher { - hasher(uint32_t cs_num){} + explicit hasher(uint32_t cs_num) + { + } inline size_t operator()(long double val) const { #ifdef MASK_LONGDOUBLE @@ -86,23 +90,27 @@ struct hasher }; // A collation aware hasher for strings -template<> +template <> struct hasher { - hasher(uint32_t cs_num) : fHasher(cs_num){} + explicit hasher(uint32_t cs_num) : fHasher(cs_num) + { + } inline size_t operator()(string val) const { return fHasher(val.c_str(), val.size()); } -private: - datatypes::CollationAwareHasher fHasher; + private: + datatypes::CollationAwareHasher fHasher; }; -template +template struct comparator { - comparator(uint32_t cs_num){} + explicit comparator(uint32_t cs_num) + { + } bool operator()(const T& lhs, const T& rhs) const { @@ -113,35 +121,38 @@ struct comparator template <> struct comparator { - comparator(uint32_t cs_num) : fCs(cs_num) {} + explicit comparator(uint32_t cs_num) : fCs(cs_num) + { + } bool operator()(const std::string lhs, const std::string rhs) const { return fCs.eq(lhs, rhs); } + private: datatypes::Charset fCs; }; - - // Override UserData for data storage struct ModaData : public UserData { - ModaData(uint32_t cs_num = 8) - : fMap(NULL) + explicit ModaData(uint32_t cs_num = 8) + : fMap(nullptr) , fReturnType((uint32_t)execplan::CalpontSystemCatalog::UNDEFINED) , fColWidth(0) - , modaImpl(NULL) - , fCs_num(cs_num){} + , modaImpl(nullptr) + , fCs_num(cs_num) + { + } - virtual ~ModaData() + ~ModaData() override { cleanup(); } - virtual void serialize(messageqcpp::ByteStream& bs) const; - virtual void unserialize(messageqcpp::ByteStream& bs); + void serialize(messageqcpp::ByteStream& bs) const override; + void unserialize(messageqcpp::ByteStream& bs) override; template std::unordered_map, comparator >* getMap() @@ -149,8 +160,8 @@ struct ModaData : public UserData if (!fMap) { // Just in time creation - fMap = new std::unordered_map, comparator >( - 10, hasher(fCs_num), comparator(fCs_num)); + fMap = new std::unordered_map, comparator >(10, hasher(fCs_num), + comparator(fCs_num)); } return (std::unordered_map, comparator >*)fMap; } @@ -169,7 +180,7 @@ struct ModaData : public UserData if (fMap) { delete (std::unordered_map, comparator >*)fMap; - fMap = NULL; + fMap = nullptr; } } @@ -192,7 +203,7 @@ struct ModaData : public UserData private: // For now, copy construction is unwanted - ModaData(UserData&); + explicit ModaData(UserData&); void cleanup(); @@ -243,45 +254,46 @@ class Moda_impl_T : public mcsv1_UDAF { public: // Defaults OK - Moda_impl_T(){}; - virtual ~Moda_impl_T(){}; + Moda_impl_T() = default; + ~Moda_impl_T() override = default; - virtual mcsv1_UDAF::ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + mcsv1_UDAF::ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual mcsv1_UDAF::ReturnCode reset(mcsv1Context* context); - virtual mcsv1_UDAF::ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); - virtual mcsv1_UDAF::ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); - virtual mcsv1_UDAF::ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); - virtual mcsv1_UDAF::ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + mcsv1_UDAF::ReturnCode reset(mcsv1Context* context) override; + mcsv1_UDAF::ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; + mcsv1_UDAF::ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; + mcsv1_UDAF::ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; + mcsv1_UDAF::ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; // Dummy: not used - virtual mcsv1_UDAF::ReturnCode createUserData(UserData*& userData, int32_t& length) + mcsv1_UDAF::ReturnCode createUserData(UserData*& userData, int32_t& length) override { return mcsv1_UDAF::SUCCESS; } }; -template<> // string specialization +template <> // string specialization class Moda_impl_T : public mcsv1_UDAF { public: // Defaults OK - Moda_impl_T() : cs(8) {}; - virtual ~Moda_impl_T() {}; + Moda_impl_T() : cs(8){}; + ~Moda_impl_T() override = default; - virtual mcsv1_UDAF::ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + mcsv1_UDAF::ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual mcsv1_UDAF::ReturnCode reset(mcsv1Context* context); - virtual mcsv1_UDAF::ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); - virtual mcsv1_UDAF::ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); - virtual mcsv1_UDAF::ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); - virtual mcsv1_UDAF::ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + mcsv1_UDAF::ReturnCode reset(mcsv1Context* context) override; + mcsv1_UDAF::ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; + mcsv1_UDAF::ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; + mcsv1_UDAF::ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; + mcsv1_UDAF::ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; // Dummy: not used - virtual mcsv1_UDAF::ReturnCode createUserData(UserData*& userData, int32_t& length) + mcsv1_UDAF::ReturnCode createUserData(UserData*& userData, int32_t& length) override { return mcsv1_UDAF::SUCCESS; } + private: datatypes::Charset cs; }; @@ -294,36 +306,36 @@ class moda : public mcsv1_UDAF public: // Defaults OK moda() : mcsv1_UDAF(){}; - virtual ~moda(){}; + ~moda() override = default; - virtual mcsv1_UDAF::ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + mcsv1_UDAF::ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context) + ReturnCode reset(mcsv1Context* context) override { return getImpl(context)->reset(context); } - virtual mcsv1_UDAF::ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) + mcsv1_UDAF::ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override { return getImpl(context)->nextValue(context, valsIn); } - virtual mcsv1_UDAF::ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) + mcsv1_UDAF::ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override { return getImpl(context)->subEvaluate(context, valIn); } - virtual mcsv1_UDAF::ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) + mcsv1_UDAF::ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override { return getImpl(context)->evaluate(context, valOut); } - virtual mcsv1_UDAF::ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) + mcsv1_UDAF::ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override { return getImpl(context)->dropValue(context, valsDropped); } - mcsv1_UDAF::ReturnCode createUserData(UserData*& userData, int32_t& length) + mcsv1_UDAF::ReturnCode createUserData(UserData*& userData, int32_t& length) override { userData = new ModaData; length = sizeof(ModaData); diff --git a/utils/regr/regr_avgx.h b/utils/regr/regr_avgx.h index 6dd8e268d..b6b4e1190 100644 --- a/utils/regr/regr_avgx.h +++ b/utils/regr/regr_avgx.h @@ -60,19 +60,19 @@ class regr_avgx : public mcsv1_UDAF public: // Defaults OK regr_avgx() : mcsv1_UDAF(){}; - virtual ~regr_avgx(){}; + ~regr_avgx() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_avgy.h b/utils/regr/regr_avgy.h index 483b0f2db..849c86f35 100644 --- a/utils/regr/regr_avgy.h +++ b/utils/regr/regr_avgy.h @@ -50,19 +50,19 @@ class regr_avgy : public mcsv1_UDAF public: // Defaults OK regr_avgy() : mcsv1_UDAF(){}; - virtual ~regr_avgy(){}; + ~regr_avgy() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_count.h b/utils/regr/regr_count.h index 1286a5c11..feccfd2b9 100644 --- a/utils/regr/regr_count.h +++ b/utils/regr/regr_count.h @@ -50,19 +50,19 @@ class regr_count : public mcsv1_UDAF public: // Defaults OK regr_count() : mcsv1_UDAF(){}; - virtual ~regr_count(){}; + ~regr_count() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_intercept.h b/utils/regr/regr_intercept.h index ffbc55534..2a8f1d3ac 100644 --- a/utils/regr/regr_intercept.h +++ b/utils/regr/regr_intercept.h @@ -50,19 +50,19 @@ class regr_intercept : public mcsv1_UDAF public: // Defaults OK regr_intercept() : mcsv1_UDAF(){}; - virtual ~regr_intercept(){}; + ~regr_intercept() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_r2.h b/utils/regr/regr_r2.h index 23f3d2fd5..4d7fb4d74 100644 --- a/utils/regr/regr_r2.h +++ b/utils/regr/regr_r2.h @@ -50,19 +50,19 @@ class regr_r2 : public mcsv1_UDAF public: // Defaults OK regr_r2() : mcsv1_UDAF(){}; - virtual ~regr_r2(){}; + ~regr_r2() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_slope.h b/utils/regr/regr_slope.h index 1a69f99ef..541571a75 100644 --- a/utils/regr/regr_slope.h +++ b/utils/regr/regr_slope.h @@ -50,19 +50,19 @@ class regr_slope : public mcsv1_UDAF public: // Defaults OK regr_slope() : mcsv1_UDAF(){}; - virtual ~regr_slope(){}; + ~regr_slope() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_sxx.h b/utils/regr/regr_sxx.h index 96f14a250..883e57d3e 100644 --- a/utils/regr/regr_sxx.h +++ b/utils/regr/regr_sxx.h @@ -50,19 +50,19 @@ class regr_sxx : public mcsv1_UDAF public: // Defaults OK regr_sxx() : mcsv1_UDAF(){}; - virtual ~regr_sxx(){}; + ~regr_sxx() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_sxy.h b/utils/regr/regr_sxy.h index 91418bec5..da1262c55 100644 --- a/utils/regr/regr_sxy.h +++ b/utils/regr/regr_sxy.h @@ -50,19 +50,19 @@ class regr_sxy : public mcsv1_UDAF public: // Defaults OK regr_sxy() : mcsv1_UDAF(){}; - virtual ~regr_sxy(){}; + ~regr_sxy() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/regr/regr_syy.h b/utils/regr/regr_syy.h index 7e017c637..2b8e0c035 100644 --- a/utils/regr/regr_syy.h +++ b/utils/regr/regr_syy.h @@ -50,19 +50,19 @@ class regr_syy : public mcsv1_UDAF public: // Defaults OK regr_syy() : mcsv1_UDAF(){}; - virtual ~regr_syy(){}; + ~regr_syy() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/rowgroup/rowaggregation.h b/utils/rowgroup/rowaggregation.h index ebbd433bb..3c6ac0695 100644 --- a/utils/rowgroup/rowaggregation.h +++ b/utils/rowgroup/rowaggregation.h @@ -357,11 +357,11 @@ class GroupConcatAg explicit GroupConcatAg(SP_GroupConcat&); virtual ~GroupConcatAg(); - virtual void initialize(){}; - virtual void processRow(const rowgroup::Row&){}; - virtual void merge(const rowgroup::Row&, uint64_t){}; + virtual void initialize() {}; + virtual void processRow(const rowgroup::Row&) {}; + virtual void merge(const rowgroup::Row&, uint64_t) {}; - uint8_t* getResult() + virtual uint8_t* getResult() { return nullptr; } @@ -392,7 +392,8 @@ class RowAggregation : public messageqcpp::Serializeable RowAggregation(); RowAggregation(const std::vector& rowAggGroupByCols, const std::vector& rowAggFunctionCols, - joblist::ResourceManager* rm = nullptr, boost::shared_ptr sessMemLimit = {}, bool withRollup = false); + joblist::ResourceManager* rm = nullptr, boost::shared_ptr sessMemLimit = {}, + bool withRollup = false); RowAggregation(const RowAggregation& rhs); /** @brief RowAggregation default destructor @@ -426,9 +427,15 @@ class RowAggregation : public messageqcpp::Serializeable initialize(); } - void clearRollup() { fRollupFlag = false; } + void clearRollup() + { + fRollupFlag = false; + } - bool hasRollup() const { return fRollupFlag; } + bool hasRollup() const + { + return fRollupFlag; + } /** @brief Define content of data to be joined * @@ -640,9 +647,9 @@ class RowAggregation : public messageqcpp::Serializeable std::unique_ptr fCurRGData; bool fRollupFlag = false; - std::string fTmpDir = config::Config::makeConfig()->getTempFileDir(config::Config::TempDirPurpose::Aggregates); + std::string fTmpDir = + config::Config::makeConfig()->getTempFileDir(config::Config::TempDirPurpose::Aggregates); std::string fCompStr = config::Config::makeConfig()->getConfig("RowAggregation", "Compression"); - }; //------------------------------------------------------------------------------ @@ -655,9 +662,7 @@ class RowAggregationUM : public RowAggregation public: /** @brief RowAggregationUM constructor */ - RowAggregationUM() - { - } + RowAggregationUM() = default; RowAggregationUM(const std::vector& rowAggGroupByCols, const std::vector& rowAggFunctionCols, joblist::ResourceManager*, boost::shared_ptr sessionMemLimit, bool withRollup); @@ -831,9 +836,7 @@ class RowAggregationUMP2 : public RowAggregationUM public: /** @brief RowAggregationUM constructor */ - RowAggregationUMP2() - { - } + RowAggregationUMP2() = default; RowAggregationUMP2(const std::vector& rowAggGroupByCols, const std::vector& rowAggFunctionCols, joblist::ResourceManager*, boost::shared_ptr sessionMemLimit, bool withRollup); @@ -873,9 +876,7 @@ class RowAggregationDistinct : public RowAggregationUMP2 public: /** @brief RowAggregationDistinct constructor */ - RowAggregationDistinct() - { - } + RowAggregationDistinct() = default; RowAggregationDistinct(const std::vector& rowAggGroupByCols, const std::vector& rowAggFunctionCols, joblist::ResourceManager*, boost::shared_ptr sessionMemLimit); @@ -940,9 +941,7 @@ class RowAggregationSubDistinct : public RowAggregationUM public: /** @brief RowAggregationSubDistinct constructor */ - RowAggregationSubDistinct() - { - } + RowAggregationSubDistinct() = default; RowAggregationSubDistinct(const std::vector& rowAggGroupByCols, const std::vector& rowAggFunctionCols, joblist::ResourceManager*, boost::shared_ptr sessionMemLimit); @@ -981,9 +980,7 @@ class RowAggregationMultiDistinct : public RowAggregationDistinct public: /** @brief RowAggregationMultiDistinct constructor */ - RowAggregationMultiDistinct() - { - } + RowAggregationMultiDistinct() = default; RowAggregationMultiDistinct(const std::vector& rowAggGroupByCols, const std::vector& rowAggFunctionCols, joblist::ResourceManager*, boost::shared_ptr sessionMemLimit); diff --git a/utils/rowgroup/rowgroup.h b/utils/rowgroup/rowgroup.h index 927dc3c7e..d8d7cedab 100644 --- a/utils/rowgroup/rowgroup.h +++ b/utils/rowgroup/rowgroup.h @@ -39,7 +39,6 @@ #include #include - #include "hasher.h" #include "joblisttypes.h" @@ -54,7 +53,7 @@ #include "collation.h" #include "common/hashfamily.h" -#include "stdlib.h" +#include #include "execinfo.h" // Workaround for my_global.h #define of isnan(X) causing a std::std namespace @@ -144,12 +143,12 @@ class StringStore // returns the offset. // it may receive nullptr as data and it is proper way to store NULL values. uint64_t storeString(const uint8_t* data, uint32_t length); - //please note getPointer can return nullptr. + // please note getPointer can return nullptr. inline const uint8_t* getPointer(uint64_t offset) const; inline uint32_t getStringLength(uint64_t offset) const; inline utils::ConstString getConstString(uint64_t offset) const { - return utils::ConstString((const char*)getPointer(offset), getStringLength(offset)); + return {(const char*)getPointer(offset), getStringLength(offset)}; } inline bool isEmpty() const; inline uint64_t getSize() const; @@ -223,7 +222,6 @@ class UserDataStore UserDataStore& operator=(const UserDataStore&) = delete; UserDataStore& operator=(UserDataStore&&) = delete; - void serialize(messageqcpp::ByteStream&) const; void deserialize(messageqcpp::ByteStream&); @@ -244,14 +242,12 @@ class UserDataStore boost::shared_ptr getUserData(uint32_t offset) const; private: - std::vector vStoreData; bool fUseUserDataMutex = false; boost::mutex fMutex; }; - class RowGroup; class Row; @@ -268,8 +264,6 @@ class RGData RGData(RGData&&) = default; virtual ~RGData() = default; - - // amount should be the # returned by RowGroup::getDataSize() void serialize(messageqcpp::ByteStream&, RGDataSizeType amount) const; @@ -321,8 +315,8 @@ class RGData } private: - uint32_t rowSize = 0; // can't be. - uint32_t columnCount = 0; // shouldn't be, but... + uint32_t rowSize = 0; // can't be. + uint32_t columnCount = 0; // shouldn't be, but... std::shared_ptr rowData; std::shared_ptr strings; std::shared_ptr userDataStore; @@ -372,7 +366,7 @@ class Row inline uint32_t getColumnWidth(uint32_t colIndex) const; inline uint32_t getColumnCount() const; inline uint32_t getInternalSize() const; // this is only accurate if there is no string table - inline uint32_t getSize() const; // this is only accurate if there is no string table + inline uint32_t getSize() const; // this is only accurate if there is no string table // if a string table is being used, getRealSize() takes into account variable-length strings inline uint32_t getRealSize() const; inline uint32_t getOffset(uint32_t colIndex) const; @@ -484,7 +478,7 @@ class Row inline void setDoubleField(double val, uint32_t colIndex); inline void setFloatField(float val, uint32_t colIndex); - inline void setDecimalField(double val, uint32_t colIndex){}; // TODO: Do something here + inline void setDecimalField(double val, uint32_t colIndex) {}; // TODO: Do something here inline void setLongDoubleField(const long double& val, uint32_t colIndex); inline void setInt128Field(const int128_t& val, uint32_t colIndex); @@ -610,10 +604,10 @@ class Row const CHARSET_INFO* getCharset(uint32_t col) const; -private: - inline bool inStringTable(uint32_t col) const; + private: + inline bool inStringTable(uint32_t col) const; -private: + private: uint32_t columnCount = 0; uint64_t baseRid = 0; @@ -653,7 +647,7 @@ inline void Row::setPointer(const Pointer& p) { data = p.data; strings = p.strings; - bool hasStrings = (strings != 0); + bool hasStrings = (strings != nullptr); if (useStringTable != hasStrings) { @@ -699,7 +693,7 @@ inline uint32_t Row::getRealSize() const if (!useStringTable) return getSize(); - uint32_t ret = columnCount; // account for NULL flags. + uint32_t ret = columnCount; // account for NULL flags. for (uint32_t i = 0; i < columnCount; i++) { @@ -866,8 +860,7 @@ inline int64_t Row::getIntField(uint32_t colIndex) const case 8: return *((int64_t*)&data[offsets[colIndex]]); - default: - idbassert(0); throw std::logic_error("Row::getIntField(): bad length."); + default: idbassert(0); throw std::logic_error("Row::getIntField(): bad length."); } } @@ -1049,12 +1042,13 @@ inline void Row::setStringField(const utils::ConstString& str, uint32_t colIndex else { uint8_t* buf = &data[offsets[colIndex]]; - memset(buf + length, 0, offsets[colIndex + 1] - (offsets[colIndex] + length)); // needed for memcmp in equals(). + memset(buf + length, 0, + offsets[colIndex + 1] - (offsets[colIndex] + length)); // needed for memcmp in equals(). if (str.str()) { memcpy(buf, str.str(), length); } - else if (colWidth <= 8) // special magic value. + else if (colWidth <= 8) // special magic value. { setToNull(colIndex); } @@ -1481,7 +1475,7 @@ class RowGroup : public messageqcpp::Serializeable explicit RowGroup(messageqcpp::ByteStream& bs); - ~RowGroup(); + ~RowGroup() override; inline void initRow(Row*, bool forceInlineData = false) const; inline uint32_t getRowCount() const; @@ -1517,8 +1511,8 @@ class RowGroup : public messageqcpp::Serializeable void resetRowGroup(uint64_t baseRid); /* The Serializeable interface */ - void serialize(messageqcpp::ByteStream&) const; - void deserialize(messageqcpp::ByteStream&); + void serialize(messageqcpp::ByteStream&) const override; + void deserialize(messageqcpp::ByteStream&) override; uint32_t getColumnWidth(uint32_t col) const; uint32_t getColumnCount() const; @@ -1604,7 +1598,7 @@ class RowGroup : public messageqcpp::Serializeable std::vector oldOffsets; // inline data offsets std::vector stOffsets; // string table offsets - uint32_t* offsets = nullptr; // offsets either points to oldOffsets or stOffsets + uint32_t* offsets = nullptr; // offsets either points to oldOffsets or stOffsets std::vector colWidths; // oids: the real oid of the column, may have duplicates with alias. // This oid is necessary for front-end to decide the real column width. @@ -1714,7 +1708,7 @@ inline void RowGroup::setUseStringTable(bool b) { useStringTable = (b && hasLongStringField); // offsets = (useStringTable ? &stOffsets[0] : &oldOffsets[0]); - offsets = 0; + offsets = nullptr; if (useStringTable && !stOffsets.empty()) offsets = &stOffsets[0]; @@ -2053,7 +2047,6 @@ inline void copyRowInline(const Row& in, Row* out, uint32_t colCount) copyRow(in, out, colCount); } - inline utils::NullString StringStore::getString(uint64_t off) const { uint32_t length; @@ -2133,7 +2126,7 @@ inline const uint8_t* StringStore::getPointer(uint64_t off) const inline bool StringStore::isNullValue(uint64_t off) const { - if (off == std::numeric_limits::max()) + if (off == std::numeric_limits::max()) return true; return false; } diff --git a/utils/rwlock/rwlock.h b/utils/rwlock/rwlock.h index 575c8854f..6fafdc4ee 100644 --- a/utils/rwlock/rwlock.h +++ b/utils/rwlock/rwlock.h @@ -42,7 +42,13 @@ namespace rwlock { const std::array RWLockNames = {{ - "all", "VSS", "ExtentMap", "FreeList", "VBBM", "CopyLocks", "ExtentMapIndex", + "all", + "VSS", + "ExtentMap", + "FreeList", + "VBBM", + "CopyLocks", + "ExtentMapIndex", }}; /// the layout of the shmseg @@ -70,7 +76,9 @@ struct LockState class RWLockShmImpl { public: - static RWLockShmImpl* makeRWLockShmImpl(int key, bool* excl = 0); + ~RWLockShmImpl() = delete; + + static RWLockShmImpl* makeRWLockShmImpl(int key, bool* excl = nullptr); boost::interprocess::shared_memory_object fStateShm; boost::interprocess::mapped_region fRegion; @@ -83,7 +91,6 @@ class RWLockShmImpl private: explicit RWLockShmImpl(int key, bool excl = false); - ~RWLockShmImpl(); RWLockShmImpl(const RWLockShmImpl& rhs); RWLockShmImpl& operator=(const RWLockShmImpl& rhs); std::string fKeyString; @@ -92,7 +99,7 @@ class RWLockShmImpl class not_excl : public std::exception { public: - virtual const char* what() const throw() + const char* what() const noexcept override { return "not_excl"; } @@ -101,7 +108,7 @@ class not_excl : public std::exception class wouldblock : public std::exception { public: - virtual const char* what() const throw() + const char* what() const noexcept override { return "wouldblock"; } @@ -143,7 +150,7 @@ class RWLock * this is not the first instance, it will throw not_excl. The intent * is similar to the IPC_EXCL flag in the sem/shm implementations. */ - EXPORT explicit RWLock(int key, bool* excl = 0); + EXPORT explicit RWLock(int key, bool* excl = nullptr); EXPORT ~RWLock(); @@ -184,7 +191,7 @@ class RWLock * a non-NULL LockState struct. This is a specialization for supporting * the RWLockMonitor class. */ - EXPORT bool timed_write_lock(const struct timespec& ts, struct LockState* state = 0); + EXPORT bool timed_write_lock(const struct timespec& ts, struct LockState* state = nullptr); /** @brief Release a write lock. * @@ -262,4 +269,3 @@ class RWLock } // namespace rwlock #undef EXPORT - diff --git a/utils/rwlock/rwlock_local.h b/utils/rwlock/rwlock_local.h index bce1b7c88..c02fa6b98 100644 --- a/utils/rwlock/rwlock_local.h +++ b/utils/rwlock/rwlock_local.h @@ -57,7 +57,7 @@ class RWLock_local class not_excl : public std::exception { public: - virtual const char* what() const throw() + const char* what() const noexcept override { return "not_excl"; } @@ -66,7 +66,7 @@ class RWLock_local class wouldblock : public std::exception { public: - virtual const char* what() const throw() + const char* what() const noexcept override { return "wouldblock"; } @@ -172,10 +172,9 @@ class ScopedRWLock_local void unlock(); private: - explicit ScopedRWLock_local() - { - } - explicit ScopedRWLock_local(const ScopedRWLock_local&) + explicit ScopedRWLock_local() = default; + + ScopedRWLock_local(const ScopedRWLock_local&) { } ScopedRWLock_local& operator=(const ScopedRWLock_local&) diff --git a/utils/udfsdk/allnull.h b/utils/udfsdk/allnull.h index 497cf985a..31cbff06d 100644 --- a/utils/udfsdk/allnull.h +++ b/utils/udfsdk/allnull.h @@ -71,7 +71,7 @@ class allnull : public mcsv1_UDAF public: // Defaults OK allnull() : mcsv1_UDAF(){}; - virtual ~allnull(){}; + ~allnull() override = default; /** * init() @@ -91,7 +91,7 @@ class allnull : public mcsv1_UDAF * colTypes or wrong number of arguments. Else return * mcsv1_UDAF::SUCCESS. */ - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; /** * reset() @@ -106,7 +106,7 @@ class allnull : public mcsv1_UDAF * * Use this opportunity to initialize the userData. */ - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; /** * nextValue() @@ -126,7 +126,7 @@ class allnull : public mcsv1_UDAF * * valsIn (in) - a vector of the parameters from the row. */ - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; /** * subEvaluate() @@ -153,7 +153,7 @@ class allnull : public mcsv1_UDAF * as seen in the last call to NextValue for a given PM. * */ - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn) override; /** * evaluate() @@ -174,11 +174,9 @@ class allnull : public mcsv1_UDAF * * To return a NULL value, don't assign to valOut. */ - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); - - protected: + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; }; -}; // namespace mcsv1sdk +} // namespace mcsv1sdk #undef EXPORT diff --git a/utils/udfsdk/avg_mode.h b/utils/udfsdk/avg_mode.h index 023522bbd..ca858f39e 100644 --- a/utils/udfsdk/avg_mode.h +++ b/utils/udfsdk/avg_mode.h @@ -71,20 +71,18 @@ typedef std::tr1::unordered_map MODE_DATA; // Override UserData for data storage struct ModeData : public UserData { - ModeData(){}; + ModeData() = default; - virtual ~ModeData() - { - } + ~ModeData() override = default; - virtual void serialize(messageqcpp::ByteStream& bs) const; - virtual void unserialize(messageqcpp::ByteStream& bs); + void serialize(messageqcpp::ByteStream& bs) const override; + void unserialize(messageqcpp::ByteStream& bs) override; MODE_DATA mData; private: // For now, copy construction is unwanted - ModeData(UserData&); + explicit ModeData(UserData&); }; // Override mcsv1_UDAF to build your User Defined Aggregate (UDAF) and/or @@ -104,7 +102,7 @@ class avg_mode : public mcsv1_UDAF public: // Defaults OK avg_mode() : mcsv1_UDAF(){}; - virtual ~avg_mode(){}; + ~avg_mode() override = default; /** * init() @@ -124,7 +122,7 @@ class avg_mode : public mcsv1_UDAF * colTypes or wrong number of arguments. Else return * mcsv1_UDAF::SUCCESS. */ - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; /** * reset() @@ -139,7 +137,7 @@ class avg_mode : public mcsv1_UDAF * * Use this opportunity to initialize the userData. */ - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; /** * nextValue() @@ -159,7 +157,7 @@ class avg_mode : public mcsv1_UDAF * * valsIn (in) - a vector of the parameters from the row. */ - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; /** * subEvaluate() @@ -186,7 +184,7 @@ class avg_mode : public mcsv1_UDAF * as seen in the last call to NextValue for a given PM. * */ - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; /** * evaluate() @@ -207,7 +205,7 @@ class avg_mode : public mcsv1_UDAF * * To return a NULL value, don't assign to valOut. */ - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; /** * dropValue() @@ -235,7 +233,7 @@ class avg_mode : public mcsv1_UDAF * dropValue() will not be called for unbounded/current row type * frames, as those are already optimized. */ - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; /** * createUserData() @@ -260,11 +258,11 @@ class avg_mode : public mcsv1_UDAF * memory leaks are your fault. * */ - virtual ReturnCode createUserData(UserData*& data, int32_t& length); + ReturnCode createUserData(UserData*& data, int32_t& length) override; protected: }; -}; // namespace mcsv1sdk +} // namespace mcsv1sdk #undef EXPORT diff --git a/utils/udfsdk/avgx.h b/utils/udfsdk/avgx.h index 7b2129c1f..6ef970787 100644 --- a/utils/udfsdk/avgx.h +++ b/utils/udfsdk/avgx.h @@ -61,19 +61,19 @@ class avgx : public mcsv1_UDAF public: // Defaults OK avgx() : mcsv1_UDAF(){}; - virtual ~avgx(){}; + ~avgx() override = default; - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/udfsdk/distinct_count.h b/utils/udfsdk/distinct_count.h index 695d99ff0..b88e677d3 100644 --- a/utils/udfsdk/distinct_count.h +++ b/utils/udfsdk/distinct_count.h @@ -70,7 +70,7 @@ class distinct_count : public mcsv1_UDAF public: // Defaults OK distinct_count() : mcsv1_UDAF(){}; - virtual ~distinct_count(){}; + ~distinct_count() override = default; /** * init() @@ -90,7 +90,7 @@ class distinct_count : public mcsv1_UDAF * colTypes or wrong number of arguments. Else return * mcsv1_UDAF::SUCCESS. */ - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; /** * reset() @@ -105,7 +105,7 @@ class distinct_count : public mcsv1_UDAF * * Use this opportunity to initialize the userData. */ - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; /** * nextValue() @@ -125,7 +125,7 @@ class distinct_count : public mcsv1_UDAF * * valsIn (in) - a vector of the parameters from the row. */ - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; /** * subEvaluate() @@ -152,7 +152,7 @@ class distinct_count : public mcsv1_UDAF * as seen in the last call to NextValue for a given PM. * */ - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn) override; /** * evaluate() @@ -173,7 +173,7 @@ class distinct_count : public mcsv1_UDAF * * To return a NULL value, don't assign to valOut. */ - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; /** * dropValue() @@ -201,7 +201,7 @@ class distinct_count : public mcsv1_UDAF * dropValue() will not be called for unbounded/current row type * frames, as those are already optimized. */ - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/udfsdk/mcsv1_udaf.h b/utils/udfsdk/mcsv1_udaf.h index 9fbc56547..ea949b71e 100644 --- a/utils/udfsdk/mcsv1_udaf.h +++ b/utils/udfsdk/mcsv1_udaf.h @@ -100,9 +100,9 @@ typedef std::tr1::unordered_map UDAF_MAP; class UDAFMap { public: - EXPORT UDAFMap(){}; + EXPORT UDAFMap() = default; - EXPORT ~UDAFMap(){}; + EXPORT ~UDAFMap() = default; static EXPORT UDAF_MAP& getMap(); @@ -129,8 +129,8 @@ class mcsv1Context; struct UserData { - UserData() : size(0), data(NULL){}; - UserData(size_t sz) + UserData() : size(0), data(nullptr){}; + explicit UserData(size_t sz) { size = sz; data = new uint8_t[sz]; @@ -468,8 +468,8 @@ class mcsv1_UDAF NOT_IMPLEMENTED = 2 // User UDA(n)F shouldn't return this }; // Defaults OK - mcsv1_UDAF(){}; - virtual ~mcsv1_UDAF(){}; + mcsv1_UDAF() = default; + virtual ~mcsv1_UDAF() = default; /** * init() @@ -667,19 +667,19 @@ inline mcsv1Context::mcsv1Context() , fColWidth(0) , fResultscale(0) , fResultPrecision(18) - , dataFlags(NULL) - , bInterrupted(NULL) + , dataFlags(nullptr) + , bInterrupted(nullptr) , fStartFrame(execplan::WF_UNBOUNDED_PRECEDING) , fEndFrame(execplan::WF_CURRENT_ROW) , fStartConstant(0) , fEndConstant(0) - , func(NULL) + , func(nullptr) , fParamCount(0) , fCharsetNumber(8) // Latin1 { } -inline mcsv1Context::mcsv1Context(const mcsv1Context& rhs) : dataFlags(NULL) +inline mcsv1Context::mcsv1Context(const mcsv1Context& rhs) : dataFlags(nullptr) { copy(rhs); } @@ -703,13 +703,11 @@ inline mcsv1Context& mcsv1Context::copy(const mcsv1Context& rhs) return *this; } -inline mcsv1Context::~mcsv1Context() -{ -} +inline mcsv1Context::~mcsv1Context() = default; inline mcsv1Context& mcsv1Context::operator=(const mcsv1Context& rhs) { - dataFlags = NULL; + dataFlags = nullptr; return copy(rhs); } diff --git a/utils/udfsdk/median.h b/utils/udfsdk/median.h index 710411f95..bb8b544a9 100644 --- a/utils/udfsdk/median.h +++ b/utils/udfsdk/median.h @@ -71,20 +71,18 @@ typedef std::map MEDIAN_DATA; // Override UserData for data storage struct MedianData : public UserData { - MedianData(){}; + MedianData() = default; - virtual ~MedianData() - { - } + ~MedianData() override = default; - virtual void serialize(messageqcpp::ByteStream& bs) const; - virtual void unserialize(messageqcpp::ByteStream& bs); + void serialize(messageqcpp::ByteStream& bs) const override; + void unserialize(messageqcpp::ByteStream& bs) override; MEDIAN_DATA mData; private: // For now, copy construction is unwanted - MedianData(UserData&); + explicit MedianData(UserData&); }; // Override mcsv1_UDAF to build your User Defined Aggregate (UDAF) and/or @@ -104,7 +102,7 @@ class median : public mcsv1_UDAF public: // Defaults OK median() : mcsv1_UDAF(){}; - virtual ~median(){}; + ~median() override = default; /** * init() @@ -124,7 +122,7 @@ class median : public mcsv1_UDAF * colTypes or wrong number of arguments. Else return * mcsv1_UDAF::SUCCESS. */ - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; /** * reset() @@ -139,7 +137,7 @@ class median : public mcsv1_UDAF * * Use this opportunity to initialize the userData. */ - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; /** * nextValue() @@ -159,7 +157,7 @@ class median : public mcsv1_UDAF * * valsIn (in) - a vector of the parameters from the row. */ - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; /** * subEvaluate() @@ -186,7 +184,7 @@ class median : public mcsv1_UDAF * as seen in the last call to NextValue for a given PM. * */ - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn) override; /** * evaluate() @@ -207,7 +205,7 @@ class median : public mcsv1_UDAF * * To return a NULL value, don't assign to valOut. */ - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; /** * dropValue() @@ -235,7 +233,7 @@ class median : public mcsv1_UDAF * dropValue() will not be called for unbounded/current row type * frames, as those are already optimized. */ - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; /** * createUserData() @@ -260,7 +258,7 @@ class median : public mcsv1_UDAF * memory leaks are your fault. * */ - virtual ReturnCode createUserData(UserData*& data, int32_t& length); + ReturnCode createUserData(UserData*& data, int32_t& length) override; protected: }; diff --git a/utils/udfsdk/ssq.h b/utils/udfsdk/ssq.h index de6327edc..2b20dbc2b 100644 --- a/utils/udfsdk/ssq.h +++ b/utils/udfsdk/ssq.h @@ -81,7 +81,7 @@ class ssq : public mcsv1_UDAF public: // Defaults OK ssq() : mcsv1_UDAF(){}; - virtual ~ssq(){}; + ~ssq() override = default; /** * init() @@ -101,7 +101,7 @@ class ssq : public mcsv1_UDAF * colTypes or wrong number of arguments. Else return * mcsv1_UDAF::SUCCESS. */ - virtual ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes); + ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; /** * reset() @@ -114,7 +114,7 @@ class ssq : public mcsv1_UDAF * the next aggregation. May be called multiple times on * different modules. */ - virtual ReturnCode reset(mcsv1Context* context); + ReturnCode reset(mcsv1Context* context) override; /** * nextValue() @@ -134,7 +134,7 @@ class ssq : public mcsv1_UDAF * * valsIn (in) - a vector of the parameters from the row. */ - virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); + ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn) override; /** * subEvaluate() @@ -161,7 +161,7 @@ class ssq : public mcsv1_UDAF * as seen in the last call to NextValue for a given PM. * */ - virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn); + ReturnCode subEvaluate(mcsv1Context* context, const UserData* userDataIn) override; /** * evaluate() @@ -182,7 +182,7 @@ class ssq : public mcsv1_UDAF * * To return a NULL value, don't assign to valOut. */ - virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); + ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut) override; /** * dropValue() @@ -210,7 +210,7 @@ class ssq : public mcsv1_UDAF * dropValue() will not be called for unbounded/current row type * frames, as those are already optimized. */ - virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); + ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped) override; protected: }; diff --git a/utils/udfsdk/udfsdk.h b/utils/udfsdk/udfsdk.h index 131b9459a..fc21d1b14 100644 --- a/utils/udfsdk/udfsdk.h +++ b/utils/udfsdk/udfsdk.h @@ -108,9 +108,7 @@ class MCS_add : public funcexp::Func /* * Destructor. MCS_add does not need to do anything here to clean up. */ - virtual ~MCS_add() - { - } + ~MCS_add() override = default; /** * Decide on the function's operation type @@ -135,8 +133,8 @@ class MCS_add : public funcexp::Func * This function is called only one from the connector. Once it's determined, it * will be passed to the getXXXval() APIs during function evaluation. */ - execplan::CalpontSystemCatalog::ColType operationType(funcexp::FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + funcexp::FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; /** * Returns an integer result of this function. @@ -154,47 +152,47 @@ class MCS_add : public funcexp::Func * @parm op_ct the operation type that is determined in operationType(). * */ - virtual int64_t getIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + int64_t getIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a double result of this function. */ - virtual double getDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + double getDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a long double result of this function. */ - virtual long double getLongDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + long double getLongDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a float result of this function. */ - virtual float getFloatVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + float getFloatVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a string result of this function. */ - virtual std::string getStrVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + std::string getStrVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a bool result of this function. */ - virtual bool getBoolVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + bool getBoolVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a decimal result of this function. * * IDB_Decimal is defined in ~/execplan/treenode.h */ - virtual execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns an integer representation of a date result of the function. @@ -202,8 +200,8 @@ class MCS_add : public funcexp::Func * Check the date/time functions in ~/utils/funcexp for implementation * example of this API. */ - virtual int32_t getDateIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + int32_t getDateIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns an integer representation of a datetime result of the function. @@ -211,8 +209,8 @@ class MCS_add : public funcexp::Func * Check the date/time functions in ~/utils/funcexp for implementation * example of this API. */ - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + int64_t getDatetimeIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; /** @@ -233,59 +231,57 @@ class MCS_isnull : public funcexp::Func /* * Destructor. MCS_add does not need to do anything here to clean up. */ - virtual ~MCS_isnull() - { - } + ~MCS_isnull() override = default; /** * Decide on the function's operation type */ - execplan::CalpontSystemCatalog::ColType operationType(funcexp::FunctionParm& fp, - execplan::CalpontSystemCatalog::ColType& resultType); + execplan::CalpontSystemCatalog::ColType operationType( + funcexp::FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType) override; /** * Returns an integer result of this function. */ - virtual int64_t getIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + int64_t getIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a double result of this function. */ - virtual double getDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + double getDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a double result of this function. */ - virtual long double getLongDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + long double getLongDoubleVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a float result of this function. */ - virtual float getFloatVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + float getFloatVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a string result of this function. */ - virtual std::string getStrVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + std::string getStrVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a bool result of this function. */ - virtual bool getBoolVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + bool getBoolVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns a decimal result of this function. * * IDB_Decimal is defined in ~/execplan/treenode.h */ - virtual execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns an integer representation of a date result of the function. @@ -293,8 +289,8 @@ class MCS_isnull : public funcexp::Func * Check the date/time functions in ~/utils/funcexp for implementation * example of this API. */ - virtual int32_t getDateIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + int32_t getDateIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; /** * Returns an integer representation of a datetime result of the function. @@ -302,11 +298,10 @@ class MCS_isnull : public funcexp::Func * Check the date/time functions in ~/utils/funcexp for implementation * example of this API. */ - virtual int64_t getDatetimeIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& op_ct); + int64_t getDatetimeIntVal(rowgroup::Row& row, funcexp::FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct) override; }; } // namespace udfsdk -#undef EXPORT - +#undef EXPORT \ No newline at end of file diff --git a/utils/windowfunction/framebound.cpp b/utils/windowfunction/framebound.cpp index 56b50d2e0..d41c380f9 100644 --- a/utils/windowfunction/framebound.cpp +++ b/utils/windowfunction/framebound.cpp @@ -17,18 +17,11 @@ // $Id: framebound.cpp 3828 2013-05-22 17:58:14Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include #include -#include using namespace std; -#include "idberrorinfo.h" -#include "errorids.h" -#include "exceptclasses.h" -using namespace logging; - #include "idborderby.h" using namespace ordering; diff --git a/utils/windowfunction/framebound.h b/utils/windowfunction/framebound.h index 7dd4ad179..7787fc518 100644 --- a/utils/windowfunction/framebound.h +++ b/utils/windowfunction/framebound.h @@ -52,11 +52,11 @@ class FrameBound /** @brief FrameBound constructor * @param t, frame type */ - FrameBound(int t = 0) : fBoundType(t), fStart(true){}; + explicit FrameBound(int t = 0) : fBoundType(t), fStart(true){}; /** @brief FrameBound destructor */ - virtual ~FrameBound(){}; + virtual ~FrameBound() = default; /** @brief clone */ @@ -144,4 +144,3 @@ class FrameBound extern std::map colType2String; } // namespace windowfunction - diff --git a/utils/windowfunction/frameboundrange.cpp b/utils/windowfunction/frameboundrange.cpp index e884d9303..694ee6a10 100644 --- a/utils/windowfunction/frameboundrange.cpp +++ b/utils/windowfunction/frameboundrange.cpp @@ -18,11 +18,9 @@ // $Id: frameboundrange.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include #include -#include using namespace std; #include "idberrorinfo.h" diff --git a/utils/windowfunction/frameboundrange.h b/utils/windowfunction/frameboundrange.h index 5526a0b04..35515b0d2 100644 --- a/utils/windowfunction/frameboundrange.h +++ b/utils/windowfunction/frameboundrange.h @@ -35,25 +35,25 @@ class FrameBoundRange : public FrameBound * @param n, order by sort spec: null first | null last * @param v, order by column data type */ - FrameBoundRange(int t = 0, bool a = true, bool n = true) + explicit FrameBoundRange(int t = 0, bool a = true, bool n = true) : FrameBound(t), fAsc(a), fNullFirst(n), fIsZero(false){}; /** @brief FrameBoundRange destructor */ - virtual ~FrameBoundRange(){}; + ~FrameBoundRange() override = default; /** @brief clone */ - virtual FrameBound* clone() + FrameBound* clone() override { - return NULL; // abstract class + return nullptr; // abstract class } /** @brief virtual void getBound */ - int64_t getBound(int64_t, int64_t, int64_t); + int64_t getBound(int64_t, int64_t, int64_t) override; - const std::string toString() const; + const std::string toString() const override; void setTupleId(std::vector ids) { @@ -125,9 +125,10 @@ class FrameBoundConstantRange : public FrameBoundRange * @param n, order by sort spec: null first | null last * @param c, constant value. !! caller need to check NULL or negative value !! */ - FrameBoundConstantRange(int t = 0, bool a = true, bool n = true, void* c = NULL) : FrameBoundRange(t, a, n) + explicit FrameBoundConstantRange(int t = 0, bool a = true, bool n = true, void* c = nullptr) + : FrameBoundRange(t, a, n) { - fValue.fIsNull = (c == NULL); + fValue.fIsNull = (c == nullptr); if (!fValue.fIsNull) fValue.fValue = *((T*)c); @@ -135,20 +136,20 @@ class FrameBoundConstantRange : public FrameBoundRange /** @brief FrameBoundConstantRange destructor */ - virtual ~FrameBoundConstantRange(){}; + ~FrameBoundConstantRange() override = default; /** @brief clone */ - virtual FrameBound* clone() + FrameBound* clone() override { return new FrameBoundConstantRange(*this); } /** @brief virtual void getBound */ - int64_t getBound(int64_t, int64_t, int64_t); + int64_t getBound(int64_t, int64_t, int64_t) override; - const std::string toString() const; + const std::string toString() const override; protected: // find the range offset @@ -183,15 +184,16 @@ class FrameBoundExpressionRange : public FrameBoundConstantRange * @param a, order by sort spec: asc | desc * @param n, order by sort spec: null first | null last */ - FrameBoundExpressionRange(int t = 0, bool a = true, bool n = true) : FrameBoundConstantRange(t, a, n){}; + explicit FrameBoundExpressionRange(int t = 0, bool a = true, bool n = true) + : FrameBoundConstantRange(t, a, n){}; /** @brief FrameBoundExpressionRange destructor */ - virtual ~FrameBoundExpressionRange(){}; + ~FrameBoundExpressionRange() override = default; /** @brief clone */ - virtual FrameBound* clone() + FrameBound* clone() override { return new FrameBoundExpressionRange(*this); } @@ -200,16 +202,15 @@ class FrameBoundExpressionRange : public FrameBoundConstantRange */ // int64_t getBound(int64_t, int64_t, int64_t); - const std::string toString() const; + const std::string toString() const override; protected: // virtual in FrameBoundRange - int64_t getPrecedingOffset(int64_t j, int64_t i); - int64_t getFollowingOffset(int64_t j, int64_t k); + int64_t getPrecedingOffset(int64_t j, int64_t i) override; + int64_t getFollowingOffset(int64_t j, int64_t k) override; // validate the expression is not negative - void validate(); + void validate() override; }; } // namespace windowfunction - diff --git a/utils/windowfunction/frameboundrow.cpp b/utils/windowfunction/frameboundrow.cpp index 3d4427413..b157a6b5b 100644 --- a/utils/windowfunction/frameboundrow.cpp +++ b/utils/windowfunction/frameboundrow.cpp @@ -17,11 +17,9 @@ // $Id: frameboundrow.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include #include -#include using namespace std; #include "idberrorinfo.h" @@ -32,7 +30,6 @@ using namespace logging; #include "idborderby.h" using namespace ordering; -#include "treenode.h" #include "frameboundrow.h" namespace windowfunction diff --git a/utils/windowfunction/frameboundrow.h b/utils/windowfunction/frameboundrow.h index 79c071e49..f97e3d929 100644 --- a/utils/windowfunction/frameboundrow.h +++ b/utils/windowfunction/frameboundrow.h @@ -32,24 +32,24 @@ class FrameBoundRow : public FrameBound /** @brief FrameBoundRow constructor * @param t, frame type */ - FrameBoundRow(int t = 0) : FrameBound(t){}; + explicit FrameBoundRow(int t = 0) : FrameBound(t){}; /** @brief FrameBoundRow destructor */ - virtual ~FrameBoundRow(){}; + ~FrameBoundRow() override = default; /** @brief clone */ - virtual FrameBound* clone() + FrameBound* clone() override { return new FrameBoundRow(*this); } /** @brief virtual void getBound */ - int64_t getBound(int64_t, int64_t, int64_t); + int64_t getBound(int64_t, int64_t, int64_t) override; - const std::string toString() const; + const std::string toString() const override; protected: }; @@ -64,24 +64,24 @@ class FrameBoundConstantRow : public FrameBoundRow * @param t, frame type * @param c, constant value. !! caller need to check NULL or negative value !! */ - FrameBoundConstantRow(int t = 0, int c = 0) : FrameBoundRow(t), fOffset(c){}; + explicit FrameBoundConstantRow(int t = 0, int c = 0) : FrameBoundRow(t), fOffset(c){}; /** @brief FrameBoundConstantRow destructor */ - virtual ~FrameBoundConstantRow(){}; + ~FrameBoundConstantRow() override = default; /** @brief clone */ - virtual FrameBound* clone() + FrameBound* clone() override { return new FrameBoundConstantRow(*this); } /** @brief virtual void getBound */ - int64_t getBound(int64_t, int64_t, int64_t); + int64_t getBound(int64_t, int64_t, int64_t) override; - const std::string toString() const; + const std::string toString() const override; protected: // constant offset @@ -98,25 +98,25 @@ class FrameBoundExpressionRow : public FrameBoundConstantRow /** @brief FrameBoundExpressionRow constructor * @param t, frame type */ - FrameBoundExpressionRow(int t, uint64_t id = -1, int idx = -1) + explicit FrameBoundExpressionRow(int t, uint64_t id = -1, int idx = -1) : FrameBoundConstantRow(t), fExprTupleId(id), fExprIdx(idx){}; /** @brief FrameBoundExpressionRow destructor */ - virtual ~FrameBoundExpressionRow(){}; + ~FrameBoundExpressionRow() override = default; /** @brief clone */ - virtual FrameBound* clone() + FrameBound* clone() override { return new FrameBoundExpressionRow(*this); } /** @brief virtual void getBound */ - int64_t getBound(int64_t, int64_t, int64_t); + int64_t getBound(int64_t, int64_t, int64_t) override; - const std::string toString() const; + const std::string toString() const override; void setExprTupleId(int id) { @@ -145,4 +145,3 @@ class FrameBoundExpressionRow : public FrameBoundConstantRow }; } // namespace windowfunction - diff --git a/utils/windowfunction/idborderby.cpp b/utils/windowfunction/idborderby.cpp index 1c6fd9528..ad52b0f37 100644 --- a/utils/windowfunction/idborderby.cpp +++ b/utils/windowfunction/idborderby.cpp @@ -19,7 +19,6 @@ // $Id: idborderby.cpp 3932 2013-06-25 16:08:10Z xlou $ #include -#include #include #include using namespace std; @@ -28,7 +27,6 @@ using namespace std; #include "calpontselectexecutionplan.h" #include "rowgroup.h" - using namespace boost; #include "errorids.h" @@ -41,7 +39,6 @@ using namespace execplan; #include "resourcemanager.h" using namespace joblist; -#include "rowgroup.h" using namespace rowgroup; #include "idborderby.h" @@ -531,9 +528,9 @@ int TimeCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2) bool CompareRule::less(Row::Pointer r1, Row::Pointer r2) { - for (vector::iterator i = fCompares.begin(); i != fCompares.end(); i++) + for (auto& compare : fCompares) { - int c = ((*(*i))(fIdbCompare, r1, r2)); + int c = ((*compare)(fIdbCompare, r1, r2)); if (c < 0) return true; @@ -546,7 +543,7 @@ bool CompareRule::less(Row::Pointer r1, Row::Pointer r2) void CompareRule::revertRules() { - std::vector::iterator fCompareIter = fCompares.begin(); + auto fCompareIter = fCompares.begin(); for (; fCompareIter != fCompares.end(); fCompareIter++) { (*fCompareIter)->revertSortSpec(); @@ -558,32 +555,32 @@ void CompareRule::compileRules(const std::vector& spec, const rowgr const vector& types = rg.getColTypes(); const auto& offsets = rg.getOffsets(); - for (vector::const_iterator i = spec.begin(); i != spec.end(); i++) + for (auto spec_el : spec) { - switch (types[i->fIndex]) + switch (types[spec_el.fIndex]) { case CalpontSystemCatalog::TINYINT: { - Compare* c = new TinyIntCompare(*i); + Compare* c = new TinyIntCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::SMALLINT: { - Compare* c = new SmallIntCompare(*i); + Compare* c = new SmallIntCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::MEDINT: case CalpontSystemCatalog::INT: { - Compare* c = new IntCompare(*i); + Compare* c = new IntCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::BIGINT: { - Compare* c = new BigIntCompare(*i); + Compare* c = new BigIntCompare(spec_el); fCompares.push_back(c); break; } @@ -591,14 +588,16 @@ void CompareRule::compileRules(const std::vector& spec, const rowgr case CalpontSystemCatalog::UDECIMAL: { Compare* c; - uint32_t len = rg.getColumnWidth(i->fIndex); + uint32_t len = rg.getColumnWidth(spec_el.fIndex); switch (len) { - case datatypes::MAXDECIMALWIDTH: c = new WideDecimalCompare(*i, offsets[i->fIndex]); break; - case datatypes::MAXLEGACYWIDTH: c = new BigIntCompare(*i); break; - case 1: c = new TinyIntCompare(*i); break; - case 2: c = new SmallIntCompare(*i); break; - case 4: c = new IntCompare(*i); break; + case datatypes::MAXDECIMALWIDTH: + c = new WideDecimalCompare(spec_el, offsets[spec_el.fIndex]); + break; + case datatypes::MAXLEGACYWIDTH: c = new BigIntCompare(spec_el); break; + case 1: c = new TinyIntCompare(spec_el); break; + case 2: c = new SmallIntCompare(spec_el); break; + case 4: c = new IntCompare(spec_el); break; } fCompares.push_back(c); @@ -607,26 +606,26 @@ void CompareRule::compileRules(const std::vector& spec, const rowgr case CalpontSystemCatalog::UTINYINT: { - Compare* c = new UTinyIntCompare(*i); + Compare* c = new UTinyIntCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::USMALLINT: { - Compare* c = new USmallIntCompare(*i); + Compare* c = new USmallIntCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::UMEDINT: case CalpontSystemCatalog::UINT: { - Compare* c = new UIntCompare(*i); + Compare* c = new UIntCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::UBIGINT: { - Compare* c = new UBigIntCompare(*i); + Compare* c = new UBigIntCompare(spec_el); fCompares.push_back(c); break; } @@ -635,7 +634,7 @@ void CompareRule::compileRules(const std::vector& spec, const rowgr case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::TEXT: { - Compare* c = new StringCompare(*i); + Compare* c = new StringCompare(spec_el); fCompares.push_back(c); break; } @@ -643,7 +642,7 @@ void CompareRule::compileRules(const std::vector& spec, const rowgr case CalpontSystemCatalog::DOUBLE: case CalpontSystemCatalog::UDOUBLE: { - Compare* c = new DoubleCompare(*i); + Compare* c = new DoubleCompare(spec_el); fCompares.push_back(c); break; } @@ -651,34 +650,34 @@ void CompareRule::compileRules(const std::vector& spec, const rowgr case CalpontSystemCatalog::FLOAT: case CalpontSystemCatalog::UFLOAT: { - Compare* c = new FloatCompare(*i); + Compare* c = new FloatCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::LONGDOUBLE: { - Compare* c = new LongDoubleCompare(*i); + Compare* c = new LongDoubleCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::DATE: { - Compare* c = new DateCompare(*i); + Compare* c = new DateCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::DATETIME: case CalpontSystemCatalog::TIMESTAMP: { - Compare* c = new DatetimeCompare(*i); + Compare* c = new DatetimeCompare(spec_el); fCompares.push_back(c); break; } case CalpontSystemCatalog::TIME: { - Compare* c = new TimeCompare(*i); + Compare* c = new TimeCompare(spec_el); fCompares.push_back(c); break; } @@ -717,7 +716,7 @@ OrderByData::OrderByData(const std::vector& spec, const rowgroup::R OrderByData::~OrderByData() { // delete compare objects - vector::iterator i = fRule.fCompares.begin(); + auto i = fRule.fCompares.begin(); while (i != fRule.fCompares.end()) { @@ -732,7 +731,7 @@ OrderByData::~OrderByData() // IdbOrderBy class implementation IdbOrderBy::IdbOrderBy() - : fDistinct(false), fMemSize(0), fRowsPerRG(rowgroup::rgCommonSize), fErrorCode(0), fRm(NULL) + : fDistinct(false), fMemSize(0), fRowsPerRG(rowgroup::rgCommonSize), fErrorCode(0), fRm(nullptr) { } diff --git a/utils/windowfunction/idborderby.h b/utils/windowfunction/idborderby.h index 3ea9f892f..600a0f3da 100644 --- a/utils/windowfunction/idborderby.h +++ b/utils/windowfunction/idborderby.h @@ -49,7 +49,7 @@ class reservablePQ : private std::priority_queue<_Tp, _Sequence, _Compare> { public: typedef typename std::priority_queue<_Tp, _Sequence, _Compare>::size_type size_type; - reservablePQ(size_type capacity = 0) + explicit reservablePQ(size_type capacity = 0) { reserve(capacity); }; @@ -98,12 +98,10 @@ struct IdbSortSpec class Compare { public: - Compare(const IdbSortSpec& spec) : fSpec(spec) - { - } - virtual ~Compare() + explicit Compare(const IdbSortSpec& spec) : fSpec(spec) { } + virtual ~Compare() = default; virtual int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) = 0; void revertSortSpec() @@ -121,41 +119,41 @@ class Compare class TinyIntCompare : public Compare { public: - TinyIntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit TinyIntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class SmallIntCompare : public Compare { public: - SmallIntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit SmallIntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class IntCompare : public Compare { public: - IntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit IntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class BigIntCompare : public Compare { public: - BigIntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit BigIntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class WideDecimalCompare : public Compare @@ -167,7 +165,7 @@ class WideDecimalCompare : public Compare { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; // End of comparators for signed types @@ -176,41 +174,41 @@ class WideDecimalCompare : public Compare class UTinyIntCompare : public Compare { public: - UTinyIntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit UTinyIntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class USmallIntCompare : public Compare { public: - USmallIntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit USmallIntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class UIntCompare : public Compare { public: - UIntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit UIntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class UBigIntCompare : public Compare { public: - UBigIntCompare(const IdbSortSpec& spec) : Compare(spec) + explicit UBigIntCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; // end of comparators for unsigned types @@ -220,31 +218,31 @@ class UBigIntCompare : public Compare class DoubleCompare : public Compare { public: - DoubleCompare(const IdbSortSpec& spec) : Compare(spec) + explicit DoubleCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class LongDoubleCompare : public Compare { public: - LongDoubleCompare(const IdbSortSpec& spec) : Compare(spec) + explicit LongDoubleCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class FloatCompare : public Compare { public: - FloatCompare(const IdbSortSpec& spec) : Compare(spec) + explicit FloatCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; // End of comparators for float types @@ -253,31 +251,31 @@ class FloatCompare : public Compare class DateCompare : public Compare { public: - DateCompare(const IdbSortSpec& spec) : Compare(spec) + explicit DateCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class DatetimeCompare : public Compare { public: - DatetimeCompare(const IdbSortSpec& spec) : Compare(spec) + explicit DatetimeCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; class TimeCompare : public Compare { public: - TimeCompare(const IdbSortSpec& spec) : Compare(spec) + explicit TimeCompare(const IdbSortSpec& spec) : Compare(spec) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; }; // End of comparators for temporal types @@ -287,11 +285,11 @@ class TimeCompare : public Compare class StringCompare : public Compare { public: - StringCompare(const IdbSortSpec& spec) : Compare(spec), cs(NULL) + explicit StringCompare(const IdbSortSpec& spec) : Compare(spec), cs(nullptr) { } - int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer); + int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override; CHARSET_INFO* cs; }; @@ -301,7 +299,7 @@ class StringCompare : public Compare class CompareRule { public: - CompareRule(IdbCompare* c = NULL) : fIdbCompare(c) + explicit CompareRule(IdbCompare* c = nullptr) : fIdbCompare(c) { } @@ -317,8 +315,8 @@ class CompareRule class IdbCompare { public: - IdbCompare(){}; - virtual ~IdbCompare(){}; + IdbCompare() = default; + virtual ~IdbCompare() = default; virtual void initialize(const rowgroup::RowGroup&); void setStringTable(bool b); @@ -362,7 +360,7 @@ class OrderByRow class EqualCompData : public IdbCompare { public: - EqualCompData(std::vector& v) : fIndex(v) + explicit EqualCompData(std::vector& v) : fIndex(v) { } EqualCompData(std::vector& v, const rowgroup::RowGroup& rg) : fIndex(v) @@ -370,7 +368,7 @@ class EqualCompData : public IdbCompare initialize(rg); } - ~EqualCompData(){}; + ~EqualCompData() override = default; bool operator()(rowgroup::Row::Pointer, rowgroup::Row::Pointer); @@ -381,7 +379,7 @@ class OrderByData : public IdbCompare { public: OrderByData(const std::vector&, const rowgroup::RowGroup&); - virtual ~OrderByData(); + ~OrderByData() override; bool operator()(rowgroup::Row::Pointer p1, rowgroup::Row::Pointer p2) { @@ -401,9 +399,9 @@ class IdbOrderBy : public IdbCompare { public: IdbOrderBy(); - virtual ~IdbOrderBy(); + ~IdbOrderBy() override; - virtual void initialize(const rowgroup::RowGroup&); + void initialize(const rowgroup::RowGroup&) override; virtual void processRow(const rowgroup::Row&) = 0; virtual uint64_t getKeyLength() const = 0; virtual const std::string toString() const = 0; diff --git a/utils/windowfunction/wf_count.cpp b/utils/windowfunction/wf_count.cpp index 342baf426..ee80030e7 100644 --- a/utils/windowfunction/wf_count.cpp +++ b/utils/windowfunction/wf_count.cpp @@ -17,29 +17,19 @@ // $Id: wf_count.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include -#include +// #define NDEBUG #include -#include -#include using namespace std; #include using namespace boost; #include "loggingid.h" -#include "errorcodes.h" -#include "idberrorinfo.h" using namespace logging; -#include "rowgroup.h" -using namespace rowgroup; - #include "idborderby.h" using namespace ordering; -#include "joblisttypes.h" #include "calpontsystemcatalog.h" using namespace execplan; diff --git a/utils/windowfunction/wf_count.h b/utils/windowfunction/wf_count.h index cb0844788..ab65b75dc 100644 --- a/utils/windowfunction/wf_count.h +++ b/utils/windowfunction/wf_count.h @@ -34,9 +34,9 @@ class WF_count : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -46,4 +46,3 @@ class WF_count : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_lead_lag.cpp b/utils/windowfunction/wf_lead_lag.cpp index dd1d4e93e..d0e886e54 100644 --- a/utils/windowfunction/wf_lead_lag.cpp +++ b/utils/windowfunction/wf_lead_lag.cpp @@ -18,7 +18,7 @@ // $Id: wf_lead_lag.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG +// #define NDEBUG #include #include #include @@ -159,7 +159,7 @@ void WF_lead_lag::parseParms(const std::vector& parms) // parms[1]: offset ConstantColumn* cc = dynamic_cast(parms[1].get()); - if (cc != NULL) + if (cc != nullptr) { fOffsetNull = false; fOffset = cc->getIntVal(fRow, fOffsetNull) * fLead; // row not used, no need to setData. @@ -168,7 +168,7 @@ void WF_lead_lag::parseParms(const std::vector& parms) // parms[2]: default value cc = dynamic_cast(parms[2].get()); - if (cc != NULL) + if (cc != nullptr) { fDefNull = false; getConstValue(cc, fDefault, fDefNull); @@ -176,7 +176,7 @@ void WF_lead_lag::parseParms(const std::vector& parms) // parms[3]: respect null | ignore null cc = dynamic_cast(parms[3].get()); - if (cc != NULL) + if (cc != nullptr) { bool isNull = false; // dummy. Return not used fRespectNulls = (cc->getIntVal(fRow, isNull) > 0); diff --git a/utils/windowfunction/wf_lead_lag.h b/utils/windowfunction/wf_lead_lag.h index 7ccb41062..7f2219eae 100644 --- a/utils/windowfunction/wf_lead_lag.h +++ b/utils/windowfunction/wf_lead_lag.h @@ -33,10 +33,10 @@ class WF_lead_lag : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); - void parseParms(const std::vector&); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; + void parseParms(const std::vector&) override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -51,4 +51,3 @@ class WF_lead_lag : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_min_max.cpp b/utils/windowfunction/wf_min_max.cpp index fbc2ffe18..7f6af5aab 100644 --- a/utils/windowfunction/wf_min_max.cpp +++ b/utils/windowfunction/wf_min_max.cpp @@ -18,11 +18,8 @@ // $Id: wf_min_max.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include -#include -#include using namespace std; #include @@ -30,13 +27,8 @@ using namespace boost; #include "loggingid.h" #include "errorcodes.h" -#include "idberrorinfo.h" using namespace logging; -#include "rowgroup.h" -using namespace rowgroup; - -#include "joblisttypes.h" #include "calpontsystemcatalog.h" using namespace execplan; diff --git a/utils/windowfunction/wf_min_max.h b/utils/windowfunction/wf_min_max.h index caf615191..b0381f7e6 100644 --- a/utils/windowfunction/wf_min_max.h +++ b/utils/windowfunction/wf_min_max.h @@ -33,9 +33,9 @@ class WF_min_max : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -45,4 +45,3 @@ class WF_min_max : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_nth_value.cpp b/utils/windowfunction/wf_nth_value.cpp index a79f2a402..2ee196eb3 100644 --- a/utils/windowfunction/wf_nth_value.cpp +++ b/utils/windowfunction/wf_nth_value.cpp @@ -18,7 +18,7 @@ // $Id: wf_nth_value.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG +// #define NDEBUG #include #include #include @@ -149,7 +149,7 @@ void WF_nth_value::parseParms(const std::vector& parms) // parms[1]: nth value ConstantColumn* cc = dynamic_cast(parms[1].get()); - if (cc != NULL) + if (cc != nullptr) { fNthNull = false; fNth = cc->getIntVal(fRow, fNthNull); // row not used, no need to setData. @@ -166,12 +166,12 @@ void WF_nth_value::parseParms(const std::vector& parms) // parms[2]: from first | from last bool isNull = false; cc = dynamic_cast(parms[2].get()); - idbassert(cc != NULL); + idbassert(cc != nullptr); fFromFirst = (cc->getIntVal(fRow, isNull) > 0); // parms[3]: respect null | ignore null cc = dynamic_cast(parms[3].get()); - idbassert(cc != NULL); + idbassert(cc != nullptr); fRespectNulls = (cc->getIntVal(fRow, isNull) > 0); } diff --git a/utils/windowfunction/wf_nth_value.h b/utils/windowfunction/wf_nth_value.h index d4a2247ff..d12835030 100644 --- a/utils/windowfunction/wf_nth_value.h +++ b/utils/windowfunction/wf_nth_value.h @@ -33,10 +33,10 @@ class WF_nth_value : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); - void parseParms(const std::vector&); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; + void parseParms(const std::vector&) override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -49,4 +49,3 @@ class WF_nth_value : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_ntile.cpp b/utils/windowfunction/wf_ntile.cpp index 4b6634603..001c79288 100644 --- a/utils/windowfunction/wf_ntile.cpp +++ b/utils/windowfunction/wf_ntile.cpp @@ -17,24 +17,18 @@ // $Id: wf_ntile.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include #include -#include using namespace std; #include using namespace boost; #include "loggingid.h" -#include "errorcodes.h" #include "idberrorinfo.h" using namespace logging; -#include "rowgroup.h" -using namespace rowgroup; - #include "idborderby.h" using namespace ordering; @@ -50,8 +44,8 @@ using namespace joblist; namespace windowfunction { -boost::shared_ptr WF_ntile::makeFunction(int id, const string& name, int ct, - WindowFunctionColumn* wc) +boost::shared_ptr WF_ntile::makeFunction(int id, const string& name, int, + WindowFunctionColumn*) { boost::shared_ptr func(new WF_ntile(id, name)); return func; @@ -70,9 +64,9 @@ void WF_ntile::resetData() void WF_ntile::parseParms(const std::vector& parms) { // parms[0]: nt - ConstantColumn* cc = dynamic_cast(parms[0].get()); + auto* cc = dynamic_cast(parms[0].get()); - if (cc != NULL) + if (cc != nullptr) { fNtileNull = false; fNtile = cc->getIntVal(fRow, fNtileNull); // row not used, no need to setData. diff --git a/utils/windowfunction/wf_ntile.h b/utils/windowfunction/wf_ntile.h index ed5ee6b77..e85524e4e 100644 --- a/utils/windowfunction/wf_ntile.h +++ b/utils/windowfunction/wf_ntile.h @@ -33,10 +33,10 @@ class WF_ntile : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); - void parseParms(const std::vector&); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; + void parseParms(const std::vector&) override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -46,4 +46,3 @@ class WF_ntile : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_percentile.cpp b/utils/windowfunction/wf_percentile.cpp index 2b7a34ab5..71c9728de 100644 --- a/utils/windowfunction/wf_percentile.cpp +++ b/utils/windowfunction/wf_percentile.cpp @@ -18,11 +18,10 @@ // $Id: wf_percentile.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG +// #define NDEBUG #include #include #include -#include using namespace std; #include @@ -34,13 +33,9 @@ using namespace boost; #include "idberrorinfo.h" using namespace logging; -#include "rowgroup.h" -using namespace rowgroup; - #include "idborderby.h" using namespace ordering; -#include "joblisttypes.h" #include "calpontsystemcatalog.h" #include "constantcolumn.h" using namespace execplan; @@ -206,7 +201,7 @@ void WF_percentile::parseParms(const std::vector& parms) // parms[0]: nve ConstantColumn* cc = dynamic_cast(parms[0].get()); - if (cc != NULL) + if (cc != nullptr) { fNveNull = false; fNve = cc->getDoubleVal(fRow, fNveNull); // row not used, no need to setData. @@ -339,7 +334,7 @@ void WF_percentile::operator()(int64_t b, int64_t e, int64_t c) tempvd[1] = 0; v = *(reinterpret_cast(&tempvd[0])); - //v = *(reinterpret_cast(&vd)); // XXX old code that produced out-of-bounds difference. + // v = *(reinterpret_cast(&vd)); // XXX old code that produced out-of-bounds difference. p = &v; } else // (fFunctionId == WF__PERCENTILE_DISC) diff --git a/utils/windowfunction/wf_percentile.h b/utils/windowfunction/wf_percentile.h index db08c08d2..64b092b9b 100644 --- a/utils/windowfunction/wf_percentile.h +++ b/utils/windowfunction/wf_percentile.h @@ -34,10 +34,10 @@ class WF_percentile : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); - void parseParms(const std::vector&); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; + void parseParms(const std::vector&) override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -47,4 +47,3 @@ class WF_percentile : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_ranking.cpp b/utils/windowfunction/wf_ranking.cpp index 540ca8082..0dce1399a 100644 --- a/utils/windowfunction/wf_ranking.cpp +++ b/utils/windowfunction/wf_ranking.cpp @@ -17,29 +17,19 @@ // $Id: wf_ranking.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include -#include -#include using namespace std; #include using namespace boost; #include "loggingid.h" -#include "errorcodes.h" -#include "idberrorinfo.h" using namespace logging; -#include "rowgroup.h" -using namespace rowgroup; - #include "idborderby.h" using namespace ordering; -#include "joblisttypes.h" -#include "calpontsystemcatalog.h" using namespace execplan; #include "windowfunctionstep.h" diff --git a/utils/windowfunction/wf_ranking.h b/utils/windowfunction/wf_ranking.h index ecfdae97a..063d1795d 100644 --- a/utils/windowfunction/wf_ranking.h +++ b/utils/windowfunction/wf_ranking.h @@ -33,9 +33,9 @@ class WF_ranking : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -45,4 +45,3 @@ class WF_ranking : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_row_number.cpp b/utils/windowfunction/wf_row_number.cpp index 6dd58ce31..3dead0920 100644 --- a/utils/windowfunction/wf_row_number.cpp +++ b/utils/windowfunction/wf_row_number.cpp @@ -17,29 +17,19 @@ // $Id: wf_row_number.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include -#include -#include using namespace std; #include using namespace boost; #include "loggingid.h" -#include "errorcodes.h" -#include "idberrorinfo.h" using namespace logging; -#include "rowgroup.h" -using namespace rowgroup; - #include "idborderby.h" using namespace ordering; -#include "joblisttypes.h" -#include "calpontsystemcatalog.h" using namespace execplan; #include "windowfunctionstep.h" @@ -49,8 +39,8 @@ using namespace joblist; namespace windowfunction { -boost::shared_ptr WF_row_number::makeFunction(int id, const string& name, int ct, - WindowFunctionColumn* wc) +boost::shared_ptr WF_row_number::makeFunction(int id, const string& name, int, + WindowFunctionColumn*) { boost::shared_ptr func(new WF_row_number(id, name)); return func; diff --git a/utils/windowfunction/wf_row_number.h b/utils/windowfunction/wf_row_number.h index 953a68c35..dcd20e718 100644 --- a/utils/windowfunction/wf_row_number.h +++ b/utils/windowfunction/wf_row_number.h @@ -33,9 +33,9 @@ class WF_row_number : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -44,4 +44,3 @@ class WF_row_number : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_stats.cpp b/utils/windowfunction/wf_stats.cpp index 73a668acf..c24abdf47 100644 --- a/utils/windowfunction/wf_stats.cpp +++ b/utils/windowfunction/wf_stats.cpp @@ -18,11 +18,9 @@ // $Id: wf_stats.cpp 3932 2013-06-25 16:08:10Z xlou $ -//#define NDEBUG -#include +// #define NDEBUG #include #include -#include using namespace std; #include @@ -33,13 +31,9 @@ using namespace boost; #include "idberrorinfo.h" using namespace logging; -#include "rowgroup.h" -using namespace rowgroup; - #include "idborderby.h" using namespace ordering; -#include "joblisttypes.h" #include "calpontsystemcatalog.h" using namespace execplan; @@ -177,7 +171,7 @@ void WF_stats::operator()(int64_t b, int64_t e, int64_t c) long double val = (long double)valIn; count_++; long double delta = val - mean_; - mean_ += delta/count_; + mean_ += delta / count_; scaledMomentum2_ += delta * (val - mean_); } @@ -208,13 +202,13 @@ void WF_stats::operator()(int64_t b, int64_t e, int64_t c) if (count_ == 0) { - setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)NULL); + setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)nullptr); } else if (count_ == 1) { if (fFunctionId == WF__STDDEV_SAMP || fFunctionId == WF__VAR_SAMP) { - setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)NULL); + setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)nullptr); } else // fFunctionId == WF__STDDEV_POP || fFunctionId == WF__VAR_POP { diff --git a/utils/windowfunction/wf_stats.h b/utils/windowfunction/wf_stats.h index b5c98830d..843b0e98a 100644 --- a/utils/windowfunction/wf_stats.h +++ b/utils/windowfunction/wf_stats.h @@ -33,9 +33,9 @@ class WF_stats : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -47,4 +47,3 @@ class WF_stats : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_sum_avg.h b/utils/windowfunction/wf_sum_avg.h index c423e7617..130fbec7c 100644 --- a/utils/windowfunction/wf_sum_avg.h +++ b/utils/windowfunction/wf_sum_avg.h @@ -38,9 +38,9 @@ class WF_sum_avg : public WindowFunctionType } // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); @@ -59,4 +59,3 @@ class WF_sum_avg : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/wf_udaf.h b/utils/windowfunction/wf_udaf.h index 81cdee481..655184f82 100644 --- a/utils/windowfunction/wf_udaf.h +++ b/utils/windowfunction/wf_udaf.h @@ -55,18 +55,18 @@ class WF_udaf : public WindowFunctionType } WF_udaf(WF_udaf& rhs); // pure virtual in base - void operator()(int64_t b, int64_t e, int64_t c); - WindowFunctionType* clone() const; - void resetData(); - void parseParms(const std::vector&); - virtual bool dropValues(int64_t, int64_t); + void operator()(int64_t b, int64_t e, int64_t c) override; + WindowFunctionType* clone() const override; + void resetData() override; + void parseParms(const std::vector&) override; + bool dropValues(int64_t, int64_t) override; mcsv1sdk::mcsv1Context& getContext() { return fUDAFContext; } - bool getInterrupted() + bool getInterrupted() const { return bInterrupted; } @@ -76,7 +76,7 @@ class WF_udaf : public WindowFunctionType return &bInterrupted; } - bool getDistinct() + bool getDistinct() const { return fDistinct; } @@ -107,4 +107,3 @@ class WF_udaf : public WindowFunctionType }; } // namespace windowfunction - diff --git a/utils/windowfunction/windowframe.h b/utils/windowfunction/windowframe.h index 2dd3c23d7..b65eb54d2 100644 --- a/utils/windowfunction/windowframe.h +++ b/utils/windowfunction/windowframe.h @@ -50,7 +50,7 @@ class WindowFrame /** @brief WindowFrame destructor */ - virtual ~WindowFrame(){}; + virtual ~WindowFrame() = default; /** @brief clone */ @@ -118,4 +118,3 @@ class WindowFrame }; } // namespace windowfunction - diff --git a/utils/windowfunction/windowfunctiontype.h b/utils/windowfunction/windowfunctiontype.h index c29c08376..14b1ed39b 100644 --- a/utils/windowfunction/windowfunctiontype.h +++ b/utils/windowfunction/windowfunctiontype.h @@ -109,14 +109,14 @@ class WindowFunctionType { public: // @brief WindowFunctionType constructor - WindowFunctionType(int id = 0, const std::string& name = "") + explicit WindowFunctionType(int id = 0, const std::string& name = "") : fFunctionId(id), fFunctionName(name), fFrameUnit(0){}; // use default copy construct // WindowFunctionType(const WindowFunctionType&); // @brief WindowFunctionType destructor - virtual ~WindowFunctionType(){}; + virtual ~WindowFunctionType() = default; // @brief virtual operator(begin, end, current, data, row) virtual void operator()(int64_t, int64_t, int64_t) = 0; @@ -216,7 +216,7 @@ class WindowFunctionType // utility methods template - void getValue(uint64_t, T&, CDT* cdt = NULL); + void getValue(uint64_t, T&, CDT* cdt = nullptr); template void setValue(int, int64_t, int64_t, int64_t, T* = NULL); template @@ -303,4 +303,3 @@ class WindowFunctionType extern std::map colType2String; } // namespace windowfunction - diff --git a/versioning/BRM/brmtypes.h b/versioning/BRM/brmtypes.h index b5472d711..b82f41e5d 100644 --- a/versioning/BRM/brmtypes.h +++ b/versioning/BRM/brmtypes.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "mcs_basic_types.h" #include "logicalpartition.h" @@ -248,10 +248,10 @@ struct TableLockInfo : public messageqcpp::Serializeable std::vector dbrootList; bool overlaps(const TableLockInfo&, const std::set& sPMList) const; - EXPORT void serialize(messageqcpp::ByteStream& bs) const; + EXPORT void serialize(messageqcpp::ByteStream& bs) const override; EXPORT void serialize(std::ostream&) const; EXPORT void deserialize(std::istream&); - EXPORT void deserialize(messageqcpp::ByteStream& bs); + EXPORT void deserialize(messageqcpp::ByteStream& bs) override; EXPORT void serialize(idbdatafile::IDBDataFile*) const; EXPORT void deserialize(idbdatafile::IDBDataFile*); EXPORT void serialize(char* buffer, uint32_t& offset); @@ -259,7 +259,7 @@ struct TableLockInfo : public messageqcpp::Serializeable bool operator<(const TableLockInfo&) const; private: - void serializeElement(char* buffer, const char* src, const uint32_t size, uint32_t& offset); + void serializeElement(char* buffer, const char* src, uint32_t size, uint32_t& offset); }; /// A Serializeable version of InlineLBIDRange @@ -274,15 +274,15 @@ class LBIDRange : public messageqcpp::Serializeable { } EXPORT LBIDRange(const LBIDRange& l); - EXPORT LBIDRange(const InlineLBIDRange& l); + EXPORT explicit LBIDRange(const InlineLBIDRange& l); EXPORT LBIDRange& operator=(const LBIDRange& l); EXPORT LBIDRange& operator=(const InlineLBIDRange& l); - EXPORT virtual ~LBIDRange(); + EXPORT ~LBIDRange() override; /** The Serializeable interface. Exports the instance to the bytestream */ - EXPORT virtual void serialize(messageqcpp::ByteStream& bs) const; + EXPORT void serialize(messageqcpp::ByteStream& bs) const override; /** The Serializeable interface. Initializes itself from the bytestrem. */ - EXPORT virtual void deserialize(messageqcpp::ByteStream& bs); + EXPORT void deserialize(messageqcpp::ByteStream& bs) override; }; /* To support bulkVSSLookup() */ @@ -312,7 +312,7 @@ struct BulkUpdateDBRootArg { return startLBID < b.startLBID; } - BulkUpdateDBRootArg(LBID_t l = 0, uint16_t d = 0) : startLBID(l), dbRoot(d) + explicit BulkUpdateDBRootArg(LBID_t l = 0, uint16_t d = 0) : startLBID(l), dbRoot(d) { } }; @@ -347,9 +347,9 @@ class VBRange : public messageqcpp::Serializeable EXPORT VBRange(); EXPORT VBRange(const VBRange& v); EXPORT VBRange& operator=(const VBRange& v); - EXPORT virtual ~VBRange(); - EXPORT virtual void serialize(messageqcpp::ByteStream& bs) const; - EXPORT virtual void deserialize(messageqcpp::ByteStream& bs); + EXPORT ~VBRange() override; + EXPORT void serialize(messageqcpp::ByteStream& bs) const override; + EXPORT void deserialize(messageqcpp::ByteStream& bs) override; }; // Structure used to return HWM information for each DbRoot in a PM @@ -371,7 +371,7 @@ struct EmDbRootHWMInfo { init(0); } - EmDbRootHWMInfo(uint16_t root) + explicit EmDbRootHWMInfo(uint16_t root) { init(root); } @@ -614,13 +614,13 @@ class QueryContext : public messageqcpp::Serializeable currentTxns.reset(new std::vector()); } - void serialize(messageqcpp::ByteStream& bs) const + void serialize(messageqcpp::ByteStream& bs) const override { bs << currentScn; serializeInlineVector(bs, *currentTxns); } - void deserialize(messageqcpp::ByteStream& bs) + void deserialize(messageqcpp::ByteStream& bs) override { bs >> currentScn; deserializeInlineVector(bs, *currentTxns); diff --git a/versioning/BRM/extentmap.cpp b/versioning/BRM/extentmap.cpp index b1e3e9890..84eb88b08 100644 --- a/versioning/BRM/extentmap.cpp +++ b/versioning/BRM/extentmap.cpp @@ -115,13 +115,7 @@ EMCasualPartition_struct::EMCasualPartition_struct() isValid = CP_INVALID; } -EMCasualPartition_struct::EMCasualPartition_struct(const int64_t lo, const int64_t hi, const int32_t seqNum, - const char status) - : sequenceNum(seqNum), isValid(status), loVal(lo), hiVal(hi) -{ -} - -EMCasualPartition_struct::EMCasualPartition_struct(const int64_t lo, const int64_t hi, const int32_t seqNum) +EMCasualPartition_struct::EMCasualPartition_struct(int64_t lo, int64_t hi, int32_t seqNum) { loVal = lo; hiVal = hi; @@ -129,8 +123,13 @@ EMCasualPartition_struct::EMCasualPartition_struct(const int64_t lo, const int64 isValid = CP_INVALID; } -EMCasualPartition_struct::EMCasualPartition_struct(const int128_t bigLo, const int128_t bigHi, - const int32_t seqNum) +EMCasualPartition_struct::EMCasualPartition_struct(const int64_t lo, const int64_t hi, const int32_t seqNum, + const char status) + : sequenceNum(seqNum), isValid(status), loVal(lo), hiVal(hi) +{ +} + +EMCasualPartition_struct::EMCasualPartition_struct(const int128_t bigLo, const int128_t bigHi, int32_t seqNum) { bigLoVal = bigLo; bigHiVal = bigHi; @@ -261,7 +260,7 @@ ExtentMapRBTreeImpl::ExtentMapRBTreeImpl(unsigned key, off_t size, bool readOnly boost::mutex FreeListImpl::fInstanceMutex; /*static*/ -FreeListImpl* FreeListImpl::fInstance = 0; +FreeListImpl* FreeListImpl::fInstance = nullptr; /*static*/ FreeListImpl* FreeListImpl::makeFreeListImpl(unsigned key, off_t size, bool readOnly) diff --git a/versioning/BRM/extentmap.h b/versioning/BRM/extentmap.h index 96e5f4b40..67c42d81b 100644 --- a/versioning/BRM/extentmap.h +++ b/versioning/BRM/extentmap.h @@ -162,10 +162,9 @@ struct EMCasualPartition_struct int64_t hiVal; }; EXPORT EMCasualPartition_struct(); - EXPORT EMCasualPartition_struct(const int64_t lo, const int64_t hi, const int32_t seqNum); - EXPORT EMCasualPartition_struct(const int128_t bigLo, const int128_t bigHi, const int32_t seqNum); - EXPORT EMCasualPartition_struct(const int64_t lo, const int64_t hi, const int32_t seqNum, - const char status); + EXPORT EMCasualPartition_struct(int64_t lo, int64_t hi, int32_t seqNum); + EXPORT EMCasualPartition_struct(const int128_t bigLo, const int128_t bigHi, int32_t seqNum); + EXPORT EMCasualPartition_struct(int64_t lo, int64_t hi, int32_t seqNum, char status); EXPORT EMCasualPartition_struct(const EMCasualPartition_struct& em); EXPORT EMCasualPartition_struct& operator=(const EMCasualPartition_struct& em); }; @@ -276,7 +275,7 @@ class ExtentMapRBTreeImpl if (fInstance) { delete fInstance; - fInstance = NULL; + fInstance = nullptr; } } @@ -320,22 +319,22 @@ class ExtentMapRBTreeImpl class FreeListImpl { public: - ~FreeListImpl(){}; + ~FreeListImpl() = default; static FreeListImpl* makeFreeListImpl(unsigned key, off_t size, bool readOnly = false); - + static void refreshShmWithLock() { boost::mutex::scoped_lock lk(fInstanceMutex); return refreshShm(); } - + static void refreshShm() { if (fInstance) { delete fInstance; - fInstance = NULL; + fInstance = nullptr; } } @@ -387,7 +386,7 @@ class FreeListImpl class ExtentMapIndexImpl { public: - ~ExtentMapIndexImpl(){}; + ~ExtentMapIndexImpl() = default; static ExtentMapIndexImpl* makeExtentMapIndexImpl(unsigned key, off_t size, bool readOnly = false); static void refreshShm() @@ -505,7 +504,7 @@ class ExtentMap : public Undoable { public: EXPORT ExtentMap(); - EXPORT ~ExtentMap(); + EXPORT ~ExtentMap() override; /** @brief Loads the ExtentMap entries from a file * @@ -1010,9 +1009,9 @@ class ExtentMap : public Undoable EXPORT void setReadOnly(); - EXPORT virtual void undoChanges(); + EXPORT void undoChanges() override; - EXPORT virtual void confirmChanges(); + EXPORT void confirmChanges() override; EXPORT int markInvalid(const LBID_t lbid, const execplan::CalpontSystemCatalog::ColDataType colDataType); EXPORT int markInvalid(const std::vector& lbids, diff --git a/writeengine/bulk/we_bulkload.h b/writeengine/bulk/we_bulkload.h index 926ff6c93..22e98611e 100644 --- a/writeengine/bulk/we_bulkload.h +++ b/writeengine/bulk/we_bulkload.h @@ -66,7 +66,7 @@ class BulkLoad : public FileOp /** * @brief BulkLoad destructor */ - EXPORT ~BulkLoad(); + EXPORT ~BulkLoad() override; /** * @brief Load job information @@ -523,12 +523,12 @@ inline void BulkLoad::setUsername(const std::string& username) inline void BulkLoad::startTimer() { - gettimeofday(&fStartTime, 0); + gettimeofday(&fStartTime, nullptr); } inline void BulkLoad::stopTimer() { - gettimeofday(&fEndTime, 0); + gettimeofday(&fEndTime, nullptr); fTotalTime = (fEndTime.tv_sec + (fEndTime.tv_usec / 1000000.0)) - (fStartTime.tv_sec + (fStartTime.tv_usec / 1000000.0)); } diff --git a/writeengine/bulk/we_colbufcompressed.h b/writeengine/bulk/we_colbufcompressed.h index 13e81b06e..0c4570d5e 100644 --- a/writeengine/bulk/we_colbufcompressed.h +++ b/writeengine/bulk/we_colbufcompressed.h @@ -54,19 +54,19 @@ class ColumnBufferCompressed : public ColumnBuffer /** @brief default Destructor */ - virtual ~ColumnBufferCompressed(); + ~ColumnBufferCompressed() override; /** @brief Final flushing of data and headers prior to closing the file. * @param bTruncFile is file to be truncated * @return NO_ERROR or success */ - virtual int finishFile(bool bTruncFile); + int finishFile(bool bTruncFile) override; /** @brief Reset the ColBuf to-be-compressed buffer prior to importing the * next extent. * @param startFileOffset Byte offset where next extent chunk will start */ - virtual int resetToBeCompressedColBuf(long long& startFileOffset); + int resetToBeCompressedColBuf(long long& startFileOffset) override; /** @brief file mutator * @@ -74,7 +74,7 @@ class ColumnBufferCompressed : public ColumnBuffer * @param startHwm Starting HWM for cFile * @param hdrs Headers with ptr information. */ - virtual int setDbFile(IDBDataFile* const cFile, HWM startHwm, const char* hdrs); + int setDbFile(IDBDataFile* const cFile, HWM startHwm, const char* hdrs) override; /** @brief Write data to FILE * @@ -83,7 +83,7 @@ class ColumnBufferCompressed : public ColumnBuffer * @param fillUpWEmpties The flag to fill the buffer with empty magic * values up to the block boundary. */ - virtual int writeToFile(int startOffset, int writeSize, bool fillUpWEmpties = false); + int writeToFile(int startOffset, int writeSize, bool fillUpWEmpties = false) override; private: // Disable copy constructor and assignment operator by declaring and diff --git a/writeengine/bulk/we_colbufmgr.h b/writeengine/bulk/we_colbufmgr.h index a0adc9356..874389653 100644 --- a/writeengine/bulk/we_colbufmgr.h +++ b/writeengine/bulk/we_colbufmgr.h @@ -260,9 +260,9 @@ class ColumnBufferManagerDctnry : public ColumnBufferManager { public: ColumnBufferManagerDctnry(ColumnInfo* pColInfo, int colWidth, Log* logger, int compressionType); - virtual ~ColumnBufferManagerDctnry(); + ~ColumnBufferManagerDctnry() override; - virtual int rowsExtentCheck(int nRows, int& nRows2); + int rowsExtentCheck(int nRows, int& nRows2) override; using ColumnBufferManager::writeToFileExtentCheck; virtual int writeToFileExtentCheck(uint32_t startOffset, uint32_t writeSize); }; diff --git a/writeengine/bulk/we_colextinf.h b/writeengine/bulk/we_colextinf.h index bba0094ff..cf2de5700 100644 --- a/writeengine/bulk/we_colextinf.h +++ b/writeengine/bulk/we_colextinf.h @@ -136,12 +136,8 @@ struct uint64Hasher class ColExtInfBase { public: - ColExtInfBase() - { - } - virtual ~ColExtInfBase() - { - } + ColExtInfBase() = default; + virtual ~ColExtInfBase() = default; virtual void addFirstEntry(RID lastInputRow, BRM::LBID_t lbid, bool bIsNewExtent) { @@ -192,9 +188,7 @@ class ColExtInf : public ColExtInfBase ColExtInf(OID oid, Log* logger) : fColOid(oid), fLog(logger) { } - virtual ~ColExtInf() - { - } + ~ColExtInf() override = default; /** @brief Add an entry for first extent, for the specified Row and LBID. * @param lastInputRow Last input Row for old extent we are adding data to @@ -202,7 +196,7 @@ class ColExtInf : public ColExtInfBase * @param bIsNewExtent Treat as new or existing extent when CP min/max is * sent to BRM */ - virtual void addFirstEntry(RID lastInputRow, BRM::LBID_t lbid, bool bIsNewExtent); + void addFirstEntry(RID lastInputRow, BRM::LBID_t lbid, bool bIsNewExtent) override; /** @brief Add or update an entry for the specified Row and its min/max val. * If new extent, LBID will be added later when extent is allocated. @@ -213,31 +207,31 @@ class ColExtInf : public ColExtInfBase template void addOrUpdateEntryTemplate(RID lastInputRow, T minVal, T maxVal, ColDataType colDataType, int width); - virtual void addOrUpdateEntry(RID lastInputRow, int64_t minVal, int64_t maxVal, ColDataType colDataType, - int width) + void addOrUpdateEntry(RID lastInputRow, int64_t minVal, int64_t maxVal, ColDataType colDataType, + int width) override { addOrUpdateEntryTemplate(lastInputRow, minVal, maxVal, colDataType, width); } - virtual void addOrUpdateEntry(RID lastInputRow, int128_t minVal, int128_t maxVal, ColDataType colDataType, - int width) + void addOrUpdateEntry(RID lastInputRow, int128_t minVal, int128_t maxVal, ColDataType colDataType, + int width) override { addOrUpdateEntryTemplate(lastInputRow, minVal, maxVal, colDataType, width); } /** @brief Send updated Casual Partition (CP) info to BRM. */ - virtual void getCPInfoForBRM(JobColumn column, BRMReporter& brmReporter); + void getCPInfoForBRM(JobColumn column, BRMReporter& brmReporter) override; /** @brief Debug print function. */ - virtual void print(const JobColumn& column); + void print(const JobColumn& column) override; /** @brief Add extent's LBID to the oldest entry that is awaiting an LBID * @param startLbid Starting LBID for a pending extent. * @return NO_ERROR upon success; else error if extent entry not found */ - virtual int updateEntryLbid(BRM::LBID_t startLbid); + int updateEntryLbid(BRM::LBID_t startLbid) override; private: OID fColOid; // Column OID for the relevant extents diff --git a/writeengine/bulk/we_colopbulk.h b/writeengine/bulk/we_colopbulk.h index 618594e79..373a043fc 100644 --- a/writeengine/bulk/we_colopbulk.h +++ b/writeengine/bulk/we_colopbulk.h @@ -44,16 +44,15 @@ class ColumnOpBulk : public ColumnOp public: ColumnOpBulk(); ColumnOpBulk(Log* logger, int compressionType); - virtual ~ColumnOpBulk(); + ~ColumnOpBulk() override; - virtual bool abbreviatedExtent(IDBDataFile*, int) const; - virtual int blocksInFile(IDBDataFile*) const; - virtual IDBDataFile* openFile(const WriteEngine::Column& column, uint16_t dbRoot, uint32_t partition, - uint16_t segment, std::string& segFile, bool useTmpSuffix, - const char* mode = "r+b", int ioBuffSize = DEFAULT_BUFSIZ, - bool isReadOnly = false) const; - virtual int readBlock(IDBDataFile*, unsigned char*, const uint64_t); - virtual int saveBlock(IDBDataFile*, const unsigned char*, const uint64_t); + bool abbreviatedExtent(IDBDataFile*, int) const override; + int blocksInFile(IDBDataFile*) const override; + IDBDataFile* openFile(const WriteEngine::Column& column, uint16_t dbRoot, uint32_t partition, + uint16_t segment, std::string& segFile, bool useTmpSuffix, const char* mode = "r+b", + int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const override; + int readBlock(IDBDataFile*, unsigned char*, const uint64_t) override; + int saveBlock(IDBDataFile*, const unsigned char*, const uint64_t) override; }; } // namespace WriteEngine diff --git a/writeengine/bulk/we_columnautoinc.h b/writeengine/bulk/we_columnautoinc.h index e53d1152e..8ddfea84a 100644 --- a/writeengine/bulk/we_columnautoinc.h +++ b/writeengine/bulk/we_columnautoinc.h @@ -97,9 +97,9 @@ class ColumnAutoIncJob : public ColumnAutoInc { public: explicit ColumnAutoIncJob(Log* logger); - virtual ~ColumnAutoIncJob(); + ~ColumnAutoIncJob() override; - virtual int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue); + int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue) override; }; //------------------------------------------------------------------------------ @@ -115,9 +115,9 @@ class ColumnAutoIncIncremental : public ColumnAutoInc { public: explicit ColumnAutoIncIncremental(Log* logger); - virtual ~ColumnAutoIncIncremental(); + ~ColumnAutoIncIncremental() override; - virtual int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue); + int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue) override; }; } // namespace WriteEngine diff --git a/writeengine/bulk/we_columninfo.h b/writeengine/bulk/we_columninfo.h index db548e7d0..035b09245 100644 --- a/writeengine/bulk/we_columninfo.h +++ b/writeengine/bulk/we_columninfo.h @@ -184,7 +184,7 @@ class ColumnInfo : public WeUIDGID /** @brief Destructor */ - virtual ~ColumnInfo(); + ~ColumnInfo() override; /** @brief Returns last input Row num in current "logical" extent; used * to track min/max value per extent, as the data is parsed. 0-based @@ -205,7 +205,8 @@ class ColumnInfo : public WeUIDGID * returns the assigned tokens (tokenBuf) to be stored in the * corresponding column token file. */ - int updateDctnryStoreParquet(std::shared_ptr columnData, int tokenPos, const int totalRow, char* tokenBuf); + int updateDctnryStoreParquet(std::shared_ptr columnData, int tokenPos, const int totalRow, + char* tokenBuf); /** @brief Update dictionary method. * Parses and stores specified strings into the store file, and diff --git a/writeengine/bulk/we_columninfocompressed.h b/writeengine/bulk/we_columninfocompressed.h index 92890874a..4d06fecfe 100644 --- a/writeengine/bulk/we_columninfocompressed.h +++ b/writeengine/bulk/we_columninfocompressed.h @@ -50,14 +50,14 @@ class ColumnInfoCompressed : public ColumnInfo /** @brief Destructor */ - virtual ~ColumnInfoCompressed(); + ~ColumnInfoCompressed() override; /** @brief Close the current Column file. * @param bCompletedExtent are we completing an extent * @param bAbort indicates if job is aborting and file should be * closed without doing extra work: flushing buffer, etc. */ - virtual int closeColumnFile(bool bCompletingExtent, bool bAbort); + int closeColumnFile(bool bCompletingExtent, bool bAbort) override; /** @brief Truncate specified dictionary file. Only applies if compressed. * @param dctnryOid Dictionary store OID @@ -65,21 +65,21 @@ class ColumnInfoCompressed : public ColumnInfo * @param pNum Partition number of relevant dictionary store segment file. * @param sNum Segment number of relevant dictionary store segment file. */ - virtual int truncateDctnryStore(OID dctnryOid, uint16_t root, uint32_t pNum, uint16_t sNum) const; + int truncateDctnryStore(OID dctnryOid, uint16_t root, uint32_t pNum, uint16_t sNum) const override; private: - virtual int resetFileOffsetsNewExtent(const char* hdr); + int resetFileOffsetsNewExtent(const char* hdr) override; // Prepare initial compressed column seg file for importing of data. // oldHWM - Current HWM prior to initial block skipping. This is only // used for abbreviated extents, to detect when block skipping has // caused us to require a full expanded extent. // newHWM - Starting point for adding data after initial blockskipping - virtual int setupInitialColumnFile(HWM oldHWM, HWM newHWM); + int setupInitialColumnFile(HWM oldHWM, HWM newHWM) override; - virtual int saveDctnryStoreHWMChunk(bool& needBackup); - virtual int extendColumnOldExtent(uint16_t dbRootNext, uint32_t partitionNext, uint16_t segmentNext, - HWM hwmNext); + int saveDctnryStoreHWMChunk(bool& needBackup) override; + int extendColumnOldExtent(uint16_t dbRootNext, uint32_t partitionNext, uint16_t segmentNext, + HWM hwmNext) override; RBMetaWriter* fRBMetaWriter; FileOp fTruncateDctnryFileOp; // Used to truncate dctnry store file diff --git a/writeengine/bulk/we_tableinfo.h b/writeengine/bulk/we_tableinfo.h index 98a6048ea..33325ecfd 100644 --- a/writeengine/bulk/we_tableinfo.h +++ b/writeengine/bulk/we_tableinfo.h @@ -224,7 +224,7 @@ class TableInfo : public WeUIDGID /** @brief Default destructor */ - ~TableInfo(); + ~TableInfo() override; /** @brief Acquire the DB table lock for this table */ diff --git a/writeengine/bulk/we_tempxmlgendata.h b/writeengine/bulk/we_tempxmlgendata.h index 385d0b47d..8562f00fe 100644 --- a/writeengine/bulk/we_tempxmlgendata.h +++ b/writeengine/bulk/we_tempxmlgendata.h @@ -38,9 +38,9 @@ class TempXMLGenData : public XMLGenData public: TempXMLGenData(const std::string& jobId, const std::string& schema, const std::string& table); - virtual ~TempXMLGenData(); + ~TempXMLGenData() override; - virtual void print(std::ostream& os) const; + void print(std::ostream& os) const override; private: TempXMLGenData(const TempXMLGenData&); // disable default copy ctor diff --git a/writeengine/shared/we_brm.h b/writeengine/shared/we_brm.h index e091e38ae..59afea48f 100644 --- a/writeengine/shared/we_brm.h +++ b/writeengine/shared/we_brm.h @@ -381,7 +381,7 @@ class BRMWrapper : public WEObj * @brief Commit the transaction */ EXPORT int commit(const BRM::VER_t transID); - EXPORT uint8_t newCpimportJob(uint32_t &jobId); + EXPORT uint8_t newCpimportJob(uint32_t& jobId); EXPORT void finishCpimportJob(uint32_t jobId); /** @@ -489,10 +489,9 @@ inline BRMWrapper::BRMWrapper() inline BRMWrapper::~BRMWrapper() { - if (blockRsltnMgrPtr) - delete blockRsltnMgrPtr; + delete blockRsltnMgrPtr; - blockRsltnMgrPtr = 0; + blockRsltnMgrPtr = nullptr; } inline BRM::DBRM* BRMWrapper::getDbrmObject() diff --git a/writeengine/shared/we_bulkrollbackfilecompressed.h b/writeengine/shared/we_bulkrollbackfilecompressed.h index 6a91f65fc..bb133c2b7 100644 --- a/writeengine/shared/we_bulkrollbackfilecompressed.h +++ b/writeengine/shared/we_bulkrollbackfilecompressed.h @@ -53,7 +53,7 @@ class BulkRollbackFileCompressed : public BulkRollbackFile /** @brief BulkRollbackFile destructor */ - virtual ~BulkRollbackFileCompressed(); + ~BulkRollbackFileCompressed() override; /** @brief Do we reinit trailing blocks in the HWM extent for the specified * segment file @@ -63,7 +63,7 @@ class BulkRollbackFileCompressed : public BulkRollbackFile * @param partNum Partition number for the segment file in question * @param segNum Segment number for the segment file in question */ - virtual bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const; + bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const override; /** @brief Reinitialize the specified column segment file starting at * startOffsetBlk, and truncate trailing extents. @@ -78,10 +78,10 @@ class BulkRollbackFileCompressed : public BulkRollbackFile * @param colWidth Width in bytes of column. * @param restoreHwmChk Restore HWM chunk */ - virtual void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, - long long startOffsetBlk, int nBlocks, - execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth, - bool restoreHwmChk); + void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, + long long startOffsetBlk, int nBlocks, + execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth, + bool restoreHwmChk) override; /** @brief Reinitialize the specified dictionary store segment file starting * at startOffsetBlk, and truncate trailing extents. @@ -93,8 +93,8 @@ class BulkRollbackFileCompressed : public BulkRollbackFile * reinitialized * @param nBlocks Number of blocks to be reinitialized */ - virtual void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, - long long startOffsetBlk, int nBlocks); + void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, + long long startOffsetBlk, int nBlocks) override; /** @brief Truncate the specified segment file to a specified num of bytes * @param columnOID OID of the relevant segment file @@ -103,8 +103,8 @@ class BulkRollbackFileCompressed : public BulkRollbackFile * @param segNum Segment number of the relevant segment file * @param fileSizeBlocks Number of blocks to retain in the file */ - virtual void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, - long long filesSizeBlocks); + void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, + long long filesSizeBlocks) override; private: // Disable unnecessary copy constructor and assignment operator diff --git a/writeengine/shared/we_bulkrollbackfilecompressedhdfs.h b/writeengine/shared/we_bulkrollbackfilecompressedhdfs.h index fa33855a4..4a270e399 100644 --- a/writeengine/shared/we_bulkrollbackfilecompressedhdfs.h +++ b/writeengine/shared/we_bulkrollbackfilecompressedhdfs.h @@ -51,7 +51,7 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile /** @brief BulkRollbackFile destructor */ - virtual ~BulkRollbackFileCompressedHdfs(); + ~BulkRollbackFileCompressedHdfs() override; /** @brief Do we reinit trailing blocks in the HWM extent for the specified * segment file @@ -61,7 +61,7 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile * @param partNum Partition number for the segment file in question * @param segNum Segment number for the segment file in question */ - virtual bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const; + bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const override; /** @brief Reinitialize the specified column segment file starting at * startOffsetBlk, and truncate trailing extents. @@ -76,10 +76,10 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile * @param colWidth Width in bytes of column. * @param restoreHwmChk Restore HWM chunk */ - virtual void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, - long long startOffsetBlk, int nBlocks, - execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth, - bool restoreHwmChk); + void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, + long long startOffsetBlk, int nBlocks, + execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth, + bool restoreHwmChk) override; /** @brief Reinitialize the specified dictionary store segment file starting * at startOffsetBlk, and truncate trailing extents. @@ -91,8 +91,8 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile * reinitialized * @param nBlocks Number of blocks to be reinitialized */ - virtual void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, - long long startOffsetBlk, int nBlocks); + void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, + long long startOffsetBlk, int nBlocks) override; /** @brief Truncate the specified segment file to a specified num of bytes * @param columnOID OID of the relevant segment file @@ -101,8 +101,8 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile * @param segNum Segment number of the relevant segment file * @param fileSizeBlocks Number of blocks to retain in the file */ - virtual void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, - long long filesSizeBlocks); + void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum, + long long filesSizeBlocks) override; private: // Disable unnecessary copy constructor and assignment operator diff --git a/writeengine/shared/we_bulkrollbackmgr.h b/writeengine/shared/we_bulkrollbackmgr.h index b7c0bafba..a239abb63 100644 --- a/writeengine/shared/we_bulkrollbackmgr.h +++ b/writeengine/shared/we_bulkrollbackmgr.h @@ -68,7 +68,7 @@ class BulkRollbackMgr * Currently used for logging only. */ EXPORT BulkRollbackMgr(OID tableOID, uint64_t lockID, const std::string& tableName, - const std::string& applName, Log* logger = 0); + const std::string& applName, Log* logger = nullptr); /** * @brief BulkRollbackMgr destructor diff --git a/writeengine/shared/we_cache.cpp b/writeengine/shared/we_cache.cpp index 317ca8009..11825427a 100644 --- a/writeengine/shared/we_cache.cpp +++ b/writeengine/shared/we_cache.cpp @@ -27,11 +27,11 @@ using namespace std; namespace WriteEngine { -CacheControl* Cache::m_cacheParam = NULL; -FreeBufList* Cache::m_freeList = NULL; -CacheMap* Cache::m_lruList = NULL; -CacheMap* Cache::m_writeList = NULL; - bool Cache::m_useCache = false; +CacheControl* Cache::m_cacheParam = nullptr; +FreeBufList* Cache::m_freeList = nullptr; +CacheMap* Cache::m_lruList = nullptr; +CacheMap* Cache::m_writeList = nullptr; +bool Cache::m_useCache = false; /*********************************************************** * DESCRIPTION: * Clear all list and free memory @@ -47,7 +47,7 @@ void Cache::clear() size_t i; // free list - if (m_freeList != NULL) + if (m_freeList != nullptr) { for (i = 0; i < m_freeList->size(); i++) { @@ -57,7 +57,7 @@ void Cache::clear() } // LRU list - if (m_lruList != NULL) + if (m_lruList != nullptr) { for (it = m_lruList->begin(); it != m_lruList->end(); it++) { @@ -70,7 +70,7 @@ void Cache::clear() } // Write list - if (m_writeList != NULL) + if (m_writeList != nullptr) { for (it = m_writeList->begin(); it != m_writeList->end(); it++) { @@ -97,13 +97,13 @@ int Cache::flushCache() BlockBuffer* curBuf; // add lock here - if (m_lruList && m_lruList->size() > 0) + if (m_lruList && !m_lruList->empty()) { bHasReadBlock = true; - for (CacheMapIt it = m_lruList->begin(); it != m_lruList->end(); it++) + for (auto& it : *m_lruList) { - curBuf = it->second; + curBuf = it.second; curBuf->clear(); m_freeList->push_back(curBuf); } @@ -112,19 +112,19 @@ int Cache::flushCache() } // must write to disk first - if (m_writeList && m_writeList->size() > 0) + if (m_writeList && !m_writeList->empty()) { if (!bHasReadBlock) - for (CacheMapIt it = m_writeList->begin(); it != m_writeList->end(); it++) + for (auto& it : *m_writeList) { - curBuf = it->second; + curBuf = it.second; curBuf->clear(); m_freeList->push_back(curBuf); } else - for (CacheMapIt it = m_writeList->begin(); it != m_writeList->end(); it++) + for (auto& it : *m_writeList) { - curBuf = it->second; + curBuf = it.second; (*curBuf).block.dirty = false; processCacheMap(m_lruList, curBuf, INSERT); } @@ -152,7 +152,7 @@ void Cache::freeMemory() size_t i; // free list - if (m_freeList != NULL) + if (m_freeList != nullptr) { for (i = 0; i < m_freeList->size(); i++) { @@ -163,11 +163,11 @@ void Cache::freeMemory() m_freeList->clear(); delete m_freeList; - m_freeList = NULL; + m_freeList = nullptr; } // LRU list - if (m_lruList != NULL) + if (m_lruList != nullptr) { for (it = m_lruList->begin(); it != m_lruList->end(); it++) { @@ -178,11 +178,11 @@ void Cache::freeMemory() m_lruList->clear(); delete m_lruList; - m_lruList = NULL; + m_lruList = nullptr; } // Write list - if (m_writeList != NULL) + if (m_writeList != nullptr) { for (it = m_writeList->begin(); it != m_writeList->end(); it++) { @@ -193,14 +193,14 @@ void Cache::freeMemory() m_writeList->clear(); delete m_writeList; - m_writeList = NULL; + m_writeList = nullptr; } // param - if (m_cacheParam != NULL) + if (m_cacheParam != nullptr) { delete m_cacheParam; - m_cacheParam = NULL; + m_cacheParam = nullptr; } } @@ -282,7 +282,7 @@ int Cache::insertLRUList(CommBlock& cb, const uint64_t lbid, const uint64_t fbo, BlockBuffer* buffer; vector::iterator it; - if (m_freeList->size() == 0) + if (m_freeList->empty()) return ERR_FREE_LIST_EMPTY; // make sure flush first if necessary @@ -397,10 +397,10 @@ void Cache::printCacheList() cout << "\nFree List has " << m_freeList->size() << " elements" << endl; cout << "LRU List has " << m_lruList->size() << " elements" << endl; - for (CacheMapIt it = m_lruList->begin(); it != m_lruList->end(); it++) + for (const auto& it : *m_lruList) { - buffer = it->second; - cout << "\t[" << i++ << "] key=" << it->first << " listType=" << buffer->listType + buffer = it.second; + cout << "\t[" << i++ << "] key=" << it.first << " listType=" << buffer->listType << " oid=" << (*buffer).cb.file.oid << " fbo=" << (*buffer).block.fbo << " dirty=" << (*buffer).block.dirty << " hitCount=" << (*buffer).block.hitCount << endl; } @@ -408,10 +408,10 @@ void Cache::printCacheList() i = 0; cout << "Write List has " << m_writeList->size() << " elements" << endl; - for (CacheMapIt it = m_writeList->begin(); it != m_writeList->end(); it++) + for (const auto& it : *m_writeList) { - buffer = it->second; - cout << "\t[" << i++ << "] key=" << it->first << " listType=" << buffer->listType + buffer = it.second; + cout << "\t[" << i++ << "] key=" << it.first << " listType=" << buffer->listType << " oid=" << (*buffer).cb.file.oid << " fbo=" << (*buffer).block.fbo << " dirty=" << (*buffer).block.dirty << " hitCount=" << (*buffer).block.hitCount << endl; } diff --git a/writeengine/shared/we_cache.h b/writeengine/shared/we_cache.h index 1367a9708..41bd711e2 100644 --- a/writeengine/shared/we_cache.h +++ b/writeengine/shared/we_cache.h @@ -23,11 +23,7 @@ #pragma once #include -#if __GNUC__ == 4 && __GNUC_MINOR__ < 2 -#include -#else -#include -#endif +#include #include #include @@ -65,13 +61,7 @@ struct eqCacheKey } }; -// typedef hash_map, eqSig> DCTNRYHASHMAP; -#if __GNUC__ == 4 && __GNUC_MINOR__ < 2 -typedef __gnu_cxx::hash_map, eqCacheKey> CacheMap; -#else -typedef std::tr1::unordered_map, eqCacheKey> CacheMap; -#endif -// typedef __gnu_cxx::hash_map CacheMap; +typedef std::unordered_map, eqCacheKey> CacheMap; typedef CacheMap::iterator CacheMapIt; // typedef CacheMap LRUBufList; /** @brief Least Recent Used Buffer list */ @@ -84,16 +74,12 @@ class Cache /** * @brief Constructor */ - Cache() - { - } + Cache() = default; /** * @brief Default Destructor */ - ~Cache() - { - } + ~Cache() = default; /** * @brief Check whether cache key exists @@ -215,7 +201,7 @@ class Cache static CacheMap* m_lruList; // LRU buffer list static CacheMap* m_writeList; // Write buffer list - EXPORT static bool m_useCache; // Use cache flag + EXPORT static bool m_useCache; // Use cache flag private: }; diff --git a/writeengine/shared/we_chunkmanager.h b/writeengine/shared/we_chunkmanager.h index 2cec57dff..fca2714fe 100644 --- a/writeengine/shared/we_chunkmanager.h +++ b/writeengine/shared/we_chunkmanager.h @@ -35,7 +35,7 @@ #define EXPORT -//#define IDB_COMP_DEBUG +// #define IDB_COMP_DEBUG #ifdef IDB_COMP_DEBUG #define WE_COMP_DBG(x) \ { \ @@ -136,7 +136,7 @@ class CompFileData , fColDataType(colDataType) , fColWidth(colWidth) , fDctnryCol(false) - , fFilePtr(NULL) + , fFilePtr(nullptr) , fCompressionType(1) , fReadOnly(readOnly) { diff --git a/writeengine/shared/we_config.h b/writeengine/shared/we_config.h index 3620619b5..946116d4a 100644 --- a/writeengine/shared/we_config.h +++ b/writeengine/shared/we_config.h @@ -30,7 +30,7 @@ #include "we_obj.h" -//#define SHARED_NOTHING_DEMO_2 +// #define SHARED_NOTHING_DEMO_2 #define EXPORT @@ -44,16 +44,12 @@ class Config /** * @brief Constructor */ - Config() - { - } + Config() = default; /** * @brief Default Destructor */ - ~Config() - { - } + ~Config() = default; /** * @brief Get DB root (for local PM) @@ -187,7 +183,7 @@ class Config static boost::mutex m_bulkRoot_lk; // mutex for m_bulkRoot sync #endif static int m_WaitPeriod; // secs to wait for transaction - static unsigned m_FilesPerColumnPartition; //# seg files per partition + static unsigned m_FilesPerColumnPartition; // # seg files per partition static unsigned m_ExtentsPerSegmentFile; // # extents per segment file static int m_BulkProcessPriority; // cpimport.bin proc priority static std::string m_BulkRollbackDir; // bulk rollback meta data dir diff --git a/writeengine/shared/we_convertor.cpp b/writeengine/shared/we_convertor.cpp index 9ae0784b8..0d29e3d9f 100644 --- a/writeengine/shared/we_convertor.cpp +++ b/writeengine/shared/we_convertor.cpp @@ -201,7 +201,7 @@ struct Convertor::dmFilePathArgs_t const std::string Convertor::getTimeStr() { char buf[sizeof(DATE_TIME_FORMAT) + 10] = {0}; - time_t curTime = time(NULL); + time_t curTime = time(nullptr); struct tm pTime; localtime_r(&curTime, &pTime); string timeStr; @@ -250,7 +250,7 @@ const std::string Convertor::int2Str(int val) long long Convertor::convertDecimalString(const char* field, int fieldLength, int scale) { - long double dval = strtold(field, NULL); + long double dval = strtold(field, nullptr); long long ret = 0; // move scale digits to the left of the decimal point @@ -634,9 +634,9 @@ void Convertor::convertColType(ColStruct* curStruct) { CalpontSystemCatalog::ColDataType dataType // This will be updated later, = CalpontSystemCatalog::CHAR; // CHAR used only for initialization. - ColType* internalType = NULL; + ColType* internalType = nullptr; bool bTokenFlag = false; - int* width = NULL; + int* width = nullptr; dataType = curStruct->colDataType; internalType = &(curStruct->colType); diff --git a/writeengine/shared/we_dbfileop.h b/writeengine/shared/we_dbfileop.h index f0559622a..0a5bc0dba 100644 --- a/writeengine/shared/we_dbfileop.h +++ b/writeengine/shared/we_dbfileop.h @@ -46,7 +46,7 @@ class DbFileOp : public FileOp /** * @brief Default Destructor */ - EXPORT virtual ~DbFileOp(); + EXPORT ~DbFileOp() override; EXPORT virtual int flushCache(); diff --git a/writeengine/splitter/we_brmupdater.h b/writeengine/splitter/we_brmupdater.h index 09aeb7e38..68a7afe2b 100644 --- a/writeengine/splitter/we_brmupdater.h +++ b/writeengine/splitter/we_brmupdater.h @@ -36,12 +36,10 @@ class WESDHandler; // forward deceleration class WEBrmUpdater { public: - WEBrmUpdater(WESDHandler& Ref) : fRef(Ref), fpBrm(0) - { - } - virtual ~WEBrmUpdater() + WEBrmUpdater(WESDHandler& Ref) : fRef(Ref), fpBrm(nullptr) { } + virtual ~WEBrmUpdater() = default; public: bool updateCasualPartitionAndHighWaterMarkInBRM(); @@ -59,7 +57,7 @@ class WEBrmUpdater void releaseBrmConnection() { delete fpBrm; - fpBrm = 0; + fpBrm = nullptr; } public: diff --git a/writeengine/splitter/we_cmdargs.h b/writeengine/splitter/we_cmdargs.h index 310ec3170..b5bc48af9 100644 --- a/writeengine/splitter/we_cmdargs.h +++ b/writeengine/splitter/we_cmdargs.h @@ -34,9 +34,7 @@ class WECmdArgs { public: WECmdArgs(int argc, char** argv); - virtual ~WECmdArgs() - { - } + virtual ~WECmdArgs() = default; typedef std::vector VecInts; typedef std::vector VecArgs; diff --git a/writeengine/wrapper/we_colop.h b/writeengine/wrapper/we_colop.h index 3db0027d5..9eb84db59 100644 --- a/writeengine/wrapper/we_colop.h +++ b/writeengine/wrapper/we_colop.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include "we_dbfileop.h" #include "brmtypes.h" @@ -54,7 +54,7 @@ class ColumnOp : public DbFileOp /** * @brief Default Destructor */ - EXPORT virtual ~ColumnOp(); + EXPORT ~ColumnOp() override; EXPORT virtual int allocRowId(const TxnID& txnid, bool useStartingExtent, Column& column, uint64_t totalRow, RID* rowIdArray, HWM& hwm, bool& newExtent, uint64_t& rowsLeft, HWM& newHwm, @@ -145,7 +145,7 @@ class ColumnOp : public DbFileOp */ EXPORT int extendColumn(const Column& column, bool leaveFileOpen, HWM hwm, BRM::LBID_t startLbid, int allocSize, uint16_t dbRoot, uint32_t partition, uint16_t segment, - std::string& segFile, IDBDataFile*& pFile, bool& newFile, char* hdrs = NULL); + std::string& segFile, IDBDataFile*& pFile, bool& newFile, char* hdrs = nullptr); /** * @brief Add an extent to the OID specified in the column argument. @@ -165,7 +165,7 @@ class ColumnOp : public DbFileOp */ EXPORT int addExtent(const Column& column, uint16_t dbRoot, uint32_t partition, uint16_t segment, std::string& segFile, BRM::LBID_t& startLbid, bool& newFile, int& allocSize, - char* hdrs = NULL); + char* hdrs = nullptr); /** * @brief Get columne data type @@ -216,13 +216,13 @@ class ColumnOp : public DbFileOp * @brief Write row(s) */ EXPORT virtual int writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray, const void* valArray, - void* oldValArray = 0, bool bDelete = false); + void* oldValArray = nullptr, bool bDelete = false); /** * @brief Write row(s) for delete @Bug 1886,2870 */ EXPORT virtual int writeRows(Column& curCol, uint64_t totalRow, const RIDList& ridList, - const void* valArray, void* oldValArray = 0, bool bDelete = false); + const void* valArray, void* oldValArray = nullptr, bool bDelete = false); /** * @brief MCOL-5021 Read-only version of the writeRows() function above. @@ -232,13 +232,13 @@ class ColumnOp : public DbFileOp database files. */ EXPORT virtual int writeRowsReadOnly(Column& curCol, uint64_t totalRow, const RIDList& ridList, - void* oldValArray = 0); + void* oldValArray = nullptr); /** * @brief Write row(s) for update @Bug 1886,2870 */ EXPORT virtual int writeRowsValues(Column& curCol, uint64_t totalRow, const RIDList& ridList, - const void* valArray, void* oldValArray = 0); + const void* valArray, void* oldValArray = nullptr); /** * @brief Test if the pFile is an abbreviated extent. diff --git a/writeengine/wrapper/we_colopcompress.h b/writeengine/wrapper/we_colopcompress.h index 15be5e614..5ebcbc909 100644 --- a/writeengine/wrapper/we_colopcompress.h +++ b/writeengine/wrapper/we_colopcompress.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include "we_colop.h" #include "we_chunkmanager.h" @@ -45,35 +45,35 @@ class ColumnOpCompress0 : public ColumnOp /** * @brief Default Destructor */ - EXPORT virtual ~ColumnOpCompress0(); + EXPORT ~ColumnOpCompress0() override; /** * @brief virtual method in ColumnOp */ IDBDataFile* openFile(const Column& column, uint16_t dbRoot, uint32_t partition, uint16_t segment, std::string& segFile, bool useTmpSuffix, const char* mode = "r+b", - int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const; + int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const override; /** * @brief virtual method in ColumnOp */ - bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const; + bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const override; /** * @brief virtual method in ColumnOp */ - int blocksInFile(IDBDataFile* pFile) const; + int blocksInFile(IDBDataFile* pFile) const override; protected: /** * @brief virtual method in ColumnOp */ - int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo); + int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo) override; /** * @brief virtual method in ColumnOp */ - int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo); + int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo) override; private: }; @@ -85,47 +85,47 @@ class ColumnOpCompress1 : public ColumnOp /** * @brief Constructor */ - EXPORT ColumnOpCompress1(uint32_t compressionType, Log* logger = 0); + EXPORT ColumnOpCompress1(uint32_t compressionType, Log* logger = nullptr); /** * @brief Default Destructor */ - EXPORT virtual ~ColumnOpCompress1(); + EXPORT ~ColumnOpCompress1() override; /** * @brief virtual method in FileOp */ - EXPORT int flushFile(int rc, std::map& columnOids); + EXPORT int flushFile(int rc, std::map& columnOids) override; /** * @brief virtual method in FileOp */ int expandAbbrevColumnExtent(IDBDataFile* pFile, uint16_t dbRoot, const uint8_t* emptyVal, int width, - execplan::CalpontSystemCatalog::ColDataType colDataType); + execplan::CalpontSystemCatalog::ColDataType colDataType) override; /** * @brief virtual method in ColumnOp */ IDBDataFile* openFile(const Column& column, uint16_t dbRoot, uint32_t partition, uint16_t segment, std::string& segFile, bool useTmpSuffix, const char* mode = "r+b", - int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const; + int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const override; /** * @brief virtual method in ColumnOp */ - bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const; + bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const override; /** * @brief virtual method in ColumnOp */ - int blocksInFile(IDBDataFile* pFile) const; + int blocksInFile(IDBDataFile* pFile) const override; // void chunkManager(ChunkManager* cm); /** * @brief virtual method in FileOp */ - void setTransId(const TxnID& transId) + void setTransId(const TxnID& transId) override { ColumnOp::setTransId(transId); @@ -133,12 +133,12 @@ class ColumnOpCompress1 : public ColumnOp m_chunkManager->setTransId(transId); } - void setBulkFlag(bool isBulkLoad) + void setBulkFlag(bool isBulkLoad) override { m_chunkManager->setBulkFlag(isBulkLoad); }; - void setFixFlag(bool isFix) + void setFixFlag(bool isFix) override { m_chunkManager->setFixFlag(isFix); }; @@ -147,22 +147,22 @@ class ColumnOpCompress1 : public ColumnOp /** * @brief virtual method in FileOp */ - int updateColumnExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid); + int updateColumnExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid) override; /** * @brief virtual method in ColumnOp */ - void closeColumnFile(Column& column) const; + void closeColumnFile(Column& column) const override; /** * @brief virtual method in ColumnOp */ - int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo); + int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo) override; /** * @brief virtual method in ColumnOp */ - int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo); + int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo) override; /** * @brief Set the IsInsert flag in the ChunkManager. diff --git a/writeengine/wrapper/we_dctnrycompress.h b/writeengine/wrapper/we_dctnrycompress.h index 2831b5c95..367fd5482 100644 --- a/writeengine/wrapper/we_dctnrycompress.h +++ b/writeengine/wrapper/we_dctnrycompress.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include "../dictionary/we_dctnry.h" #include "we_chunkmanager.h" @@ -43,7 +43,7 @@ class DctnryCompress0 : public Dctnry /** * @brief Default Destructor */ - EXPORT virtual ~DctnryCompress0(); + EXPORT ~DctnryCompress0() override; }; /** Class DctnryCompress1 */ @@ -53,55 +53,56 @@ class DctnryCompress1 : public Dctnry /** * @brief Constructor */ - EXPORT DctnryCompress1(uint32_t compressionType, Log* logger = 0); + EXPORT DctnryCompress1(uint32_t compressionType, Log* logger = nullptr); /** * @brief Default Destructor */ - EXPORT virtual ~DctnryCompress1(); + EXPORT ~DctnryCompress1() override; /** * @brief virtual method in FileOp */ - EXPORT int flushFile(int rc, std::map& columnOids); + EXPORT int flushFile(int rc, std::map& columnOids) override; /** * @brief virtual method in DBFileOp */ EXPORT int readDBFile(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t lbid, - const bool isFbo = false); + const bool isFbo = false) override; /** * @brief virtual method in DBFileOp */ EXPORT int writeDBFile(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t lbid, - const int numOfBlock = 1); + const int numOfBlock = 1) override; /** * @brief virtual method in DBFileOp */ EXPORT int writeDBFileNoVBCache(IDBDataFile* pFile, const unsigned char* writeBuf, const int fbo, - const int numOfBlock = 1); + const int numOfBlock = 1) override; /** * @brief virtual method in Dctnry */ - IDBDataFile* createDctnryFile(const char* name, int width, const char* mode, int ioBuffSize, int64_t lbid); + IDBDataFile* createDctnryFile(const char* name, int width, const char* mode, int ioBuffSize, + int64_t lbid) override; /** * @brief virtual method in Dctnry */ - IDBDataFile* openDctnryFile(bool useTmpSuffix); + IDBDataFile* openDctnryFile(bool useTmpSuffix) override; /** * @brief virtual method in Dctnry */ - void closeDctnryFile(bool doFlush, std::map& columnOids); + void closeDctnryFile(bool doFlush, std::map& columnOids) override; /** * @brief virtual method in Dctnry */ - int numOfBlocksInFile(); + int numOfBlocksInFile() override; /** * @brief For bulkload to use @@ -110,15 +111,15 @@ class DctnryCompress1 : public Dctnry { m_chunkManager->setMaxActiveChunkNum(maxActiveChunkNum); }; - void setBulkFlag(bool isBulkLoad) + void setBulkFlag(bool isBulkLoad) override { m_chunkManager->setBulkFlag(isBulkLoad); }; - void setFixFlag(bool isFix) + void setFixFlag(bool isFix) override { m_chunkManager->setFixFlag(isFix); }; - int checkFixLastDictChunk() + int checkFixLastDictChunk() override { return m_chunkManager->checkFixLastDictChunk(m_dctnryOID, m_dbRoot, m_partition, m_segment); }; @@ -127,7 +128,7 @@ class DctnryCompress1 : public Dctnry /** * @brief virtual method in FileOp */ - void setTransId(const TxnID& transId) + void setTransId(const TxnID& transId) override { Dctnry::setTransId(transId); @@ -148,7 +149,7 @@ class DctnryCompress1 : public Dctnry /** * @brief virtual method in FileOp */ - int updateDctnryExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid); + int updateDctnryExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid) override; /** * @brief convert lbid to fbo diff --git a/writeengine/wrapper/we_tablemetadata.h b/writeengine/wrapper/we_tablemetadata.h index 91fe7d2f8..fc92771b2 100644 --- a/writeengine/wrapper/we_tablemetadata.h +++ b/writeengine/wrapper/we_tablemetadata.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include "we_type.h" #include "brmtypes.h" #include @@ -82,7 +82,7 @@ class TableMetaData private: /** Constuctors */ explicit TableMetaData(); - explicit TableMetaData(const TableMetaData& rhs); + TableMetaData(const TableMetaData& rhs); ~TableMetaData(); static boost::mutex map_mutex; static TableMetaDataMap fTableMetaDataMap; @@ -93,4 +93,3 @@ class TableMetaData } // namespace WriteEngine #undef EXPORT - diff --git a/writeengine/wrapper/writeengine.h b/writeengine/wrapper/writeengine.h index ad472a302..07c67ca46 100644 --- a/writeengine/wrapper/writeengine.h +++ b/writeengine/wrapper/writeengine.h @@ -20,7 +20,7 @@ /** @file */ #pragma once -#include +#include #include // the header file for fd @@ -66,10 +66,8 @@ struct TxnLBIDRec std::vector m_LBIDs; std::vector m_ColDataTypes; - TxnLBIDRec(){}; - ~TxnLBIDRec() - { - } + TxnLBIDRec() = default; + ~TxnLBIDRec() = default; void AddLBID(BRM::LBID_t lbid, const execplan::CalpontSystemCatalog::ColDataType& colDataType) { if (m_LBIDSet.insert(lbid).second) @@ -92,7 +90,7 @@ struct ColSplitMaxMinInfo ColSplitMaxMinInfo(execplan::CalpontSystemCatalog::ColDataType colDataType, int colWidth) : fSplitMaxMinInfo{ExtCPInfo(colDataType, colWidth), ExtCPInfo(colDataType, colWidth)} { - fSplitMaxMinInfoPtrs[0] = fSplitMaxMinInfoPtrs[1] = NULL; // disable by default. + fSplitMaxMinInfoPtrs[0] = fSplitMaxMinInfoPtrs[1] = nullptr; // disable by default. } }; @@ -246,8 +244,7 @@ class WriteEngineWrapper : public WEObj */ EXPORT int deleteRow(const TxnID& txnid, const std::vector& colExtentsColType, std::vector& colExtentsStruct, std::vector& colOldValueList, - std::vector& ridLists, const int32_t tableOid, - bool hasAUXCol = false); + std::vector& ridLists, const int32_t tableOid, bool hasAUXCol = false); /** * @brief Delete a list of rows from a table @@ -702,7 +699,7 @@ class WriteEngineWrapper : public WEObj int writeColumnRec(const TxnID& txnid, const CSCTypesList& cscColTypes, const ColStructList& colStructList, ColValueList& colValueList, RID* rowIdArray, const ColStructList& newColStructList, ColValueList& newColValueList, const int32_t tableOid, bool useTmpSuffix, - bool versioning = true, ColSplitMaxMinInfoList* maxMins = NULL); + bool versioning = true, ColSplitMaxMinInfoList* maxMins = nullptr); int writeColumnRecBinary(const TxnID& txnid, const ColStructList& colStructList, std::vector& colValueList, RID* rowIdArray, @@ -714,14 +711,14 @@ class WriteEngineWrapper : public WEObj const ColStructList& colStructList, const ColValueList& colValueList, std::vector& colOldValueList, const RIDList& ridList, const int32_t tableOid, bool convertStructFlag = true, - ColTupleList::size_type nRows = 0, std::vector* cpInfos = NULL, + ColTupleList::size_type nRows = 0, std::vector* cpInfos = nullptr, bool hasAUXCol = false); // For update column from column to use int writeColumnRecords(const TxnID& txnid, const CSCTypesList& cscColTypeList, std::vector& colStructList, ColValueList& colValueList, const RIDList& ridLists, const int32_t tableOid, bool versioning = true, - std::vector* cpInfos = NULL); + std::vector* cpInfos = nullptr); /** * @brief util method to convert rowid to a column file @@ -738,7 +735,7 @@ class WriteEngineWrapper : public WEObj // txn so that we don't waste time marking the same extent as invalid. This // list should be trimmed if it gets too big. int AddLBIDtoList(const TxnID txnid, const ColStruct& colStruct, const int fbo, - ExtCPInfo* cpInfo = NULL // provide CPInfo pointer if you want max/min updated. + ExtCPInfo* cpInfo = nullptr // provide CPInfo pointer if you want max/min updated. ); // Get CPInfo for given starting LBID and column description structure. diff --git a/writeengine/xml/we_xmlgendata.h b/writeengine/xml/we_xmlgendata.h index 5bf4873cc..633f1ed8a 100644 --- a/writeengine/xml/we_xmlgendata.h +++ b/writeengine/xml/we_xmlgendata.h @@ -48,13 +48,13 @@ class XMLGenData // Valid parms that can be stored and retrieved from XMLGenData EXPORT const static std::string DELIMITER; EXPORT const static std::string DESCRIPTION; - EXPORT const static std::string ENCLOSED_BY_CHAR; - EXPORT const static std::string ESCAPE_CHAR; - EXPORT const static std::string JOBID; + EXPORT const static std::string ENCLOSED_BY_CHAR; + EXPORT const static std::string ESCAPE_CHAR; + EXPORT const static std::string JOBID; EXPORT const static std::string MAXERROR; EXPORT const static std::string NAME; EXPORT const static std::string PATH; - EXPORT const static std::string RPT_DEBUG; + EXPORT const static std::string RPT_DEBUG; EXPORT const static std::string USER; EXPORT const static std::string NO_OF_READ_BUFFER; EXPORT const static std::string READ_BUFFER_CAPACITY; diff --git a/writeengine/xml/we_xmljob.h b/writeengine/xml/we_xmljob.h index d5943f8b0..088a2c65b 100644 --- a/writeengine/xml/we_xmljob.h +++ b/writeengine/xml/we_xmljob.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "we_xmlop.h" @@ -54,7 +54,7 @@ class XMLJob : public XMLOp /** * @brief Default Destructor */ - EXPORT ~XMLJob(); + EXPORT ~XMLJob() override; /** * @brief Utility to generate a full path name for a Job XML file name @@ -115,7 +115,7 @@ class XMLJob : public XMLOp * @brief Process node * @param pParentNode Node to be parsed from XML */ - EXPORT bool processNode(xmlNode* pParentNode); + EXPORT bool processNode(xmlNode* pParentNode) override; /** * @brief Set timezone