|
| 1 | +package com.sap.hadoop.windowing.runtime2; |
| 2 | + |
| 3 | +import com.sap.hadoop.windowing.testutils.WindowingTest; |
| 4 | + |
| 5 | +public class WindowingTestsFactory |
| 6 | +{ |
| 7 | + public static WindowingTest BASIC = new WindowingTest( |
| 8 | + "basicTest", |
| 9 | + "Basic Test", |
| 10 | + "select p_mfgr,p_name, p_size,\n" |
| 11 | + + "rank() as r,\n" |
| 12 | + + "denserank() as dr\n" |
| 13 | + + "from part_tiny\n" |
| 14 | + + "partition by p_mfgr\n" |
| 15 | + + "order by p_name\n" |
| 16 | + + "window w1 as rows between 2 preceding and 2 following\n" |
| 17 | + + "into path='/tmp/wout2'\n" |
| 18 | + + "serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'\n" |
| 19 | + + "with serdeproperties('field.delim'=',')\n" |
| 20 | + + "format 'org.apache.hadoop.mapred.TextOutputFormat'", |
| 21 | + "Manufacturer#1 almond antique burnished rose metallic 2 1 1\n" |
| 22 | + + "Manufacturer#1 almond antique burnished rose metallic 2 1 1\n" |
| 23 | + + "Manufacturer#1 almond antique chartreuse lavender yellow 34 3 2\n" |
| 24 | + + "Manufacturer#1 almond antique salmon chartreuse burlywood 6 4 3\n" |
| 25 | + + "Manufacturer#1 almond aquamarine burnished black steel 28 5 4\n" |
| 26 | + + "Manufacturer#1 almond aquamarine pink moccasin thistle 42 6 5\n" |
| 27 | + + "Manufacturer#2 almond antique violet chocolate turquoise 14 1 1\n" |
| 28 | + + "Manufacturer#2 almond antique violet turquoise frosted 40 2 2\n" |
| 29 | + + "Manufacturer#2 almond aquamarine midnight light salmon 2 3 3\n" |
| 30 | + + "Manufacturer#2 almond aquamarine rose maroon antique 25 4 4\n" |
| 31 | + + "Manufacturer#2 almond aquamarine sandy cyan gainsboro 18 5 5\n" |
| 32 | + + "Manufacturer#3 almond antique chartreuse khaki white 17 1 1\n" |
| 33 | + + "Manufacturer#3 almond antique forest lavender goldenrod 14 2 2\n" |
| 34 | + + "Manufacturer#3 almond antique metallic orange dim 19 3 3\n" |
| 35 | + + "Manufacturer#3 almond antique misty red olive 1 4 4\n" |
| 36 | + + "Manufacturer#3 almond antique olive coral navajo 45 5 5\n" |
| 37 | + + "Manufacturer#4 almond antique gainsboro frosted violet 10 1 1\n" |
| 38 | + + "Manufacturer#4 almond antique violet mint lemon 39 2 2\n" |
| 39 | + + "Manufacturer#4 almond aquamarine floral ivory bisque 27 3 3\n" |
| 40 | + + "Manufacturer#4 almond aquamarine yellow dodger mint 7 4 4\n" |
| 41 | + + "Manufacturer#4 almond azure aquamarine papaya violet 12 5 5\n" |
| 42 | + + "Manufacturer#5 almond antique blue firebrick mint 31 1 1\n" |
| 43 | + + "Manufacturer#5 almond antique medium spring khaki 6 2 2\n" |
| 44 | + + "Manufacturer#5 almond antique sky peru orange 2 3 3\n" |
| 45 | + + "Manufacturer#5 almond aquamarine dodger light gainsboro 46 4 4\n" |
| 46 | + + "Manufacturer#5 almond azure blanched chiffon midnight 23 5 5\n"); |
| 47 | + |
| 48 | + public static WindowingTest RC = new WindowingTest( |
| 49 | + "testRC", |
| 50 | + "Basic Test on RC File", |
| 51 | + "select p_mfgr,p_name, p_size,\n" |
| 52 | + + "rank() as r,\n" |
| 53 | + + "denserank() as dr\n" |
| 54 | + + "from partrc_tiny\n" |
| 55 | + + "partition by p_mfgr\n" |
| 56 | + + "order by p_name\n" |
| 57 | + + "window w1 as rows between 2 preceding and 2 following\n" |
| 58 | + + "into path='/tmp/wout2'\n" |
| 59 | + + "serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'\n" |
| 60 | + + "with serdeproperties('field.delim'=',')\n" |
| 61 | + + "format 'org.apache.hadoop.mapred.TextOutputFormat'", |
| 62 | + "Manufacturer#1 almond antique burnished rose metallic 2 1 1\n" |
| 63 | + + "Manufacturer#1 almond antique burnished rose metallic 2 1 1\n" |
| 64 | + + "Manufacturer#1 almond antique chartreuse lavender yellow 34 3 2\n" |
| 65 | + + "Manufacturer#1 almond antique salmon chartreuse burlywood 6 4 3\n" |
| 66 | + + "Manufacturer#1 almond aquamarine burnished black steel 28 5 4\n" |
| 67 | + + "Manufacturer#1 almond aquamarine pink moccasin thistle 42 6 5\n" |
| 68 | + + "Manufacturer#2 almond antique violet chocolate turquoise 14 1 1\n" |
| 69 | + + "Manufacturer#2 almond antique violet turquoise frosted 40 2 2\n" |
| 70 | + + "Manufacturer#2 almond aquamarine midnight light salmon 2 3 3\n" |
| 71 | + + "Manufacturer#2 almond aquamarine rose maroon antique 25 4 4\n" |
| 72 | + + "Manufacturer#2 almond aquamarine sandy cyan gainsboro 18 5 5\n" |
| 73 | + + "Manufacturer#3 almond antique chartreuse khaki white 17 1 1\n" |
| 74 | + + "Manufacturer#3 almond antique forest lavender goldenrod 14 2 2\n" |
| 75 | + + "Manufacturer#3 almond antique metallic orange dim 19 3 3\n" |
| 76 | + + "Manufacturer#3 almond antique misty red olive 1 4 4\n" |
| 77 | + + "Manufacturer#3 almond antique olive coral navajo 45 5 5\n" |
| 78 | + + "Manufacturer#4 almond antique gainsboro frosted violet 10 1 1\n" |
| 79 | + + "Manufacturer#4 almond antique violet mint lemon 39 2 2\n" |
| 80 | + + "Manufacturer#4 almond aquamarine floral ivory bisque 27 3 3\n" |
| 81 | + + "Manufacturer#4 almond aquamarine yellow dodger mint 7 4 4\n" |
| 82 | + + "Manufacturer#4 almond azure aquamarine papaya violet 12 5 5\n" |
| 83 | + + "Manufacturer#5 almond antique blue firebrick mint 31 1 1\n" |
| 84 | + + "Manufacturer#5 almond antique medium spring khaki 6 2 2\n" |
| 85 | + + "Manufacturer#5 almond antique sky peru orange 2 3 3\n" |
| 86 | + + "Manufacturer#5 almond aquamarine dodger light gainsboro 46 4 4\n" |
| 87 | + + "Manufacturer#5 almond azure blanched chiffon midnight 23 5 5\n"); |
| 88 | + |
| 89 | + public static WindowingTest NOFUNCS = new WindowingTest( |
| 90 | + "selectOnly", |
| 91 | + "Test with no Window or PTF clauses", |
| 92 | + "select p_mfgr,p_name,p_size " |
| 93 | + + "from part_tiny " |
| 94 | + + "partition by p_mfgr " |
| 95 | + + "order by p_size " |
| 96 | + + "into path='/tmp/test2' " |
| 97 | + + "serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' " |
| 98 | + + "with serdeproperties('field.delim'=',') " |
| 99 | + + "format 'org.apache.hadoop.mapred.TextOutputFormat'", |
| 100 | + "Manufacturer#1 almond antique burnished rose metallic 2\n" |
| 101 | + + "Manufacturer#1 almond antique burnished rose metallic 2\n" |
| 102 | + + "Manufacturer#1 almond antique salmon chartreuse burlywood 6\n" |
| 103 | + + "Manufacturer#1 almond aquamarine burnished black steel 28\n" |
| 104 | + + "Manufacturer#1 almond antique chartreuse lavender yellow 34\n" |
| 105 | + + "Manufacturer#1 almond aquamarine pink moccasin thistle 42\n" |
| 106 | + + "Manufacturer#2 almond aquamarine midnight light salmon 2\n" |
| 107 | + + "Manufacturer#2 almond antique violet chocolate turquoise 14\n" |
| 108 | + + "Manufacturer#2 almond aquamarine sandy cyan gainsboro 18\n" |
| 109 | + + "Manufacturer#2 almond aquamarine rose maroon antique 25\n" |
| 110 | + + "Manufacturer#2 almond antique violet turquoise frosted 40\n" |
| 111 | + + "Manufacturer#3 almond antique misty red olive 1\n" |
| 112 | + + "Manufacturer#3 almond antique forest lavender goldenrod 14\n" |
| 113 | + + "Manufacturer#3 almond antique chartreuse khaki white 17\n" |
| 114 | + + "Manufacturer#3 almond antique metallic orange dim 19\n" |
| 115 | + + "Manufacturer#3 almond antique olive coral navajo 45\n" |
| 116 | + + "Manufacturer#4 almond aquamarine yellow dodger mint 7\n" |
| 117 | + + "Manufacturer#4 almond antique gainsboro frosted violet 10\n" |
| 118 | + + "Manufacturer#4 almond azure aquamarine papaya violet 12\n" |
| 119 | + + "Manufacturer#4 almond aquamarine floral ivory bisque 27\n" |
| 120 | + + "Manufacturer#4 almond antique violet mint lemon 39\n" |
| 121 | + + "Manufacturer#5 almond antique sky peru orange 2\n" |
| 122 | + + "Manufacturer#5 almond antique medium spring khaki 6\n" |
| 123 | + + "Manufacturer#5 almond azure blanched chiffon midnight 23\n" |
| 124 | + + "Manufacturer#5 almond antique blue firebrick mint 31\n" |
| 125 | + + "Manufacturer#5 almond aquamarine dodger light gainsboro 46\n"); |
| 126 | + public static WindowingTest WHERELEAD = new WindowingTest( |
| 127 | + "testWhereLead", |
| 128 | + "Test with Lead in Where clause", |
| 129 | + " select p_mfgr,p_name, p_size \n" |
| 130 | + + "from part_tiny \n" |
| 131 | + + "partition by p_mfgr \n" |
| 132 | + + "order by p_name \n" |
| 133 | + + "where lead(p_size, 1) <= p_size \n" |
| 134 | + + "into path='/tmp/testWhereLead' \n" |
| 135 | + + "serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' \n" |
| 136 | + + "with serdeproperties('field.delim'=',') \n" |
| 137 | + + "format 'org.apache.hadoop.mapred.TextOutputFormat'", |
| 138 | + "Manufacturer#1 almond antique burnished rose metallic 2\n" |
| 139 | + + "Manufacturer#1 almond antique chartreuse lavender yellow 34\n" |
| 140 | + + "Manufacturer#1 almond aquamarine pink moccasin thistle 42\n" |
| 141 | + + "Manufacturer#2 almond antique violet turquoise frosted 40\n" |
| 142 | + + "Manufacturer#2 almond aquamarine rose maroon antique 25\n" |
| 143 | + + "Manufacturer#2 almond aquamarine sandy cyan gainsboro 18\n" |
| 144 | + + "Manufacturer#3 almond antique chartreuse khaki white 17\n" |
| 145 | + + "Manufacturer#3 almond antique metallic orange dim 19\n" |
| 146 | + + "Manufacturer#3 almond antique olive coral navajo 45\n" |
| 147 | + + "Manufacturer#4 almond antique violet mint lemon 39\n" |
| 148 | + + "Manufacturer#4 almond aquamarine floral ivory bisque 27\n" |
| 149 | + + "Manufacturer#4 almond azure aquamarine papaya violet 12\n" |
| 150 | + + "Manufacturer#5 almond antique blue firebrick mint 31\n" |
| 151 | + + "Manufacturer#5 almond antique medium spring khaki 6\n" |
| 152 | + + "Manufacturer#5 almond aquamarine dodger light gainsboro 46\n" |
| 153 | + + "Manufacturer#5 almond azure blanched chiffon midnight 23\n"); |
| 154 | + public static WindowingTest CENSUSTOP4 = new WindowingTest( |
| 155 | + "testCensusTop4", |
| 156 | + "List Top 4 tracts by land area for each county", |
| 157 | + "select county, tract, arealand, rank() as r " |
| 158 | + + "from census_tiny " |
| 159 | + + "partition by county " |
| 160 | + + "order by county, arealand desc " |
| 161 | + + "where r < 5 " |
| 162 | + + "into path='/tmp/wout' " |
| 163 | + + "serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' " |
| 164 | + + "with serdeproperties('field.delim'=',') " |
| 165 | + + "format 'org.apache.hadoop.mapred.TextOutputFormat'", |
| 166 | + "001 451101 5.52877327E8 1\n" + "001 450701 2.66251308E8 2\n" |
| 167 | + + "001 441503 7.7476439E7 3\n" |
| 168 | + + "001 430102 7.6698501E7 4\n" |
| 169 | + + "003 010000 1.912271907E9 1\n" |
| 170 | + + "005 000102 4.5622349E8 1\n" |
| 171 | + + "005 000200 3.23078053E8 2\n" |
| 172 | + + "005 000301 1.95628423E8 3\n" |
| 173 | + + "005 000304 1.41639221E8 4\n" |
| 174 | + + "007 002400 1.106587526E9 1\n" |
| 175 | + + "007 001600 5.58529159E8 2\n" |
| 176 | + + "007 001500 3.50730015E8 3\n" |
| 177 | + + "007 003600 3.30874034E8 4\n"); |
| 178 | + public static WindowingTest NOOPWITHWINDOWING = new WindowingTest( |
| 179 | + "testNoopWithWindowing", |
| 180 | + "List Noop PTF", |
| 181 | + "select county, tract, arealand, rank() as r " |
| 182 | + + "from noop(census_tiny " |
| 183 | + + " partition by county " |
| 184 | + + " order by county, arealand desc) " |
| 185 | + + "where r < 5 " |
| 186 | + + "into path='/tmp/NoopWithWindowing' " |
| 187 | + + "serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' " |
| 188 | + + "with serdeproperties('field.delim'=',') " |
| 189 | + + "format 'org.apache.hadoop.mapred.TextOutputFormat'", |
| 190 | + "001 451101 5.52877327E8 1\n" + "001 450701 2.66251308E8 2\n" |
| 191 | + + "001 441503 7.7476439E7 3\n" |
| 192 | + + "001 430102 7.6698501E7 4\n" |
| 193 | + + "003 010000 1.912271907E9 1\n" |
| 194 | + + "005 000102 4.5622349E8 1\n" |
| 195 | + + "005 000200 3.23078053E8 2\n" |
| 196 | + + "005 000301 1.95628423E8 3\n" |
| 197 | + + "005 000304 1.41639221E8 4\n" |
| 198 | + + "007 002400 1.106587526E9 1\n" |
| 199 | + + "007 001600 5.58529159E8 2\n" |
| 200 | + + "007 001500 3.50730015E8 3\n" |
| 201 | + + "007 003600 3.30874034E8 4\n"); |
| 202 | + public static WindowingTest NOOPWITHMAPWINDOWING = new WindowingTest( |
| 203 | + "testNoopWithWindowing", |
| 204 | + "List NoopWithMap PTF", |
| 205 | + "select county, tract, arealand, rank() as r " |
| 206 | + + "from noopwithmap(census_tiny " |
| 207 | + + " partition by county " |
| 208 | + + " order by county, arealand desc) " |
| 209 | + + "where r < 5 " |
| 210 | + + "into path='/tmp/NoopWithWindowing' " |
| 211 | + + "serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' " |
| 212 | + + "with serdeproperties('field.delim'=',') " |
| 213 | + + "format 'org.apache.hadoop.mapred.TextOutputFormat'", |
| 214 | + "001 451101 5.52877327E8 1\n" + "001 450701 2.66251308E8 2\n" |
| 215 | + + "001 441503 7.7476439E7 3\n" |
| 216 | + + "001 430102 7.6698501E7 4\n" |
| 217 | + + "003 010000 1.912271907E9 1\n" |
| 218 | + + "005 000102 4.5622349E8 1\n" |
| 219 | + + "005 000200 3.23078053E8 2\n" |
| 220 | + + "005 000301 1.95628423E8 3\n" |
| 221 | + + "005 000304 1.41639221E8 4\n" |
| 222 | + + "007 002400 1.106587526E9 1\n" |
| 223 | + + "007 001600 5.58529159E8 2\n" |
| 224 | + + "007 001500 3.50730015E8 3\n" |
| 225 | + + "007 003600 3.30874034E8 4\n"); |
| 226 | + |
| 227 | + public static Object[][] TESTS = new Object[][] |
| 228 | + { new Object[] |
| 229 | + { BASIC }, new Object[] |
| 230 | + { RC }, new Object[] |
| 231 | + { NOFUNCS }, new Object[] |
| 232 | + { WHERELEAD }, new Object[] |
| 233 | + { CENSUSTOP4 }, new Object[] |
| 234 | + { NOOPWITHWINDOWING }, new Object[] |
| 235 | + { NOOPWITHMAPWINDOWING } }; |
| 236 | + |
| 237 | +} |
0 commit comments