From 77335b28d1ad2d57c6136b4d6d3bd93e78c7157a Mon Sep 17 00:00:00 2001 From: Tony Murphy Date: Thu, 27 Jun 2013 11:43:28 -0700 Subject: [PATCH] hive-4794 --- .../test/org/apache/hadoop/hive/ql/QTestUtil.java | 15 + .../hive/ql/exec/vector/util/OrcFileGenerator.java | 302 +++++++++++++++++++++ .../test/queries/clientpositive/vectorization_0.q | 50 ++++ .../test/queries/clientpositive/vectorization_1.q | 46 ++++ .../test/queries/clientpositive/vectorization_10.q | 57 ++++ .../test/queries/clientpositive/vectorization_11.q | 59 ++++ .../test/queries/clientpositive/vectorization_12.q | 56 ++++ .../test/queries/clientpositive/vectorization_2.q | 50 ++++ .../test/queries/clientpositive/vectorization_3.q | 51 ++++ .../test/queries/clientpositive/vectorization_4.q | 49 ++++ .../test/queries/clientpositive/vectorization_5.q | 47 ++++ .../test/queries/clientpositive/vectorization_6.q | 47 ++++ .../test/queries/clientpositive/vectorization_7.q | 54 ++++ .../test/queries/clientpositive/vectorization_8.q | 48 ++++ .../test/queries/clientpositive/vectorization_9.q | 57 ++++ 15 files changed, 988 insertions(+) create mode 100644 ql/src/test/org/apache/hadoop/hive/ql/exec/vector/util/OrcFileGenerator.java create mode 100644 ql/src/test/queries/clientpositive/vectorization_0.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_1.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_10.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_11.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_12.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_2.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_3.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_4.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_5.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_6.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_7.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_8.q create mode 100644 ql/src/test/queries/clientpositive/vectorization_9.q diff --git ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java index 1bd2a49..f318d05 100644 --- ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java +++ ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java @@ -63,6 +63,7 @@ import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.exec.Utilities.StreamPrinter; +import org.apache.hadoop.hive.ql.exec.vector.util.OrcFileGenerator; import org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat; import org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager; import org.apache.hadoop.hive.ql.metadata.Hive; @@ -656,7 +657,21 @@ public void createSources() throws Exception { fpath = new Path(testFiles, "json.txt"); runLoadCmd("LOAD DATA LOCAL INPATH '" + fpath.toUri().getPath() + "' INTO TABLE src_json"); + + // create and load data into orc + fpath = new Path(testFiles, OrcFileGenerator.AllTypesOrcRecord.TableName); + + fs.delete(fpath, false); + + OrcFileGenerator.generateOrcFile(conf, fs, fpath, + OrcFileGenerator.AllTypesOrcRecord.class); + + /*runCreateTableCmd(OrcFileGenerator.AllTypesOrcRecord.tableCreateCommand); + runLoadCmd("LOAD DATA LOCAL INPATH '" + fpath.toUri().getPath() + + "' INTO TABlE "+OrcFileGenerator.AllTypesOrcRecord.TableName);*/ + conf.setBoolean("hive.test.init.phase", false); + } public void init() throws Exception { diff --git ql/src/test/org/apache/hadoop/hive/ql/exec/vector/util/OrcFileGenerator.java ql/src/test/org/apache/hadoop/hive/ql/exec/vector/util/OrcFileGenerator.java new file mode 100644 index 0000000..d2e6249 --- /dev/null +++ ql/src/test/org/apache/hadoop/hive/ql/exec/vector/util/OrcFileGenerator.java @@ -0,0 +1,302 @@ +package org.apache.hadoop.hive.ql.exec.vector.util; + +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; +import org.apache.hadoop.hive.ql.io.orc.CompressionKind; +import org.apache.hadoop.hive.ql.io.orc.OrcFile; +import org.apache.hadoop.hive.ql.io.orc.TestVectorizedORCReader; +import org.apache.hadoop.hive.ql.io.orc.Writer; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory; + +import sun.reflect.generics.reflectiveObjects.NotImplementedException; + +public class OrcFileGenerator { + + enum BatchDataDistribution{ + AllValues, + NoNulls, + RepeatingValue, + RepeatingNull + } + + + private abstract static class BatchGenerator{ + + private static Random rand = new Random(0xfa57); + private static int possibleNullValuesGenerated=0; + + protected abstract T generateRandomNonNullValue(Random rand); + + public T[] generateBatch(BatchDataDistribution dist){ + + Object[] batch = new Object[VectorizedRowBatch.DEFAULT_SIZE]; + + for(int i=0;i{ + @Override + protected Boolean generateRandomNonNullValue(Random rand) { + return rand.nextBoolean(); + } + } + + private static class ByteBatchGenerator extends BatchGenerator{ + + @Override + protected Byte generateRandomNonNullValue(Random rand) { + return + (byte)(rand.nextInt(Byte.MAX_VALUE-Byte.MIN_VALUE)-Math.abs(Byte.MIN_VALUE)); + } + } + + private static class IntegerBatchGenerator extends BatchGenerator{ + @Override + protected Integer generateRandomNonNullValue(Random rand) { + return rand.nextInt(); + } + } + + private static class LongBatchGenerator extends BatchGenerator{ + @Override + protected Long generateRandomNonNullValue(Random rand) { + return rand.nextLong(); + } + } + + private static class ShortBatchGenerator extends BatchGenerator{ + + @Override + protected Short generateRandomNonNullValue(Random rand) { + return (short)(rand.nextInt(Short.MAX_VALUE-Short.MIN_VALUE)+Short.MIN_VALUE); + } + + } + + private static class FloatBatchGenerator extends BatchGenerator{ + + private final ByteBatchGenerator byteGenerator = new ByteBatchGenerator(); + + @Override + protected Float generateRandomNonNullValue(Random rand) { + return (float)byteGenerator.generateRandomNonNullValue(rand); + } + + } + + private static class DoubleBatchGenerator extends BatchGenerator{ + + private final ShortBatchGenerator shortGenerator = new ShortBatchGenerator(); + + @Override + protected Double generateRandomNonNullValue(Random rand) { + return (double)shortGenerator.generateRandomNonNullValue(rand); + } + + } + + private static class StringBatchGenerator extends BatchGenerator{ + + @Override + protected String generateRandomNonNullValue(Random rand) { + String value=""; + int length=rand.nextInt(20)+5; + for(int j=0;j{ + @Override + protected Timestamp generateRandomNonNullValue(Random rand) { + return new Timestamp(rand.nextLong()); + } + } + + private static final Map typeToBatchGeneratorMap; + static{ + typeToBatchGeneratorMap = new HashMap(); + typeToBatchGeneratorMap.put(Boolean.class, new BooleanBatchGenerator()); + + typeToBatchGeneratorMap.put(Byte.class, new ByteBatchGenerator()); + typeToBatchGeneratorMap.put(Integer.class, new IntegerBatchGenerator()); + typeToBatchGeneratorMap.put(Long.class, new LongBatchGenerator()); + typeToBatchGeneratorMap.put(Short.class, new ShortBatchGenerator()); + + typeToBatchGeneratorMap.put(Float.class, new FloatBatchGenerator()); + typeToBatchGeneratorMap.put(Double.class, new DoubleBatchGenerator()); + + typeToBatchGeneratorMap.put(String.class, new StringBatchGenerator()); + + typeToBatchGeneratorMap.put(Timestamp.class, new TimestampBatchGenerator()); + } + + public static class AllTypesOrcRecord{ + private final Byte ctinyInt; + private final Short csmallInt; + private final Integer cint; + private final Long cbigInt; + + private final Float cfloat; + private final Double cdouble; + + private final String cstring1; + private final String cstring2; + + private final Timestamp ctimestamp; + + private final Boolean cboolean; + + public AllTypesOrcRecord(Byte ctinyInt, Short csmallInt, Integer cint, Long cbigInt, + Float cfloat, Double cdouble, String cstring1, String cstring2, Timestamp ctimestamp, + Boolean cboolean){ + + this.ctinyInt = ctinyInt; + this.csmallInt = csmallInt; + this.cint = cint; + this.cbigInt = cbigInt; + + this.cfloat = cfloat; + this.cdouble = cdouble; + + this.cstring1 = cstring1; + this.cstring2 = cstring2; + + this.ctimestamp = ctimestamp; + + this.cboolean = cboolean; + } + + public static String TableName ="allTypesOrc"; + + public static String tableCreateCommand = + "create table " + TableName + "(" + + "ctinyint tinyint, " + + "csmallint smallint, " + + "cint int, " + + "cbigint bigint, " + + "cdouble double, " + + "cfloat float, " + + "cstring1 string, " + + "cstring2 string, " + + "ctimestamp timestamp, " + + "cboolean boolean) " + + "STORED AS ORC"; + } + + + public static void generateOrcFile(Configuration conf, FileSystem fs, Path outputPath, Class recordClass) + throws IOException, IllegalArgumentException, + InstantiationException, IllegalAccessException, InvocationTargetException{ + + ObjectInspector inspector; + synchronized (TestVectorizedORCReader.class) { + inspector = ObjectInspectorFactory.getReflectionObjectInspector( + recordClass, ObjectInspectorFactory.ObjectInspectorOptions.JAVA); + } + + Writer writer = OrcFile.createWriter( + fs, + outputPath, + conf, + inspector, + 100000, + CompressionKind.ZLIB, + 10000, + 10000); + + try{ + Constructor[] constructors = recordClass.getConstructors(); + + int dataDistOffset=0; + BatchDataDistribution[] dataDist = BatchDataDistribution.values(); + Class[] columns = constructors[0].getParameterTypes(); + for(int i=0;i= 0) + AND ((cdouble != LENGTH(cstring1)) + AND ((cfloat = 10) + AND (cstring2 LIKE '10%')))) + OR ((cint >= LENGTH(cstring1)) + OR ((cstring1 IS NULL) + OR ((cboolean > 0) + AND (cbigint = -2))))); + diff --git ql/src/test/queries/clientpositive/vectorization_1.q ql/src/test/queries/clientpositive/vectorization_1.q new file mode 100644 index 0000000..a7b5cae --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_1.q @@ -0,0 +1,46 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT MAX(csmallint), + (MAX(csmallint) * 1), + ((MAX(csmallint) * 1) + MAX(csmallint)), + SUM(cdouble), + VAR_SAMP(csmallint), + ((MAX(csmallint) * 1) + VAR_SAMP(csmallint)), + (((MAX(csmallint) * 1) + MAX(csmallint)) * -1.30000000000000000000E+000), + AVG(cbigint), + STDDEV_SAMP(cint), + (-(((MAX(csmallint) * 1) + VAR_SAMP(csmallint)))), + ((-(((MAX(csmallint) * 1) + VAR_SAMP(csmallint)))) / SUM(cdouble)), + (0.00000000000000000000E+000 - ((MAX(csmallint) * 1) + MAX(csmallint))), + STDDEV_SAMP(cfloat), + (AVG(cbigint) * MAX(csmallint)), + MAX(ctinyint), + (0.00000000000000000000E+000 + (-(((MAX(csmallint) * 1) + VAR_SAMP(csmallint))))), + COUNT(*), + (-(VAR_SAMP(csmallint))) +FROM allTypesOrc +WHERE (((cstring2 LIKE 'b') + OR ((cstring1 IS NULL) + OR (ctimestamp = '2391-03-08 04:28:25.117'))) + OR ((cint IS NOT NULL) + AND ((cbigint <= HOUR(ctimestamp)) + AND (csmallint < HOUR(ctimestamp))))); + diff --git ql/src/test/queries/clientpositive/vectorization_10.q ql/src/test/queries/clientpositive/vectorization_10.q new file mode 100644 index 0000000..03694a3 --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_10.q @@ -0,0 +1,57 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT ctimestamp, + cboolean, + cdouble, + cfloat, + cstring1, + DAY(ctimestamp), + LENGTH(cstring1), + (-(cdouble)), + VAR_POP(cdouble), + (VAR_POP(cdouble) - -2.20000000000000020000E+000), + (cfloat % VAR_POP(cdouble)), + MIN(cdouble), + AVG(cdouble), + (-2.99999999999999990000E-001 % AVG(cdouble)), + (MIN(cdouble) % (-(cdouble))), + (-(MIN(cdouble))), + VAR_SAMP(cdouble), + (-((VAR_POP(cdouble) - -2.20000000000000020000E+000))), + (VAR_POP(cdouble) - VAR_SAMP(cdouble)), + COUNT(*), + (LENGTH(cstring1) * (-(MIN(cdouble)))), + MIN(LENGTH(cstring1)), + (-(COUNT(*))), + AVG(cfloat), + ((-((VAR_POP(cdouble) - -2.20000000000000020000E+000))) * -2.20000000000000020000E+000), + (cfloat * (-(MIN(cdouble)))), + MIN(cfloat) +FROM allTypesOrc +WHERE (((cstring1 LIKE '%10%') + AND ((cdouble >= cfloat) + OR (cstring2 IS NOT NULL))) + OR ((ctinyint > cbigint) + OR ((cfloat >= ctinyint) + AND (ctimestamp <= '2550-01-06 07:41:26.130')))) +GROUP BY ctimestamp, cboolean, cdouble, cfloat, cstring1, DAY(ctimestamp), LENGTH(cstring1) +ORDER BY cfloat, cdouble, cstring1, ctimestamp; + diff --git ql/src/test/queries/clientpositive/vectorization_11.q ql/src/test/queries/clientpositive/vectorization_11.q new file mode 100644 index 0000000..d2e47fc --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_11.q @@ -0,0 +1,59 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT cfloat, + cboolean, + cstring1, + cint, + csmallint, + cdouble, + ctinyint, + cbigint, + LOWER(cstring1), + SUM(cfloat), + (cfloat / cbigint), + VAR_SAMP(cfloat), + (VAR_SAMP(cfloat) / (cfloat / cbigint)), + VAR_POP(cint), + (cint % 2), + (-(cint)), + COUNT(*), + (cdouble + 0.00000000000000000000E+000), + (cdouble * (cint % 2)), + (-((cdouble * (cint % 2)))), + STDDEV_SAMP(cdouble), + ((-((cdouble * (cint % 2)))) - ctinyint), + VAR_SAMP(cdouble), + (cdouble - cbigint), + COUNT(*), + VAR_POP(cdouble), + ((cdouble * (cint % 2)) * (cdouble - cbigint)) +FROM allTypesOrc +WHERE (((cbigint <= cfloat) + OR ((csmallint = cbigint) + AND ((cint > csmallint) + AND (LOWER(cstring1) LIKE '10%')))) + OR ((cfloat > 5.00000000000000000000E-001) + AND ((ctinyint <= 1) + AND ((cdouble > cfloat) + OR (-1.30000000000000000000E+000 >= ctinyint))))) +GROUP BY cfloat, cboolean, cstring1, cint, csmallint, cdouble, ctinyint, cbigint, LOWER(cstring1) +ORDER BY cfloat, cint; + diff --git ql/src/test/queries/clientpositive/vectorization_12.q ql/src/test/queries/clientpositive/vectorization_12.q new file mode 100644 index 0000000..db555ce --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_12.q @@ -0,0 +1,56 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT ctinyint, + cbigint, + ctimestamp, + cstring1, + cfloat, + HOUR(ctimestamp), + UPPER(cstring1), + (-(ctinyint)), + MAX(ctinyint), + ((-(ctinyint)) - cbigint), + (-(ctinyint)), + (MAX(ctinyint) - (-(ctinyint))), + MAX(ctinyint), + (10 - HOUR(ctimestamp)), + STDDEV_POP(cbigint), + (cfloat % STDDEV_POP(cbigint)), + AVG(cfloat), + (-(STDDEV_POP(cbigint))), + SUM(ctinyint), + (0 * (-(ctinyint))), + (-((0 * (-(ctinyint))))), + MAX(cfloat), + ((10 - HOUR(ctimestamp)) - cfloat), + ((-(ctinyint)) % (-(ctinyint))), + SUM(cbigint) +FROM allTypesOrc +WHERE (((cstring2 >= UPPER(cstring1)) + AND ((cstring1 LIKE 'b') + OR (ctinyint > -1))) + OR ((UPPER(cstring1) LIKE '%10%') + AND ((HOUR(ctimestamp) <= cdouble) + OR (('ss' = UPPER(cstring1)) + OR (cfloat != cdouble))))) +GROUP BY ctinyint, cbigint, ctimestamp, cstring1, cfloat, HOUR(ctimestamp), UPPER(cstring1) +ORDER BY cstring1; + diff --git ql/src/test/queries/clientpositive/vectorization_2.q ql/src/test/queries/clientpositive/vectorization_2.q new file mode 100644 index 0000000..5165824 --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_2.q @@ -0,0 +1,50 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT VAR_SAMP(ctinyint), + (-(VAR_SAMP(ctinyint))), + (1.10000000000000010000E+000 / VAR_SAMP(ctinyint)), + (-((1.10000000000000010000E+000 / VAR_SAMP(ctinyint)))), + (VAR_SAMP(ctinyint) + -2.20000000000000020000E+000), + STDDEV_POP(cfloat), + ((VAR_SAMP(ctinyint) + -2.20000000000000020000E+000) - (-(VAR_SAMP(ctinyint)))), + STDDEV_POP(cfloat), + STDDEV_POP(cfloat), + (0.00000000000000000000E+000 / ((VAR_SAMP(ctinyint) + -2.20000000000000020000E+000) - (-(VAR_SAMP(ctinyint))))), + (-1.30000000000000000000E+000 + (-(VAR_SAMP(ctinyint)))), + (-((0.00000000000000000000E+000 / ((VAR_SAMP(ctinyint) + -2.20000000000000020000E+000) - (-(VAR_SAMP(ctinyint))))))), + AVG(cint), + MIN(cint), + (AVG(cint) / (0.00000000000000000000E+000 / ((VAR_SAMP(ctinyint) + -2.20000000000000020000E+000) - (-(VAR_SAMP(ctinyint)))))), + (MIN(cint) % STDDEV_POP(cfloat)), + STDDEV_POP(cint), + (-(STDDEV_POP(cfloat))), + ((-(VAR_SAMP(ctinyint))) / ((VAR_SAMP(ctinyint) + -2.20000000000000020000E+000) - (-(VAR_SAMP(ctinyint))))), + STDDEV_POP(cdouble) +FROM allTypesOrc +WHERE (((UPPER(cstring1) LIKE '%10%') + AND ((10 = csmallint) + AND ((cdouble < cint) + OR (cfloat >= 10)))) + OR ((cstring1 LIKE 'a%') + AND ((cint > 1) + AND ((MINUTE(ctimestamp) <= cbigint) + AND (ctinyint = cfloat))))); + diff --git ql/src/test/queries/clientpositive/vectorization_3.q ql/src/test/queries/clientpositive/vectorization_3.q new file mode 100644 index 0000000..fa12901 --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_3.q @@ -0,0 +1,51 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT MIN(csmallint), + (MIN(csmallint) - 10), + (-(MIN(csmallint))), + (-((-(MIN(csmallint))))), + ((-(MIN(csmallint))) % (-((-(MIN(csmallint)))))), + VAR_POP(csmallint), + MIN(csmallint), + ((-(MIN(csmallint))) % VAR_POP(csmallint)), + (-((-(MIN(csmallint))))), + (MIN(csmallint) - (-((-(MIN(csmallint)))))), + MAX(csmallint), + ((MIN(csmallint) - 10) * -1), + (-((-((-(MIN(csmallint))))))), + COUNT(*), + VAR_SAMP(ctinyint), + ((MIN(csmallint) - 10) / VAR_POP(csmallint)), + VAR_POP(cbigint), + (MIN(csmallint) % COUNT(*)), + (-(COUNT(*))), + (MAX(csmallint) * 10), + COUNT(*) +FROM allTypesOrc +WHERE ((('10' < CONCAT('ss',cstring1)) + OR ((ctinyint > MONTH(ctimestamp)) + AND ((csmallint <= cfloat) + OR (-2 != cbigint)))) + OR (('10' >= CONCAT('ss',cstring1)) + AND ((cbigint < cdouble) + AND ((cstring2 LIKE '%10%') + AND (2 = cint))))); + diff --git ql/src/test/queries/clientpositive/vectorization_4.q ql/src/test/queries/clientpositive/vectorization_4.q new file mode 100644 index 0000000..b58d5bd --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_4.q @@ -0,0 +1,49 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT MAX(ctinyint), + (MAX(ctinyint) + 0), + (-(MAX(ctinyint))), + MIN(csmallint), + (0 * (-(MAX(ctinyint)))), + (MAX(ctinyint) % -1), + STDDEV_SAMP(cdouble), + ((0 * (-(MAX(ctinyint)))) / 10), + (-(((0 * (-(MAX(ctinyint)))) / 10))), + AVG(cbigint), + (AVG(cbigint) / 10), + MIN(cfloat), + AVG(cfloat), + (-(MIN(cfloat))), + (AVG(cbigint) * (MAX(ctinyint) % -1)), + STDDEV_SAMP(cdouble), + (MAX(ctinyint) - (MAX(ctinyint) + 0)), + STDDEV_POP(cbigint), + (AVG(cbigint) * 10), + (-((AVG(cbigint) / 10))) +FROM allTypesOrc +WHERE (((cdouble < SECOND(ctimestamp)) + OR ((cstring1 LIKE '%10') + AND (CONCAT('10',cstring1) LIKE 'a%'))) + OR ((cbigint > SECOND(ctimestamp)) + OR ((cboolean IS NOT NULL) + AND ((cstring2 <= cstring1) + OR (csmallint > cdouble))))); + diff --git ql/src/test/queries/clientpositive/vectorization_5.q ql/src/test/queries/clientpositive/vectorization_5.q new file mode 100644 index 0000000..8f18f34 --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_5.q @@ -0,0 +1,47 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT cbigint, + cstring1, + cboolean, + cfloat, + cdouble, + ctimestamp, + DAY(ctimestamp), + LENGTH(cstring1), + (cbigint + 1), + (-(LENGTH(cstring1))), + (ctinyint + csmallint), + (-2.99999999999999990000E-001 * cbigint), + (-(csmallint)), + ((ctinyint + csmallint) - -1), + (1.10000000000000010000E+000 / cfloat), + (cdouble / cdouble), + (LENGTH(cstring1) / -2), + (-((cdouble / cdouble))), + ((-((cdouble / cdouble))) % -2.20000000000000020000E+000) +FROM allTypesOrc +WHERE (((cdouble >= DAY(ctimestamp)) + OR (1 > LENGTH(cstring1))) + OR ((-1 > DAY(ctimestamp)) + OR ((cstring2 LIKE 'a%') + OR (cboolean <= 0)))) +ORDER BY cfloat, cboolean, cdouble, cbigint; + diff --git ql/src/test/queries/clientpositive/vectorization_6.q ql/src/test/queries/clientpositive/vectorization_6.q new file mode 100644 index 0000000..1db9715 --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_6.q @@ -0,0 +1,47 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT ctimestamp, + cstring1, + cboolean, + cfloat, + csmallint, + HOUR(ctimestamp), + LOWER(cstring1), + (ctinyint - cbigint), + (cfloat / (ctinyint - cbigint)), + (cfloat * cint), + (-(ctinyint)), + (HOUR(ctimestamp) / (-(ctinyint))), + (ctinyint + (HOUR(ctimestamp) / (-(ctinyint)))), + (cint % (cfloat * cint)), + ((cfloat / (ctinyint - cbigint)) % -1), + (-(cfloat)), + (cfloat * csmallint) +FROM allTypesOrc +WHERE (((cfloat > 2) + AND ((cstring1 LIKE '%b%') + AND (ctimestamp <= '6478-10-03 08:40:46.740'))) + OR ((csmallint <= 1) + AND ((cdouble IS NOT NULL) + OR ((LOWER(cstring1) IS NOT NULL) + OR (cboolean IS NULL))))) +ORDER BY ctimestamp; + diff --git ql/src/test/queries/clientpositive/vectorization_7.q ql/src/test/queries/clientpositive/vectorization_7.q new file mode 100644 index 0000000..9de7cd1 --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_7.q @@ -0,0 +1,54 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT cint, + cboolean, + cdouble, + ctinyint, + ctimestamp, + csmallint, + cfloat, + cstring1, + MINUTE(ctimestamp), + UPPER(cstring1), + (cint + csmallint), + (-(MINUTE(ctimestamp))), + (-(cdouble)), + (1.10000000000000010000E+000 * ctinyint), + (-2.20000000000000020000E+000 / cdouble), + (-(cdouble)), + (-1.30000000000000000000E+000 * (-(cdouble))), + ((-(cdouble)) % csmallint), + (-((-(cdouble)))), + (-2.99999999999999990000E-001 % (-2.20000000000000020000E+000 / cdouble)), + (-((-(cdouble)))), + ((-(cdouble)) / cfloat), + ((-((-(cdouble)))) % cfloat) +FROM allTypesOrc +WHERE (((cfloat > 1) + AND ((cdouble != 0) + OR ((0.00000000000000000000E+000 = csmallint) + AND (2.50000000000000000000E+000 = ctinyint)))) + OR ((-2 > ctinyint) + OR ((cbigint = MINUTE(ctimestamp)) + OR ((UPPER(cstring1) LIKE '%b') + OR (cint != ctinyint))))) +ORDER BY cdouble, csmallint, cboolean, cint, ctinyint; + diff --git ql/src/test/queries/clientpositive/vectorization_8.q ql/src/test/queries/clientpositive/vectorization_8.q new file mode 100644 index 0000000..37e8eb8 --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_8.q @@ -0,0 +1,48 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT ctinyint, + cint, + cstring1, + cboolean, + ctimestamp, + MONTH(ctimestamp), + CONCAT('ss',cstring1), + (ctinyint + 1), + (-2 * cdouble), + (-(cbigint)), + (2 + MONTH(ctimestamp)), + (-((ctinyint + 1))), + (-((ctinyint + 1))), + (cbigint * (-((ctinyint + 1)))), + (-(cint)), + (10 * (ctinyint + 1)), + (cdouble * (-2 * cdouble)), + ((10 * (ctinyint + 1)) - 0), + (-(MONTH(ctimestamp))) +FROM allTypesOrc +WHERE (((CONCAT('ss',cstring1) LIKE '%10%') + OR ((MONTH(ctimestamp) < 10) + OR (cstring2 = CONCAT('ss',cstring1)))) + OR ((cstring1 <= 'b') + AND (('10' != cstring1) + OR (ctinyint >= MONTH(ctimestamp))))) +ORDER BY cstring1, cint, cboolean, ctinyint; + diff --git ql/src/test/queries/clientpositive/vectorization_9.q ql/src/test/queries/clientpositive/vectorization_9.q new file mode 100644 index 0000000..48cb29d --- /dev/null +++ ql/src/test/queries/clientpositive/vectorization_9.q @@ -0,0 +1,57 @@ + +drop table if exists allTypesOrc; + +create table allTypesOrc ( + ctinyint tinyint, + csmallint smallint, + cint int, + cbigint bigint, + cdouble double, + cfloat float, + cstring1 string, + cstring2 string, + ctimestamp timestamp, + cboolean boolean) +STORED AS ORC; + +load data local inpath '../data/files/alltypesorc' INTO TABLE alltypesorc; + +set hive.vectorized.execution.enabled=true; + +SELECT cbigint, + ctimestamp, + cfloat, + cboolean, + cstring1, + ctinyint, + SECOND(ctimestamp), + CONCAT('b',cstring1), + SUM(cbigint), + (-2 / cbigint), + ((-2 / cbigint) / -2.99999999999999990000E-001), + VAR_SAMP(cbigint), + (cbigint - VAR_SAMP(cbigint)), + SUM(cbigint), + (SUM(cbigint) / 10), + MAX(ctinyint), + (2 - ((-2 / cbigint) / -2.99999999999999990000E-001)), + (-((SUM(cbigint) / 10))), + STDDEV_POP(cfloat), + STDDEV_SAMP(cbigint), + ((SUM(cbigint) / 10) + 0), + (ctinyint - MAX(ctinyint)), + SUM(ctinyint), + (-(SUM(ctinyint))), + VAR_POP(SECOND(ctimestamp)), + (cbigint - SUM(cbigint)) +FROM allTypesOrc +WHERE (((cint >= ctinyint) + OR ((cboolean = 0) + OR (cbigint <= SECOND(ctimestamp)))) + OR ((ctinyint < csmallint) + AND ((ctimestamp IS NULL) + AND ((cfloat != SECOND(ctimestamp)) + AND (-2.99999999999999990000E-001 != cint))))) +GROUP BY cbigint, ctimestamp, cfloat, cboolean, cstring1, ctinyint, SECOND(ctimestamp), CONCAT('b',cstring1) +ORDER BY ctinyint, cboolean, ctimestamp, cfloat; + -- 1.8.0.msysgit.0