Skip to content

[Enhancement] Suggestion on Restricting the Method in which String Types cannot be Used as Primary Keys during Table Creation  #26001

@Mint-Boy-He

Description

@Mint-Boy-He

Search before asking

  • I had searched in the issues and found no similar issues.

Description

  1. When creating a table, it is difficult to automatically obtain the actual length of each field when converting the source table to STRING type data, such as HIVE's table. Therefore, HIVE ->Doris, when creating a Doirs table, the character type is given to STRING type, but KEY must be specified, and STRING type cannot be KEY, so manual adjustment to VARCHAR type is necessary, which is too restrictive

  2. When creating a table, it is recommended that the VARCHAR length is sufficient, but it is not clear if Doris has addressed this situation. The actual length of 100 fields is 10, and I have given both VARCHAR (15) or VARCHAR (255). How different the lengths of these two are for querying and writing, or whether there has been optimization for VARCHAR (255), so that there is not much difference between these two situations

关于建表时String类型不能作为主键的方式限制问题建议和请教
1、关于建表时针对源表是STRING类型数据,例如hive的表,在进行两边表结构转换时,不太好自动去获取到每个字段的实际长度,所以Hive->Doris,建Doirs表时对于字符类型都是给STRING类型,但是又必须指定KEY,而STRING类型又不能做KEY,所以还得手动去调整成VARCHAR类型,这种限制太鸡肋了,当然STRING类型不作为KEY肯定是有一定的考虑
2、针对建表时,VARCHAR 长度都是建议够用就行,但不太清楚Doris有没有针对这种情况,:100个字段实际长度是10, 我都给VARCHAR(15)或VARCHAR(255),这两者不同长度对于查询和写入有多大的区别或者影响,又或者是否针对VARCHAR(255)的情况有做优化,使得这两个情况其实没太大区别

Solution

I'm not sure if there are any good solutions and suggestions for this type of situation in the future Doris versions. Thanks.

不知道后续doris版本针对这类情况有没有什么好的解决方式和建议,感谢

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions