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
13 changes: 7 additions & 6 deletions be/src/core/column/column_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ 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());
res = Field::create_field<TYPE_STRUCT>(Struct());
auto& res_tuple = res.get<TYPE_STRUCT>();
res_tuple.reserve(tuple_size);

Expand All @@ -121,10 +121,11 @@ void ColumnStruct::insert(const Field& x) {
const auto& tuple = x.get<TYPE_STRUCT>();
const size_t tuple_size = columns.size();
if (tuple.size() != tuple_size) {
throw doris::Exception(ErrorCode::INTERNAL_ERROR,
"Cannot insert value of different size into tuple. field tuple size "
"{}, columns size {}",
tuple.size(), tuple_size);
throw doris::Exception(
ErrorCode::INTERNAL_ERROR,
"Cannot insert value of different size into struct. field struct size "
"{}, columns size {}",
tuple.size(), tuple_size);
}

for (size_t i = 0; i < tuple_size; ++i) {
Expand All @@ -138,7 +139,7 @@ void ColumnStruct::insert_from(const IColumn& src_, size_t n) {
const size_t tuple_size = columns.size();
if (src.columns.size() != tuple_size) {
throw doris::Exception(ErrorCode::INTERNAL_ERROR,
"Cannot insert value of different size into tuple.");
"Cannot insert value of different size into struct.");
__builtin_unreachable();
}

Expand Down
2 changes: 1 addition & 1 deletion be/src/core/data_type/convert_field_to_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,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 Decimal32& x, JsonbWriter* writer) const {
Expand Down
2 changes: 1 addition & 1 deletion be/src/core/data_type/data_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class IDataType : private boost::noncopyable {

virtual bool equals_ignore_precision(const IDataType& rhs) const { return equals(rhs); }

/** Example: numbers, Date, DateTime, FixedString, Enum... Nullable and Tuple of such types.
/** Example: numbers, Date, DateTime, FixedString, Enum... Nullable and Struct of such types.
* Counterexamples: String, Array.
* It's Ok to return false for AggregateFunction despite the fact that some of them have fixed size state.
*/
Expand Down
4 changes: 2 additions & 2 deletions be/src/core/data_type/data_type_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ static Status check_tuple_names(const Strings& names) {
std::unordered_set<String> names_set;
for (const auto& name : names) {
if (name.empty()) {
return Status::InvalidArgument("Names of tuple elements cannot be empty");
return Status::InvalidArgument("Names of struct elements cannot be empty");
}

if (!names_set.insert(name).second) {
return Status::InvalidArgument("Names of tuple elements must be unique");
return Status::InvalidArgument("Names of struct elements must be unique");
}
}

Expand Down
4 changes: 2 additions & 2 deletions be/src/core/data_type/primitive_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ColumnVarbinary;
using ColumnString = ColumnStr<UInt32>;
class JsonbField;
struct Array;
struct Tuple;
struct Struct;
struct Map;
struct FieldWithDataType;
using VariantMap = std::map<PathInData, FieldWithDataType>;
Expand Down Expand Up @@ -496,7 +496,7 @@ struct PrimitiveTypeTraits<TYPE_MAP> {
};
template <>
struct PrimitiveTypeTraits<TYPE_STRUCT> {
using CppType = Tuple;
using CppType = Struct;
using StorageFieldType = CppType;
using DataType = DataTypeStruct;
using ColumnType = ColumnStruct;
Expand Down
8 changes: 4 additions & 4 deletions be/src/core/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ class Field;

using FieldVector = std::vector<Field>;

/// Array and Tuple use the same storage type -- FieldVector, but we declare
/// Array and Struct use the same storage type -- FieldVector, but we declare
/// distinct types for them, so that the caller can choose whether it wants to
/// construct a Field of Array or a Tuple type. An alternative approach would be
/// construct a Field of Array or a Struct type. An alternative approach would be
/// to construct both of these types from FieldVector, and have the caller
/// specify the desired Field type explicitly.
struct Array : public FieldVector {
using FieldVector::FieldVector;
};

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

Expand Down Expand Up @@ -286,7 +286,7 @@ class Field {

private:
std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64,
Int128, IPv6, Float64, String, JsonbField, StringView, Array, Tuple, Map,
Int128, IPv6, Float64, String, JsonbField, StringView, Array, Struct, Map,
VariantMap, Decimal32, Decimal64, DecimalV2Value, Decimal128V3, Decimal256,
BitmapValue, HyperLogLog, QuantileState>
storage;
Expand Down
2 changes: 1 addition & 1 deletion be/src/exprs/vstruct_literal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace doris {
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);
Expand Down
4 changes: 2 additions & 2 deletions be/src/util/json/json_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ StringRef JSONDataParser<ParserImpl>::getNameOfNested(const PathInData::Parts& p
return {};
}
/// Find first key that is marked as nested,
/// because we may have tuple of Nested and there could be
/// because we may have struct of Nested and there could be
/// several arrays with the same prefix, but with independent sizes.
/// Consider we have array element with type `k2 Tuple(k3 Nested(...), k5 Nested(...))`
/// Consider we have array element with type `k2 Struct(k3 Nested(...), k5 Nested(...))`
/// Then subcolumns `k2.k3` and `k2.k5` may have indepented sizes and we should extract
/// `k3` and `k5` keys instead of `k2`.
for (const auto& part : path) {
Expand Down
2 changes: 1 addition & 1 deletion be/test/core/column/column_hash_func_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ TEST(HashFuncTest, StructTypeTestWithSepcificValueCrcHash) {
dataTypes.push_back(n1);
dataTypes.push_back(s1);

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

Expand Down
4 changes: 2 additions & 2 deletions be/test/core/column/column_variant_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2786,9 +2786,9 @@ TEST_F(ColumnVariantTest, get_field_info_all_types) {
EXPECT_EQ(info.scalar_type_id, PrimitiveType::TYPE_JSONB);
}

// Test Tuple
// Test Struct
{
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
2 changes: 1 addition & 1 deletion be/test/core/data_type/data_type_ip_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,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/core/data_type/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/core/data_type/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 @@ -468,7 +468,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 @@ -500,7 +500,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 @@ -357,7 +357,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/core/data_type_serde/data_type_serde_pb_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,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 @@ -578,7 +578,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
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/core/jsonb/convert_field_to_type_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,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/core/jsonb/serialize_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,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
Loading