All Projects → qzchenwl → hiveql-parser

qzchenwl / hiveql-parser

Licence: other
HiveQL Parser. Parse HiveQL code and print AST in JSON format if success, else print well formed syntax error message.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to hiveql-parser

dpkb
大数据相关内容汇总,包括分布式存储引擎、分布式计算引擎、数仓建设等。关键词:Hadoop、HBase、ES、Kudu、Hive、Presto、Spark、Flink、Kylin、ClickHouse
Stars: ✭ 123 (+392%)
Mutual labels:  hive
regln
Windows Rregistry Linking Utility
Stars: ✭ 38 (+52%)
Mutual labels:  hive
dockerfiles
Multi docker container images for main Big Data Tools. (Hadoop, Spark, Kafka, HBase, Cassandra, Zookeeper, Zeppelin, Drill, Flink, Hive, Hue, Mesos, ... )
Stars: ✭ 29 (+16%)
Mutual labels:  hive
bigdata-doc
大数据学习笔记,学习路线,技术案例整理。
Stars: ✭ 37 (+48%)
Mutual labels:  hive
logparser
Easy parsing of Apache HTTPD and NGINX access logs with Java, Hadoop, Hive, Pig, Flink, Beam, Storm, Drill, ...
Stars: ✭ 139 (+456%)
Mutual labels:  hive
dt-sql-parser
SQL Parsers for BigData, built with antlr4.
Stars: ✭ 135 (+440%)
Mutual labels:  syntax-checker
radiator
Hive Ruby API Client
Stars: ✭ 49 (+96%)
Mutual labels:  hive
BigInsights-on-Apache-Hadoop
Example projects for 'BigInsights for Apache Hadoop' on IBM Bluemix
Stars: ✭ 21 (-16%)
Mutual labels:  hive
TheVimIDE
Modern Vim IDE with support for C/C++, Java, Python, Lua, PHP, JavaScript, Ruby and much more ...
Stars: ✭ 33 (+32%)
Mutual labels:  syntax-checker
the-apache-ignite-book
All code samples, scripts and more in-depth examples for The Apache Ignite Book. Include Apache Ignite 2.6 or above
Stars: ✭ 65 (+160%)
Mutual labels:  hive
flycheck-joker
Clojure syntax checker (via Joker) for flycheck
Stars: ✭ 55 (+120%)
Mutual labels:  syntax-checker
Mzinga
Open-source software to play the board game Hive.
Stars: ✭ 57 (+128%)
Mutual labels:  hive
last fm
A simple app to demonstrate a testable, maintainable, and scalable architecture for flutter. flutter_bloc, get_it, hive, and REST API are some of the tech stacks used in this project.
Stars: ✭ 134 (+436%)
Mutual labels:  hive
TiBigData
TiDB connectors for Flink/Hive/Presto
Stars: ✭ 192 (+668%)
Mutual labels:  hive
fense
Fense is a database proxy written in Java, which can connect DB of different engines at the same time. The key features are: authority management, query cache, audit security, current limiting fuse, onesql and so on
Stars: ✭ 22 (-12%)
Mutual labels:  hive
HiveRunner
An Open Source unit test framework for Hive queries based on JUnit 4 and 5
Stars: ✭ 244 (+876%)
Mutual labels:  hive
hive to es
同步Hive数据仓库数据到Elasticsearch的小工具
Stars: ✭ 21 (-16%)
Mutual labels:  hive
common-datax
基于DataX的通用数据同步微服务,一个Restful接口搞定所有通用数据同步
Stars: ✭ 51 (+104%)
Mutual labels:  hive
awesome-hive
A curated list of awesome Hive resources.
Stars: ✭ 20 (-20%)
Mutual labels:  hive
hive-bigquery-storage-handler
Hive Storage Handler for interoperability between BigQuery and Apache Hive
Stars: ✭ 16 (-36%)
Mutual labels:  hive

hiveql-parser

HiveQL Parser. Parse HiveQL code and print AST in JSON format if success(exit 0), else print well formed syntax error message(exit 1).

Build

$ mvn package

To build standalone jar, use:

$ mvn clean compile assembly:single

Run

$ javar -jar /path/to/hiveql-parser.jar /path/to/your-code.sql

Examples

