Browse files

[sql mode] Added support for Hive

  • Loading branch information...
1 parent a21c491 commit 11b4e40e21949b44b70172d4485775c2b7104e48 @malayhm malayhm committed with marijnh Mar 9, 2014
Showing with 13 additions and 1 deletion.
  1. +2 −1 mode/sql/index.html
  2. +11 −0 mode/sql/sql.js
@@ -52,7 +52,8 @@ <h2>SQL Mode for CodeMirror</h2>
<code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>,
<code><a href="?mime=text/x-cassandra">text/x-cassandra</a></code>,
<code><a href="?mime=text/x-plsql">text/x-plsql</a></code>,
- <code><a href="?mime=text/x-mssql">text/x-mssql</a></code>.
+ <code><a href="?mime=text/x-mssql">text/x-mssql</a></code>,
+ <code><a href="?mime=text/x-hive">text/x-hive</a></code>.
window.onload = function() {
@@ -332,6 +332,17 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
dateSQL: set("date time timestamp"),
support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")
+ // Created to support specific hive keywords
+ CodeMirror.defineMIME("text/x-hive", {
+ name: "sql",
+ keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),
+ builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),
+ atoms: set("false true null unknown"),
+ operatorChars: /^[*+\-%<>!=]/,
+ dateSQL: set("date timestamp"),
+ support: set("ODBCdotTable doubleQuote binaryNumber hexNumber")
+ });

0 comments on commit 11b4e40

Please sign in to comment.