Skip to content

Commit

Permalink
[fix](desc) all type in desc table all should return lowercase result
Browse files Browse the repository at this point in the history
  • Loading branch information
morrySnow committed Sep 9, 2024
1 parent d7aa336 commit 9e371d7
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,22 +238,22 @@ public void analyze(Analyzer analyzer) throws UserException {
"");

if (column.getOriginType().isDatetimeV2()) {
StringBuilder typeStr = new StringBuilder("DATETIME");
StringBuilder typeStr = new StringBuilder("datetime");
if (((ScalarType) column.getOriginType()).getScalarScale() > 0) {
typeStr.append("(").append(((ScalarType) column.getOriginType()).getScalarScale())
.append(")");
}
row.set(3, typeStr.toString());
} else if (column.getOriginType().isDateV2()) {
row.set(3, "DATE");
row.set(3, "date");
} else if (column.getOriginType().isDecimalV3()) {
StringBuilder typeStr = new StringBuilder("DECIMAL");
StringBuilder typeStr = new StringBuilder("decimal");
ScalarType sType = (ScalarType) column.getOriginType();
int scale = sType.getScalarScale();
int precision = sType.getScalarPrecision();
// not default
if (scale > 0 && precision != 9) {
typeStr.append("(").append(precision).append(", ").append(scale)
typeStr.append("(").append(precision).append(",").append(scale)
.append(")");
}
row.set(3, typeStr.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select1 --
id int No true \N
dd decimal(15, 6) Yes false \N NONE
id INT No true \N
dd DECIMAL(15, 6) Yes false \N NONE

-- !select2 --
showdb UNIQUE_KEYS id int int No true \N true
dd DECIMAL(15, 6) decimalv3(15,6) Yes false \N NONE true
showdb UNIQUE_KEYS id INT INT No true \N true
dd DECIMAL(15, 6) DECIMALV3(15, 6) Yes false \N NONE true

-- !select3 --
id int No true \N
dd decimal Yes false \N NONE
id INT No true \N
dd DECIMAL(38, 9) Yes false \N NONE

-- !select4 --
showdb UNIQUE_KEYS id int int No true \N true
dd DECIMAL decimalv3(9,0) Yes false \N NONE true
showdb UNIQUE_KEYS id INT INT No true \N true
dd DECIMAL(38, 9) DECIMALV3(38, 9) Yes false \N NONE true

30 changes: 15 additions & 15 deletions regression-test/data/ddl_p0/test_create_table_like.out
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !desc_create_table --
decimal_test DUP_KEYS name varchar(65533) varchar(65533) Yes true \N true
id smallint smallint Yes false \N NONE true
timestamp0 DECIMAL decimalv3(9,0) Yes false \N NONE true
timestamp1 DECIMAL decimalv3(10,0) Yes false \N NONE true
timestamp2 DECIMAL(10, 1) decimalv3(10,1) Yes false \N NONE true
timestamp3 DECIMAL decimalv3(10,0) Yes false \N NONE true
timestamp4 DECIMAL(10, 1) decimalv3(10,1) Yes false \N NONE true
decimal_test DUP_KEYS name VARCHAR(65533) VARCHAR(65533) Yes true \N true
id SMALLINT SMALLINT Yes false \N NONE true
timestamp0 DECIMAL(38, 9) DECIMALV3(38, 9) Yes false \N NONE true
timestamp1 DECIMAL DECIMALV3(10, 0) Yes false \N NONE true
timestamp2 DECIMAL(10, 1) DECIMALV3(10, 1) Yes false \N NONE true
timestamp3 DECIMAL DECIMALV3(10, 0) Yes false \N NONE true
timestamp4 DECIMAL(10, 1) DECIMALV3(10, 1) Yes false \N NONE true

-- !desc_create_table_like --
decimal_test_like DUP_KEYS name varchar(65533) varchar(65533) Yes true \N true
id smallint smallint Yes false \N NONE true
timestamp0 DECIMAL decimalv3(9,0) Yes false \N NONE true
timestamp1 DECIMAL decimalv3(10,0) Yes false \N NONE true
timestamp2 DECIMAL(10, 1) decimalv3(10,1) Yes false \N NONE true
timestamp3 DECIMAL decimalv3(10,0) Yes false \N NONE true
timestamp4 DECIMAL(10, 1) decimalv3(10,1) Yes false \N NONE true
decimal_test_like DUP_KEYS name VARCHAR(65533) VARCHAR(65533) Yes true \N true
id SMALLINT SMALLINT Yes false \N NONE true
timestamp0 DECIMAL(38, 9) DECIMALV3(38, 9) Yes false \N NONE true
timestamp1 DECIMAL DECIMALV3(10, 0) Yes false \N NONE true
timestamp2 DECIMAL(10, 1) DECIMALV3(10, 1) Yes false \N NONE true
timestamp3 DECIMAL DECIMALV3(10, 0) Yes false \N NONE true
timestamp4 DECIMAL(10, 1) DECIMALV3(10, 1) Yes false \N NONE true

-- !select_table_like --
test1 1 123456789 1234567891 123456789.0 1234567891 123456789.0
test1 1 123456789.000000000 1234567891 123456789.0 1234567891 123456789.0

34 changes: 17 additions & 17 deletions regression-test/data/nereids_syntax_p0/rollup/agg_date.out
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
test_rollup_agg_date1 AGG_KEYS datek1 DATE datev2 Yes true \N true
datetimek1 DATETIME datetimev2(0) Yes true \N true
datetimek2 DATETIME(3) datetimev2(3) Yes true \N true
datetimek3 DATETIME(6) datetimev2(6) Yes true \N true
datev1 DATE datev2 No false \N MAX true
datetimev1 DATETIME datetimev2(0) No false \N MAX true
datetimev2 DATETIME(3) datetimev2(3) No false \N MAX true
datetimev3 DATETIME(6) datetimev2(6) No false \N MAX true
datetimev4 DATETIME(3) datetimev2(3) Yes false \N MAX true
test_rollup_agg_date1 AGG_KEYS datek1 DATE DATEV2 Yes true \N true
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
datetimek2 DATETIME(3) DATETIMEV2(3) Yes true \N true
datetimek3 DATETIME(6) DATETIMEV2(6) Yes true \N true
datev1 DATE DATEV2 No false \N MAX true
datetimev1 DATETIME DATETIMEV2(0) No false \N MAX true
datetimev2 DATETIME(3) DATETIMEV2(3) No false \N MAX true
datetimev3 DATETIME(6) DATETIMEV2(6) No false \N MAX true
datetimev4 DATETIME(3) DATETIMEV2(3) Yes false \N MAX true

rollup_date AGG_KEYS datek1 DATE datev2 Yes true \N true
datetimek2 DATETIME(3) datetimev2(3) Yes true \N true
datetimek1 DATETIME datetimev2(0) Yes true \N true
datetimek3 DATETIME(6) datetimev2(6) Yes true \N true
datev1 DATE datev2 No false \N MAX true
datetimev1 DATETIME datetimev2(0) No false \N MAX true
datetimev2 DATETIME(3) datetimev2(3) No false \N MAX true
datetimev3 DATETIME(6) datetimev2(6) No false \N MAX true
rollup_date AGG_KEYS datek1 DATE DATEV2 Yes true \N true
datetimek2 DATETIME(3) DATETIMEV2(3) Yes true \N true
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
datetimek3 DATETIME(6) DATETIMEV2(6) Yes true \N true
datev1 DATE DATEV2 No false \N MAX true
datetimev1 DATETIME DATETIMEV2(0) No false \N MAX true
datetimev2 DATETIME(3) DATETIMEV2(3) No false \N MAX true
datetimev3 DATETIME(6) DATETIMEV2(6) No false \N MAX true

-- !sql --
2022-08-23 2022-08-23T11:11:11 2022-08-23T11:11:11.111 2022-08-23T11:11:11.111111 2022-08-23 2022-08-23T11:11:11 2022-08-23T11:11:11.111 2022-08-23T11:11:11.111111
Expand Down
14 changes: 7 additions & 7 deletions regression-test/data/nereids_syntax_p0/rollup/hll/hll.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
1 1

-- !sql --
test_materialized_view_hll1 DUP_KEYS record_id int int Yes true \N true
seller_id int int Yes true \N true
store_id int int Yes true \N true
sale_date DATE datev2 Yes false \N NONE true
sale_amt bigint bigint Yes false \N NONE true
test_materialized_view_hll1 DUP_KEYS record_id INT INT Yes true \N true
seller_id INT INT Yes true \N true
store_id INT INT Yes true \N true
sale_date DATE DATEV2 Yes false \N NONE true
sale_amt BIGINT BIGINT Yes false \N NONE true

amt_count AGG_KEYS mv_store_id int int Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS varchar(65533))) hll hll No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS varchar(65533)))
amt_count AGG_KEYS mv_store_id INT INT Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS VARCHAR(65533))) HLL HLL No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS VARCHAR(65533)))

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
test_materialized_view_hll_with_light_sc1 DUP_KEYS record_id int int Yes true \N true
seller_id int int Yes true \N true
store_id int int Yes true \N true
sale_date DATE datev2 Yes false \N NONE true
sale_amt bigint bigint Yes false \N NONE true
test_materialized_view_hll_with_light_sc1 DUP_KEYS record_id INT INT Yes true \N true
seller_id INT INT Yes true \N true
store_id INT INT Yes true \N true
sale_date DATE DATEV2 Yes false \N NONE true
sale_amt BIGINT BIGINT Yes false \N NONE true

