-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Insert a space,SELECT COUNT(DISTINCT col2) FROM t1;Error query result #736
Comments
###Insert data without space, the test result is correct |
The stack for setting the count value is as follows: Tianmu::core::AggregatorCount32::PutAggregatedValue(Tianmu::core::AggregatorCount32 * const this, unsigned char * buf, int64_t factor) (\opt\litaihong\stonedb\storage\tianmu\core\aggregator.h:300)
Tianmu::core::AggregatorCount32::PutAggregatedValue(Tianmu::core::AggregatorCount32 * const this, unsigned char * buf, const Tianmu::types::BString & v, int64_t factor) (\opt\litaihong\stonedb\storage\tianmu\core\aggregator.h:313)
Tianmu::core::GroupTable::PutAggregatedValue(Tianmu::core::GroupTable * const this, int col, int64_t row, Tianmu::core::MIIterator & mit, int64_t factor, bool as_string) (\opt\litaihong\stonedb\storage\tianmu\core\group_table.cpp:556)
Tianmu::core::GroupByWrapper::PutAggregatedValue(Tianmu::core::GroupByWrapper * const this, int gr_a, int64_t pos, Tianmu::core::MIIterator & mit, int64_t factor) (\opt\litaihong\stonedb\storage\tianmu\core\groupby_wrapper.cpp:509)
Tianmu::core::AggregationAlgorithm::AggregatePackrow(Tianmu::core::AggregationAlgorithm * const this, Tianmu::core::GroupByWrapper & gbw, Tianmu::core::MIIterator * mit, int64_t cur_tuple) (\opt\litaihong\stonedb\storage\tianmu\core\aggregation_algorithm.cpp:591)
Tianmu::core::AggregationAlgorithm::MultiDimensionalGroupByScan(Tianmu::core::AggregationAlgorithm * const this, Tianmu::core::GroupByWrapper & gbw, int64_t & limit, int64_t & offset, Tianmu::core::ResultSender * sender, bool limit_less_than_no_groups, bool force_parall) (\opt\litaihong\stonedb\storage\tianmu\core\aggregation_algorithm.cpp:292)
Tianmu::core::AggregationAlgorithm::Aggregate(Tianmu::core::AggregationAlgorithm * const this, bool just_distinct, int64_t & limit, int64_t & offset, Tianmu::core::ResultSender * sender) (\opt\litaihong\stonedb\storage\tianmu\core\aggregation_algorithm.cpp:197)
Tianmu::core::TempTable::Materialize(Tianmu::core::TempTable * const this, bool in_subq, Tianmu::core::ResultSender * sender, bool lazy) (\opt\litaihong\stonedb\storage\tianmu\core\temp_table.cpp:1972)
Tianmu::core::Engine::Execute(Tianmu::core::Engine * const this, THD * thd, LEX * lex, Query_result * result_output, SELECT_LEX_UNIT * unit_for_union) (\opt\litaihong\stonedb\storage\tianmu\core\engine_execute.cpp:426)
Tianmu::core::Engine::HandleSelect(Tianmu::core::Engine * const this, THD * thd, LEX * lex, Query_result *& result, ulong setup_tables_done_option, int & res, int & optimize_after_tianmu, int & tianmu_free_join, int with_insert) (\opt\litaihong\stonedb\storage\tianmu\core\engine_execute.cpp:232)
Tianmu::dbhandler::TIANMU_HandleSelect(THD * thd, LEX * lex, Query_result *& result, ulong setup_tables_done_option, int & res, int & optimize_after_tianmu, int & tianmu_free_join, int with_insert) (\opt\litaihong\stonedb\storage\tianmu\handler\ha_rcengine.cpp:82)
execute_sqlcom_select(THD * thd, TABLE_LIST * all_tables) (\opt\litaihong\stonedb\sql\sql_parse.cc:5182)
mysql_execute_command(THD * thd, bool first_level) (\opt\litaihong\stonedb\sql\sql_parse.cc:2831)
mysql_parse(THD * thd, Parser_state * parser_state) (\opt\litaihong\stonedb\sql\sql_parse.cc:5621)
dispatch_command(THD * thd, const COM_DATA * com_data, enum_server_command command) (\opt\litaihong\stonedb\sql\sql_parse.cc:1495)
do_command(THD * thd) (\opt\litaihong\stonedb\sql\sql_parse.cc:1034)
handle_connection(void * arg) (\opt\litaihong\stonedb\sql\conn_handler\connection_handler_per_thread.cc:313)
pfs_spawn_thread(void * arg) (\opt\litaihong\stonedb\storage\perfschema\pfs.cc:2197)
libpthread.so.0!start_thread (未知源:0)
libc.so.6!clone (未知源:0) The FindCurrentRow function returns GBIMODE_AS_TEXT to enter the accumulation process, and the FindCurrentRowByVMTable function returns GDT_EXISTS to enter the re-counting process, resulting in the string type of count being always 1. Tianmu::core::GroupDistinctTable::FindCurrentRow(Tianmu::core::GroupDistinctTable * const this, bool find_only) (\opt\litaihong\stonedb\storage\tianmu\core\group_distinct_table.cpp:282)
Tianmu::core::GroupDistinctTable::Add(Tianmu::core::GroupDistinctTable * const this, int64_t group, Tianmu::core::MIIterator & mit) (\opt\litaihong\stonedb\storage\tianmu\core\group_distinct_table.cpp:179)
Tianmu::core::GroupTable::PutAggregatedValue(Tianmu::core::GroupTable * const this, int col, int64_t row, Tianmu::core::MIIterator & mit, int64_t factor, bool as_string) (\opt\litaihong\stonedb\storage\tianmu\core\group_table.cpp:538)
Tianmu::core::GroupByWrapper::PutAggregatedValue(Tianmu::core::GroupByWrapper * const this, int gr_a, int64_t pos, Tianmu::core::MIIterator & mit, int64_t factor) (\opt\litaihong\stonedb\storage\tianmu\core\groupby_wrapper.cpp:509)
Tianmu::core::AggregationAlgorithm::AggregatePackrow(Tianmu::core::AggregationAlgorithm * const this, Tianmu::core::GroupByWrapper & gbw, Tianmu::core::MIIterator * mit, int64_t cur_tuple) (\opt\litaihong\stonedb\storage\tianmu\core\aggregation_algorithm.cpp:591)
Tianmu::core::AggregationAlgorithm::MultiDimensionalGroupByScan(Tianmu::core::AggregationAlgorithm * const this, Tianmu::core::GroupByWrapper & gbw, int64_t & limit, int64_t & offset, Tianmu::core::ResultSender * sender, bool limit_less_than_no_groups, bool force_parall) (\opt\litaihong\stonedb\storage\tianmu\core\aggregation_algorithm.cpp:292)
Tianmu::core::AggregationAlgorithm::Aggregate(Tianmu::core::AggregationAlgorithm * const this, bool just_distinct, int64_t & limit, int64_t & offset, Tianmu::core::ResultSender * sender) (\opt\litaihong\stonedb\storage\tianmu\core\aggregation_algorithm.cpp:197)
Tianmu::core::TempTable::Materialize(Tianmu::core::TempTable * const this, bool in_subq, Tianmu::core::ResultSender * sender, bool lazy) (\opt\litaihong\stonedb\storage\tianmu\core\temp_table.cpp:1972)
Tianmu::core::Engine::Execute(Tianmu::core::Engine * const this, THD * thd, LEX * lex, Query_result * result_output, SELECT_LEX_UNIT * unit_for_union) (\opt\litaihong\stonedb\storage\tianmu\core\engine_execute.cpp:426)
Tianmu::core::Engine::HandleSelect(Tianmu::core::Engine * const this, THD * thd, LEX * lex, Query_result *& result, ulong setup_tables_done_option, int & res, int & optimize_after_tianmu, int & tianmu_free_join, int with_insert) (\opt\litaihong\stonedb\storage\tianmu\core\engine_execute.cpp:232)
Tianmu::dbhandler::TIANMU_HandleSelect(THD * thd, LEX * lex, Query_result *& result, ulong setup_tables_done_option, int & res, int & optimize_after_tianmu, int & tianmu_free_join, int with_insert) (\opt\litaihong\stonedb\storage\tianmu\handler\ha_rcengine.cpp:82)
execute_sqlcom_select(THD * thd, TABLE_LIST * all_tables) (\opt\litaihong\stonedb\sql\sql_parse.cc:5182)
mysql_execute_command(THD * thd, bool first_level) (\opt\litaihong\stonedb\sql\sql_parse.cc:2831)
mysql_parse(THD * thd, Parser_state * parser_state) (\opt\litaihong\stonedb\sql\sql_parse.cc:5621)
dispatch_command(THD * thd, const COM_DATA * com_data, enum_server_command command) (\opt\litaihong\stonedb\sql\sql_parse.cc:1495)
do_command(THD * thd) (\opt\litaihong\stonedb\sql\sql_parse.cc:1034)
handle_connection(void * arg) (\opt\litaihong\stonedb\sql\conn_handler\connection_handler_per_thread.cc:313)
pfs_spawn_thread(void * arg) (\opt\litaihong\stonedb\storage\perfschema\pfs.cc:2197)
libpthread.so.0!start_thread (未知源:0)
libc.so.6!clone (未知源:0) |
The AggregatePackrow function call flow is as follows: AggregationAlgorithm::AggregatePackrow
--------------------------->AggregateRough--->FindCurrentRow--->GroupTable::FindCurrentRow--->FindCurrentRow
--------------------------------------------------------------------------------------------->GetAggregationRow
--------------------------------------------->AddGroup
--------------------------------------------->InvalidateAggregationStatistics
--------------------------------------------->PackWillNotUpdateAggregation
--------------------------->GroupByWrapper::PutAggregatedValue--->GroupTable::PutAggregatedValue--->GroupDistinctTable::Add--->ColumnBinEncoder::ValEncode--->ColumnBinEncoder::EncoderInt::ValEncode--->GetNotNullValueInt64--->GetNotNullValueInt64
------------------------------------------------------------------------------------------------------------------------------>FindCurrentRowByVMTable
--------------------------------------------------------------------------------------------------->PutAggregatedValue
--------------------------->GroupByWrapper::PutAggregatedValue--->GroupTable::PutAggregatedValue |
… (#756) Replace the function FindCurrentRowByVMTable that gets the current row to FindCurrentRow.
Have you read the Contributing Guidelines on issues?
Please confirm if bug report does NOT exists already ?
Describe the problem
Expected behavior
How To Reproduce
CREATE TABLE t1(col1 INT, col2 CHAR(5))ENGINE=tianmu;
INSERT INTO t1 VALUES(NULL,''),(1,'a'),(1,'b'),(1,'c'),(2,'dd'),(3,'eee');
SELECT COUNT(DISTINCT col2) FROM t1;
Ver 14.14 Distrib 5.7.36-StoneDB
The text was updated successfully, but these errors were encountered: