mrql初级教程-概念、使用(一)
以下是本人原创,如若转载和使用请注明转载地址。本博客信息切勿用于商业,可以个人使用,若喜欢我的博客,请关注我,谢谢!博客地址
MRQL简介
MRQL (发音 miracle) 是一个查询处理和优化系统,适用于大规模分布式的数据分析。MRQL (MapReduce Query Language) 是一个在计算机集群中对大规模数据的类 SQL 查询语言。MRQL 查询处理系统可使用如下三种模式评估 MRQL 查询:
- 使用 Hadoop 的 Map-Reduce 模式
- 使用 Apache Hama 的 BSP 模式 (Bulk Synchronous Parallel mode)
- 基于 Apache Spark 的 Spark 模式
MRQL一般的使用语法
Evaluating MRQL Queries Using Map-Reduce
Before deploying your MRQL queries on a Hadoop cluster, you can run these queries in memory on a small amount of data using the command:
which evaluates MRQL top-level commands and queries from the input until you type quit. To run MRQL in Hadoop's standalone mode (single node on local files), use:
To run MRQL in Hadoop's fully distributed mode (cluster mode), use:
//MRQL运行Hadoop的完全分布式模式(集群模式)
Accessing the Data Sources
The MRQL expression that makes a directory of raw files accessibleto a query is:
where path is the URI of the directory that contains thesource files (a string), parser is the name of the parser toparse the files, and args are various parameters specific tothe parsing method. It returns a !bag(t), for some t,that is, it returns a map-reduce type. Currently, there are foursupported parsers: line, xml, json, andbinary, but it is easy to define and embed your own parser(explained later).
Parsing XML Documents
The MRQL expression used for parsing an XML document is:
source( xml, path, tags, xpath )
For example, the following expression:
binds the variable XMark to the result of parsing thedocument "xmark.xml" and returns a list of personelements. A more complex example is:
下面是我自己做的例子:
|
1
2
3
4
5
6
7
8
|
<person> <name> 张三 </name> <age> 20 </age></person> |
将1.xml文件上传到hdfs目录下
hadoop fs -put ~/1.xml /user/hadoop/jl
查看jl目录

mrql初级教程-概念、使用(一)的更多相关文章
- mrql初级教程-使用(er)
最近使用mrql做xml文件解析,使用xpath来进行判断 使用的方法如下,其中t.mrql文件如下: v =args[1];store ty:=source(xml,args[0],{"p ...
- [初级教程]用SecureCRT+Xming轻松远程实现Linux的X DISPLAY
[初级教程]用SecureCRT+Xming轻松远程实现Linux的X DISPLAY 发布者:sqqdugdu 时间:10-06 阅读数:2117 测试环境:RHEL 6.1,SecureCRT 5 ...
- Python图像处理库:Pillow 初级教程
Python图像处理库:Pillow 初级教程 2014-09-14 翻译 http://pillow.readthedocs.org/en/latest/handbook/tutorial.html ...
- shellKali Linux Web 渗透测试— 初级教程(第三课)
shellKali Linux Web 渗透测试— 初级教程(第三课) 文/玄魂 目录 shellKali Linux Web 渗透测试—初级教程(第三课) 课程目录 通过google hack寻找测 ...
- Mac OS X Terminal 101:终端使用初级教程
Mac OS X Terminal 101:终端使用初级教程 发表于 2012 年 7 月 29 日 由 Renfei Song | 文章目录 1 为什么要使用命令行/如何开启命令行? 2 初识Com ...
- Coding 初级教程(二)——上传已有项目
Coding 初级教程(二)——上传已有项目 [摘要:方针读者 :已具有 Coding.net 的账号. 本文首要先容若何把项目上传到 Coding.net 上. 分两种环境,一种是项目已归入到 gi ...
- Window服务初级教程以及log4net配置文件初始化
Window服务初级教程:http://www.jb51.net/article/48987.htm 另外,配置log4net这个日志功能的时候需要初始化,不然会报没有初始化的错误,而且初始化的节点应 ...
- 《自学C语言》初级教程 - 目录
我现在打算出一个C语言学习教程,目的是为了让初学者能够很容易和更深刻地理解C语言. 你可能有这样的疑问,网上不是有很多的初级教程吗,我需要这个吗?我的回答是:网上的C语言教程讲得不够全面,而且许多的初 ...
- Android初级教程理论知识(第三章测试&数据存储&界面展现)
首先介绍单元测试,我在javaweb部分有详细介绍单元测试框架的一篇文章. 可以先看在javaweb中的单元测试详解篇http://blog.csdn.net/qq_32059827/article/ ...
随机推荐
- Explain of Interaction Operators in UML?
来源于:EA 中的 Interaction Operators Enterprise Architect User Guide Operator Action alt Divide up intera ...
- 根据View获取该控制器
//根据View获取控制器 - (UIViewController*)viewController { for (UIView* next = [self superview]; next; next ...
- iOS 10推送通知开发
原文地址:Developing Push Notifications for iOS 10,译者:李剑飞 虽然通知经常被过度使用,但是通知确实是一种获得用户关注和通知他们需要更新或行动的有效方式.iO ...
- 清除number输入框的上下箭头
<input type="number"/> 在chrome,firefox,safari浏览器上输入框右侧会有上下箭头 方法1: <input type=&qu ...
- 【转】ethtool 命令详解
命令描述: ethtool 是用于查询及设置网卡参数的命令. 使用概要:ethtool ethx //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0.eth1等等etht ...
- Android 开发——如何显示 GIF 动画
gif 图动画在 android 中还是比较常用的,比如像新浪微博中,有很多 gif 图片,而且展示非常好,所以我也想弄一个.经过我多方的搜索资料和整理,终于弄出来了,其实 github 上有很多开源 ...
- JMeter-使用Badboy录制Web测试脚本
JMeter是纯Java编写的软件功能和性.能测试工具,其录制脚本过于笨拙和复杂.而Badboy是用C++开发的动态应用测试工具,其拥有强大的屏幕录制和回放功能,同时提供图形结果分析功能,刚好弥补了J ...
- angular.js之路由的选择
在一个单页面中,我们可以添加多个模块,使得网页只在需要的时候加载这个模块.模块的切换大致上可以代替网页的切换,于是,我们便可以通过模块的切换实现网页的切换,这个切换是按需加载的. 乍一看非常普通的东西 ...
- Python IDLE中实现清屏
首先下载clearwindow.py(点击可直接下载,不能下载的可以右键保存,格式为py结尾)将这个文件放在Python X\Lib\idlelib目录下(X为你的python版本),然后在这个目录下 ...
- Java8学习笔记----Lambda表达式 (转)
Java8学习笔记----Lambda表达式 天锦 2014-03-24 16:43:30 发表于:ATA之家 本文主要记录自己学习Java8的历程,方便大家一起探讨和自己的备忘.因为本人 ...