github-actions[bot] commented on code in PR #68307:
URL: https://github.com/apache/doris/pull/68307#discussion_r4059151453
##########
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:
[P2] Honor NO_BACKSLASH_ESCAPES when rendering comments
Passing `false` always doubles backslashes. With `NO_BACKSLASH_ESCAPES`, a
stored nested comment containing one backslash is emitted with two;
`CreateTableLikeCommand` then reparses that DDL with the session-aware lexer
and stores both literally, so the copied table—and a client replaying SHOW text
under that mode—no longer preserves the comment. Please thread the live mode
into interactive SHOW/LIKE rendering (while keeping synced CCR output on an
explicit canonical mode) and cover this mode in the round-trip test.
##########
regression-test/data/external_table_p0/iceberg/test_iceberg_nested_schema_evolution_ddl.out:
##########
@@ -1,9 +1,9 @@
-- This file is automatically generated. You should know what you did if you
want to edit this
-- !desc --
id int(11)
-s struct<string,bigint(20),string,string,string>
-arr array<struct<bigint(20),int(11),int(11)>>
-m map<string,struct<bigint(20),int(11),int(11)>>
+s struct<first_pos:string,a:bigint(20),after_a:string,b:string,c2:string>
Review Comment:
[P2] Regenerate the external expected results
The commit message says the two Iceberg/Spark `.out` updates were derived
from the suite logic because the required environment was unavailable.
Repository test rules require regression results to be generated by the owning
test scripts, and static tracing cannot prove the refreshed external systems
return these exact bytes. Please run both suites in the prescribed environment
and commit their generated outputs.
##########
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:
[P2] Preserve and quote struct field identifiers
`columnName` is the normalized lookup name, and concatenating it raw cannot
represent every legal field. For example, Iceberg `Metric` is reported as
`metric`, while a native field named `a-b` (declared with backticks) is emitted
as `struct<a-b:int(11)>`, which cannot be parsed back as one field. Please
carry the original/display spelling to this boundary, escape it as an SQL
identifier, and add mixed-case plus quoted-name coverage.
##########
regression-test/suites/datatype_p0/nested_types/ddl/test_struct_nested_comment_ddl.groovy:
##########
@@ -0,0 +1,62 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_struct_nested_comment_ddl", "p0") {
+ sql "DROP TABLE IF EXISTS struct_nested_comment"
+ sql "DROP TABLE IF EXISTS struct_nested_comment_replay"
+ sql "DROP TABLE IF EXISTS struct_nested_comment_like"
+
+ // The comment on b carries a single quote and a back slash, both have to
survive the DDL.
+ sql """
+ CREATE TABLE struct_nested_comment (
+ id INT,
+ s STRUCT<a:INT, b:TEXT COMMENT "owner''s \\\\path", c:INT> COMMENT
"top-level",
+ n STRUCT<lvl1:STRUCT<lvl2:INT COMMENT "deep doc">>,
+ arr ARRAY<STRUCT<inside:INT COMMENT "in array">>
+ )
+ DUPLICATE KEY(id)
+ DISTRIBUTED BY HASH(id) BUCKETS 1
+ PROPERTIES ("replication_num" = "1")
+ """
+
+ // SHOW CREATE TABLE used to drop every nested field comment.
+ def createStmt = (sql "SHOW CREATE TABLE
struct_nested_comment")[0][1].toString()
+ logger.info("SHOW CREATE TABLE struct_nested_comment: ${createStmt}")
+
+ // Substring checks, the full statement carries volatile properties that
no .out can pin.
+ assertTrue(createStmt.contains("struct<a:int,b:text comment \"owner''s
\\\\path\",c:int>"))
Review Comment:
[P2] Capture the fixed DDL expectations in generated output
These three fragments are deterministic user-visible results, but the new
`.out` contains only the COLUMN_TYPE query. The regression rules require fixed
expected results to go through the generated-output workflow instead of Groovy
assertions. Please normalize/capture the stable SHOW/LIKE comment text in the
suite's generated result; the runtime-derived replay/LIKE equality checks can
remain dynamic assertions.
--
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]