stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

feature: Improve the readbility of stonedb

Open RingsC opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Nowaday, The code style of stonedb is not friendly to who are first time to try understand the code. for example, the code does not spererate logically, or the variables name can not be unstooed by the literal meaning. for example:

int DoGetSomething(); , Doing 'GetSomething' int GetNoNulls(), Getting the number of nulls.

or Makes the directory of stonedb more reable. For example, core / to core/parse; core/optimize, etc.

Describe the solution you'd like

To refactor code make it more readable to anyone who are the first to read that. For example: Changes int DoGetSomething(); to int GetSomethingXXX();, int GetNoNulls() to int GetNumOfNulls()

Describe alternatives you've considered

Additional context

SubTasks:

  • #311

RingsC avatar Jun 16 '22 02:06 RingsC

Close it now.

RingsC avatar Sep 09 '22 02:09 RingsC

In Tianmu engine conversion syntax tree code style collation

In the code logic of Tianmu engine conversion syntax tree, a large number of if judgment returns to the same line as if, which has the following problems:

  1. During debugging, it is not possible to break the point directly at the position where the logic returns, so it must be tracked step by step, which is unfavorable for fast positioning logic problems

  2. When reading the code, I could not quickly understand the relevant logic. I wrote the if and return logic on the same line, which apparently saved the number of lines of code, but increased the effort needed to understand the context

adofsauron avatar Sep 28 '22 13:09 adofsauron

