You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/06 02:37:28 UTC

[GitHub] [doris] carlvinhust2012 opened a new pull request, #15669: adjust the vexpr for struct type

carlvinhust2012 opened a new pull request, #15669:
URL: https://github.com/apache/doris/pull/15669

   # Proposed changes
   1. this pr is used to adjust the vexpr for struct type when we import data.
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] cambyzju merged pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
cambyzju merged PR #15669:
URL: https://github.com/apache/doris/pull/15669


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15669:
URL: https://github.com/apache/doris/pull/15669#issuecomment-1381549234

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] carlvinhust2012 commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
carlvinhust2012 commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069055330


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -91,6 +80,88 @@ std::string DataTypeStruct::do_get_name() const {
     return s.str();
 }
 
+Status DataTypeStruct::from_string(ReadBuffer& rb, IColumn* column) const {
+    DCHECK(!rb.eof());
+    auto* struct_column = assert_cast<ColumnStruct*>(column);
+
+    if (*rb.position() != '{') {
+        return Status::InvalidArgument("Struct does not start with '{' character, found '{}'",
+                                       *rb.position());
+    }
+    if (*(rb.end() - 1) != '}') {

Review Comment:
   done



##########
be/src/vec/data_types/data_type_factory.cpp:
##########
@@ -20,6 +20,10 @@
 
 #include "vec/data_types/data_type_factory.hpp"
 
+#include "vec/data_types/data_type_hll.h"
+#include "vec/data_types/data_type_jsonb.h"

Review Comment:
   done



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069075952


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -22,17 +22,6 @@
 
 namespace doris::vectorized {
 
-namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
-} // namespace ErrorCodes
-
 DataTypeStruct::DataTypeStruct(const DataTypes& elems_)
         : elems(elems_), have_explicit_names(false) {

Review Comment:
   warning: unused variable 'NOT_FOUND_COLUMN_IN_BLOCK' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -22,17 +22,6 @@
 
 namespace doris::vectorized {
 
-namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
-} // namespace ErrorCodes
-
 DataTypeStruct::DataTypeStruct(const DataTypes& elems_)
         : elems(elems_), have_explicit_names(false) {
     /// Automatically assigned names in form of '1', '2', ...

Review Comment:
   warning: unused variable 'SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
             ^
   ```
   



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] carlvinhust2012 commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
carlvinhust2012 commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069055844


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java:
##########
@@ -169,8 +169,29 @@ public abstract class Type {
         arraySubTypes.add(STRING);
 
         structSubTypes = Lists.newArrayList();
+        structSubTypes.add(TINYINT);
+        structSubTypes.add(SMALLINT);
         structSubTypes.add(INT);
+        structSubTypes.add(BIGINT);
+        structSubTypes.add(LARGEINT);

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java:
##########
@@ -169,8 +169,29 @@ public abstract class Type {
         arraySubTypes.add(STRING);
 
         structSubTypes = Lists.newArrayList();
+        structSubTypes.add(TINYINT);
+        structSubTypes.add(SMALLINT);
         structSubTypes.add(INT);
+        structSubTypes.add(BIGINT);
+        structSubTypes.add(LARGEINT);
+        structSubTypes.add(FLOAT);
+        structSubTypes.add(DOUBLE);
+
+        structSubTypes.add(BOOLEAN);
+        structSubTypes.add(VARCHAR);
         structSubTypes.add(STRING);
+        structSubTypes.add(CHAR);
+        structSubTypes.add(DATE);
+        structSubTypes.add(DATETIME);
+        structSubTypes.add(DATEV2);
+        structSubTypes.add(DATETIMEV2);
+        structSubTypes.add(TIME);
+        structSubTypes.add(TIMEV2);
+        structSubTypes.add(JSONB);

Review Comment:
   done



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15669:
URL: https://github.com/apache/doris/pull/15669#issuecomment-1381467944

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15669:
URL: https://github.com/apache/doris/pull/15669#issuecomment-1381473007

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1066692783


##########
be/src/vec/data_types/data_type_struct.h:
##########
@@ -103,6 +106,7 @@ class DataTypeStruct final : public IDataType {
         LOG(FATAL) << "serialize not implemented";
     }
 
+    Status from_string(ReadBuffer& rb, IColumn* column) const;

Review Comment:
   warning: 'from_string' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
   ```cpp
       Status from_string(ReadBuffer& rb, IColumn* column) const;
              ^
   ```
   **be/src/vec/data_types/data_type.h:72:** overridden virtual function is here
   ```cpp
       virtual Status from_string(ReadBuffer& rb, IColumn* column) const;
                      ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.h:
##########
@@ -103,6 +106,7 @@
         LOG(FATAL) << "serialize not implemented";
     }
 
+    Status from_string(ReadBuffer& rb, IColumn* column) const;

Review Comment:
   warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override]
   
   ```suggestion
       Status from_string(ReadBuffer& rb, IColumn* column) const override;
   ```
   



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] cambyzju commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069067462


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -91,6 +80,94 @@ std::string DataTypeStruct::do_get_name() const {
     return s.str();
 }
 
+Status DataTypeStruct::from_string(ReadBuffer& rb, IColumn* column) const {
+    DCHECK(!rb.eof());
+    auto* struct_column = assert_cast<ColumnStruct*>(column);
+
+    if (*rb.position() != '{') {
+        return Status::InvalidArgument("Struct does not start with '{' character, found '{}'",
+                                       *rb.position());
+    }
+    if (*(rb.end() - 1) != '}' && rb.count() > 1) {

Review Comment:
   ```suggestion
       if (rb.count() < 2 || *(rb.end() - 1) != '}' && ) {
   ```



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] cambyzju commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069036760


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -91,6 +80,88 @@ std::string DataTypeStruct::do_get_name() const {
     return s.str();
 }
 
+Status DataTypeStruct::from_string(ReadBuffer& rb, IColumn* column) const {
+    DCHECK(!rb.eof());
+    auto* struct_column = assert_cast<ColumnStruct*>(column);
+
+    if (*rb.position() != '{') {
+        return Status::InvalidArgument("Struct does not start with '{' character, found '{}'",
+                                       *rb.position());
+    }
+    if (*(rb.end() - 1) != '}') {
+        return Status::InvalidArgument("Struct does not end with '}' character, found '{}'",
+                                       *(rb.end() - 1));
+    }
+    ++rb.position();
+    std::vector<ReadBuffer> field_rbs;
+    field_rbs.reserve(elems.size());
+
+    // here get the value "jack" and 20 from {"name":"jack","age":20}
+    while (!rb.eof()) {
+        size_t field_len = 0;
+        auto start = rb.position();
+        while (!rb.eof() && *start != ',' && *start != '}') {
+            field_len++;
+            start++;
+        }
+        if (field_len >= rb.count()) {
+            return Status::InvalidArgument("Invalid Length");
+        }
+        ReadBuffer field_rb(rb.position(), field_len);
+        size_t len = 0;
+        auto start_rb = field_rb.position();
+        while (!field_rb.eof() && *start_rb != ':') {
+            len++;
+            start_rb++;
+        }
+        ReadBuffer field(field_rb.position() + len + 1, field_rb.count() - len - 1);
+
+        if (*field.position() != '"' && *field.end() != '"') {

Review Comment:
   if `field_size < 2 || *field.position() != '"' || *field.end() != '"'` ?



##########
be/src/vec/data_types/data_type_factory.cpp:
##########
@@ -20,6 +20,10 @@
 
 #include "vec/data_types/data_type_factory.hpp"
 
+#include "vec/data_types/data_type_hll.h"
+#include "vec/data_types/data_type_jsonb.h"

Review Comment:
   hll and jsonb already included in data_type_factory.hpp



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java:
##########
@@ -169,8 +169,29 @@ public abstract class Type {
         arraySubTypes.add(STRING);
 
         structSubTypes = Lists.newArrayList();
+        structSubTypes.add(TINYINT);
+        structSubTypes.add(SMALLINT);
         structSubTypes.add(INT);
+        structSubTypes.add(BIGINT);
+        structSubTypes.add(LARGEINT);
+        structSubTypes.add(FLOAT);
+        structSubTypes.add(DOUBLE);
+
+        structSubTypes.add(BOOLEAN);
+        structSubTypes.add(VARCHAR);
         structSubTypes.add(STRING);
+        structSubTypes.add(CHAR);
+        structSubTypes.add(DATE);
+        structSubTypes.add(DATETIME);
+        structSubTypes.add(DATEV2);
+        structSubTypes.add(DATETIMEV2);
+        structSubTypes.add(TIME);
+        structSubTypes.add(TIMEV2);
+        structSubTypes.add(JSONB);

Review Comment:
   do not add complex type  now for STRUCT



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] cambyzju commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069027760


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java:
##########
@@ -169,8 +169,29 @@ public abstract class Type {
         arraySubTypes.add(STRING);
 
         structSubTypes = Lists.newArrayList();
+        structSubTypes.add(TINYINT);
+        structSubTypes.add(SMALLINT);
         structSubTypes.add(INT);
+        structSubTypes.add(BIGINT);
+        structSubTypes.add(LARGEINT);

Review Comment:
   structSubTypes.addAll(integerTypes);



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15669:
URL: https://github.com/apache/doris/pull/15669#issuecomment-1381607861

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1063051134


##########
be/src/vec/columns/column_struct.cpp:
##########
@@ -23,10 +23,10 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int ILLEGAL_COLUMN;
-extern const int NOT_IMPLEMENTED;
-extern const int CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE;
-extern const int LOGICAL_ERROR;
+    const int ILLEGAL_COLUMN = 44;
+    const int NOT_IMPLEMENTED = 48;
+    const int LOGICAL_ERROR = 49;

Review Comment:
   warning: unused variable 'LOGICAL_ERROR' [clang-diagnostic-unused-const-variable]
   ```cpp
       const int LOGICAL_ERROR = 49;
                 ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+    const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+    const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+    const int DUPLICATE_COLUMN = 15;
+    const int BAD_ARGUMENTS = 36;
+    const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH = 42;
+    const int LOGICAL_ERROR = 49;
+    const int EMPTY_DATA_PASSED = 92;

Review Comment:
   warning: unused variable 'EMPTY_DATA_PASSED' [clang-diagnostic-unused-const-variable]
   ```cpp
       const int EMPTY_DATA_PASSED = 92;
                 ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+    const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+    const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+    const int DUPLICATE_COLUMN = 15;
+    const int BAD_ARGUMENTS = 36;
+    const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH = 42;
+    const int LOGICAL_ERROR = 49;

Review Comment:
   warning: unused variable 'LOGICAL_ERROR' [clang-diagnostic-unused-const-variable]
   ```cpp
       const int LOGICAL_ERROR = 49;
                 ^
   ```
   



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15669:
URL: https://github.com/apache/doris/pull/15669#issuecomment-1381616577

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1067818064


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+const int DUPLICATE_COLUMN = 15;

Review Comment:
   warning: unused variable 'DUPLICATE_COLUMN' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int DUPLICATE_COLUMN = 15;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;

Review Comment:
   warning: unused variable 'SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+const int DUPLICATE_COLUMN = 15;
+const int BAD_ARGUMENTS = 36;
+const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH = 42;
+const int LOGICAL_ERROR = 49;

Review Comment:
   warning: unused variable 'LOGICAL_ERROR' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int LOGICAL_ERROR = 49;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+const int DUPLICATE_COLUMN = 15;
+const int BAD_ARGUMENTS = 36;
+const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH = 42;
+const int LOGICAL_ERROR = 49;
+const int EMPTY_DATA_PASSED = 92;

Review Comment:
   warning: unused variable 'EMPTY_DATA_PASSED' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int EMPTY_DATA_PASSED = 92;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+const int DUPLICATE_COLUMN = 15;
+const int BAD_ARGUMENTS = 36;
+const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH = 42;
+const int LOGICAL_ERROR = 49;
+const int EMPTY_DATA_PASSED = 92;
+const int ILLEGAL_INDEX = 127;

Review Comment:
   warning: unused variable 'ILLEGAL_INDEX' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int ILLEGAL_INDEX = 127;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+const int DUPLICATE_COLUMN = 15;
+const int BAD_ARGUMENTS = 36;

Review Comment:
   warning: unused variable 'BAD_ARGUMENTS' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int BAD_ARGUMENTS = 36;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;

Review Comment:
   warning: unused variable 'NOT_FOUND_COLUMN_IN_BLOCK' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
             ^
   ```
   



##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -23,14 +23,14 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int BAD_ARGUMENTS;
-extern const int DUPLICATE_COLUMN;
-extern const int EMPTY_DATA_PASSED;
-extern const int NOT_FOUND_COLUMN_IN_BLOCK;
-extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
-extern const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH;
-extern const int ILLEGAL_INDEX;
-extern const int LOGICAL_ERROR;
+const int NOT_FOUND_COLUMN_IN_BLOCK = 10;
+const int SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH = 13;
+const int DUPLICATE_COLUMN = 15;
+const int BAD_ARGUMENTS = 36;
+const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH = 42;

Review Comment:
   warning: unused variable 'NUMBER_OF_ARGUMENTS_DOESNT_MATCH' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH = 42;
             ^
   ```
   



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1067808419


##########
be/src/vec/columns/column_struct.cpp:
##########
@@ -23,10 +23,10 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int ILLEGAL_COLUMN;
-extern const int NOT_IMPLEMENTED;
-extern const int CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE;
-extern const int LOGICAL_ERROR;
+const int ILLEGAL_COLUMN = 44;

Review Comment:
   warning: unused variable 'ILLEGAL_COLUMN' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int ILLEGAL_COLUMN = 44;
             ^
   ```
   



##########
be/src/vec/columns/column_struct.cpp:
##########
@@ -23,10 +23,10 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int ILLEGAL_COLUMN;
-extern const int NOT_IMPLEMENTED;
-extern const int CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE;
-extern const int LOGICAL_ERROR;
+const int ILLEGAL_COLUMN = 44;
+const int NOT_IMPLEMENTED = 48;
+const int LOGICAL_ERROR = 49;
+const int CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE = 120;

Review Comment:
   warning: unused variable 'CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE = 120;
             ^
   ```
   



##########
be/src/vec/columns/column_struct.cpp:
##########
@@ -23,10 +23,10 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int ILLEGAL_COLUMN;
-extern const int NOT_IMPLEMENTED;
-extern const int CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE;
-extern const int LOGICAL_ERROR;
+const int ILLEGAL_COLUMN = 44;
+const int NOT_IMPLEMENTED = 48;
+const int LOGICAL_ERROR = 49;

Review Comment:
   warning: unused variable 'LOGICAL_ERROR' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int LOGICAL_ERROR = 49;
             ^
   ```
   



##########
be/src/vec/columns/column_struct.cpp:
##########
@@ -23,10 +23,10 @@
 namespace doris::vectorized {
 
 namespace ErrorCodes {
-extern const int ILLEGAL_COLUMN;
-extern const int NOT_IMPLEMENTED;
-extern const int CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE;
-extern const int LOGICAL_ERROR;
+const int ILLEGAL_COLUMN = 44;
+const int NOT_IMPLEMENTED = 48;

Review Comment:
   warning: unused variable 'NOT_IMPLEMENTED' [clang-diagnostic-unused-const-variable]
   ```cpp
   const int NOT_IMPLEMENTED = 48;
             ^
   ```
   



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] carlvinhust2012 commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
carlvinhust2012 commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069109566


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -91,6 +80,88 @@ std::string DataTypeStruct::do_get_name() const {
     return s.str();
 }
 
+Status DataTypeStruct::from_string(ReadBuffer& rb, IColumn* column) const {
+    DCHECK(!rb.eof());
+    auto* struct_column = assert_cast<ColumnStruct*>(column);
+
+    if (*rb.position() != '{') {
+        return Status::InvalidArgument("Struct does not start with '{' character, found '{}'",
+                                       *rb.position());
+    }
+    if (*(rb.end() - 1) != '}') {
+        return Status::InvalidArgument("Struct does not end with '}' character, found '{}'",
+                                       *(rb.end() - 1));
+    }
+    ++rb.position();
+    std::vector<ReadBuffer> field_rbs;
+    field_rbs.reserve(elems.size());
+
+    // here get the value "jack" and 20 from {"name":"jack","age":20}
+    while (!rb.eof()) {
+        size_t field_len = 0;
+        auto start = rb.position();
+        while (!rb.eof() && *start != ',' && *start != '}') {
+            field_len++;
+            start++;
+        }
+        if (field_len >= rb.count()) {
+            return Status::InvalidArgument("Invalid Length");
+        }
+        ReadBuffer field_rb(rb.position(), field_len);
+        size_t len = 0;
+        auto start_rb = field_rb.position();
+        while (!field_rb.eof() && *start_rb != ':') {
+            len++;
+            start_rb++;
+        }
+        ReadBuffer field(field_rb.position() + len + 1, field_rb.count() - len - 1);
+
+        if (*field.position() != '"' && *field.end() != '"') {

Review Comment:
   done



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] carlvinhust2012 commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
carlvinhust2012 commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069109797


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -91,6 +80,94 @@ std::string DataTypeStruct::do_get_name() const {
     return s.str();
 }
 
+Status DataTypeStruct::from_string(ReadBuffer& rb, IColumn* column) const {
+    DCHECK(!rb.eof());
+    auto* struct_column = assert_cast<ColumnStruct*>(column);
+
+    if (*rb.position() != '{') {
+        return Status::InvalidArgument("Struct does not start with '{' character, found '{}'",
+                                       *rb.position());
+    }
+    if (*(rb.end() - 1) != '}' && rb.count() > 1) {

Review Comment:
   done



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15669:
URL: https://github.com/apache/doris/pull/15669#issuecomment-1381523330

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] cambyzju commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069033095


##########
be/src/vec/data_types/data_type_struct.cpp:
##########
@@ -91,6 +80,88 @@ std::string DataTypeStruct::do_get_name() const {
     return s.str();
 }
 
+Status DataTypeStruct::from_string(ReadBuffer& rb, IColumn* column) const {
+    DCHECK(!rb.eof());
+    auto* struct_column = assert_cast<ColumnStruct*>(column);
+
+    if (*rb.position() != '{') {
+        return Status::InvalidArgument("Struct does not start with '{' character, found '{}'",
+                                       *rb.position());
+    }
+    if (*(rb.end() - 1) != '}') {

Review Comment:
   size == 1 may crash?



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] cambyzju commented on a diff in pull request #15669: [feature](struct-type) adjust the vexpr for struct type

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #15669:
URL: https://github.com/apache/doris/pull/15669#discussion_r1069028832


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java:
##########
@@ -169,8 +169,29 @@ public abstract class Type {
         arraySubTypes.add(STRING);
 
         structSubTypes = Lists.newArrayList();
+        structSubTypes.add(TINYINT);
+        structSubTypes.add(SMALLINT);
         structSubTypes.add(INT);
+        structSubTypes.add(BIGINT);
+        structSubTypes.add(LARGEINT);

Review Comment:
   or addAll(numericTypes);



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org