摘要:作為MapReduce系統的核心組件的腳本解析模塊,它是分布式云計算平臺實現的基礎。該模塊的實現是基于腳本編程接口,在此過程中使用的語言是QL(Query Language)。QL腳本通過腳本解析模塊實現解析之后,事件執行模塊則由參數通過配置事件的方式一一實現。下面就這種腳本語言的實現過程作了詳細的分析。
關鍵詞:MapReduce;腳本解析;QL;事件配置
中圖分類號:TP311 文獻標識碼:A 文章編號:1009-3044(2014)19-4361-03
An Analysis of Parsing Module QL Script
CHEN Hao
(Guangdong Technical College of Water Resources and Electric Engineering, Computer Information Engineering, Guangzhou 510925, China)
Abstract:MapReduce system as a core component of the script parsing module, which is the basis for a distributed cloud computing platform implementation. The module is based on the realization scripting interface, the language used in this process is QL (Query Language). After the QL script by script parsing module for parsing, event execution module configured by the parameters of events come true. The following detailed analysis of the implementation process of this scripting language.
Key words:MapReduce; script parsing; QL; event configuration
1 QL腳本的設計理念
QL腳本在設計方面,充分考慮了與現有數據庫查詢語言SQL相結合的特點,QL腳本無疑可以被看作是對數據庫查詢語句SQL的一種轉型和衍生。基于對現有技術的可擴展性和覆蓋性分析,使用QL腳本來定義關鍵詞的過程能夠適應市場上各種網絡流量統計的不同類型,當然必須對設計過程中對關鍵詞的靈活擴展性作以充分性的考慮,以便于后期對QL腳本的擴容升級,更好的支撐云計算平臺的綜合應用。
2 QL腳本模塊的分析
QL腳本模塊解析可以分為以下幾大模塊:解析引擎(ScritEngine)、腳本語句解釋器(ScritParser)、比較運算模塊(Compare)、算術運算模塊(Arithmetic)、邏輯運算模塊(ExpressionEngine)、聚合運算模塊(Aggregate)、字段運算模塊(Field)、配置模塊(Configuration)等。圖1是QL腳本解析模塊的整體結構圖。
QL腳本解析的實現過程如下:系統的入口為ScriptEngine,它的功能是讀取QL語言腳本,并將腳本逐行傳遞給腳本解析器。腳本解析器按照每行的QL語言腳本首字母對語句進行分類,根據不同語句的類別調用不同的解釋模塊對語句進行解析。語句解析逐行進行,如腳本中含有子句等其他復雜句型,腳本解析器會調用其他的處理模塊,如調用聚合運算模塊對腳本進行相應的處理。……