apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.21k stars 3.19k forks source link

[Bug] cannot get array internal type #33461

Open xxhZs opened 4 months ago

xxhZs commented 4 months ago

Search before asking

Version

x

What's Wrong?

I tried to get the type inside the array, but I can't get it, I queried it from the columnstable and it came up with unknown, I got it from the http api and it came up with array

What You Expected?

I want the type of the doris to be array<decimal(10,1)>, and the type that I can get it to be is array<decimal(10,1)>, not unknownor array I prefer to get it from the http port though, so I don't have to access two ports

How to Reproduce?

x

Anything Else?

x

Are you willing to submit PR?

Code of Conduct

caizj commented 4 months ago

Which version are you using? I can get the array internal type from information_schema.columns using doris 2.0

2. row TABLE_SCHEMA: test TABLE_NAME: array_test1 COLUMN_NAME: c_array DATA_TYPE: array COLUMN_TYPE: array<decimalv3(10, 1)>

xxhZs commented 4 months ago

Which version are you using? I can get the array internal type from information_schema.columns using doris 2.0

2. row TABLE_SCHEMA: test TABLE_NAME: array_test1 COLUMN_NAME: c_array DATA_TYPE: array COLUMN_TYPE: array<decimalv3(10, 1)>

I use apache/doris:2.0.0_alpha-fe-x86_64, and I do it select * from information_schema.columns where table_name = 'demo_bhv_table'; +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES | COLUMN_COMMENT | COLUMN_SIZE | DECIMAL_DIGITS | GENERATION_EXPRESSION | SRS_ID | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | internal | demo | demo_bhv_table | user_id | 1 | NULL | YES | int | NULL | NULL | 10 | 0 | NULL | NULL | NULL | int(11) | UNI | | | | 10 | 0 | NULL | NULL | | internal | demo | demo_bhv_table | target_id | 2 | NULL | YES | varchar | 2147483643 | 8589934572 | NULL | NULL | NULL | NULL | NULL | string | | | | | 2147483643 | NULL | NULL | NULL | | internal | demo | demo_bhv_table | event_timestamp_local | 3 | NULL | YES | array | NULL | NULL | NULL | NULL | NULL | NULL | NULL | unknown | | | | | NULL | NULL | NULL | NULL | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ result is

caizj commented 4 months ago

Which version are you using? I can get the array internal type from information_schema.columns using doris 2.0 2. row TABLE_SCHEMA: test TABLE_NAME: array_test1 COLUMN_NAME: c_array DATA_TYPE: array COLUMN_TYPE: array<decimalv3(10, 1)>

I use apache/doris:2.0.0_alpha-fe-x86_64, and I do it select * from information_schema.columns where table_name = 'demo_bhv_table'; +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES | COLUMN_COMMENT | COLUMN_SIZE | DECIMAL_DIGITS | GENERATION_EXPRESSION | SRS_ID | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | internal | demo | demo_bhv_table | user_id | 1 | NULL | YES | int | NULL | NULL | 10 | 0 | NULL | NULL | NULL | int(11) | UNI | | | | 10 | 0 | NULL | NULL | | internal | demo | demo_bhv_table | target_id | 2 | NULL | YES | varchar | 2147483643 | 8589934572 | NULL | NULL | NULL | NULL | NULL | string | | | | | 2147483643 | NULL | NULL | NULL | | internal | demo | demo_bhv_table | event_timestamp_local | 3 | NULL | YES | array | NULL | NULL | NULL | NULL | NULL | NULL | NULL | unknown | | | | | NULL | NULL | NULL | NULL | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ result is

How to reproduce? Could you provide the create table statement

xxhZs commented 4 months ago

Which version are you using? I can get the array internal type from information_schema.columns using doris 2.0 2. row TABLE_SCHEMA: test TABLE_NAME: array_test1 COLUMN_NAME: c_array DATA_TYPE: array COLUMN_TYPE: array<decimalv3(10, 1)>

