[ 
https://issues.apache.org/jira/browse/DRILL-5868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16318903#comment-16318903
 ] 

ASF GitHub Bot commented on DRILL-5868:
---------------------------------------

Github user kkhatua commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1084#discussion_r160491309
  
    --- Diff: 
exec/java-exec/src/main/resources/rest/static/js/ace-code-editor/mode-sql.js ---
    @@ -1 +1,128 @@
    
-ace.define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use
 strict";var 
r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var
 
e="select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|foreign|not|references|default|null|inner|cross|natural|database|drop|grant",t="true|false",n="avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl",r="int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|money|real|number|integer",i=this.createKeywordMapper({"support.function":n,keyword:e,"constant.language":t,"storage.type":r},"identifier",!0);this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",start:"/\\*",end:"\\*/"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"string",regex:"`.*?`"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:i,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]},this.normalizeRules()};r.inherits(s,i),t.SqlHighlightRules=s}),ace.define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules"],function(e,t,n){"use
 strict";var 
r=e("../lib/oop"),i=e("./text").Mode,s=e("./sql_highlight_rules").SqlHighlightRules,o=function(){this.HighlightRules=s,this.$behaviour=this.$defaultBehaviour};r.inherits(o,i),function(){this.lineCommentStart="--",this.$id="ace/mode/sql"}.call(o.prototype),t.Mode=o})
    \ No newline at end of file
    +/**
    + * Drill SQL Definition (Forked from SqlServer definition)
    + */
    +
    
+ace.define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],
 function(require, exports, module) {
    +"use strict";
    +
    +var oop = require("../lib/oop");
    +var TextHighlightRules = 
require("./text_highlight_rules").TextHighlightRules;
    +
    +var SqlHighlightRules = function() {
    +
    +    //TODO: https://drill.apache.org/docs/reserved-keywords/
    +   //e.g. Cubing operators like ROLLUP are not listed
    +    var keywords = (
    +        
"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|"
 +
    +        
"when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|key|if|"
 +
    +        "not|default|null|inner|database|drop|" +
    +           "flatten|kvgen|columns"
    --- End diff --
    
    There is a small challenge with this list. The 300+ keywords are a mix of 
reserved SQL keywords, functions and other words. I could be wrong, but I think 
some of these are not even supported (e.g. TRIGGER).
    I would need to separate the functions and SQL keywords for the colour 
highlighting to appear correctly.
    Let me walk through the list and at least identify the SQL keywords. 
Functions were already covered separately.


> Support SQL syntax highlighting of queries
> ------------------------------------------
>
>                 Key: DRILL-5868
>                 URL: https://issues.apache.org/jira/browse/DRILL-5868
>             Project: Apache Drill
>          Issue Type: New Feature
>          Components: Web Server
>            Reporter: Kunal Khatua
>            Assignee: Kunal Khatua
>            Priority: Minor
>             Fix For: 1.13.0
>
>
> It would be nice to have the Query Editor support syntax highlighting.
> An autocomplete would be even better as new functions are introduced in Drill



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to