csun5285 commented on code in PR #68307:
URL: https://github.com/apache/doris/pull/68307#discussion_r4070740970


##########
be/src/information_schema/schema_columns_scanner.cpp:
##########
@@ -284,11 +284,12 @@ std::string 
SchemaColumnsScanner::_type_to_string(TColumnDesc& desc) {
     case TPrimitiveType::STRUCT: {
         // for old be service we should compitable
         std::string ret = "struct<";
-        if (!desc.children.empty()) {
-            for (int i = 0; i < desc.children.size() - 1; ++i) {
-                ret += _type_to_string(desc.children[i]) + ",";
+        // Name every field, a client rebuilds the schema from this text.
+        for (size_t i = 0; i < desc.children.size(); ++i) {
+            if (i != 0) {
+                ret += ",";
             }
-            ret += _type_to_string(desc.children[desc.children.size() - 1]);
+            ret += desc.children[i].columnName + ":" + 
_type_to_string(desc.children[i]);

Review Comment:
   已修改



##########
fe/fe-catalog/src/main/java/org/apache/doris/catalog/Column.java:
##########
@@ -895,7 +895,9 @@ public String toSql(boolean isUniqueTable, boolean 
isCompatible, boolean useGene
 
         // show change datetimeV2/dateV2 to datetime/date
         if (isCompatible) {
-            sb.append(type.hideVersionForVersionColumn(true));
+            // isToSql = true, showNestedComment = true
+            // SHOW CREATE TABLE and CREATE TABLE LIKE need the nested comment.
+            sb.append(type.hideVersionForVersionColumn(true, true, false));

Review Comment:
   已修改



-- 
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]

Reply via email to