I use apache/doris:2.0.0_alpha-fe-x86_64, and I do it select * from information_schema.columns where table_name = 'demo_bhv_table'; +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES | COLUMN_COMMENT | COLUMN_SIZE | DECIMAL_DIGITS | GENERATION_EXPRESSION | SRS_ID | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | internal | demo | demo_bhv_table | user_id | 1 | NULL | YES | int | NULL | NULL | 10 | 0 | NULL | NULL | NULL | int(11) | UNI | | | | 10 | 0 | NULL | NULL | | internal | demo | demo_bhv_table | target_id | 2 | NULL | YES | varchar | 2147483643 | 8589934572 | NULL | NULL | NULL | NULL | NULL | string | | | | | 2147483643 | NULL | NULL | NULL | | internal | demo | demo_bhv_table | event_timestamp_local | 3 | NULL | YES | array | NULL | NULL | NULL | NULL | NULL | NULL | NULL | unknown | | | | | NULL | NULL | NULL | NULL | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ result is

How to reproduce? Could you provide the create table statement

sure

CREATE database demo; use demo; CREATE table demo_bhv_table( user_id int, target_id text, event_timestamp_local datetime ) UNIQUE KEY(user_id) DISTRIBUTED BY HASH(user_id) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1" );

caizj commented 4 months ago

But the event_timestamp_local column is datetime type instead of array type in my environment.

mysql> select * from information_schema.columns where table_name like 'demo_bhv_table'; +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES | COLUMN_COMMENT | COLUMN_SIZE | DECIMAL_DIGITS | GENERATION_EXPRESSION | SRS_ID | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | internal | demo | demo_bhv_table | user_id | 1 | NULL | YES | int | NULL | NULL | 10 | 0 | NULL | NULL | NULL | int(11) | UNI | | | | 10 | 0 | NULL | NULL | | internal | demo | demo_bhv_table | target_id | 2 | NULL | YES | varchar | 2147483643 | 8589934572 | NULL | NULL | NULL | NULL | NULL | string | | | | | 2147483643 | NULL | NULL | NULL | | internal | demo | demo_bhv_table | event_timestamp_local | 3 | NULL | YES | datetime | NULL | NULL | 18 | 0 | NULL | NULL | NULL | datetime | | | | | NULL | 0 | NULL | NULL | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+

xxhZs commented 4 months ago

But the event_timestamp_local column is datetime type instead of array type in my environment.

mysql> select * from information_schema.columns where table_name like 'demo_bhv_table'; +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES | COLUMN_COMMENT | COLUMN_SIZE | DECIMAL_DIGITS | GENERATION_EXPRESSION | SRS_ID | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | internal | demo | demo_bhv_table | user_id | 1 | NULL | YES | int | NULL | NULL | 10 | 0 | NULL | NULL | NULL | int(11) | UNI | | | | 10 | 0 | NULL | NULL | | internal | demo | demo_bhv_table | target_id | 2 | NULL | YES | varchar | 2147483643 | 8589934572 | NULL | NULL | NULL | NULL | NULL | string | | | | | 2147483643 | NULL | NULL | NULL | | internal | demo | demo_bhv_table | event_timestamp_local | 3 | NULL | YES | datetime | NULL | NULL | 18 | 0 | NULL | NULL | NULL | datetime | | | | | NULL | 0 | NULL | NULL | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+

sorry,The real create stmt is

CREATE table demo_bhv_table( user_id int, target_id text, event_timestamp_local array<int> ) UNIQUE KEY(user_id) DISTRIBUTED BY HASH(user_id) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1" );

caizj commented 4 months ago

Can not reproduce, It shows array<int(11)>: mysql> select * from information_schema.columns where table_name like 'demo_bhv_table'; +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES | COLUMN_COMMENT | COLUMN_SIZE | DECIMAL_DIGITS | GENERATION_EXPRESSION | SRS_ID | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+ | internal | demo | demo_bhv_table | user_id | 1 | NULL | YES | int | NULL | NULL | 10 | 0 | NULL | NULL | NULL | int(11) | UNI | | | | 10 | 0 | NULL | NULL | | internal | demo | demo_bhv_table | target_id | 2 | NULL | YES | varchar | 2147483643 | 8589934572 | NULL | NULL | NULL | NULL | NULL | string | | | | | 2147483643 | NULL | NULL | NULL | | internal | demo | demo_bhv_table | event_timestamp_local | 3 | NULL | YES | array | NULL | NULL | NULL | NULL | NULL | NULL | NULL | array<int(11)> | | | | | NULL | NULL | NULL | NULL | +---------------+--------------+----------------+-----------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+----------------+------------+-------+------------+----------------+-------------+----------------+-----------------------+--------+