github-actions[bot] commented on code in PR #17921:
URL: https://github.com/apache/doris/pull/17921#discussion_r1141228782
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@ TEST(TEST_VEXPR, ABSTEST) {
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
Review Comment:
warning: unknown type name 'TupleDescriptor'; did you mean
'doris::TupleDescriptor'? [clang-diagnostic-error]
```suggestion
static doris::TupleDescriptor* create_tuple_desc(ObjectPool* pool,
```
**be/src/vec/core/block.h:43:** 'doris::TupleDescriptor' declared here
```cpp
class TupleDescriptor;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
Review Comment:
warning: unknown type name 'ObjectPool' [clang-diagnostic-error]
```cpp
static TupleDescriptor* create_tuple_desc(ObjectPool* pool,
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
Review Comment:
warning: use of undeclared identifier 'SchemaScanner'; did you mean
'doris::SchemaScanner'? [clang-diagnostic-error]
```suggestion
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
```
**be/src/exec/schema_scanner.h:67:** 'doris::SchemaScanner' declared here
```cpp
class SchemaScanner {
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
Review Comment:
warning: use of undeclared identifier 'SlotDescriptor'
[clang-diagnostic-error]
```cpp
std::vector<SlotDescriptor*> slots;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
Review Comment:
warning: expected expression [clang-diagnostic-error]
```cpp
std::vector<SlotDescriptor*> slots;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
Review Comment:
warning: unknown type name 'TSlotDescriptor'; did you mean
'doris::TSlotDescriptor'? [clang-diagnostic-error]
```suggestion
doris::TSlotDescriptor t_slot_desc;
```
**be/src/runtime/descriptors.h:45:** 'doris::TSlotDescriptor' declared here
```cpp
class TSlotDescriptor;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
Review Comment:
warning: use of undeclared identifier 'TypeDescriptor'; did you mean
'doris::TypeDescriptor'? [clang-diagnostic-error]
```suggestion
t_slot_desc.__set_slotType(doris::TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
```
**be/src/udf/udf.h:40:** 'doris::TypeDescriptor' declared here
```cpp
struct TypeDescriptor;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
Review Comment:
warning: use of undeclared identifier 'TYPE_DECIMALV2'; did you mean
'doris::TYPE_DECIMALV2'? [clang-diagnostic-error]
```suggestion
if (column_descs[i].type == doris::TYPE_DECIMALV2) {
```
**be/src/runtime/define_primitive_type.h:43:** 'doris::TYPE_DECIMALV2'
declared here
```cpp
TYPE_DECIMALV2, /* 20 */
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
Review Comment:
warning: unknown type name 'SlotDescriptor'; did you mean
'doris::SlotDescriptor'? [clang-diagnostic-error]
```suggestion
doris::SlotDescriptor* slot = pool->add(new (std::nothrow)
SlotDescriptor(t_slot_desc));
```
**be/src/runtime/descriptors.h:84:** 'doris::SlotDescriptor' declared here
```cpp
class SlotDescriptor {
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
Review Comment:
warning: unknown type name 'TypeDescriptor'; did you mean
'doris::TypeDescriptor'? [clang-diagnostic-error]
```suggestion
doris::TypeDescriptor descriptor(column_descs[i].type);
```
**be/src/udf/udf.h:40:** 'doris::TypeDescriptor' declared here
```cpp
struct TypeDescriptor;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
Review Comment:
warning: unknown type name 'SlotDescriptor'; did you mean
'doris::SlotDescriptor'? [clang-diagnostic-error]
```suggestion
SlotDescriptor* slot = pool->add(new (std::nothrow)
doris::SlotDescriptor(t_slot_desc));
```
**be/src/runtime/descriptors.h:84:** 'doris::SlotDescriptor' declared here
```cpp
class SlotDescriptor {
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
Review Comment:
warning: calling a private constructor of class 'doris::SlotDescriptor'
[clang-diagnostic-error]
```cpp
SlotDescriptor* slot = pool->add(new (std::nothrow)
SlotDescriptor(t_slot_desc));
^
```
**be/src/runtime/descriptors.h:148:** declared private here
```cpp
SlotDescriptor(const TSlotDescriptor& tdesc);
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
+ SlotDescriptor* slot = pool->add(new (std::nothrow)
SlotDescriptor(t_slot_desc));
+ slots.push_back(slot);
+ offset += column_descs[i].size;
+ }
+
+ TTupleDescriptor t_tuple_desc;
+ t_tuple_desc.__set_byteSize(offset);
+ t_tuple_desc.__set_numNullBytes((null_byte * 8 + null_bit + 7) / 8);
Review Comment:
warning: unknown type name 'TupleDescriptor'; did you mean
'doris::TupleDescriptor'? [clang-diagnostic-error]
```suggestion
doris::TupleDescriptor* tuple_desc = pool->add(new (std::nothrow)
TupleDescriptor(t_tuple_desc));
```
**be/src/vec/core/block.h:43:** 'doris::TupleDescriptor' declared here
```cpp
class TupleDescriptor;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
+ SlotDescriptor* slot = pool->add(new (std::nothrow)
SlotDescriptor(t_slot_desc));
+ slots.push_back(slot);
+ offset += column_descs[i].size;
+ }
+
Review Comment:
warning: unknown type name 'TTupleDescriptor'; did you mean
'doris::TTupleDescriptor'? [clang-diagnostic-error]
```suggestion
doris::TTupleDescriptor t_tuple_desc;
```
**be/src/runtime/descriptors.h:46:** 'doris::TTupleDescriptor' declared here
```cpp
class TTupleDescriptor;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
+ SlotDescriptor* slot = pool->add(new (std::nothrow)
SlotDescriptor(t_slot_desc));
+ slots.push_back(slot);
+ offset += column_descs[i].size;
+ }
+
+ TTupleDescriptor t_tuple_desc;
+ t_tuple_desc.__set_byteSize(offset);
+ t_tuple_desc.__set_numNullBytes((null_byte * 8 + null_bit + 7) / 8);
Review Comment:
warning: calling a private constructor of class 'doris::TupleDescriptor'
[clang-diagnostic-error]
```cpp
TupleDescriptor* tuple_desc = pool->add(new (std::nothrow)
TupleDescriptor(t_tuple_desc));
^
```
**be/src/runtime/descriptors.h:368:** declared private here
```cpp
TupleDescriptor(const TTupleDescriptor& tdesc, bool own_slot = false);
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
+ SlotDescriptor* slot = pool->add(new (std::nothrow)
SlotDescriptor(t_slot_desc));
+ slots.push_back(slot);
+ offset += column_descs[i].size;
+ }
+
+ TTupleDescriptor t_tuple_desc;
+ t_tuple_desc.__set_byteSize(offset);
+ t_tuple_desc.__set_numNullBytes((null_byte * 8 + null_bit + 7) / 8);
Review Comment:
warning: unknown type name 'TupleDescriptor'; did you mean
'doris::TupleDescriptor'? [clang-diagnostic-error]
```suggestion
TupleDescriptor* tuple_desc = pool->add(new (std::nothrow)
doris::TupleDescriptor(t_tuple_desc));
```
**be/src/vec/core/block.h:43:** 'doris::TupleDescriptor' declared here
```cpp
class TupleDescriptor;
^
```
##########
be/test/vec/exprs/vexpr_test.cpp:
##########
@@ -63,15 +64,80 @@
context->close(&runtime_stat);
}
+// Only the unit test depend on this, but it is wrong, should not use
TTupleDesc to create tuple desc, not
+// use columndesc
+static doris::TupleDescriptor* create_tuple_desc(
+ doris::ObjectPool* pool,
std::vector<doris::SchemaScanner::ColumnDesc>& column_descs) {
+ using namespace doris;
+ int null_column = 0;
+ for (int i = 0; i < column_descs.size(); ++i) {
+ if (column_descs[i].is_null) {
+ null_column++;
+ }
+ }
+
+ int offset = (null_column + 7) / 8;
+ std::vector<SlotDescriptor*> slots;
+ int null_byte = 0;
+ int null_bit = 0;
+
+ for (int i = 0; i < column_descs.size(); ++i) {
+ TSlotDescriptor t_slot_desc;
+ if (column_descs[i].type == TYPE_DECIMALV2) {
+
t_slot_desc.__set_slotType(TypeDescriptor::create_decimalv2_type(27,
9).to_thrift());
+ } else {
+ TypeDescriptor descriptor(column_descs[i].type);
+ if (column_descs[i].precision >= 0 && column_descs[i].scale >= 0) {
+ descriptor.precision = column_descs[i].precision;
+ descriptor.scale = column_descs[i].scale;
+ }
+ t_slot_desc.__set_slotType(descriptor.to_thrift());
+ }
+ t_slot_desc.__set_colName(column_descs[i].name);
+ t_slot_desc.__set_columnPos(i);
+ t_slot_desc.__set_byteOffset(offset);
+
+ if (column_descs[i].is_null) {
+ t_slot_desc.__set_nullIndicatorByte(null_byte);
+ t_slot_desc.__set_nullIndicatorBit(null_bit);
+ null_bit = (null_bit + 1) % 8;
+
+ if (0 == null_bit) {
+ null_byte++;
+ }
+ } else {
+ t_slot_desc.__set_nullIndicatorByte(0);
+ t_slot_desc.__set_nullIndicatorBit(-1);
+ }
+
+ t_slot_desc.id = i;
+ t_slot_desc.__set_slotIdx(i);
+ t_slot_desc.__set_isMaterialized(true);
+
+ SlotDescriptor* slot = pool->add(new (std::nothrow)
SlotDescriptor(t_slot_desc));
+ slots.push_back(slot);
+ offset += column_descs[i].size;
+ }
+
+ TTupleDescriptor t_tuple_desc;
+ t_tuple_desc.__set_byteSize(offset);
+ t_tuple_desc.__set_numNullBytes((null_byte * 8 + null_bit + 7) / 8);
+ doris::TupleDescriptor* tuple_desc =
+ pool->add(new (std::nothrow) doris::TupleDescriptor(t_tuple_desc));
+
Review Comment:
warning: 'add_slot' is a private member of 'doris::TupleDescriptor'
[clang-diagnostic-error]
```cpp
tuple_desc->add_slot(slots[i]);
^
```
**be/src/runtime/descriptors.h:373:** declared private here
```cpp
void add_slot(SlotDescriptor* slot);
^
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]