root@ub01:/data/codebase/stonedb57/stonedb/build/build_fix-11-stonedb57-1116_x86_64_Ubuntu20.04_Debug_2022-11-16_01-01-53# grep  "warning.*" build.log.11.16  |sort |uniq  |grep tianmu
/data/codebase/stonedb57/stonedb/storage/tianmu/async_tests/task_executor.h:69:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
/data/codebase/stonedb57/stonedb/storage/tianmu/base/core/iostream_impl.h:38:27: warning: redundant move in return statement [-Wredundant-move]
/data/codebase/stonedb57/stonedb/storage/tianmu/compress/part_dict.cpp:110:43: warning: declaration ‘class Tianmu::compress::PartDict<T>::HashTab::AKey’ does not declare anything
/data/codebase/stonedb57/stonedb/storage/tianmu/compress/text_compressor.cpp:406:70: warning: ‘int LZ4_compress(const char*, char*, int)’ is deprecated: use LZ4_compress_default() instead [-Wdeprecated-declarations]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/aggregation_algorithm.cpp:860:77: warning: unused parameter ‘ci’ [-Wunused-parameter]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/aggregation_algorithm.cpp:921:7: warning: unused variable ‘mod’ [-Wunused-variable]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/column.h:38:15: warning: implicitly-declared ‘constexpr Tianmu::core::Column& Tianmu::core::Column::operator=(const Tianmu::core::Column&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/engine.cpp:1543:93: warning: implicitly-declared ‘Tianmu::common::TianmuError& Tianmu::common::TianmuError::operator=(const Tianmu::common::TianmuError&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/engine.cpp:1545:16: warning: implicitly-declared ‘Tianmu::common::TianmuError& Tianmu::common::TianmuError::operator=(const Tianmu::common::TianmuError&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/engine_results.cpp:478:93: warning: implicitly-declared ‘Tianmu::common::TianmuError& Tianmu::common::TianmuError::operator=(const Tianmu::common::TianmuError&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/group_distinct_table.cpp:60:17: warning: comparison of integer expressions of different signedness: ‘int64_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/item_tianmu_field.cpp:210:26: warning: unused variable ‘res’ [-Wunused-variable]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner.cpp:43:32: warning: capture of variable ‘tianmu_sysvar_force_hashjoin’ with non-automatic storage duration
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:102:69: warning: unused parameter ‘task’ [-Wunused-parameter]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:103:91: warning: unused parameter ‘_pack_desc_locked’ [-Wunused-parameter]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:176:86: warning: unused parameter ‘pack_desc_locked_p’ [-Wunused-parameter]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:282:13: warning: unused variable ‘packrow_length’ [-Wunused-variable]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:336:7: warning: unused variable ‘no_desc’ [-Wunused-variable]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:338:7: warning: unused variable ‘index’ [-Wunused-variable]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:68:8: warning: unused variable ‘loc_result’ [-Wunused-variable]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_general.cpp:69:8: warning: unused variable ‘stop_execution’ [-Wunused-variable]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/joiner_mapped.cpp:221:19: warning: redundant move in return statement [-Wredundant-move]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/mi_iterator.h:356:27: warning: implicitly-declared ‘Tianmu::core::MIInpackIterator::MIInpackIterator(const Tianmu::core::MIInpackIterator&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/parameterized_filter.cpp:1021:41: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Tianmu::core::JustATable*>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/parameterized_filter.cpp:1026:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint’ {aka ‘unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/parameterized_filter.cpp:1553:41: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Tianmu::core::JustATable*>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/proxy_hash_joiner.cpp:131:21: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/query_compile.cpp:1012:63: warning: operation on ‘conds’ may be undefined [-Wsequence-point]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/query_compile.cpp:1204:19: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/task_executor.h:69:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/value_matching_table.h:118:8: warning:   by ‘virtual bool Tianmu::core::ValueMatching_OnePosition::FindCurrentRow(unsigned char*, int64_t&, bool)’ [-Woverloaded-virtual]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/value_matching_table.h:159:8: warning:   by ‘virtual bool Tianmu::core::ValueMatching_LookupTable::FindCurrentRow(unsigned char*, int64_t&, bool)’ [-Woverloaded-virtual]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/value_matching_table.h:55:16: warning: ‘virtual bool Tianmu::core::ValueMatchingTable::FindCurrentRow(unsigned char*, int64_t&, bool, int)’ was hidden [-Woverloaded-virtual]
/data/codebase/stonedb57/stonedb/storage/tianmu/core/value_matching_table.h:55:95: warning: unused parameter ‘match_width’ [-Wunused-parameter]
/data/codebase/stonedb57/stonedb/storage/tianmu/handler/ha_rcengine.cpp:111:68: warning: implicitly-declared ‘Tianmu::common::TianmuError& Tianmu::common::TianmuError::operator=(const Tianmu::common::TianmuError&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/handler/ha_rcengine.cpp:118:82: warning: implicitly-declared ‘Tianmu::common::TianmuError& Tianmu::common::TianmuError::operator=(const Tianmu::common::TianmuError&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/handler/ha_rcengine.cpp:121:117: warning: implicitly-declared ‘Tianmu::common::TianmuError& Tianmu::common::TianmuError::operator=(const Tianmu::common::TianmuError&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/index/rc_table_index.cpp:210:110: warning: unused parameter ‘row’ [-Wunused-parameter]
/data/codebase/stonedb57/stonedb/storage/tianmu/index/rdb_meta_manager.cpp:40:31: warning: unused parameter ‘keyno’ [-Wunused-parameter]
/data/codebase/stonedb57/stonedb/storage/tianmu/mm/reference_object.h:38:74: warning: implicitly-declared ‘constexpr Tianmu::core::TOCoordinate& Tianmu::core::TOCoordinate::operator=(const Tianmu::core::TOCoordinate&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/mm/tcm/tccommon.cpp:127:62: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers]
/data/codebase/stonedb57/stonedb/storage/tianmu/system/cacheable_item.cpp:58:34: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/system/cacheable_item.cpp:59:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/system/cacheable_item.cpp:61:33: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/system/cacheable_item.cpp:62:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
/data/codebase/stonedb57/stonedb/storage/tianmu/types/bstring.cpp:56:113: warning: implicitly-declared ‘constexpr Tianmu::types::ValueBasic<Tianmu::types::BString>::ValueBasic(const Tianmu::types::ValueBasic<Tianmu::types::BString>&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/types/rc_data_types.h:175:7: warning: implicitly-declared ‘constexpr Tianmu::types::RCDataType::RCDataType(const Tianmu::types::RCDataType&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/types/rc_datetime.cpp:112:77: warning: implicitly-declared ‘constexpr Tianmu::types::ValueBasic<Tianmu::types::RCDateTime>::ValueBasic(const Tianmu::types::ValueBasic<Tianmu::types::RCDateTime>&)’ is deprecated [-Wdeprecated-copy]
/data/codebase/stonedb57/stonedb/storage/tianmu/types/rc_num.cpp:48:32: warning: implicitly-declared ‘constexpr Tianmu::types::ValueBasic<Tianmu::types::RCNum>::ValueBasic(const Tianmu::types::ValueBasic<Tianmu::types::RCNum>&)’ is deprecated [-Wdeprecated-copy]

lujiashun avatar Nov 16 '22 01:11 lujiashun