Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions be/src/runtime/primitive_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,15 +709,15 @@ struct PrimitiveTypeTraits<TYPE_MAP> {
};
template <>
struct PrimitiveTypeTraits<TYPE_STRUCT> {
using CppType = vectorized::Tuple;
using CppType = vectorized::Struct;
using StorageFieldType = CppType;
using CppNativeType = CppType;
using ColumnItemType = CppType;
using DataType = vectorized::DataTypeStruct;
using ColumnType = vectorized::ColumnStruct;
using NearestFieldType = vectorized::Tuple;
using AvgNearestFieldType = vectorized::Tuple;
using AvgNearestFieldType256 = vectorized::Tuple;
using NearestFieldType = vectorized::Struct;
using AvgNearestFieldType = vectorized::Struct;
using AvgNearestFieldType256 = vectorized::Struct;
static constexpr PrimitiveType NearestPrimitiveType = TYPE_STRUCT;
static constexpr PrimitiveType AvgNearestPrimitiveType = TYPE_STRUCT;
static constexpr PrimitiveType AvgNearestPrimitiveType256 = TYPE_STRUCT;
Expand Down
6 changes: 3 additions & 3 deletions be/src/vec/columns/column_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Field ColumnStruct::operator[](size_t n) const {
void ColumnStruct::get(size_t n, Field& res) const {
const size_t tuple_size = columns.size();

res = Field::create_field<TYPE_STRUCT>(Tuple());
Tuple& res_tuple = res.get<Tuple&>();
res = Field::create_field<TYPE_STRUCT>(Struct());
Struct& res_tuple = res.get<Struct&>();
res_tuple.reserve(tuple_size);

for (size_t i = 0; i < tuple_size; ++i) {
Expand All @@ -119,7 +119,7 @@ void ColumnStruct::get(size_t n, Field& res) const {

void ColumnStruct::insert(const Field& x) {
DCHECK_EQ(x.get_type(), PrimitiveType::TYPE_STRUCT);
const auto& tuple = x.get<const Tuple&>();
const auto& tuple = x.get<const Struct&>();
const size_t tuple_size = columns.size();
if (tuple.size() != tuple_size) {
throw doris::Exception(ErrorCode::INTERNAL_ERROR,
Expand Down
6 changes: 3 additions & 3 deletions be/src/vec/core/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct Array : public FieldVector {
using FieldVector::FieldVector;
};

struct Tuple : public FieldVector {
struct Struct : public FieldVector {
using FieldVector::FieldVector;
};

Expand Down Expand Up @@ -445,7 +445,7 @@ class Field {
f(field.template get<Array>());
return;
case PrimitiveType::TYPE_STRUCT:
f(field.template get<Tuple>());
f(field.template get<Struct>());
return;
case PrimitiveType::TYPE_MAP:
f(field.template get<Map>());
Expand Down Expand Up @@ -488,7 +488,7 @@ class Field {

private:
std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64,
Int128, IPv6, Float64, String, JsonbField, Array, Tuple, Map, VariantMap,
Int128, IPv6, Float64, String, JsonbField, Array, Struct, Map, VariantMap,
DecimalField<Decimal32>, DecimalField<Decimal64>,
DecimalField<Decimal128V2>, DecimalField<Decimal128V3>,
DecimalField<Decimal256>, BitmapValue, HyperLogLog, QuantileState,
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/data_types/convert_field_to_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class FieldVisitorToJsonb : public StaticVisitor<void> {
}
void operator()(const Array& x, JsonbWriter* writer) const;

void operator()(const Tuple& x, JsonbWriter* writer) const {
void operator()(const Struct& x, JsonbWriter* writer) const {
throw doris::Exception(doris::ErrorCode::NOT_IMPLEMENTED_ERROR, "Not implemeted");
}
void operator()(const DecimalField<Decimal32>& x, JsonbWriter* writer) const {
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/data_types/data_type_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Status DataTypeStruct::check_column(const IColumn& column) const {

Field DataTypeStruct::get_default() const {
size_t size = elems.size();
Tuple t;
Struct t;
for (size_t i = 0; i < size; ++i) {
t.push_back(elems[i]->get_default());
}
Expand Down
4 changes: 2 additions & 2 deletions be/src/vec/exprs/vstruct_literal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ namespace doris::vectorized {
Status VStructLiteral::prepare(RuntimeState* state, const RowDescriptor& row_desc,
VExprContext* context) {
RETURN_IF_ERROR_OR_PREPARED(VExpr::prepare(state, row_desc, context));
Field struct_field = Field::create_field<TYPE_STRUCT>(Tuple());
Field struct_field = Field::create_field<TYPE_STRUCT>(Struct());
for (const auto& child : _children) {
Field item;
auto child_literal = std::dynamic_pointer_cast<const VLiteral>(child);
child_literal->get_column_ptr()->get(0, item);
struct_field.get<Tuple>().push_back(item);
struct_field.get<Struct>().push_back(item);
}
_column_ptr = _data_type->create_column_const(1, struct_field);
return Status::OK();
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/columns/column_hash_func_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ TEST(HashFuncTest, StructTypeTestWithSepcificValueCrcHash) {
dataTypes.push_back(n1);
dataTypes.push_back(s1);

Tuple t;
Struct t;
t.push_back(vectorized::Field::create_field<TYPE_BIGINT>(Int64(1)));
t.push_back(vectorized::Field::create_field<TYPE_STRING>("hello"));

Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/columns/column_variant_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2788,7 +2788,7 @@ TEST_F(ColumnVariantTest, get_field_info_all_types) {

// Test Tuple
{
Tuple t1;
Struct t1;
t1.push_back(Field::create_field<TYPE_STRING>(String("amory cute")));
t1.push_back(Field::create_field<TYPE_BIGINT>(Int64(37)));
t1.push_back(Field::create_field<TYPE_BOOLEAN>(true));
Expand Down
6 changes: 3 additions & 3 deletions be/test/vec/core/column_struct_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ TEST(ColumnStructTest2, StringTest) {
->insert_indices_from(*str64_struct_column, indices.data(),
indices.data() + indices.size());
EXPECT_EQ(str32_struct_column->size(), indices.size());
auto t = get<Tuple>(str32_struct_column->operator[](0));
auto t = get<Struct>(str32_struct_column->operator[](0));
EXPECT_EQ(t.size(), 2);
EXPECT_EQ(t[0], Field::create_field<TYPE_STRING>("aaa"));
EXPECT_EQ(t[1], Field::create_field<TYPE_BIGINT>(111));

t = get<Tuple>(str32_struct_column->operator[](1));
t = get<Struct>(str32_struct_column->operator[](1));
EXPECT_EQ(t.size(), 2);
EXPECT_EQ(t[0], Field::create_field<TYPE_STRING>("ccc"));
EXPECT_EQ(t[1], Field::create_field<TYPE_BIGINT>(333));

t = get<Tuple>(str32_struct_column->operator[](2));
t = get<Struct>(str32_struct_column->operator[](2));
EXPECT_EQ(t.size(), 2);
EXPECT_EQ(t[0], Field::create_field<TYPE_STRING>("ddd"));
EXPECT_EQ(t[1], Field::create_field<TYPE_BIGINT>(444));
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/data_types/data_type_ip_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ TEST_F(DataTypeIPTest, SerdeTOJsonInComplex) {
column_map_ipv6->insert(Field::create_field<TYPE_MAP>(ipv6_map));

// pack struct
Tuple tuple;
Struct tuple;
tuple.push_back(Field::create_field<TYPE_IPV4>(ipv4_values[0]));
tuple.push_back(Field::create_field<TYPE_IPV6>(ipv6_values[0]));
tuple.push_back(Field::create_field<TYPE_ARRAY>(ipv4_array));
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/data_types/data_type_map_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ TEST_F(DataTypeMapTest, SerdeNestedTypeArrowTest) {
std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {f4}));
DataTypePtr ma = std::make_shared<DataTypeMap>(dt1, dt2);

Tuple t1, t2, t3, t4;
Struct t1, t2, t3, t4;
t1.push_back(Field::create_field<TYPE_STRING>("clever"));
t1.push_back(Field::create_field<TYPE_LARGEINT>(__int128_t(37)));
t1.push_back(Field::create_field<TYPE_BOOLEAN>(true));
Expand Down
10 changes: 5 additions & 5 deletions be/test/vec/data_types/data_type_struct_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ TEST_F(DataTypeStructTest, SerdeNestedTypeArrowTest) {
m2.push_back(Field::create_field<TYPE_ARRAY>(v2));

// nested Struct
Tuple t1, t2;
Struct t1, t2;
t1.push_back(Field::create_field<TYPE_STRING>("clever"));
t1.push_back(Field::create_field<TYPE_LARGEINT>(__int128_t(37)));
t1.push_back(Field::create_field<TYPE_BOOLEAN>(true));
Expand All @@ -397,7 +397,7 @@ TEST_F(DataTypeStructTest, SerdeNestedTypeArrowTest) {
t2.push_back(Field::create_field<TYPE_BOOLEAN>(false));

// Struct
Tuple tt1, tt2;
Struct tt1, tt2;
tt1.push_back(Field::create_field<TYPE_ARRAY>(a1));
tt1.push_back(Field::create_field<TYPE_MAP>(m1));
tt1.push_back(Field::create_field<TYPE_STRUCT>(t1));
Expand Down Expand Up @@ -425,7 +425,7 @@ TEST_F(DataTypeStructTest, writeColumnToOrc) {
DataTypePtr st = std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {dt1, dt2});
auto serde = st->get_serde(1);

Tuple test_data;
Struct test_data;
test_data.push_back(Field::create_field<TYPE_BIGINT>(100));
test_data.push_back(Field::create_field<TYPE_BIGINT>(200));

Expand Down Expand Up @@ -463,7 +463,7 @@ TEST_F(DataTypeStructTest, formString) {
DataTypePtr dt1 = std::make_shared<DataTypeInt32>();
DataTypePtr dt2 = std::make_shared<DataTypeString>();
DataTypePtr st = std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {dt1, dt2});
Tuple tt1;
Struct tt1;
tt1.push_back(Field::create_field<TYPE_INT>(100));
tt1.push_back(Field::create_field<TYPE_STRING>("asd"));

Expand Down Expand Up @@ -495,7 +495,7 @@ TEST_F(DataTypeStructTest, insertColumnLastValueMultipleTimes) {
DataTypePtr dt1 = std::make_shared<DataTypeInt32>();
DataTypePtr dt2 = std::make_shared<DataTypeString>();
DataTypePtr st = std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {dt1, dt2});
Tuple tt1;
Struct tt1;
tt1.push_back(Field::create_field<TYPE_INT>(100));
tt1.push_back(Field::create_field<TYPE_STRING>("asd"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void serialize_and_deserialize_arrow_test(std::vector<PrimitiveType> cols, int r
DataTypePtr m = std::make_shared<DataTypeNullable>(std::make_shared<DataTypeUInt8>());
DataTypePtr st = std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {s, d, m});
type_desc = st;
Tuple t1, t2;
Struct t1, t2;
t1.push_back(Field::create_field<TYPE_STRING>("amory cute"));
t1.push_back(Field::create_field<TYPE_LARGEINT>(__int128_t(37)));
t1.push_back(Field::create_field<TYPE_BOOLEAN>(true));
Expand Down
4 changes: 2 additions & 2 deletions be/test/vec/data_types/serde/data_type_serde_pb_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ TEST(DataTypeSerDePbTest, DataTypeScalaSerDeTestStruct) {
DataTypePtr d = std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt128>());
DataTypePtr m = std::make_shared<DataTypeNullable>(std::make_shared<DataTypeUInt8>());
DataTypePtr st = std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {s, d, m});
Tuple t1, t2;
Struct t1, t2;
t1.push_back(Field::create_field<TYPE_STRING>(String("amory cute")));
t1.push_back(Field::create_field<TYPE_LARGEINT>(__int128_t(37)));
t1.push_back(Field::create_field<TYPE_BOOLEAN>(true));
Expand Down Expand Up @@ -596,7 +596,7 @@ TEST(DataTypeSerDePbTest, DataTypeScalaSerDeTestStruct2) {
DataTypePtr d = std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt64>());
DataTypePtr m = std::make_shared<DataTypeNullable>(std::make_shared<DataTypeUInt8>());
DataTypePtr st = std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {s, d, m});
Tuple t1, t2;
Struct t1, t2;
t1.push_back(Field::create_field<TYPE_STRING>(String("amory cute")));
t1.push_back(Field::create_field<TYPE_BIGINT>(37));
t1.push_back(Field::create_field<TYPE_BOOLEAN>(true));
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/data_types/serde/data_type_to_string_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TEST(ToStringMethodTest, DataTypeToStringTest) {
m.push_back(Field::create_field<TYPE_ARRAY>(a1));
m.push_back(Field::create_field<TYPE_ARRAY>(a2));

Tuple t;
Struct t;
t.push_back(Field::create_field<TYPE_LARGEINT>(Int128(12345454342)));
t.push_back(Field::create_field<TYPE_STRING>(String("amory cute")));
t.push_back(Field::create_field<TYPE_BIGINT>(Int64(0)));
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/jsonb/convert_field_to_type_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ TEST_F(ConvertFieldToTypeTest, ConvertFieldToType_ErrorCases) {

// Test with unsupported types (should throw exception)
{
Field tuple_field = Field::create_field<TYPE_STRUCT>(Tuple());
Field tuple_field = Field::create_field<TYPE_STRUCT>(Struct());

EXPECT_THROW(
{
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/jsonb/serialize_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ TEST(BlockSerializeTest, Struct) {
DataTypePtr d = std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt128>());
DataTypePtr m = std::make_shared<DataTypeNullable>(std::make_shared<DataTypeUInt8>());
DataTypePtr st = std::make_shared<DataTypeStruct>(std::vector<DataTypePtr> {s, d, m});
Tuple t1, t2;
Struct t1, t2;
t1.push_back(Field::create_field<TYPE_STRING>(String("amory cute")));
t1.push_back(Field::create_field<TYPE_LARGEINT>(__int128_t(37)));
t1.push_back(Field::create_field<TYPE_BOOLEAN>(true));
Expand Down