amt_count1 AGG_KEYS mv_store_id int int Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS varchar(65533))) hll hll No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS varchar(65533)))
amt_count1 AGG_KEYS mv_store_id INT INT Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS VARCHAR(65533))) HLL HLL No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS VARCHAR(65533)))

-- !sql --
1 1
Expand Down
14 changes: 7 additions & 7 deletions regression-test/data/rollup/test_materialized_view_hll.out
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
test_materialized_view_hll DUP_KEYS record_id int int Yes true \N true
seller_id int int Yes true \N true
store_id int int Yes true \N true
sale_date DATE datev2 Yes false \N NONE true
sale_amt bigint bigint Yes false \N NONE true
test_materialized_view_hll DUP_KEYS record_id INT INT Yes true \N true
seller_id INT INT Yes true \N true
store_id INT INT Yes true \N true
sale_date DATE DATEV2 Yes false \N NONE true
sale_amt BIGINT BIGINT Yes false \N NONE true

amt_count AGG_KEYS mv_store_id int int Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS varchar(65533))) hll hll No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS varchar(65533)))
amt_count AGG_KEYS mv_store_id INT INT Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS VARCHAR(65533))) HLL HLL No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS VARCHAR(65533)))

-- !sql --
1 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
test_materialized_view_hll_with_light_sc DUP_KEYS record_id int int Yes true \N true
seller_id int int Yes true \N true
store_id int int Yes true \N true
sale_date DATE datev2 Yes false \N NONE true
sale_amt bigint bigint Yes false \N NONE true
test_materialized_view_hll_with_light_sc DUP_KEYS record_id INT INT Yes true \N true
seller_id INT INT Yes true \N true
store_id INT INT Yes true \N true
sale_date DATE DATEV2 Yes false \N NONE true
sale_amt BIGINT BIGINT Yes false \N NONE true

