Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[optimize](desc) display the correct data type of aggStateType #34968

Merged
merged 3 commits into from
May 21, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public String toSql(int depth) {
return stringBuilder.toString();
}

@Override
public String toString() {
return toSql();
}

@Override
protected String prettyPrint(int lpad) {
return Strings.repeat(" ", lpad) + toSql();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ public void analyze(Analyzer analyzer) throws UserException {
for (Column column : columns) {
List<String> row = Arrays.asList(
column.getName(),
column.getOriginType().toString(),
column.getOriginType().hideVersionForVersionColumn(true),
column.isAllowNull() ? "Yes" : "No",
((Boolean) column.isKey()).toString(),
column.getDefaultValue() == null
? FeConstants.null_string : column.getDefaultValue(),
"NONE"
);
row.set(1, column.getOriginType().hideVersionForVersionColumn(false));
totalRows.add(row);
}
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,12 @@ public static ProcResult createResult(List<Column> schema, Set<String> bfColumns
String extraStr = StringUtils.join(extras, ",");

List<String> rowList = Arrays.asList(column.getDisplayName(),
column.getOriginType().toString(),
column.getOriginType().hideVersionForVersionColumn(true),
column.isAllowNull() ? "Yes" : "No",
((Boolean) column.isKey()).toString(),
column.getDefaultValue() == null
? FeConstants.null_string : column.getDefaultValue(),
extraStr);

rowList.set(1, column.getOriginType().hideVersionForVersionColumn(false));
result.addRow(rowList);
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
-- !sum_null --
\N

-- !desc --
k1 INT Yes true \N
k2 AGG_STATE<max_by(INT, INT NULL)> No false \N GENERIC

-- !length1 --
1 11

Expand Down
4 changes: 4 additions & 0 deletions regression-test/data/datatype_p0/agg_state/test_agg_state.out
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
-- !sum_null --
\N

-- !desc --
k1 INT Yes true \N
k2 AGG_STATE<max_by(INT, INT NULL)> No false \N GENERIC

-- !length1 --
1 11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ suite("test_agg_state_nereids") {
properties("replication_num" = "1");
"""

qt_desc "desc a_table;"

sql "explain insert into a_table select 1,max_by_state(1,3);"

sql "insert into a_table select 1,max_by_state(1,3);"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ suite("test_agg_state") {
properties("replication_num" = "1");
"""

qt_desc "desc a_table;"

sql "insert into a_table select 1,max_by_state(1,3);"
sql "insert into a_table select 1,max_by_state(2,2);"
sql "insert into a_table values(1,max_by_state(3,1));"
Expand Down
Loading