You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/08/29 07:26:35 UTC

[GitHub] [doris] dujl opened a new pull request, #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

dujl opened a new pull request, #12148:
URL: https://github.com/apache/doris/pull/12148

    support create the table containing string/text type with a default value that length greater than 1
   
   # Proposed changes
   
   Issue Number: close #12145
   
   ## Problem summary
   Create the table containing string/text type with a default value that length greater than 1 failed.
   ```
   CREATE TABLE `tb6` (
     `id` int(11) NULL DEFAULT "10",
     `name` varchar(32) NULL DEFAULT "a varchar 32",
     `c_text` text NULL DEFAULT "a text",
     `c_str` string  NULL DEFAULT "a string"
   ) ENGINE=OLAP
   UNIQUE KEY(`id`)
   COMMENT 'OLAP'
   DISTRIBUTED BY HASH(`id`) BUCKETS 4
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   ); 
   ```
   
   Describe your changes.
   do not set string/text column type‘s length as 1.
   
   ```
   mysql> insert into tb6 (id, c_str) select 2,  'string value';
   Query OK, 1 row affected (0.04 sec)
   {'label':'insert_6c0d9cb7483488e_9f029797c91dab0b', 'status':'VISIBLE', 'txnId':'2004'}
   mysql> insert into tb6 (id, c_str) select 1,  'string value';
   Query OK, 1 row affected (0.03 sec)
   {'label':'insert_92da962f4f954d82_916b66273df28cea', 'status':'VISIBLE', 'txnId':'2005'}
   mysql> 
   mysql> select * from tb6;
   +------+--------------+--------+--------------+
   | id   | name         | c_text | c_str        |
   +------+--------------+--------+--------------+
   |    1 | a varchar 32 | a text | string value |
   |    2 | a varchar 32 | a text | string value |
   +------+--------------+--------+--------------+
   2 rows in set (0.11 sec)
   ```
   
   
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [N ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ N] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ N] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ N] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] stalary commented on pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #12148:
URL: https://github.com/apache/doris/pull/12148#issuecomment-1231311078

   Under normal circumstances should isAssignedStrLenInColDefinition to true, you are in what circumstances to this case?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] stalary commented on pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #12148:
URL: https://github.com/apache/doris/pull/12148#issuecomment-1231379034

   > 
   
   
   
   > > 
   > 
   > my case is create table with column
   > 
   > ```
   > `c_str` string  NULL DEFAULT "a string"
   > ```
   > > will failed. FE has denied creation because of the default value length > 1
   
   
   
   > > 
   > 
   > my case is create table with column
   > 
   > ```
   > `c_str` string  NULL DEFAULT "a string"
   > ```
   > 
   > will failed. FE has denied creation because of the default value length > 1
   
   Wait a minute, I try it in local.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] dujl commented on pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
dujl commented on PR #12148:
URL: https://github.com/apache/doris/pull/12148#issuecomment-1231347572

   > 
   
   my case is create table with column 
   ```
   `c_str` string  NULL DEFAULT "a string"
   ```
   will failed.
   FE has denied creation because of the default value length > 1
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] stalary commented on pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #12148:
URL: https://github.com/apache/doris/pull/12148#issuecomment-1232324978

   https://github.com/apache/doris/pull/12187 can resolve it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12148:
URL: https://github.com/apache/doris/pull/12148#issuecomment-1231443990

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] stalary commented on a diff in pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
stalary commented on code in PR #12148:
URL: https://github.com/apache/doris/pull/12148#discussion_r958151001


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java:
##########
@@ -202,15 +202,6 @@ public void analyze(boolean isOlap) throws AnalysisException {
         }
         FeNameFormat.checkColumnName(name);
 
-        // When string type length is not assigned, it need to be assigned to 1.
-        if (typeDef.getType().isScalarType()) {

Review Comment:
   I think varchar can keep the old logic, only modify String logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12148:
URL: https://github.com/apache/doris/pull/12148#issuecomment-1231444037

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] stalary closed pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1

Posted by GitBox <gi...@apache.org>.
stalary closed pull request #12148: [enhancement](string-type) support create the table containing string/text type with a default value that length greater than 1
URL: https://github.com/apache/doris/pull/12148


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org