This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new d7ac44a [Bug] Fix bug that BE will crash when querying
information_schema.columns (#4511)
d7ac44a is described below
commit d7ac44ac79c043cf37c45590c31eac69eec05728
Author: Mingyu Chen <[email protected]>
AuthorDate: Thu Sep 3 16:57:56 2020 +0800
[Bug] Fix bug that BE will crash when querying information_schema.columns
(#4511)
This bug is introduced from #4364
---
.../exec/schema_scanner/schema_columns_scanner.cpp | 42 ++++++++++++++--------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/be/src/exec/schema_scanner/schema_columns_scanner.cpp
b/be/src/exec/schema_scanner/schema_columns_scanner.cpp
index 640f7bd..84f1d50 100644
--- a/be/src/exec/schema_scanner/schema_columns_scanner.cpp
+++ b/be/src/exec/schema_scanner/schema_columns_scanner.cpp
@@ -154,11 +154,11 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
// set all bit to not null
memset((void *)tuple, 0, _tuple_desc->num_null_bytes());
- // catalog
+ // TABLE_CATALOG
{
tuple->set_null(_tuple_desc->slots()[0]->null_indicator_offset());
}
- // schema
+ // TABLE_SCHEMA
{
void *slot = tuple->get_slot(_tuple_desc->slots()[1]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
@@ -167,7 +167,7 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
str_slot->len = db_name.size();
memcpy(str_slot->ptr, db_name.c_str(), str_slot->len);
}
- // table
+ // TABLE_NAME
{
void *slot = tuple->get_slot(_tuple_desc->slots()[2]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
@@ -175,7 +175,7 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
str_slot->len = _table_result.tables[_table_index - 1].length();
memcpy(str_slot->ptr, _table_result.tables[_table_index - 1].c_str(),
str_slot->len);
}
- // column
+ // COLUMN_NAME
{
void *slot = tuple->get_slot(_tuple_desc->slots()[3]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
@@ -252,17 +252,21 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
tuple->set_null(_tuple_desc->slots()[11]->null_indicator_offset());
}
}
- // CHARACTER_SET_NAME
+ // DATETIME_PRECISION
{
tuple->set_null(_tuple_desc->slots()[12]->null_indicator_offset());
}
- // COLLATION_NAME
+ // CHARACTER_SET_NAME
{
tuple->set_null(_tuple_desc->slots()[13]->null_indicator_offset());
}
+ // COLLATION_NAME
+ {
+ tuple->set_null(_tuple_desc->slots()[14]->null_indicator_offset());
+ }
// COLUMN_TYPE
{
- void *slot = tuple->get_slot(_tuple_desc->slots()[14]->tuple_offset());
+ void *slot = tuple->get_slot(_tuple_desc->slots()[15]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
std::string buffer =
type_to_string(_desc_result.columns[_column_index].columnDesc);
str_slot->len = buffer.length();
@@ -271,7 +275,7 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
}
// COLUMN_KEY
{
- void *slot = tuple->get_slot(_tuple_desc->slots()[15]->tuple_offset());
+ void *slot = tuple->get_slot(_tuple_desc->slots()[16]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
str_slot->len = strlen("") + 1;
str_slot->ptr = (char *)pool->allocate(str_slot->len);
@@ -279,7 +283,7 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
}
// EXTRA
{
- void *slot = tuple->get_slot(_tuple_desc->slots()[16]->tuple_offset());
+ void *slot = tuple->get_slot(_tuple_desc->slots()[17]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
str_slot->len = strlen("") + 1;
str_slot->ptr = (char *)pool->allocate(str_slot->len);
@@ -287,7 +291,7 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
}
// PRIVILEGES
{
- void *slot = tuple->get_slot(_tuple_desc->slots()[17]->tuple_offset());
+ void *slot = tuple->get_slot(_tuple_desc->slots()[18]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
str_slot->len = strlen("") + 1;
str_slot->ptr = (char *)pool->allocate(str_slot->len);
@@ -295,7 +299,7 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
}
// COLUMN_COMMENT
{
- void *slot = tuple->get_slot(_tuple_desc->slots()[18]->tuple_offset());
+ void *slot = tuple->get_slot(_tuple_desc->slots()[19]->tuple_offset());
StringValue* str_slot = reinterpret_cast<StringValue*>(slot);
str_slot->ptr =
(char
*)pool->allocate(_desc_result.columns[_column_index].comment.length());
@@ -304,24 +308,32 @@ Status SchemaColumnsScanner::fill_one_row(Tuple *tuple,
MemPool *pool) {
}
// COLUMN_SIZE
{
- void *slot = tuple->get_slot(_tuple_desc->slots()[19]->tuple_offset());
+ void *slot = tuple->get_slot(_tuple_desc->slots()[20]->tuple_offset());
int64_t* str_slot = reinterpret_cast<int64_t*>(slot);
if
(_desc_result.columns[_column_index].columnDesc.__isset.columnLength) {
*str_slot =
_desc_result.columns[_column_index].columnDesc.columnLength;
} else {
- tuple->set_null(_tuple_desc->slots()[19]->null_indicator_offset());
+ tuple->set_null(_tuple_desc->slots()[20]->null_indicator_offset());
}
}
// DECIMAL_DIGITS
{
- void *slot = tuple->get_slot(_tuple_desc->slots()[20]->tuple_offset());
+ void *slot = tuple->get_slot(_tuple_desc->slots()[21]->tuple_offset());
int64_t* str_slot = reinterpret_cast<int64_t*>(slot);
if
(_desc_result.columns[_column_index].columnDesc.__isset.columnScale) {
*str_slot =
_desc_result.columns[_column_index].columnDesc.columnScale;
} else {
- tuple->set_null(_tuple_desc->slots()[20]->null_indicator_offset());
+ tuple->set_null(_tuple_desc->slots()[21]->null_indicator_offset());
}
}
+ // GENERATION_EXPRESSION
+ {
+ tuple->set_null(_tuple_desc->slots()[23]->null_indicator_offset());
+ }
+ // SRS_ID
+ {
+ tuple->set_null(_tuple_desc->slots()[23]->null_indicator_offset());
+ }
_column_index++;
return Status::OK();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]