drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-5868) Support SQL syntax highlighting of queries
Date Tue, 09 Jan 2018 18:08:00 GMT

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

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_r160482817
  
    --- 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"
    +    );
    +	//Confirmed to be UnSupported as of Drill-1.12.0
    +	/* cross|natural|primary|foreign|references|grant */
    +
    +    var builtinConstants = (
    +        "true|false"
    +    );
    +
    +    //Drill-specific
    +    var builtinFunctions = (
    +        //Math and Trignometric
    +        "abs|cbrt|ceil|ceiling|degrees|e|exp|floor|log|log|log10|lshift|mod|negative|pi|pow|radians|rand|round|round|rshift|sign|sqrt|trunc|trunc|"
+
    --- End diff --
    
    I tried looking at that option, but it is quite difficult to figure out how the libraries
read these files. We could do a dynamic generation of this list, when the {sys.functions}
table does get implemented. 


> 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)

Mime
View raw message