$ java -jar hiveql-parser.jar <(echo "select count(*) as count, myfield from &0rz") 2>/dev/null
[1,39]: line 1:39 cannot recognize input near '&' '0rz' '<EOF>' in join source
$ java -jar hiveql-parser.jar <(echo "select count(*) as count, myfield from 0rz") 2>/dev/null | jq .
{
  "startIndex": 0,
  "stopIndex": 18,
  "childIndex": -1,
  "children": [
    {
      "startIndex": 0,
      "stopIndex": 16,
      "token": {
        "type": 860,
        "line": 0,
        "charPositionInLine": -1,
        "channel": 0,
        "text": "TOK_QUERY",
        "index": -1,
        "start": 0,
        "stop": 0
      },
      "childIndex": 0,
      "children": [
        {
          "startIndex": 14,
          "stopIndex": 16,
          "token": {
            "type": 748,
            "line": 0,
            "charPositionInLine": -1,
            "channel": 0,
            "text": "TOK_FROM",
            "index": -1,
            "start": 0,
            "stop": 0
          },
          "childIndex": 0,
          "children": [
            {
              "startIndex": 16,
              "stopIndex": 16,
              "token": {
                "type": 954,
                "line": 0,
                "charPositionInLine": -1,
                "channel": 0,
                "text": "TOK_TABREF",
                "index": -1,
                "start": 0,
                "stop": 0
              },
              "childIndex": 0,
              "children": [
                {
                  "startIndex": 16,
                  "stopIndex": 16,
                  "token": {
                    "type": 953,
                    "line": 0,
                    "charPositionInLine": -1,
                    "channel": 0,
                    "text": "TOK_TABNAME",
                    "index": -1,
                    "start": 0,
                    "stop": 0
                  },
                  "childIndex": 0,
                  "children": [
                    {
                      "startIndex": 16,
                      "stopIndex": 16,
                      "token": {
                        "type": 26,
                        "line": 1,
                        "charPositionInLine": 39,
                        "channel": 0,
                        "index": 16,
                        "start": 39,
                        "stop": 41
                      },
                      "childIndex": 0,
                      "children": [],
                      "toString": "0rz",
                      "toStringTree": "0rz"
                    }
                  ],
                  "toString": "TOK_TABNAME",
                  "toStringTree": "(tok_tabname 0rz)"
                }
              ],
              "toString": "TOK_TABREF",
              "toStringTree": "(tok_tabref (tok_tabname 0rz))"
            }
          ],
          "toString": "TOK_FROM",
          "toStringTree": "(tok_from (tok_tabref (tok_tabname 0rz)))"
        },
        {
          "startIndex": -1,
          "stopIndex": 12,
          "token": {
            "type": 772,
            "line": 0,
            "charPositionInLine": -1,
            "channel": 0,
            "text": "TOK_INSERT",
            "index": -1,
            "start": 0,
            "stop": 0
          },
          "childIndex": 1,
          "children": [
            {
              "startIndex": -1,
              "stopIndex": -1,
              "token": {
                "type": 726,
                "line": 0,
                "charPositionInLine": -1,
                "channel": 0,
                "text": "TOK_DESTINATION",
                "index": -1,
                "start": 0,
                "stop": 0
              },
              "childIndex": 0,
              "children": [
                {
                  "startIndex": -1,
                  "stopIndex": -1,
                  "token": {
                    "type": 727,
                    "line": 0,
                    "charPositionInLine": -1,
                    "channel": 0,
                    "text": "TOK_DIR",
                    "index": -1,
                    "start": 0,
                    "stop": 0
                  },
                  "childIndex": 0,
                  "children": [
                    {
                      "startIndex": -1,
                      "stopIndex": -1,
                      "token": {
                        "type": 963,
                        "line": 0,
                        "charPositionInLine": -1,
                        "channel": 0,
                        "text": "TOK_TMP_FILE",
                        "index": -1,
                        "start": 0,
                        "stop": 0
                      },
                      "childIndex": 0,
                      "children": [],
                      "toString": "TOK_TMP_FILE",
                      "toStringTree": "tok_tmp_file"
                    }
                  ],
                  "toString": "TOK_DIR",
                  "toStringTree": "(tok_dir tok_tmp_file)"
                }
              ],
              "toString": "TOK_DESTINATION",
              "toStringTree": "(tok_destination (tok_dir tok_tmp_file))"
            },
            {
              "startIndex": 0,
              "stopIndex": 12,
              "token": {
                "type": 878,
                "line": 0,
                "charPositionInLine": -1,
                "channel": 0,
                "text": "TOK_SELECT",
                "index": -1,
                "start": 0,
                "stop": 0
              },
              "childIndex": 1,
              "children": [
                {
                  "startIndex": 2,
                  "stopIndex": 9,
                  "token": {
                    "type": 880,
                    "line": 0,
                    "charPositionInLine": -1,
                    "channel": 0,
                    "text": "TOK_SELEXPR",
                    "index": -1,
                    "start": 0,
                    "stop": 0
                  },
                  "childIndex": 0,
                  "children": [
                    {
                      "startIndex": 2,
                      "stopIndex": 5,
                      "token": {
                        "type": 752,
                        "line": 0,
                        "charPositionInLine": -1,
                        "channel": 0,
                        "text": "TOK_FUNCTIONSTAR",
                        "index": -1,
                        "start": 0,
                        "stop": 0
                      },
                      "childIndex": 0,
                      "children": [
                        {
                          "startIndex": 2,
                          "stopIndex": 2,
                          "token": {
                            "type": 26,
                            "line": 1,
                            "charPositionInLine": 7,
                            "channel": 0,
                            "index": 2,
                            "start": 7,
                            "stop": 11
                          },
                          "childIndex": 0,
                          "children": [],
                          "toString": "count",
                          "toStringTree": "count"
                        }
                      ],
                      "toString": "TOK_FUNCTIONSTAR",
                      "toStringTree": "(tok_functionstar count)"
                    },
                    {
                      "startIndex": 9,
                      "stopIndex": 9,
                      "token": {
                        "type": 26,
                        "line": 1,
                        "charPositionInLine": 19,
                        "channel": 0,
                        "index": 9,
                        "start": 19,
                        "stop": 23
                      },
                      "childIndex": 1,
                      "children": [],
                      "toString": "count",
                      "toStringTree": "count"
                    }
                  ],
                  "toString": "TOK_SELEXPR",
                  "toStringTree": "(tok_selexpr (tok_functionstar count) count)"
                },
                {
                  "startIndex": 12,
                  "stopIndex": 12,
                  "token": {
                    "type": 880,
                    "line": 0,
                    "charPositionInLine": -1,
                    "channel": 0,
                    "text": "TOK_SELEXPR",
                    "index": -1,
                    "start": 0,
                    "stop": 0
                  },
                  "childIndex": 1,
                  "children": [
                    {
                      "startIndex": 12,
                      "stopIndex": 12,
                      "token": {
                        "type": 950,
                        "line": 0,
                        "charPositionInLine": -1,
                        "channel": 0,
                        "text": "TOK_TABLE_OR_COL",
                        "index": -1,
                        "start": 0,
                        "stop": 0
                      },
                      "childIndex": 0,
                      "children": [
                        {
                          "startIndex": 12,
                          "stopIndex": 12,
                          "token": {
                            "type": 26,
                            "line": 1,
                            "charPositionInLine": 26,
                            "channel": 0,
                            "index": 12,
                            "start": 26,
                            "stop": 32
                          },
                          "childIndex": 0,
                          "children": [],
                          "toString": "myfield",
                          "toStringTree": "myfield"
                        }
                      ],
                      "toString": "TOK_TABLE_OR_COL",
                      "toStringTree": "(tok_table_or_col myfield)"
                    }
                  ],
                  "toString": "TOK_SELEXPR",
                  "toStringTree": "(tok_selexpr (tok_table_or_col myfield))"
                }
              ],
              "toString": "TOK_SELECT",
              "toStringTree": "(tok_select (tok_selexpr (tok_functionstar count) count) (tok_selexpr (tok_table_or_col myfield)))"
            }
          ],
          "toString": "TOK_INSERT",
          "toStringTree": "(tok_insert (tok_destination (tok_dir tok_tmp_file)) (tok_select (tok_selexpr (tok_functionstar count) count) (tok_selexpr (tok_table_or_col myfield))))"
        }
      ],
      "toString": "TOK_QUERY",
      "toStringTree": "(tok_query (tok_from (tok_tabref (tok_tabname 0rz))) (tok_insert (tok_destination (tok_dir tok_tmp_file)) (tok_select (tok_selexpr (tok_functionstar count) count) (tok_selexpr (tok_table_or_col myfield)))))"
    },
    {
      "startIndex": 18,
      "stopIndex": 18,
      "token": {
        "type": -1,
        "line": 2,
        "charPositionInLine": 0,
        "channel": 0,
        "index": 18,
        "start": 43,
        "stop": 43
      },
      "childIndex": 1,
      "children": [],
      "toString": "<EOF>",
      "toStringTree": "<eof>"
    }
  ],
  "toString": "nil",
  "toStringTree": "(tok_query (tok_from (tok_tabref (tok_tabname 0rz))) (tok_insert (tok_destination (tok_dir tok_tmp_file)) (tok_select (tok_selexpr (tok_functionstar count) count) (tok_selexpr (tok_table_or_col myfield))))) <eof>"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].