You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/09/12 03:21:29 UTC
svn commit: r1522098 [29/30] - in /hive/branches/vectorization: ./
beeline/src/test/org/apache/hive/beeline/src/test/ bin/ bin/ext/
common/src/java/org/apache/hadoop/hive/common/
common/src/java/org/apache/hadoop/hive/conf/ conf/ contrib/src/java/org/a...
Modified: hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_case.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_case.q.xml?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_case.q.xml (original)
+++ hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_case.q.xml Thu Sep 12 01:21:10 2013
@@ -277,6 +277,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
<void method="add">
@@ -290,6 +293,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
</object>
@@ -348,6 +354,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
<void method="add">
@@ -361,6 +370,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
</object>
@@ -605,6 +617,9 @@
<void property="neededColumnIDs">
<object class="java.util.ArrayList"/>
</void>
+ <void property="neededColumns">
+ <object class="java.util.ArrayList"/>
+ </void>
<void property="operatorId">
<string>TS_0</string>
</void>
@@ -627,6 +642,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -640,6 +658,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo1"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -660,6 +681,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>bigint</string>
+ </void>
</object>
</void>
<void method="add">
@@ -676,6 +700,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo1"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
Modified: hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_when.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_when.q.xml?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_when.q.xml (original)
+++ hive/branches/vectorization/ql/src/test/results/compiler/plan/udf_when.q.xml Thu Sep 12 01:21:10 2013
@@ -277,6 +277,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
<void method="add">
@@ -290,6 +293,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
</object>
@@ -348,6 +354,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
<void method="add">
@@ -361,6 +370,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>int</string>
+ </void>
</object>
</void>
</object>
@@ -685,6 +697,9 @@
<void property="neededColumnIDs">
<object class="java.util.ArrayList"/>
</void>
+ <void property="neededColumns">
+ <object class="java.util.ArrayList"/>
+ </void>
<void property="operatorId">
<string>TS_0</string>
</void>
@@ -707,6 +722,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -720,6 +738,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo2"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -740,6 +761,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>bigint</string>
+ </void>
</object>
</void>
<void method="add">
@@ -756,6 +780,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo2"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
Modified: hive/branches/vectorization/ql/src/test/results/compiler/plan/union.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/test/results/compiler/plan/union.q.xml?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/ql/src/test/results/compiler/plan/union.q.xml (original)
+++ hive/branches/vectorization/ql/src/test/results/compiler/plan/union.q.xml Thu Sep 12 01:21:10 2013
@@ -134,6 +134,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -147,6 +150,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
@@ -881,6 +887,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -897,6 +906,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
@@ -1056,12 +1068,12 @@
<void property="typeInfo">
<object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo">
<void property="typeName">
- <string>int</string>
+ <string>int</string>
</void>
</object>
</void>
<void property="value">
- <int>100</int>
+ <int>100</int>
</void>
</object>
</void>
@@ -1147,6 +1159,16 @@
</void>
</object>
</void>
+ <void property="neededColumns">
+ <object class="java.util.ArrayList">
+ <void method="add">
+ <string>key</string>
+ </void>
+ <void method="add">
+ <string>value</string>
+ </void>
+ </object>
+ </void>
<void property="operatorId">
<string>TS_3</string>
</void>
@@ -1165,6 +1187,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1178,6 +1203,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1198,6 +1226,9 @@
</void>
</object>
</void>
+ <void property="typeName">
+ <string>bigint</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1214,6 +1245,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
@@ -1257,6 +1291,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1270,6 +1307,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
@@ -1295,6 +1335,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1308,6 +1351,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
@@ -1415,6 +1461,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1428,6 +1477,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
@@ -1463,7 +1515,7 @@
<object idref="PrimitiveTypeInfo1"/>
</void>
<void property="value">
- <int>100</int>
+ <int>100</int>
</void>
</object>
</void>
@@ -1520,6 +1572,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1533,6 +1588,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
@@ -1579,6 +1637,16 @@
</void>
</object>
</void>
+ <void property="neededColumns">
+ <object class="java.util.ArrayList">
+ <void method="add">
+ <string>key</string>
+ </void>
+ <void method="add">
+ <string>value</string>
+ </void>
+ </object>
+ </void>
<void property="operatorId">
<string>TS_0</string>
</void>
@@ -1606,6 +1674,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo3"/>
</void>
+ <void property="typeName">
+ <string>bigint</string>
+ </void>
</object>
</void>
<void method="add">
@@ -1622,6 +1693,9 @@
<void property="type">
<object idref="PrimitiveTypeInfo0"/>
</void>
+ <void property="typeName">
+ <string>string</string>
+ </void>
</object>
</void>
</object>
Modified: hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/ColumnProjectionUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/ColumnProjectionUtils.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/ColumnProjectionUtils.java (original)
+++ hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/ColumnProjectionUtils.java Thu Sep 12 01:21:10 2013
@@ -31,6 +31,7 @@ import org.apache.hadoop.util.StringUtil
public final class ColumnProjectionUtils {
public static final String READ_COLUMN_IDS_CONF_STR = "hive.io.file.readcolumn.ids";
+ public static final String READ_COLUMN_NAMES_CONF_STR = "hive.io.file.readcolumn.names";
/**
* Sets read columns' ids(start from zero) for RCFile's Reader. Once a column
@@ -60,6 +61,24 @@ public final class ColumnProjectionUtils
}
}
+ public static void appendReadColumnNames(Configuration conf,
+ List<String> cols) {
+ if (cols != null) {
+ String old = conf.get(READ_COLUMN_NAMES_CONF_STR, "");
+ StringBuilder result = new StringBuilder(old);
+ boolean first = old.isEmpty();
+ for(String col: cols) {
+ if (first) {
+ first = false;
+ } else {
+ result.append(',');
+ }
+ result.append(col);
+ }
+ conf.set(READ_COLUMN_NAMES_CONF_STR, result.toString());
+ }
+ }
+
private static void setReadColumnIDConf(Configuration conf, String id) {
if (id == null || id.length() <= 0) {
conf.set(READ_COLUMN_IDS_CONF_STR, "");
Modified: hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java (original)
+++ hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java Thu Sep 12 01:21:10 2013
@@ -30,7 +30,6 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.MapObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.UnionObjectInspector;
@@ -405,7 +404,7 @@ public final class SerDeUtils {
/**
* return false though element is null if nullsafe flag is true for that
*/
- public static boolean hasAnyNullObject(List o, StandardStructObjectInspector loi,
+ public static boolean hasAnyNullObject(List o, StructObjectInspector loi,
boolean[] nullSafes) {
List<? extends StructField> fields = loi.getAllStructFieldRefs();
for (int i = 0; i < o.size();i++) {
Modified: hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyDate.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyDate.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyDate.java (original)
+++ hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyDate.java Thu Sep 12 01:21:10 2013
@@ -62,6 +62,7 @@ public class LazyDate extends LazyPrimit
try {
s = Text.decode(bytes.getData(), start, length);
data.set(Date.valueOf(s));
+ isNull = false;
} catch (Exception e) {
isNull = true;
logExceptionMessage(bytes, start, length, "DATE");
Modified: hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java (original)
+++ hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java Thu Sep 12 01:21:10 2013
@@ -25,16 +25,16 @@ import java.util.Map;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.JavaStringObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorConverter;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveDecimalObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableBinaryObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableBooleanObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableByteObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableDateObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableDoubleObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableFloatObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveDecimalObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableIntObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableLongObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableShortObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableDateObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableTimestampObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.VoidObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableStringObjectInspector;
@@ -136,6 +136,7 @@ public final class ObjectInspectorConver
if (inputOI.equals(outputOI)) {
return new IdentityConverter();
}
+ // TODO: Add support for UNION once SettableUnionObjectInspector is implemented.
switch (outputOI.getCategory()) {
case PRIMITIVE:
return getConverter((PrimitiveObjectInspector) inputOI, (PrimitiveObjectInspector) outputOI);
@@ -155,39 +156,24 @@ public final class ObjectInspectorConver
}
}
- // Return the settable equivalent object inspector for primitive categories
- // For eg: for table T containing partitions p1 and p2 (possibly different
- // from the table T), return the settable inspector for T. The inspector for
- // T is settable recursively i.e all the nested fields are also settable.
- private static ObjectInspector getSettableConvertedOI(
- ObjectInspector inputOI) {
- switch (inputOI.getCategory()) {
- case PRIMITIVE:
- PrimitiveObjectInspector primInputOI = (PrimitiveObjectInspector) inputOI;
- return PrimitiveObjectInspectorFactory.
- getPrimitiveWritableObjectInspector(primInputOI.getPrimitiveCategory());
- case STRUCT:
- return inputOI;
- case LIST:
- return inputOI;
- case MAP:
- return inputOI;
- default:
- throw new RuntimeException("Hive internal error: desired OI of "
- + inputOI.getTypeName() + " not supported yet.");
- }
- }
-
public static ObjectInspector getConvertedOI(
ObjectInspector inputOI,
- ObjectInspector outputOI) {
+ ObjectInspector outputOI,
+ boolean equalsCheck) {
// If the inputOI is the same as the outputOI, just return it
- if (inputOI.equals(outputOI)) {
+ if (equalsCheck && inputOI.equals(outputOI)) {
return outputOI;
}
+ // Return the settable equivalent object inspector for primitive categories
+ // For eg: for table T containing partitions p1 and p2 (possibly different
+ // from the table T), return the settable inspector for T. The inspector for
+ // T is settable recursively i.e all the nested fields are also settable.
+ // TODO: Add support for UNION once SettableUnionObjectInspector is implemented.
switch (outputOI.getCategory()) {
case PRIMITIVE:
- return outputOI;
+ PrimitiveObjectInspector primInputOI = (PrimitiveObjectInspector) inputOI;
+ return PrimitiveObjectInspectorFactory.
+ getPrimitiveWritableObjectInspector(primInputOI.getPrimitiveCategory());
case STRUCT:
StructObjectInspector structOutputOI = (StructObjectInspector) outputOI;
if (structOutputOI.isSettable()) {
@@ -202,20 +188,22 @@ public final class ObjectInspectorConver
for (StructField listField : listFields) {
structFieldNames.add(listField.getFieldName());
- structFieldObjectInspectors.add(
- getSettableConvertedOI(listField.getFieldObjectInspector()));
+ structFieldObjectInspectors.add(getConvertedOI(listField.getFieldObjectInspector(),
+ listField.getFieldObjectInspector(), false));
}
- StandardStructObjectInspector structStandardOutputOI = ObjectInspectorFactory
- .getStandardStructObjectInspector(
+ return ObjectInspectorFactory.getStandardStructObjectInspector(
structFieldNames,
structFieldObjectInspectors);
- return structStandardOutputOI;
}
case LIST:
- return outputOI;
+ ListObjectInspector listOutputOI = (ListObjectInspector) outputOI;
+ return ObjectInspectorFactory.getStandardListObjectInspector(
+ listOutputOI.getListElementObjectInspector());
case MAP:
- return outputOI;
+ MapObjectInspector mapOutputOI = (MapObjectInspector) outputOI;
+ return ObjectInspectorFactory.getStandardMapObjectInspector(
+ mapOutputOI.getMapKeyObjectInspector(), mapOutputOI.getMapValueObjectInspector());
default:
throw new RuntimeException("Hive internal error: conversion of "
+ inputOI.getTypeName() + " to " + outputOI.getTypeName()
Modified: hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java (original)
+++ hive/branches/vectorization/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java Thu Sep 12 01:21:10 2013
@@ -952,6 +952,44 @@ public final class PrimitiveObjectInspec
return t == null ? null : t.primitiveJavaClass;
}
+ /**
+ * Provide a general grouping for each primitive data type.
+ */
+ public static enum PrimitiveGrouping {
+ NUMERIC_GROUP, STRING_GROUP, BOOLEAN_GROUP, DATE_GROUP, BINARY_GROUP, UNKNOWN_GROUP
+ };
+
+ /**
+ * Based on the PrimitiveCategory of a type, return the PrimitiveGrouping
+ * that the PrimitiveCategory belongs to (numeric, string, date, etc).
+ * @param primitiveCategory Primitive category of the type
+ * @return PrimitveGrouping corresponding to the PrimitiveCategory,
+ * or UNKNOWN_GROUP if the type does not match to a grouping.
+ */
+ public static PrimitiveGrouping getPrimitiveGrouping(PrimitiveCategory primitiveCategory) {
+ switch (primitiveCategory) {
+ case BYTE:
+ case SHORT:
+ case INT:
+ case LONG:
+ case FLOAT:
+ case DOUBLE:
+ case DECIMAL:
+ return PrimitiveGrouping.NUMERIC_GROUP;
+ case STRING:
+ return PrimitiveGrouping.STRING_GROUP;
+ case BOOLEAN:
+ return PrimitiveGrouping.BOOLEAN_GROUP;
+ case TIMESTAMP:
+ case DATE:
+ return PrimitiveGrouping.DATE_GROUP;
+ case BINARY:
+ return PrimitiveGrouping.BINARY_GROUP;
+ default:
+ return PrimitiveGrouping.UNKNOWN_GROUP;
+ }
+ }
+
private PrimitiveObjectInspectorUtils() {
// prevent instantiation
}
Modified: hive/branches/vectorization/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyPrimitive.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyPrimitive.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyPrimitive.java (original)
+++ hive/branches/vectorization/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyPrimitive.java Thu Sep 12 01:21:10 2013
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hive.serde2.lazy;
+import java.sql.Date;
import java.sql.Timestamp;
import junit.framework.TestCase;
@@ -408,6 +409,25 @@ public class TestLazyPrimitive extends T
assertEquals(true, t.isNull);
}
+ public void testLazyDate() throws Throwable {
+ LazyDate t = new LazyDate(LazyPrimitiveObjectInspectorFactory.LAZY_DATE_OBJECT_INSPECTOR);
+ String nullDate = "NULL";
+ byte[] nullBytes = nullDate.getBytes();
+ initLazyObject(t, nullBytes, 0, nullBytes.length);
+ assertEquals(true, t.isNull);
+ String sampleDate = "2013-02-12";
+ byte[] good2013 = sampleDate.getBytes();
+ initLazyObject(t, good2013, 0, good2013.length);
+ assertEquals(false, t.isNull);
+ assertEquals(Date.valueOf(sampleDate),
+ t.getWritableObject().get());
+ String badDate = "X013-02-12";
+ byte[] bad2013 = badDate.getBytes();
+ initLazyObject(t, bad2013, 0, bad2013.length);
+ assertEquals(true, t.isNull);
+
+ }
+
public void testLazyIntegerWrite() throws Throwable {
try {
ByteStream.Output out = new ByteStream.Output();
Modified: hive/branches/vectorization/service/if/TCLIService.thrift
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/if/TCLIService.thrift?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/if/TCLIService.thrift (original)
+++ hive/branches/vectorization/service/if/TCLIService.thrift Thu Sep 12 01:21:10 2013
@@ -38,7 +38,10 @@ namespace cpp apache.hive.service.cli.th
// List of protocol versions. A new token should be
// added to the end of this list every time a change is made.
enum TProtocolVersion {
- HIVE_CLI_SERVICE_PROTOCOL_V1
+ HIVE_CLI_SERVICE_PROTOCOL_V1,
+
+ // V2 adds support for asynchronous execution
+ HIVE_CLI_SERVICE_PROTOCOL_V2
}
enum TTypeId {
@@ -356,6 +359,9 @@ enum TOperationState {
// The operation is in an unrecognized state
UKNOWN_STATE,
+
+ // The operation is in an pending state
+ PENDING_STATE,
}
@@ -452,7 +458,7 @@ struct TOperationHandle {
// which operations may be executed.
struct TOpenSessionReq {
// The version of the HiveServer2 protocol that the client is using.
- 1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1
+ 1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V2
// Username and password for authentication.
// Depending on the authentication scheme being used,
@@ -471,7 +477,7 @@ struct TOpenSessionResp {
1: required TStatus status
// The protocol version that the server is using.
- 2: required TProtocolVersion serverProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1
+ 2: required TProtocolVersion serverProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V2
// Session Handle
3: optional TSessionHandle sessionHandle
@@ -582,7 +588,7 @@ struct TGetInfoResp {
// status of the statement, and to fetch results once the
// statement has finished executing.
struct TExecuteStatementReq {
- // The session to exexcute the statement against
+ // The session to execute the statement against
1: required TSessionHandle sessionHandle
// The statement to be executed (DML, DDL, SET, etc)
@@ -593,6 +599,9 @@ struct TExecuteStatementReq {
// is executed. These properties apply to this statement
// only and will not affect the subsequent state of the Session.
3: optional map<string, string> confOverlay
+
+ // Execute asynchronously when runAsync is true
+ 4: optional bool runAsync = false
}
struct TExecuteStatementResp {
@@ -600,7 +609,6 @@ struct TExecuteStatementResp {
2: optional TOperationHandle operationHandle
}
-
// GetTypeInfo()
//
// Get information about types supported by the HiveServer instance.
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.cpp
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.cpp?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.cpp (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.cpp Thu Sep 12 01:21:10 2013
@@ -11,12 +11,14 @@
namespace apache { namespace hive { namespace service { namespace cli { namespace thrift {
int _kTProtocolVersionValues[] = {
- TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V1
+ TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V1,
+ TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V2
};
const char* _kTProtocolVersionNames[] = {
- "HIVE_CLI_SERVICE_PROTOCOL_V1"
+ "HIVE_CLI_SERVICE_PROTOCOL_V1",
+ "HIVE_CLI_SERVICE_PROTOCOL_V2"
};
-const std::map<int, const char*> _TProtocolVersion_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(1, _kTProtocolVersionValues, _kTProtocolVersionNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
+const std::map<int, const char*> _TProtocolVersion_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kTProtocolVersionValues, _kTProtocolVersionNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kTTypeIdValues[] = {
TTypeId::BOOLEAN_TYPE,
@@ -83,7 +85,8 @@ int _kTOperationStateValues[] = {
TOperationState::CANCELED_STATE,
TOperationState::CLOSED_STATE,
TOperationState::ERROR_STATE,
- TOperationState::UKNOWN_STATE
+ TOperationState::UKNOWN_STATE,
+ TOperationState::PENDING_STATE
};
const char* _kTOperationStateNames[] = {
"INITIALIZED_STATE",
@@ -92,9 +95,10 @@ const char* _kTOperationStateNames[] = {
"CANCELED_STATE",
"CLOSED_STATE",
"ERROR_STATE",
- "UKNOWN_STATE"
+ "UKNOWN_STATE",
+ "PENDING_STATE"
};
-const std::map<int, const char*> _TOperationState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(7, _kTOperationStateValues, _kTOperationStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
+const std::map<int, const char*> _TOperationState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(8, _kTOperationStateValues, _kTOperationStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kTOperationTypeValues[] = {
TOperationType::EXECUTE_STATEMENT,
@@ -3259,8 +3263,8 @@ void swap(TGetInfoResp &a, TGetInfoResp
swap(a.infoValue, b.infoValue);
}
-const char* TExecuteStatementReq::ascii_fingerprint = "4CDA19909D21B7D9907F85E3387EAB27";
-const uint8_t TExecuteStatementReq::binary_fingerprint[16] = {0x4C,0xDA,0x19,0x90,0x9D,0x21,0xB7,0xD9,0x90,0x7F,0x85,0xE3,0x38,0x7E,0xAB,0x27};
+const char* TExecuteStatementReq::ascii_fingerprint = "FED75DB77E66D76EC1939A51FB0D96FA";
+const uint8_t TExecuteStatementReq::binary_fingerprint[16] = {0xFE,0xD7,0x5D,0xB7,0x7E,0x66,0xD7,0x6E,0xC1,0x93,0x9A,0x51,0xFB,0x0D,0x96,0xFA};
uint32_t TExecuteStatementReq::read(::apache::thrift::protocol::TProtocol* iprot) {
@@ -3323,6 +3327,14 @@ uint32_t TExecuteStatementReq::read(::ap
xfer += iprot->skip(ftype);
}
break;
+ case 4:
+ if (ftype == ::apache::thrift::protocol::T_BOOL) {
+ xfer += iprot->readBool(this->runAsync);
+ this->__isset.runAsync = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
default:
xfer += iprot->skip(ftype);
break;
@@ -3365,6 +3377,11 @@ uint32_t TExecuteStatementReq::write(::a
}
xfer += oprot->writeFieldEnd();
}
+ if (this->__isset.runAsync) {
+ xfer += oprot->writeFieldBegin("runAsync", ::apache::thrift::protocol::T_BOOL, 4);
+ xfer += oprot->writeBool(this->runAsync);
+ xfer += oprot->writeFieldEnd();
+ }
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
@@ -3375,6 +3392,7 @@ void swap(TExecuteStatementReq &a, TExec
swap(a.sessionHandle, b.sessionHandle);
swap(a.statement, b.statement);
swap(a.confOverlay, b.confOverlay);
+ swap(a.runAsync, b.runAsync);
swap(a.__isset, b.__isset);
}
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.h
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.h?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.h (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-cpp/TCLIService_types.h Thu Sep 12 01:21:10 2013
@@ -18,7 +18,8 @@ namespace apache { namespace hive { name
struct TProtocolVersion {
enum type {
- HIVE_CLI_SERVICE_PROTOCOL_V1 = 0
+ HIVE_CLI_SERVICE_PROTOCOL_V1 = 0,
+ HIVE_CLI_SERVICE_PROTOCOL_V2 = 1
};
};
@@ -69,7 +70,8 @@ struct TOperationState {
CANCELED_STATE = 3,
CLOSED_STATE = 4,
ERROR_STATE = 5,
- UKNOWN_STATE = 6
+ UKNOWN_STATE = 6,
+ PENDING_STATE = 7
};
};
@@ -1467,8 +1469,8 @@ class TOpenSessionReq {
static const char* ascii_fingerprint; // = "C8FD0F306A16C16BDA7B57F58BFAE5B2";
static const uint8_t binary_fingerprint[16]; // = {0xC8,0xFD,0x0F,0x30,0x6A,0x16,0xC1,0x6B,0xDA,0x7B,0x57,0xF5,0x8B,0xFA,0xE5,0xB2};
- TOpenSessionReq() : client_protocol((TProtocolVersion::type)0), username(), password() {
- client_protocol = (TProtocolVersion::type)0;
+ TOpenSessionReq() : client_protocol((TProtocolVersion::type)1), username(), password() {
+ client_protocol = (TProtocolVersion::type)1;
}
@@ -1543,8 +1545,8 @@ class TOpenSessionResp {
static const char* ascii_fingerprint; // = "CFE7D7F4E9EC671F2518ED74FEE9F163";
static const uint8_t binary_fingerprint[16]; // = {0xCF,0xE7,0xD7,0xF4,0xE9,0xEC,0x67,0x1F,0x25,0x18,0xED,0x74,0xFE,0xE9,0xF1,0x63};
- TOpenSessionResp() : serverProtocolVersion((TProtocolVersion::type)0) {
- serverProtocolVersion = (TProtocolVersion::type)0;
+ TOpenSessionResp() : serverProtocolVersion((TProtocolVersion::type)1) {
+ serverProtocolVersion = (TProtocolVersion::type)1;
}
@@ -1850,17 +1852,18 @@ class TGetInfoResp {
void swap(TGetInfoResp &a, TGetInfoResp &b);
typedef struct _TExecuteStatementReq__isset {
- _TExecuteStatementReq__isset() : confOverlay(false) {}
+ _TExecuteStatementReq__isset() : confOverlay(false), runAsync(true) {}
bool confOverlay;
+ bool runAsync;
} _TExecuteStatementReq__isset;
class TExecuteStatementReq {
public:
- static const char* ascii_fingerprint; // = "4CDA19909D21B7D9907F85E3387EAB27";
- static const uint8_t binary_fingerprint[16]; // = {0x4C,0xDA,0x19,0x90,0x9D,0x21,0xB7,0xD9,0x90,0x7F,0x85,0xE3,0x38,0x7E,0xAB,0x27};
+ static const char* ascii_fingerprint; // = "FED75DB77E66D76EC1939A51FB0D96FA";
+ static const uint8_t binary_fingerprint[16]; // = {0xFE,0xD7,0x5D,0xB7,0x7E,0x66,0xD7,0x6E,0xC1,0x93,0x9A,0x51,0xFB,0x0D,0x96,0xFA};
- TExecuteStatementReq() : statement() {
+ TExecuteStatementReq() : statement(), runAsync(false) {
}
virtual ~TExecuteStatementReq() throw() {}
@@ -1868,6 +1871,7 @@ class TExecuteStatementReq {
TSessionHandle sessionHandle;
std::string statement;
std::map<std::string, std::string> confOverlay;
+ bool runAsync;
_TExecuteStatementReq__isset __isset;
@@ -1884,6 +1888,11 @@ class TExecuteStatementReq {
__isset.confOverlay = true;
}
+ void __set_runAsync(const bool val) {
+ runAsync = val;
+ __isset.runAsync = true;
+ }
+
bool operator == (const TExecuteStatementReq & rhs) const
{
if (!(sessionHandle == rhs.sessionHandle))
@@ -1894,6 +1903,10 @@ class TExecuteStatementReq {
return false;
else if (__isset.confOverlay && !(confOverlay == rhs.confOverlay))
return false;
+ if (__isset.runAsync != rhs.__isset.runAsync)
+ return false;
+ else if (__isset.runAsync && !(runAsync == rhs.runAsync))
+ return false;
return true;
}
bool operator != (const TExecuteStatementReq &rhs) const {
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java Thu Sep 12 01:21:10 2013
@@ -37,6 +37,7 @@ public class TExecuteStatementReq implem
private static final org.apache.thrift.protocol.TField SESSION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionHandle", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField STATEMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("statement", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField CONF_OVERLAY_FIELD_DESC = new org.apache.thrift.protocol.TField("confOverlay", org.apache.thrift.protocol.TType.MAP, (short)3);
+ private static final org.apache.thrift.protocol.TField RUN_ASYNC_FIELD_DESC = new org.apache.thrift.protocol.TField("runAsync", org.apache.thrift.protocol.TType.BOOL, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -47,12 +48,14 @@ public class TExecuteStatementReq implem
private TSessionHandle sessionHandle; // required
private String statement; // required
private Map<String,String> confOverlay; // optional
+ private boolean runAsync; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SESSION_HANDLE((short)1, "sessionHandle"),
STATEMENT((short)2, "statement"),
- CONF_OVERLAY((short)3, "confOverlay");
+ CONF_OVERLAY((short)3, "confOverlay"),
+ RUN_ASYNC((short)4, "runAsync");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -73,6 +76,8 @@ public class TExecuteStatementReq implem
return STATEMENT;
case 3: // CONF_OVERLAY
return CONF_OVERLAY;
+ case 4: // RUN_ASYNC
+ return RUN_ASYNC;
default:
return null;
}
@@ -113,7 +118,9 @@ public class TExecuteStatementReq implem
}
// isset id assignments
- private _Fields optionals[] = {_Fields.CONF_OVERLAY};
+ private static final int __RUNASYNC_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.CONF_OVERLAY,_Fields.RUN_ASYNC};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -125,11 +132,15 @@ public class TExecuteStatementReq implem
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.RUN_ASYNC, new org.apache.thrift.meta_data.FieldMetaData("runAsync", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TExecuteStatementReq.class, metaDataMap);
}
public TExecuteStatementReq() {
+ this.runAsync = false;
+
}
public TExecuteStatementReq(
@@ -145,6 +156,7 @@ public class TExecuteStatementReq implem
* Performs a deep copy on <i>other</i>.
*/
public TExecuteStatementReq(TExecuteStatementReq other) {
+ __isset_bitfield = other.__isset_bitfield;
if (other.isSetSessionHandle()) {
this.sessionHandle = new TSessionHandle(other.sessionHandle);
}
@@ -166,6 +178,7 @@ public class TExecuteStatementReq implem
}
this.confOverlay = __this__confOverlay;
}
+ this.runAsync = other.runAsync;
}
public TExecuteStatementReq deepCopy() {
@@ -177,6 +190,8 @@ public class TExecuteStatementReq implem
this.sessionHandle = null;
this.statement = null;
this.confOverlay = null;
+ this.runAsync = false;
+
}
public TSessionHandle getSessionHandle() {
@@ -259,6 +274,28 @@ public class TExecuteStatementReq implem
}
}
+ public boolean isRunAsync() {
+ return this.runAsync;
+ }
+
+ public void setRunAsync(boolean runAsync) {
+ this.runAsync = runAsync;
+ setRunAsyncIsSet(true);
+ }
+
+ public void unsetRunAsync() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RUNASYNC_ISSET_ID);
+ }
+
+ /** Returns true if field runAsync is set (has been assigned a value) and false otherwise */
+ public boolean isSetRunAsync() {
+ return EncodingUtils.testBit(__isset_bitfield, __RUNASYNC_ISSET_ID);
+ }
+
+ public void setRunAsyncIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RUNASYNC_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SESSION_HANDLE:
@@ -285,6 +322,14 @@ public class TExecuteStatementReq implem
}
break;
+ case RUN_ASYNC:
+ if (value == null) {
+ unsetRunAsync();
+ } else {
+ setRunAsync((Boolean)value);
+ }
+ break;
+
}
}
@@ -299,6 +344,9 @@ public class TExecuteStatementReq implem
case CONF_OVERLAY:
return getConfOverlay();
+ case RUN_ASYNC:
+ return Boolean.valueOf(isRunAsync());
+
}
throw new IllegalStateException();
}
@@ -316,6 +364,8 @@ public class TExecuteStatementReq implem
return isSetStatement();
case CONF_OVERLAY:
return isSetConfOverlay();
+ case RUN_ASYNC:
+ return isSetRunAsync();
}
throw new IllegalStateException();
}
@@ -360,6 +410,15 @@ public class TExecuteStatementReq implem
return false;
}
+ boolean this_present_runAsync = true && this.isSetRunAsync();
+ boolean that_present_runAsync = true && that.isSetRunAsync();
+ if (this_present_runAsync || that_present_runAsync) {
+ if (!(this_present_runAsync && that_present_runAsync))
+ return false;
+ if (this.runAsync != that.runAsync)
+ return false;
+ }
+
return true;
}
@@ -382,6 +441,11 @@ public class TExecuteStatementReq implem
if (present_confOverlay)
builder.append(confOverlay);
+ boolean present_runAsync = true && (isSetRunAsync());
+ builder.append(present_runAsync);
+ if (present_runAsync)
+ builder.append(runAsync);
+
return builder.toHashCode();
}
@@ -423,6 +487,16 @@ public class TExecuteStatementReq implem
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetRunAsync()).compareTo(typedOther.isSetRunAsync());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRunAsync()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.runAsync, typedOther.runAsync);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -468,6 +542,12 @@ public class TExecuteStatementReq implem
}
first = false;
}
+ if (isSetRunAsync()) {
+ if (!first) sb.append(", ");
+ sb.append("runAsync:");
+ sb.append(this.runAsync);
+ first = false;
+ }
sb.append(")");
return sb.toString();
}
@@ -498,6 +578,8 @@ public class TExecuteStatementReq implem
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
@@ -559,6 +641,14 @@ public class TExecuteStatementReq implem
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 4: // RUN_ASYNC
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.runAsync = iprot.readBool();
+ struct.setRunAsyncIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -597,6 +687,11 @@ public class TExecuteStatementReq implem
oprot.writeFieldEnd();
}
}
+ if (struct.isSetRunAsync()) {
+ oprot.writeFieldBegin(RUN_ASYNC_FIELD_DESC);
+ oprot.writeBool(struct.runAsync);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -620,7 +715,10 @@ public class TExecuteStatementReq implem
if (struct.isSetConfOverlay()) {
optionals.set(0);
}
- oprot.writeBitSet(optionals, 1);
+ if (struct.isSetRunAsync()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
if (struct.isSetConfOverlay()) {
{
oprot.writeI32(struct.confOverlay.size());
@@ -631,6 +729,9 @@ public class TExecuteStatementReq implem
}
}
}
+ if (struct.isSetRunAsync()) {
+ oprot.writeBool(struct.runAsync);
+ }
}
@Override
@@ -641,7 +742,7 @@ public class TExecuteStatementReq implem
struct.setSessionHandleIsSet(true);
struct.statement = iprot.readString();
struct.setStatementIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
+ BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TMap _map150 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
@@ -657,6 +758,10 @@ public class TExecuteStatementReq implem
}
struct.setConfOverlayIsSet(true);
}
+ if (incoming.get(1)) {
+ struct.runAsync = iprot.readBool();
+ struct.setRunAsyncIsSet(true);
+ }
}
}
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java Thu Sep 12 01:21:10 2013
@@ -141,7 +141,7 @@ public class TOpenSessionReq implements
}
public TOpenSessionReq() {
- this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1;
+ this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V2;
}
@@ -188,7 +188,7 @@ public class TOpenSessionReq implements
@Override
public void clear() {
- this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1;
+ this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V2;
this.username = null;
this.password = null;
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java Thu Sep 12 01:21:10 2013
@@ -141,7 +141,7 @@ public class TOpenSessionResp implements
}
public TOpenSessionResp() {
- this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1;
+ this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V2;
}
@@ -191,7 +191,7 @@ public class TOpenSessionResp implements
@Override
public void clear() {
this.status = null;
- this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1;
+ this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V2;
this.sessionHandle = null;
this.configuration = null;
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOperationState.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOperationState.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOperationState.java (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOperationState.java Thu Sep 12 01:21:10 2013
@@ -18,7 +18,8 @@ public enum TOperationState implements o
CANCELED_STATE(3),
CLOSED_STATE(4),
ERROR_STATE(5),
- UKNOWN_STATE(6);
+ UKNOWN_STATE(6),
+ PENDING_STATE(7);
private final int value;
@@ -53,6 +54,8 @@ public enum TOperationState implements o
return ERROR_STATE;
case 6:
return UKNOWN_STATE;
+ case 7:
+ return PENDING_STATE;
default:
return null;
}
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java Thu Sep 12 01:21:10 2013
@@ -12,7 +12,8 @@ import java.util.HashMap;
import org.apache.thrift.TEnum;
public enum TProtocolVersion implements org.apache.thrift.TEnum {
- HIVE_CLI_SERVICE_PROTOCOL_V1(0);
+ HIVE_CLI_SERVICE_PROTOCOL_V1(0),
+ HIVE_CLI_SERVICE_PROTOCOL_V2(1);
private final int value;
@@ -35,6 +36,8 @@ public enum TProtocolVersion implements
switch (value) {
case 0:
return HIVE_CLI_SERVICE_PROTOCOL_V1;
+ case 1:
+ return HIVE_CLI_SERVICE_PROTOCOL_V2;
default:
return null;
}
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-py/TCLIService/ttypes.py
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-py/TCLIService/ttypes.py?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-py/TCLIService/ttypes.py (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-py/TCLIService/ttypes.py Thu Sep 12 01:21:10 2013
@@ -18,13 +18,16 @@ except:
class TProtocolVersion:
HIVE_CLI_SERVICE_PROTOCOL_V1 = 0
+ HIVE_CLI_SERVICE_PROTOCOL_V2 = 1
_VALUES_TO_NAMES = {
0: "HIVE_CLI_SERVICE_PROTOCOL_V1",
+ 1: "HIVE_CLI_SERVICE_PROTOCOL_V2",
}
_NAMES_TO_VALUES = {
"HIVE_CLI_SERVICE_PROTOCOL_V1": 0,
+ "HIVE_CLI_SERVICE_PROTOCOL_V2": 1,
}
class TTypeId:
@@ -120,6 +123,7 @@ class TOperationState:
CLOSED_STATE = 4
ERROR_STATE = 5
UKNOWN_STATE = 6
+ PENDING_STATE = 7
_VALUES_TO_NAMES = {
0: "INITIALIZED_STATE",
@@ -129,6 +133,7 @@ class TOperationState:
4: "CLOSED_STATE",
5: "ERROR_STATE",
6: "UKNOWN_STATE",
+ 7: "PENDING_STATE",
}
_NAMES_TO_VALUES = {
@@ -139,6 +144,7 @@ class TOperationState:
"CLOSED_STATE": 4,
"ERROR_STATE": 5,
"UKNOWN_STATE": 6,
+ "PENDING_STATE": 7,
}
class TOperationType:
@@ -2431,7 +2437,7 @@ class TOpenSessionReq:
thrift_spec = (
None, # 0
- (1, TType.I32, 'client_protocol', None, 0, ), # 1
+ (1, TType.I32, 'client_protocol', None, 1, ), # 1
(2, TType.STRING, 'username', None, None, ), # 2
(3, TType.STRING, 'password', None, None, ), # 3
(4, TType.MAP, 'configuration', (TType.STRING,None,TType.STRING,None), None, ), # 4
@@ -2540,7 +2546,7 @@ class TOpenSessionResp:
thrift_spec = (
None, # 0
(1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1
- (2, TType.I32, 'serverProtocolVersion', None, 0, ), # 2
+ (2, TType.I32, 'serverProtocolVersion', None, 1, ), # 2
(3, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 3
(4, TType.MAP, 'configuration', (TType.STRING,None,TType.STRING,None), None, ), # 4
)
@@ -3047,6 +3053,7 @@ class TExecuteStatementReq:
- sessionHandle
- statement
- confOverlay
+ - runAsync
"""
thrift_spec = (
@@ -3054,12 +3061,14 @@ class TExecuteStatementReq:
(1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1
(2, TType.STRING, 'statement', None, None, ), # 2
(3, TType.MAP, 'confOverlay', (TType.STRING,None,TType.STRING,None), None, ), # 3
+ (4, TType.BOOL, 'runAsync', None, False, ), # 4
)
- def __init__(self, sessionHandle=None, statement=None, confOverlay=None,):
+ def __init__(self, sessionHandle=None, statement=None, confOverlay=None, runAsync=thrift_spec[4][4],):
self.sessionHandle = sessionHandle
self.statement = statement
self.confOverlay = confOverlay
+ self.runAsync = runAsync
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
@@ -3092,6 +3101,11 @@ class TExecuteStatementReq:
iprot.readMapEnd()
else:
iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.BOOL:
+ self.runAsync = iprot.readBool();
+ else:
+ iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
@@ -3118,6 +3132,10 @@ class TExecuteStatementReq:
oprot.writeString(viter135)
oprot.writeMapEnd()
oprot.writeFieldEnd()
+ if self.runAsync is not None:
+ oprot.writeFieldBegin('runAsync', TType.BOOL, 4)
+ oprot.writeBool(self.runAsync)
+ oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
Modified: hive/branches/vectorization/service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb (original)
+++ hive/branches/vectorization/service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb Thu Sep 12 01:21:10 2013
@@ -8,8 +8,9 @@ require 'thrift'
module TProtocolVersion
HIVE_CLI_SERVICE_PROTOCOL_V1 = 0
- VALUE_MAP = {0 => "HIVE_CLI_SERVICE_PROTOCOL_V1"}
- VALID_VALUES = Set.new([HIVE_CLI_SERVICE_PROTOCOL_V1]).freeze
+ HIVE_CLI_SERVICE_PROTOCOL_V2 = 1
+ VALUE_MAP = {0 => "HIVE_CLI_SERVICE_PROTOCOL_V1", 1 => "HIVE_CLI_SERVICE_PROTOCOL_V2"}
+ VALID_VALUES = Set.new([HIVE_CLI_SERVICE_PROTOCOL_V1, HIVE_CLI_SERVICE_PROTOCOL_V2]).freeze
end
module TTypeId
@@ -53,8 +54,9 @@ module TOperationState
CLOSED_STATE = 4
ERROR_STATE = 5
UKNOWN_STATE = 6
- VALUE_MAP = {0 => "INITIALIZED_STATE", 1 => "RUNNING_STATE", 2 => "FINISHED_STATE", 3 => "CANCELED_STATE", 4 => "CLOSED_STATE", 5 => "ERROR_STATE", 6 => "UKNOWN_STATE"}
- VALID_VALUES = Set.new([INITIALIZED_STATE, RUNNING_STATE, FINISHED_STATE, CANCELED_STATE, CLOSED_STATE, ERROR_STATE, UKNOWN_STATE]).freeze
+ PENDING_STATE = 7
+ VALUE_MAP = {0 => "INITIALIZED_STATE", 1 => "RUNNING_STATE", 2 => "FINISHED_STATE", 3 => "CANCELED_STATE", 4 => "CLOSED_STATE", 5 => "ERROR_STATE", 6 => "UKNOWN_STATE", 7 => "PENDING_STATE"}
+ VALID_VALUES = Set.new([INITIALIZED_STATE, RUNNING_STATE, FINISHED_STATE, CANCELED_STATE, CLOSED_STATE, ERROR_STATE, UKNOWN_STATE, PENDING_STATE]).freeze
end
module TOperationType
@@ -724,7 +726,7 @@ class TOpenSessionReq
CONFIGURATION = 4
FIELDS = {
- CLIENT_PROTOCOL => {:type => ::Thrift::Types::I32, :name => 'client_protocol', :default => 0, :enum_class => ::TProtocolVersion},
+ CLIENT_PROTOCOL => {:type => ::Thrift::Types::I32, :name => 'client_protocol', :default => 1, :enum_class => ::TProtocolVersion},
USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true},
PASSWORD => {:type => ::Thrift::Types::STRING, :name => 'password', :optional => true},
CONFIGURATION => {:type => ::Thrift::Types::MAP, :name => 'configuration', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true}
@@ -751,7 +753,7 @@ class TOpenSessionResp
FIELDS = {
STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus},
- SERVERPROTOCOLVERSION => {:type => ::Thrift::Types::I32, :name => 'serverProtocolVersion', :default => 0, :enum_class => ::TProtocolVersion},
+ SERVERPROTOCOLVERSION => {:type => ::Thrift::Types::I32, :name => 'serverProtocolVersion', :default => 1, :enum_class => ::TProtocolVersion},
SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::TSessionHandle, :optional => true},
CONFIGURATION => {:type => ::Thrift::Types::MAP, :name => 'configuration', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true}
}
@@ -904,11 +906,13 @@ class TExecuteStatementReq
SESSIONHANDLE = 1
STATEMENT = 2
CONFOVERLAY = 3
+ RUNASYNC = 4
FIELDS = {
SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::TSessionHandle},
STATEMENT => {:type => ::Thrift::Types::STRING, :name => 'statement'},
- CONFOVERLAY => {:type => ::Thrift::Types::MAP, :name => 'confOverlay', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true}
+ CONFOVERLAY => {:type => ::Thrift::Types::MAP, :name => 'confOverlay', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
+ RUNASYNC => {:type => ::Thrift::Types::BOOL, :name => 'runAsync', :default => false, :optional => true}
}
def struct_fields; FIELDS; end
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIService.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIService.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIService.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIService.java Thu Sep 12 01:21:10 2013
@@ -140,10 +140,12 @@ public class CLIService extends Composit
}
/* (non-Javadoc)
- * @see org.apache.hive.service.cli.ICLIService#executeStatement(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.util.Map)
+ * @see org.apache.hive.service.cli.ICLIService#executeStatement(org.apache.hive.service.cli.SessionHandle,
+ * java.lang.String, java.util.Map)
*/
@Override
- public OperationHandle executeStatement(SessionHandle sessionHandle, String statement, Map<String, String> confOverlay)
+ public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
+ Map<String, String> confOverlay)
throws HiveSQLException {
OperationHandle opHandle = sessionManager.getSession(sessionHandle)
.executeStatement(statement, confOverlay);
@@ -152,6 +154,20 @@ public class CLIService extends Composit
}
/* (non-Javadoc)
+ * @see org.apache.hive.service.cli.ICLIService#executeStatementAsync(org.apache.hive.service.cli.SessionHandle,
+ * java.lang.String, java.util.Map)
+ */
+ @Override
+ public OperationHandle executeStatementAsync(SessionHandle sessionHandle, String statement,
+ Map<String, String> confOverlay) throws HiveSQLException {
+ OperationHandle opHandle = sessionManager.getSession(sessionHandle)
+ .executeStatementAsync(statement, confOverlay);
+ LOG.info(sessionHandle + ": executeStatementAsync()");
+ return opHandle;
+ }
+
+
+ /* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getTypeInfo(org.apache.hive.service.cli.SessionHandle)
*/
@Override
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIServiceClient.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIServiceClient.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIServiceClient.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/CLIServiceClient.java Thu Sep 12 01:21:10 2013
@@ -56,13 +56,22 @@ public abstract class CLIServiceClient i
throws HiveSQLException;
/* (non-Javadoc)
- * @see org.apache.hive.service.cli.ICLIService#executeStatement(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.util.Map)
+ * @see org.apache.hive.service.cli.ICLIService#executeStatement(org.apache.hive.service.cli.SessionHandle,
+ * java.lang.String, java.util.Map)
*/
@Override
public abstract OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
Map<String, String> confOverlay) throws HiveSQLException;
/* (non-Javadoc)
+ * @see org.apache.hive.service.cli.ICLIService#executeStatementAsync(org.apache.hive.service.cli.SessionHandle,
+ * java.lang.String, java.util.Map)
+ */
+ @Override
+ public abstract OperationHandle executeStatementAsync(SessionHandle sessionHandle, String statement,
+ Map<String, String> confOverlay) throws HiveSQLException;
+
+ /* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getTypeInfo(org.apache.hive.service.cli.SessionHandle)
*/
@Override
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java Thu Sep 12 01:21:10 2013
@@ -66,7 +66,8 @@ public class EmbeddedCLIServiceClient ex
}
/* (non-Javadoc)
- * @see org.apache.hive.service.cli.CLIServiceClient#executeStatement(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.util.Map)
+ * @see org.apache.hive.service.cli.CLIServiceClient#executeStatement(org.apache.hive.service.cli.SessionHandle,
+ * java.lang.String, java.util.Map)
*/
@Override
public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
@@ -75,6 +76,17 @@ public class EmbeddedCLIServiceClient ex
}
/* (non-Javadoc)
+ * @see org.apache.hive.service.cli.CLIServiceClient#executeStatementAsync(org.apache.hive.service.cli.SessionHandle,
+ * java.lang.String, java.util.Map)
+ */
+ @Override
+ public OperationHandle executeStatementAsync(SessionHandle sessionHandle, String statement,
+ Map<String, String> confOverlay) throws HiveSQLException {
+ return cliService.executeStatementAsync(sessionHandle, statement, confOverlay);
+ }
+
+
+ /* (non-Javadoc)
* @see org.apache.hive.service.cli.CLIServiceClient#getTypeInfo(org.apache.hive.service.cli.SessionHandle)
*/
@Override
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/ICLIService.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/ICLIService.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/ICLIService.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/ICLIService.java Thu Sep 12 01:21:10 2013
@@ -43,6 +43,10 @@ public interface ICLIService {
Map<String, String> confOverlay)
throws HiveSQLException;
+ public abstract OperationHandle executeStatementAsync(SessionHandle sessionHandle,
+ String statement, Map<String, String> confOverlay)
+ throws HiveSQLException;
+
public abstract OperationHandle getTypeInfo(SessionHandle sessionHandle)
throws HiveSQLException;
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/OperationState.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/OperationState.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/OperationState.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/OperationState.java Thu Sep 12 01:21:10 2013
@@ -31,7 +31,8 @@ public enum OperationState {
CANCELED(TOperationState.CANCELED_STATE),
CLOSED(TOperationState.CLOSED_STATE),
ERROR(TOperationState.ERROR_STATE),
- UNKNOWN(TOperationState.UKNOWN_STATE);
+ UNKNOWN(TOperationState.UKNOWN_STATE),
+ PENDING(TOperationState.PENDING_STATE);
private final TOperationState tOperationState;
@@ -55,11 +56,22 @@ public enum OperationState {
switch (oldState) {
case INITIALIZED:
switch (newState) {
+ case PENDING:
case RUNNING:
case CLOSED:
return;
}
break;
+ case PENDING:
+ switch (newState) {
+ case RUNNING:
+ case FINISHED:
+ case CANCELED:
+ case ERROR:
+ case CLOSED:
+ return;
+ }
+ break;
case RUNNING:
switch (newState) {
case FINISHED:
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java Thu Sep 12 01:21:10 2013
@@ -40,7 +40,7 @@ public abstract class ExecuteStatementOp
}
public static ExecuteStatementOperation newExecuteStatementOperation(
- HiveSession parentSession, String statement, Map<String, String> confOverlay) {
+ HiveSession parentSession, String statement, Map<String, String> confOverlay, boolean runAsync) {
String[] tokens = statement.trim().split("\\s+");
String command = tokens[0].toLowerCase();
@@ -53,7 +53,7 @@ public abstract class ExecuteStatementOp
} else if ("delete".equals(command)) {
return new DeleteResourceOperation(parentSession, statement, confOverlay);
} else {
- return new SQLOperation(parentSession, statement, confOverlay);
+ return new SQLOperation(parentSession, statement, confOverlay, runAsync);
}
}
}
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java Thu Sep 12 01:21:10 2013
@@ -66,9 +66,9 @@ public class OperationManager extends Ab
}
public ExecuteStatementOperation newExecuteStatementOperation(HiveSession parentSession,
- String statement, Map<String, String> confOverlay) {
+ String statement, Map<String, String> confOverlay, boolean runAsync) {
ExecuteStatementOperation executeStatementOperation = ExecuteStatementOperation
- .newExecuteStatementOperation(parentSession, statement, confOverlay);
+ .newExecuteStatementOperation(parentSession, statement, confOverlay, runAsync);
addOperation(executeStatementOperation);
return executeStatementOperation;
}
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java Thu Sep 12 01:21:10 2013
@@ -19,17 +19,22 @@
package org.apache.hive.service.cli.operation;
import java.io.IOException;
+import java.io.Serializable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.Schema;
import org.apache.hadoop.hive.ql.CommandNeedRetryException;
import org.apache.hadoop.hive.ql.Driver;
+import org.apache.hadoop.hive.ql.exec.ExplainTask;
+import org.apache.hadoop.hive.ql.exec.Task;
import org.apache.hadoop.hive.ql.parse.VariableSubstitution;
import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse;
import org.apache.hadoop.hive.ql.session.SessionState;
@@ -61,19 +66,21 @@ public class SQLOperation extends Execut
private TableSchema resultSchema = null;
private Schema mResultSchema = null;
private SerDe serde = null;
+ private final boolean runAsync;
+ private Future<?> backgroundHandle;
-
- public SQLOperation(HiveSession parentSession, String statement, Map<String, String> confOverlay) {
+ public SQLOperation(HiveSession parentSession, String statement, Map<String,
+ String> confOverlay, boolean runInBackground) {
// TODO: call setRemoteUser in ExecuteStatementOperation or higher.
super(parentSession, statement, confOverlay);
+ this.runAsync = runInBackground;
}
public void prepare() throws HiveSQLException {
}
- @Override
- public void run() throws HiveSQLException {
+ private void runInternal() throws HiveSQLException {
setState(OperationState.RUNNING);
String statement_trimmed = statement.trim();
String[] tokens = statement_trimmed.split("\\s");
@@ -99,12 +106,28 @@ public class SQLOperation extends Execut
}
mResultSchema = driver.getSchema();
- if (mResultSchema != null && mResultSchema.isSetFieldSchemas()) {
+
+ // hasResultSet should be true only if the query has a FetchTask
+ // "explain" is an exception for now
+ if(driver.getPlan().getFetchTask() != null) {
+ //Schema has to be set
+ if (mResultSchema == null || !mResultSchema.isSetFieldSchemas()) {
+ throw new HiveSQLException("Error running query: Schema and FieldSchema " +
+ "should be set when query plan has a FetchTask");
+ }
resultSchema = new TableSchema(mResultSchema);
setHasResultSet(true);
} else {
setHasResultSet(false);
}
+ // Set hasResultSet true if the plan has ExplainTask
+ // TODO explain should use a FetchTask for reading
+ for (Task<? extends Serializable> task: driver.getPlan().getRootTasks()) {
+ if (task.getClass() == ExplainTask.class) {
+ setHasResultSet(true);
+ break;
+ }
+ }
} catch (HiveSQLException e) {
setState(OperationState.ERROR);
throw e;
@@ -116,31 +139,62 @@ public class SQLOperation extends Execut
}
@Override
- public void cancel() throws HiveSQLException {
- setState(OperationState.CANCELED);
+ public void run() throws HiveSQLException {
+ setState(OperationState.PENDING);
+ if (!shouldRunAsync()) {
+ runInternal();
+ } else {
+ Runnable backgroundOperation = new Runnable() {
+ SessionState ss = SessionState.get();
+ @Override
+ public void run() {
+ SessionState.start(ss);
+ try {
+ runInternal();
+ } catch (HiveSQLException e) {
+ LOG.error("Error: ", e);
+ // TODO: Return a more detailed error to the client,
+ // currently the async thread only writes to the log and sets the OperationState
+ }
+ }
+ };
+ try {
+ // This submit blocks if no background threads are available to run this operation
+ backgroundHandle =
+ getParentSession().getSessionManager().submitBackgroundOperation(backgroundOperation);
+ } catch (RejectedExecutionException rejected) {
+ setState(OperationState.ERROR);
+ throw new HiveSQLException(rejected);
+ }
+ }
+ }
+
+ private void cleanup(OperationState state) throws HiveSQLException {
+ setState(state);
+ if (shouldRunAsync()) {
+ if (backgroundHandle != null) {
+ backgroundHandle.cancel(true);
+ }
+ }
if (driver != null) {
driver.close();
driver.destroy();
}
- SessionState session = SessionState.get();
- if (session.getTmpOutputFile() != null) {
- session.getTmpOutputFile().delete();
+ SessionState ss = SessionState.get();
+ if (ss.getTmpOutputFile() != null) {
+ ss.getTmpOutputFile().delete();
}
}
@Override
- public void close() throws HiveSQLException {
- setState(OperationState.CLOSED);
- if (driver != null) {
- driver.close();
- driver.destroy();
- }
+ public void cancel() throws HiveSQLException {
+ cleanup(OperationState.CANCELED);
+ }
- SessionState session = SessionState.get();
- if (session.getTmpOutputFile() != null) {
- session.getTmpOutputFile().delete();
- }
+ @Override
+ public void close() throws HiveSQLException {
+ cleanup(OperationState.CLOSED);
}
@Override
@@ -259,4 +313,8 @@ public class SQLOperation extends Execut
return serde;
}
+ private boolean shouldRunAsync() {
+ return runAsync;
+ }
+
}
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSession.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSession.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSession.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSession.java Thu Sep 12 01:21:10 2013
@@ -42,6 +42,11 @@ public interface HiveSession {
public void setSessionManager(SessionManager sessionManager);
/**
+ * Get the session manager for the session
+ */
+ public SessionManager getSessionManager();
+
+ /**
* Set operation manager for the session
* @param operationManager
*/
@@ -76,6 +81,16 @@ public interface HiveSession {
Map<String, String> confOverlay) throws HiveSQLException;
/**
+ * execute operation handler
+ * @param statement
+ * @param confOverlay
+ * @return
+ * @throws HiveSQLException
+ */
+ public OperationHandle executeStatementAsync(String statement,
+ Map<String, String> confOverlay) throws HiveSQLException;
+
+ /**
* getTypeInfo operation handler
* @return
* @throws HiveSQLException
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java?rev=1522098&r1=1522097&r2=1522098&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java Thu Sep 12 01:21:10 2013
@@ -18,7 +18,6 @@
package org.apache.hive.service.cli.session;
-import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
@@ -26,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.conf.HiveConf;
@@ -93,7 +91,7 @@ public class HiveSessionImpl implements
sessionState = new SessionState(hiveConf);
}
- private SessionManager getSessionManager() {
+ public SessionManager getSessionManager() {
return sessionManager;
}
@@ -174,10 +172,21 @@ public class HiveSessionImpl implements
public OperationHandle executeStatement(String statement, Map<String, String> confOverlay)
throws HiveSQLException {
+ return executeStatementInternal(statement, confOverlay, false);
+ }
+
+ public OperationHandle executeStatementAsync(String statement, Map<String, String> confOverlay)
+ throws HiveSQLException {
+ return executeStatementInternal(statement, confOverlay, true);
+ }
+
+ private OperationHandle executeStatementInternal(String statement, Map<String, String> confOverlay,
+ boolean runAsync)
+ throws HiveSQLException {
acquire();
try {
ExecuteStatementOperation operation = getOperationManager()
- .newExecuteStatementOperation(getSession(), statement, confOverlay);
+ .newExecuteStatementOperation(getSession(), statement, confOverlay, runAsync);
operation.run();
OperationHandle opHandle = operation.getHandle();
opHandleSet.add(opHandle);