amt_count1 AGG_KEYS mv_store_id int int Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS varchar(65533))) hll hll No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS varchar(65533)))
amt_count1 AGG_KEYS mv_store_id INT INT Yes true \N true `store_id`
mva_HLL_UNION__hll_hash(CAST(`sale_amt` AS VARCHAR(65533))) HLL HLL No false \N HLL_UNION true hll_hash(CAST(`sale_amt` AS VARCHAR(65533)))

-- !sql --
1 1
Expand Down
48 changes: 24 additions & 24 deletions regression-test/data/rollup_p0/test_materialized_view.out
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
test_materialized_view1 DUP_KEYS record_id int int Yes true \N true
seller_id int int Yes true \N true
store_id int int Yes true \N true
sale_date DATE datev2 Yes false \N NONE true
sale_amt bigint bigint Yes false \N NONE true
test_materialized_view1 DUP_KEYS record_id INT INT Yes true \N true
seller_id INT INT Yes true \N true
store_id INT INT Yes true \N true
sale_date DATE DATEV2 Yes false \N NONE true
sale_amt BIGINT BIGINT Yes false \N NONE true

amt_sum AGG_KEYS mv_store_id int int Yes true \N true `store_id`
mva_SUM__`sale_amt` bigint bigint Yes false \N SUM true `sale_amt`
amt_sum AGG_KEYS mv_store_id INT INT Yes true \N true `store_id`
mva_SUM__`sale_amt` BIGINT BIGINT Yes false \N SUM true `sale_amt`

-- !sql --
test_materialized_view2 DUP_KEYS record_id int int Yes true \N true
seller_id int int Yes true \N true
store_id int int Yes true \N true
sale_date DATE datev2 Yes false \N NONE true
sale_amt bigint bigint Yes false \N NONE true
test_materialized_view2 DUP_KEYS record_id INT INT Yes true \N true
seller_id INT INT Yes true \N true
store_id INT INT Yes true \N true
sale_date DATE DATEV2 Yes false \N NONE true
sale_amt BIGINT BIGINT Yes false \N NONE true

seller_id_order DUP_KEYS mv_store_id int int Yes true \N true `store_id`
mv_seller_id int int Yes true \N true `seller_id`
mv_sale_amt bigint bigint Yes false \N NONE true `sale_amt`
seller_id_order DUP_KEYS mv_store_id INT INT Yes true \N true `store_id`
mv_seller_id INT INT Yes true \N true `seller_id`
mv_sale_amt BIGINT BIGINT Yes false \N NONE true `sale_amt`

