[datetimev2](minor) Add scale parameter for datetimev2 (#21176)
This commit is contained in:
@ -132,7 +132,11 @@ public class DescribeStmt extends ShowStmt {
|
||||
"NONE"
|
||||
);
|
||||
if (column.getOriginType().isDatetimeV2()) {
|
||||
row.set(1, "DATETIME");
|
||||
StringBuilder typeStr = new StringBuilder("DATETIME");
|
||||
if (((ScalarType) column.getOriginType()).getScalarScale() > 0) {
|
||||
typeStr.append("(").append(((ScalarType) column.getOriginType()).getScalarScale()).append(")");
|
||||
}
|
||||
row.set(1, typeStr.toString());
|
||||
} else if (column.getOriginType().isDateV2()) {
|
||||
row.set(1, "DATE");
|
||||
}
|
||||
@ -223,7 +227,12 @@ public class DescribeStmt extends ShowStmt {
|
||||
"");
|
||||
|
||||
if (column.getOriginType().isDatetimeV2()) {
|
||||
row.set(3, "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");
|
||||
}
|
||||
|
||||
@ -723,6 +723,9 @@ public class Column implements Writable, GsonPostProcessable {
|
||||
if (isCompatible) {
|
||||
if (type.isDatetimeV2()) {
|
||||
sb.append("datetime");
|
||||
if (((ScalarType) type).getScalarScale() > 0) {
|
||||
sb.append("(").append(((ScalarType) type).getScalarScale()).append(")");
|
||||
}
|
||||
} else if (type.isDateV2()) {
|
||||
sb.append("date");
|
||||
} else {
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package org.apache.doris.common.proc;
|
||||
|
||||
import org.apache.doris.catalog.Column;
|
||||
import org.apache.doris.catalog.ScalarType;
|
||||
import org.apache.doris.common.AnalysisException;
|
||||
import org.apache.doris.common.FeConstants;
|
||||
|
||||
@ -81,7 +82,11 @@ public class IndexSchemaProcNode implements ProcNodeInterface {
|
||||
rowList.set(1, "DATE");
|
||||
}
|
||||
if (column.getOriginType().isDatetimeV2()) {
|
||||
rowList.set(1, "DATETIME");
|
||||
StringBuilder typeStr = new StringBuilder("DATETIME");
|
||||
if (((ScalarType) column.getOriginType()).getScalarScale() > 0) {
|
||||
typeStr.append("(").append(((ScalarType) column.getOriginType()).getScalarScale()).append(")");
|
||||
}
|
||||
rowList.set(1, typeStr.toString());
|
||||
}
|
||||
result.addRow(rowList);
|
||||
}
|
||||
|
||||
@ -20,8 +20,8 @@ date_key DATE No true \N BLOOM_FILTER
|
||||
datetime_key DATETIME No true \N BLOOM_FILTER
|
||||
datev2_key DATE No true \N BLOOM_FILTER
|
||||
datetimev2_key_1 DATETIME No true \N BLOOM_FILTER
|
||||
datetimev2_key_2 DATETIME No true \N BLOOM_FILTER
|
||||
datetimev2_key_3 DATETIME No true \N BLOOM_FILTER
|
||||
datetimev2_key_2 DATETIME(3) No true \N BLOOM_FILTER
|
||||
datetimev2_key_3 DATETIME(6) No true \N BLOOM_FILTER
|
||||
tinyint_value TINYINT No false \N SUM
|
||||
smallint_value SMALLINT No false \N SUM
|
||||
int_value INT No false \N SUM
|
||||
@ -47,12 +47,12 @@ datev2_value_min DATE No false \N MIN
|
||||
datetimev2_value_1_max DATETIME No false \N MAX
|
||||
datetimev2_value_1_replace DATETIME No false \N REPLACE
|
||||
datetimev2_value_1_min DATETIME No false \N MIN
|
||||
datetimev2_value_2_max DATETIME No false \N MAX
|
||||
datetimev2_value_2_replace DATETIME No false \N REPLACE
|
||||
datetimev2_value_2_min DATETIME No false \N MIN
|
||||
datetimev2_value_3_max DATETIME No false \N MAX
|
||||
datetimev2_value_3_replace DATETIME No false \N REPLACE
|
||||
datetimev2_value_3_min DATETIME No false \N MIN
|
||||
datetimev2_value_2_max DATETIME(3) No false \N MAX
|
||||
datetimev2_value_2_replace DATETIME(3) No false \N REPLACE
|
||||
datetimev2_value_2_min DATETIME(3) No false \N MIN
|
||||
datetimev2_value_3_max DATETIME(6) No false \N MAX
|
||||
datetimev2_value_3_replace DATETIME(6) No false \N REPLACE
|
||||
datetimev2_value_3_min DATETIME(6) No false \N MIN
|
||||
float_value FLOAT No false \N SUM
|
||||
double_value DOUBLE No false \N SUM
|
||||
|
||||
|
||||
@ -37,12 +37,12 @@ datetimev2_value_max DATETIME Yes false \N MAX
|
||||
datetimev2_value_min DATETIME Yes false \N MIN
|
||||
datetimev2_value_replace DATETIME Yes false \N REPLACE
|
||||
datetimev2_value_replace_if_not_null DATETIME Yes false \N REPLACE_IF_NOT_NULL
|
||||
datetimev2_value_max_1 DATETIME Yes false \N MAX
|
||||
datetimev2_value_min_1 DATETIME Yes false \N MIN
|
||||
datetimev2_value_replace_1 DATETIME Yes false \N REPLACE
|
||||
datetimev2_value_replace_if_not_null_1 DATETIME Yes false \N REPLACE_IF_NOT_NULL
|
||||
datetimev2_value_max_2 DATETIME Yes false \N MAX
|
||||
datetimev2_value_min_2 DATETIME Yes false \N MIN
|
||||
datetimev2_value_replace_2 DATETIME Yes false \N REPLACE
|
||||
datetimev2_value_replace_if_not_null_2 DATETIME Yes false \N REPLACE_IF_NOT_NULL
|
||||
datetimev2_value_max_1 DATETIME(3) Yes false \N MAX
|
||||
datetimev2_value_min_1 DATETIME(3) Yes false \N MIN
|
||||
datetimev2_value_replace_1 DATETIME(3) Yes false \N REPLACE
|
||||
datetimev2_value_replace_if_not_null_1 DATETIME(3) Yes false \N REPLACE_IF_NOT_NULL
|
||||
datetimev2_value_max_2 DATETIME(6) Yes false \N MAX
|
||||
datetimev2_value_min_2 DATETIME(6) Yes false \N MIN
|
||||
datetimev2_value_replace_2 DATETIME(6) Yes false \N REPLACE
|
||||
datetimev2_value_replace_if_not_null_2 DATETIME(6) Yes false \N REPLACE_IF_NOT_NULL
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ char_value CHAR(10) Yes false \N NONE
|
||||
date_value DATE Yes false \N NONE
|
||||
date_value2 DATE Yes false \N NONE
|
||||
date_value3 DATETIME Yes false \N NONE
|
||||
date_value4 DATETIME Yes false \N NONE
|
||||
date_value5 DATETIME Yes false \N NONE
|
||||
date_value4 DATETIME(3) Yes false \N NONE
|
||||
date_value5 DATETIME(6) Yes false \N NONE
|
||||
|
||||
-- !select_dup_table --
|
||||
0 1 2 3
|
||||
|
||||
@ -13,8 +13,8 @@ k10 DECIMALV3(9, 0) Yes false \N NONE
|
||||
k11 BOOLEAN Yes false \N NONE
|
||||
k12 DATE Yes false \N NONE
|
||||
k13 DATETIME Yes false \N NONE
|
||||
k14 DATETIME Yes false \N NONE
|
||||
k15 DATETIME Yes false \N NONE
|
||||
k14 DATETIME(3) Yes false \N NONE
|
||||
k15 DATETIME(6) Yes false \N NONE
|
||||
|
||||
-- !sql --
|
||||
default_cluster:regression_test_index_p0.test_bitmap_index_dup index1 k1 BITMAP
|
||||
@ -50,8 +50,8 @@ k10 DECIMALV3(9, 0) Yes true \N
|
||||
k11 BOOLEAN Yes true \N
|
||||
k12 DATE Yes true \N
|
||||
k13 DATETIME Yes true \N
|
||||
k14 DATETIME Yes true \N
|
||||
k15 DATETIME Yes true \N
|
||||
k14 DATETIME(3) Yes true \N
|
||||
k15 DATETIME(6) Yes true \N
|
||||
v1 INT Yes false \N SUM
|
||||
|
||||
-- !sql --
|
||||
@ -88,8 +88,8 @@ k10 DECIMALV3(9, 0) Yes true \N
|
||||
k11 BOOLEAN Yes true \N
|
||||
k12 DATE Yes false \N REPLACE
|
||||
k13 DATETIME Yes false \N REPLACE
|
||||
k14 DATETIME Yes false \N REPLACE
|
||||
k15 DATETIME Yes false \N REPLACE
|
||||
k14 DATETIME(3) Yes false \N REPLACE
|
||||
k15 DATETIME(6) Yes false \N REPLACE
|
||||
v1 INT Yes false \N REPLACE
|
||||
|
||||
-- !sql --
|
||||
|
||||
@ -13,8 +13,8 @@ k10 DECIMALV3(9, 0) Yes false \N NONE
|
||||
k11 BOOLEAN Yes false \N NONE
|
||||
k12 DATE Yes false \N NONE
|
||||
k13 DATETIME Yes false \N NONE
|
||||
k14 DATETIME Yes false \N NONE
|
||||
k15 DATETIME Yes false \N NONE
|
||||
k14 DATETIME(3) Yes false \N NONE
|
||||
k15 DATETIME(6) Yes false \N NONE
|
||||
|
||||
-- !sql --
|
||||
default_cluster:regression_test_inverted_index_p0.test_inverted_index_dup index1 k1 INVERTED
|
||||
@ -50,8 +50,8 @@ k10 DECIMALV3(9, 0) Yes true \N
|
||||
k11 BOOLEAN Yes true \N
|
||||
k12 DATE Yes true \N
|
||||
k13 DATETIME Yes true \N
|
||||
k14 DATETIME Yes true \N
|
||||
k15 DATETIME Yes true \N
|
||||
k14 DATETIME(3) Yes true \N
|
||||
k15 DATETIME(6) Yes true \N
|
||||
v1 INT Yes false \N SUM
|
||||
|
||||
-- !sql --
|
||||
@ -88,8 +88,8 @@ k10 DECIMALV3(9, 0) Yes true \N
|
||||
k11 BOOLEAN Yes true \N
|
||||
k12 DATE Yes false \N NONE
|
||||
k13 DATETIME Yes false \N NONE
|
||||
k14 DATETIME Yes false \N NONE
|
||||
k15 DATETIME Yes false \N NONE
|
||||
k14 DATETIME(3) Yes false \N NONE
|
||||
k15 DATETIME(6) Yes false \N NONE
|
||||
v1 INT Yes false \N NONE
|
||||
|
||||
-- !sql --
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
-- !sql --
|
||||
test_rollup_agg_date1 AGG_KEYS datek1 DATE DATEV2 Yes true \N true
|
||||
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
|
||||
datetimek2 DATETIME DATETIMEV2(3) Yes true \N true
|
||||
datetimek3 DATETIME DATETIMEV2(6) 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 DATETIMEV2(3) No false \N MAX true
|
||||
datetimev3 DATETIME DATETIMEV2(6) No false \N MAX true
|
||||
datetimev4 DATETIME DATETIMEV2(3) Yes 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 DATETIMEV2(3) Yes true \N true
|
||||
datetimek2 DATETIME(3) DATETIMEV2(3) Yes true \N true
|
||||
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
|
||||
datetimek3 DATETIME DATETIMEV2(6) 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 DATETIMEV2(3) No false \N MAX true
|
||||
datetimev3 DATETIME DATETIMEV2(6) 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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !select --
|
||||
tb_show_create_table CREATE TABLE `tb_show_create_table` (\n `datek1` date NULL COMMENT 'a',\n `datetimek1` datetime NULL COMMENT 'b',\n `datetimek2` datetime NULL COMMENT 'c',\n `datetimek3` datetime NULL COMMENT 'd',\n `datev1` date MAX NOT NULL COMMENT 'e',\n `datetimev1` datetime MAX NOT NULL COMMENT 'f',\n `datetimev2` datetime MAX NOT NULL COMMENT 'g',\n `datetimev3` datetime MAX NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nAGGREGATE KEY(`datek1`, `datetimek1`, `datetimek2`, `datetimek3`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`datek1`) BUCKETS 5\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false"\n);
|
||||
tb_show_create_table CREATE TABLE `tb_show_create_table` (\n `datek1` date NULL COMMENT 'a',\n `datetimek1` datetime NULL COMMENT 'b',\n `datetimek2` datetime(3) NULL COMMENT 'c',\n `datetimek3` datetime(6) NULL COMMENT 'd',\n `datev1` date MAX NOT NULL COMMENT 'e',\n `datetimev1` datetime MAX NOT NULL COMMENT 'f',\n `datetimev2` datetime(3) MAX NOT NULL COMMENT 'g',\n `datetimev3` datetime(6) MAX NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nAGGREGATE KEY(`datek1`, `datetimek1`, `datetimek2`, `datetimek3`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`datek1`) BUCKETS 5\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false"\n);
|
||||
|
||||
-- !select --
|
||||
tb_show_create_table CREATE TABLE `tb_show_create_table` (\n `datek1` date NULL COMMENT 'a',\n `datetimek1` datetime NULL COMMENT 'b',\n `datetimek2` datetime NULL COMMENT 'c',\n `datetimek3` datetime NULL COMMENT 'd',\n `datev1` date NOT NULL COMMENT 'e',\n `datetimev1` datetime NOT NULL COMMENT 'f',\n `datetimev2` datetime NOT NULL COMMENT 'g',\n `datetimev3` datetime NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nDUPLICATE KEY(`datek1`, `datetimek1`, `datetimek2`, `datetimek3`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY RANDOM BUCKETS 5\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false"\n);
|
||||
tb_show_create_table CREATE TABLE `tb_show_create_table` (\n `datek1` date NULL COMMENT 'a',\n `datetimek1` datetime NULL COMMENT 'b',\n `datetimek2` datetime(3) NULL COMMENT 'c',\n `datetimek3` datetime(6) NULL COMMENT 'd',\n `datev1` date NOT NULL COMMENT 'e',\n `datetimev1` datetime NOT NULL COMMENT 'f',\n `datetimev2` datetime(3) NOT NULL COMMENT 'g',\n `datetimev3` datetime(6) NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nDUPLICATE KEY(`datek1`, `datetimek1`, `datetimek2`, `datetimek3`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY RANDOM BUCKETS 5\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false"\n);
|
||||
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
-- !sql --
|
||||
test_rollup_agg_date AGG_KEYS datek1 DATE DATEV2 Yes true \N true
|
||||
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
|
||||
datetimek2 DATETIME DATETIMEV2(3) Yes true \N true
|
||||
datetimek3 DATETIME DATETIMEV2(6) 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 DATETIMEV2(3) No false \N MAX true
|
||||
datetimev3 DATETIME DATETIMEV2(6) No false \N MAX true
|
||||
datetimev4 DATETIME DATETIMEV2(3) Yes 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 DATETIMEV2(3) Yes true \N true
|
||||
datetimek2 DATETIME(3) DATETIMEV2(3) Yes true \N true
|
||||
datetimek1 DATETIME DATETIMEV2(0) Yes true \N true
|
||||
datetimek3 DATETIME DATETIMEV2(6) 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 DATETIMEV2(3) No false \N MAX true
|
||||
datetimev3 DATETIME DATETIMEV2(6) 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
|
||||
|
||||
Reference in New Issue
Block a user