Skip to content

Conversation

@Astralidea
Copy link
Contributor

Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

Fix #4331 mentioned SQL:
"""
select
collation_name,
character_set_name,
is_default collate utf8_general_ci = 'Yes' as is_default
from information_schema.collations
"""

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • [] Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] Documentation Update (if none of the other choices apply)
  • [] Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have create an issue on (Fix #ISSUE), and have described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • [] If this change need a document change, I have updated the document
  • [] Any dependent changes have been merged

Further comments

代码实现了基本的功能,可以让DataGrip读出来有哪些表和表结构了,但是感觉写得不优雅。
试了很多方式都有冲突,也可以看看怎么改比较好一些。

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the opt_collate should be part of expr?
Not only in select_list_item

@morningman morningman self-assigned this Aug 16, 2020
@morningman morningman added the area/mysql-compatibility Issues or PRs related to the mysql compatibility label Aug 16, 2020
@Astralidea
Copy link
Contributor Author

Looks like the opt_collate should be part of expr?
Not only in select_list_item

这个我尝试放expr里过,但是会有大量的冲突,不知道应该怎么写比较好?

@morningman
Copy link
Contributor

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup
index 4e4e028e4..34f6dbff4 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -502,6 +502,7 @@ precedence left KW_INTERVAL;
 precedence left KW_OVER;
 precedence left KW_PARTITION;
 precedence left KW_PARTITIONS;
+precedence left KW_COLLATE;
 precedence right KW_TEMPORARY;
 precedence right LBRACKET;

@@ -3258,7 +3259,7 @@ select_sublist ::=
     ;

 select_list_item ::=
-    expr:expr opt_collate:collate select_alias:alias
+    expr:expr select_alias:alias
     {:
         RESULT = new SelectListItem(expr, alias);
     :}
@@ -3849,7 +3850,7 @@ sign_chain_expr ::=
   ;

 expr ::=
-  non_pred_expr:e
+  non_pred_expr:e opt_collate:collate
   {: RESULT = e; :}
   | predicate:p
   {: RESULT = p; :}

you can try above diff. I think it works

@Astralidea
Copy link
Contributor Author

you can try above diff. I think it works

十分感谢,好使。不过不好意思,我操作失误把原来的仓库给搞没了,我又提了个PR,在那上面看吧。
#4365

@Astralidea Astralidea closed this Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mysql-compatibility Issues or PRs related to the mysql compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doris对DataGrip的元数据的兼容

2 participants