-- !sql --
1 1 1 2020-05-30 100
Expand All @@ -37,15 +37,15 @@ seller_id_order DUP_KEYS mv_store_id int int Yes true \N true `store_id`
-- !sql --


mva_SUM__CASE WHEN `sale_amt` IS NULL THEN 0 ELSE 1 END bigint bigint No false \N SUM true CASE WHEN `sale_amt` IS NULL THEN 0 ELSE 1 END
mva_SUM__`sale_amt` bigint bigint Yes false \N SUM true `sale_amt`
sale_amt bigint bigint Yes false \N NONE true
sale_date DATE datev2 Yes false \N NONE true
seller_id int int Yes true \N true
store_id int int Yes true \N true
amt_count AGG_KEYS mv_store_id int int Yes true \N true `store_id`
amt_sum AGG_KEYS mv_store_id int int Yes true \N true `store_id`
test_materialized_view1 DUP_KEYS record_id int int Yes true \N true
mva_SUM__CASE WHEN `sale_amt` IS NULL THEN 0 ELSE 1 END BIGINT BIGINT No false \N SUM true CASE WHEN `sale_amt` IS NULL THEN 0 ELSE 1 END
mva_SUM__`sale_amt` BIGINT BIGINT Yes false \N SUM true `sale_amt`
sale_amt BIGINT BIGINT Yes false \N NONE true
sale_date DATE DATEV2 Yes false \N NONE true
seller_id INT INT Yes true \N true
store_id INT INT Yes true \N true
amt_count AGG_KEYS mv_store_id INT INT Yes true \N true `store_id`
amt_sum AGG_KEYS mv_store_id INT INT Yes true \N true `store_id`
test_materialized_view1 DUP_KEYS record_id INT INT Yes true \N true

-- !sql --
1 2
Expand Down
34 changes: 17 additions & 17 deletions regression-test/data/rollup_p0/test_rollup_agg_date.out
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
test_rollup_agg_date AGG_KEYS datek1 DATE datev2 Yes true \N true
datetimek1 DATETIME datetimev2(0) Yes true \N true
datetimek2 DATETIME(3) datetimev2(3) Yes true \N true
datetimek3 DATETIME(6) datetimev2(6) Yes true \N true
datev1 DATE datev2 No false \N MAX true
datetimev1 DATETIME datetimev2(0) No false \N MAX true
datetimev2 DATETIME(3) datetimev2(3) No false \N MAX true
datetimev3 DATETIME(6) datetimev2(6) No false \N MAX true
datetimev4 DATETIME(3) datetimev2(3) Yes false \N MAX true
test_rollup_agg_date AGG_KEYS datek1 DATE DATEV2 Yes true \N true
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
datetimek2 DATETIME(3) DATETIMEV2(3) Yes true \N true
datetimek3 DATETIME(6) DATETIMEV2(6) Yes true \N true
datev1 DATE DATEV2 No false \N MAX true
datetimev1 DATETIME DATETIMEV2(0) No false \N MAX true
datetimev2 DATETIME(3) DATETIMEV2(3) No false \N MAX true
datetimev3 DATETIME(6) DATETIMEV2(6) No false \N MAX true
datetimev4 DATETIME(3) DATETIMEV2(3) Yes false \N MAX true

rollup_date AGG_KEYS datek1 DATE datev2 Yes true \N true
datetimek2 DATETIME(3) datetimev2(3) Yes true \N true
datetimek1 DATETIME datetimev2(0) Yes true \N true
datetimek3 DATETIME(6) datetimev2(6) Yes true \N true
datev1 DATE datev2 No false \N MAX true
datetimev1 DATETIME datetimev2(0) No false \N MAX true
datetimev2 DATETIME(3) datetimev2(3) No false \N MAX true
datetimev3 DATETIME(6) datetimev2(6) No false \N MAX true
rollup_date AGG_KEYS datek1 DATE DATEV2 Yes true \N true
datetimek2 DATETIME(3) DATETIMEV2(3) Yes true \N true
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
datetimek3 DATETIME(6) DATETIMEV2(6) Yes true \N true
datev1 DATE DATEV2 No false \N MAX true
datetimev1 DATETIME DATETIMEV2(0) No false \N MAX true
datetimev2 DATETIME(3) DATETIMEV2(3) No false \N MAX true
datetimev3 DATETIME(6) DATETIMEV2(6) No false \N MAX true

-- !sql --
2022-08-23 2022-08-23T11:11:11 2022-08-23T11:11:11.111 2022-08-23T11:11:11.111111 2022-08-23 2022-08-23T11:11:11 2022-08-23T11:11:11.111 2022-08-23T11:11:11.111111
Expand Down
Loading

0 comments on commit 9e371d7

Please sign in to comment.