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/ ...
随机推荐
- [转]c++ new带括号和不带括号
ref:http://m.blog.csdn.net/blog/u012745772/42420443 在new对象的时候有加上(),有不加(),不知道这个到底是什么区别?比如:CBase *base ...
- 分页打印控制 摘自于网络:http://www.cnblogs.com/joinger/articles/1807517.html
代码 style="page-break-after:always;"> 利用CSS控制打印 放在这里,算是一个备份 <style> @media print{ ...
- 转 Oracle12c/11个 Client安装出现"[INS-30131]"错误“请确保当前用户具有访问临时位置所需的权限”解决办法之完整版
错误分析:安装时exe会自动解压到C:\Users\Administrator\AppData\Local\Temp再进行安装,当文件夹权限不足时就会拒绝安装程序的访问: 第一步: 在win+R输入 ...
- JSP中文编码问题
这个乱码问题是最简单的乱码问题.一般新会出现.就是页面编码不一致导致的乱码. <%@ page language="java" pageEncoding="UTF- ...
- Webdriver中实现区域截图的方式以及如何截取frame中的图片
import java.awt.Rectangle;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOE ...
- required 引发的小小思考
原创:转载请注明出处 首先,因为遇到问题如下: class MainTabBar: UITabBar { override init(frame: CGRect) { super.init(frame ...
- C语言客户端服务器代码
/* sockclnt.c*/ #include <stdio.h>#include <string.h>#include <stdlib.h>#include & ...
- ViewPager和Fragment组合 v4包下的页面切换
/* *主页面下 */ //-------------主页面下---------------------- package com.example.viewpagerfragment; import ...
- sql 按时间二段排序
业务需用为数据按倒序排序,当天数据排在以往日期前面,但当天数据需按小时进行升序排列 select *from( select vcTitle,dtBeginDate,case when dtBegin ...
- A SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'Lucene40' does not exist.
简单的建立索引和查询索引并不难,关键在于他的二次开发,让他适合你自己的需求 既然要二次开发就必须查看源码 首先看看索引过程中的核心类吧: IndexWriter 这个是核心组件, 建立和打开索引,以及 ...