//===========================================================================
// Testcases for FilterPushDown
// It tests pushing Filter below Transform, Join, Group By, Sort, Merge
// It handles predicate decomposition (Dividing Filter predicates into conjunctive sub-predicates)
//===========================================================================
$data_books = [
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 2007,
format: {cover: 'hard', pages: 1302},
price: [3, 34.0, 102222, 3.3]},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Chamber of Secrets',
year: 1999,
format: {cover: 'hard', pages: 1302}},
{publisher: 'XYZ',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 1998,
format: {cover: 'soft', pages: 1200},
price: [120.5, 110.0]},
{publisher: 'Ray ST',
author: 'New Rowling',
title: 'Chamber of Secrets',
year: 1998,
reviews: [{rating: 10, user: 'joe', review: 'The best ...'}]},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Sorcerers Stone',
year: 1996,
format: {cover: 'hard', pages: 742},
price: [11.0, 17.5]},
{publisher: 'Scholastic',
author: 'R. L. Stine',
title: 'Monster Blood IV',
year: 1995,
format: {cover: 'soft', pages: 302}},
{publisher: 'Grosset',
author: 'Carolyn Keene',
title: 'The Secret of Kane',
year: 1988},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 1987},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Chamber of Secrets',
year: 1987,
reviews: [
{rating: 10, user: 'joe', review: 'The best ...'},
{rating: 6, user: 'mary', review: 'Average ...'}]},
{publisher: 'XYZ',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 1986},
{publisher: 'Foster',
author: 'Old Rowling',
title: 'Chamber of Secrets',
year: 1979,
reviews: [{rating: 10, user: 'joe', review: 'The best ...'}]},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Sorcerers Stone',
year: 1978},
{publisher: 'Scholastic',
author: 'R. L. Stine',
title: 'Monster Blood IV',
year: 1977,
price: [3.6, 20.5, 41.0]
},
{publisher: 'Grosset',
author: 'Carolyn Keene',
title: 'The Secret of Kane',
year: 1920,
format: {cover: 'hard', pages: 66}}
];
$data_books2 = [
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 2007,
format: {cover: 'hard', pages: 1302},
price: [30.5, 33.5, 34.0]},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Chamber of Secrets',
year: 1999,
format: {cover: 'hard', pages: 1302},
price: [20.1, 25.0]
},
{publisher: 'XYZ',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 1998,
format: {cover: 'soft', pages: 1200},
price: [120.5, 110.0]},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Sorcerers Stone',
year: 1996,
format: {cover: 'hard', pages: 742},
price: [11.0, 17.5]},
{publisher: 'Scholastic',
author: 'R. L. Stine',
title: 'Monster Blood IV',
year: 1995,
format: {cover: 'soft', pages: 302}},
{publisher: 'Grosset',
author: 'Carolyn Keene',
title: 'The Secret of Kane',
year: 1988},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 1987},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Chamber of Secrets',
year: 1987,
reviews: [
{rating: 10, user: 'joe', review: 'The best ...'},
{rating: 6, user: 'mary', review: 'Average ...'}]},
{publisher: 'XYZ',
author: 'J. K. Rowling',
title: 'Deathly Hallows',
year: 1986},
{publisher: 'Foster',
author: 'Old Rowling',
title: 'Chamber of Secrets',
year: 1979,
reviews: [{rating: 10, user: 'joe', review: 'The best ...'}]},
{publisher: 'Scholastic',
author: 'J. K. Rowling',
title: 'Sorcerers Stone',
year: 1978},
{publisher: 'Scholastic',
author: 'R. L. Stine',
title: 'Monster Blood IV',
year: 1977,
price: [3.6, 20.5, 41.0]
},
{publisher: 'Grosset',
author: 'Carolyn Keene',
title: 'The Secret of Kane',
year: 1920,
format: {cover: 'hard', pages: 66}}
];
//=========================Testing Filter-Transform===================================================
//Returns 8 records --Should be pusheddown
$data_books -> transform {x: $.author, $.year} -> filter $.x == 'J. K. Rowling';
//Returns count of 14 records --Should be pusheddown TWICE
$data_books -> transform each $d {x: $d.author, $d.format.cover, y:$d.price} -> transform each $g [$g.x, $g.y] -> filter true ->count();
//Returns count of 3 records --Should be pusheddown (All the three predicates)
$data_books -> transform {n: $.author, x: $, $.year , $.format.cover, $, c: $.format.cover, f: $.price-> count(), k: "33333"} -> filter each $dd $dd.cover == 'hard' and $dd.k == '33333' and $dd."".author == 'J. K. Rowling' -> count();
//Returns count of 2 records --(Predicates 1, 2, and 4 should be pusheddown) (Predicate 3 stays as is)
$data_books -> transform {n: $.author, x: $, $.year , $.format.cover, $, c: $.format.cover, f: $.price-> count(), k: "33333"} -> filter $.cover == 'hard' and $.k == '33333' and $.f > 1 and $."".author == 'J. K. Rowling' -> count() ;
//Returns 3 records --Should be pusheddown
$data_books -> transform each $d {n: $d.author, m: $d.year, $d.year , c: $d.format} -> filter each $x $x.m >= 2004 or $x.c.cover == 'soft';
//Returns 6 records --Should be pusheddown
$data_books -> transform ($.year) -> filter $ > 1990;
//Returns 4 records --Should be pusheddown
$data_books -> transform ($.format) -> filter $.cover == 'hard';
//Returns 4 records --Should be pusheddown
$data_books -> transform {$.author, cnt: $.year + $.format.pages * 2} -> filter each $x $x.cnt > 3000;
//Returns 2 records --Should be pusheddown TWICE
$data_books -> transform each $d {x: $d.author, $d.format.cover, y:$d.price} -> transform each $g [$g.x, $g.y] -> filter $[0] == 'R. L. Stine';
//Returns 1 record --First predicate should be pushed TWICE. The second predicate should be pusheddown ONCE
$data_books -> transform each $d {x: $d.author, $d.format.cover, y:sum($d.price)} -> transform each $g [$g.x, $g.y] -> filter $[0] == 'R. L. Stine' and $[1]> 20;
//Returns 4 records --Should be pusheddown ONCE
$data_books -> transform [$, $.author, $.format, "3333" ,{name: $.publisher, y: $.year}, max($.price)] -> transform {c:$[2].cover, $[4].name, max: $[5] } -> filter $.max > 2;
//Returns 2 records --Should be pusheddown TWICE
$data_books -> transform [$, $.author, $.format, "3333" ,{name: $.publisher, y: $.year}, max($.price)] -> transform {c:$[2].cover, $[4].name, max: $[5] } -> filter $.c == 'soft';
//Returns 2 records --Should be pusheddown TWICE
$data_books -> transform each $d {x: $d.author, $d.format.cover, y:$d.price} -> transform each $g [$g.x, $g.y] -> filter count($[1]) > 2;
//Returns 1 record --(Predicate $.a == 1 should be pushed down.
// Predicate count($.less)>4 remains as is).
[{a:1, b:[1,2,3,4,5,6,6,77,87,43,122]}, {a:2, b:[12,3,34434,766,33,11,10,2]}]
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于Java的实例开发源码-JSON查询语言 Jaql.zip (2868个子文件)
libhadoop.so.1.0.0 74KB
libhadoop.so.1.0.0 64KB
libhadoop.so.1.0.0 63KB
libhadoop.so.1.0.0 58KB
libhadoop.so.1 74KB
libhadoop.so.1 64KB
libhadoop.so.1 63KB
libhadoop.so.1 58KB
.classpath.0.18.3 3KB
.project.0.18.3 391B
libhadoop.a 113KB
libhadoop.a 99KB
libhadoop.a 81KB
libhadoop.a 75KB
serializer_complete.bat 3KB
bench_interpreter.bat 2KB
bench_hotspot_jit.bat 1KB
bench_analysis.bat 714B
Echo.class 977B
MyNewFunction.class 648B
MyOutputAdapter3.class 253B
MyInputAdapter3.class 250B
.classpath 3KB
wordCount.conf 984B
jaql.css 5KB
jaql.css 5KB
hadoop.css 3KB
hbase.css 267B
registryTest2.dat 513B
wc.db 1.33MB
delimited-quoted.del 491B
delimited-quoted-ok.del 489B
delimited.del 123B
delimited-ddquote.del 35B
delimited-invalid3.del 13B
delimited-invalid2.del 13B
delimited-invalid1.del 11B
entries 3B
ssl-client.xml.example 1KB
ssl-server.xml.example 1KB
format 3B
jaql.g 73KB
hbase_logo_med.gif 4KB
treeview-default-line.gif 2KB
treeview-default.gif 1KB
plus.gif 841B
minus.gif 837B
.gitignore 629B
definedFunctions.no_rewrite.gold 81KB
definedFunctions.rewrite.gold 81KB
schema.gold 81KB
schema.no_rewrite.gold 81KB
filterPushDown.gold 63KB
coreOperators.no_rewrite.gold 51KB
coreOperators.rewrite.gold 50KB
storageGeneral.rewrite.gold 49KB
storageGeneral.no_rewrite.gold 49KB
examples.gold 46KB
storageText.gold 41KB
core.no_rewrite.gold 38KB
storageTemp.gold 36KB
core.gold 36KB
storageTemp.count.gold 34KB
unionTee.gold 30KB
storageText.count.gold 29KB
examples.count.gold 28KB
schemaEnhance.no_rewrite.gold 26KB
schemaEnhance.rewrite.gold 26KB
longList.gold 25KB
unionTee.count.gold 24KB
storage.gold 22KB
storage.count.gold 20KB
hashtable.gold 20KB
module.gold 18KB
globalVars.gold 17KB
longList.count.gold 17KB
fail.no_rewrite.gold 17KB
fail.gold 17KB
hashtable.count.gold 15KB
storageTextEnhance.rewrite.gold 13KB
storageTextEnhance.no_rewrite.gold 13KB
fence.gold 12KB
loop.gold 11KB
inputSplits.gold 11KB
inputSplits.count.gold 10KB
xml.gold 10KB
loop.count.gold 9KB
fence.count.gold 8KB
registry.gold 8KB
registry.count.gold 7KB
timer.no_rewrite.gold 5KB
timer.gold 5KB
nativeMR.gold 5KB
nativeMR.count.gold 5KB
rng.gold 4KB
rng.count.gold 4KB
options.gold 4KB
distribute.rewrite.gold 2KB
sampling.count.gold 2KB
sampling.gold 2KB
共 2868 条
- 1
- 2
- 3
- 4
- 5
- 6
- 29
资源评论
易小侠
- 粉丝: 6469
- 资源: 9万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功