You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2015/02/17 07:49:34 UTC
svn commit: r1660293 [48/48] - in /hive/branches/spark: ./
accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/serde/
accumulo-handler/src/test/org/apache/hadoop/hive/accumulo/
accumulo-handler/src/test/org/apache/hadoop/hive/accumulo/mr/ accumul...
Modified: hive/branches/spark/ql/src/test/results/clientpositive/vectorized_shufflejoin.q.out
URL: http://svn.apache.org/viewvc/hive/branches/spark/ql/src/test/results/clientpositive/vectorized_shufflejoin.q.out?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/ql/src/test/results/clientpositive/vectorized_shufflejoin.q.out (original)
+++ hive/branches/spark/ql/src/test/results/clientpositive/vectorized_shufflejoin.q.out Tue Feb 17 06:49:27 2015
@@ -17,34 +17,34 @@ STAGE PLANS:
Map Operator Tree:
TableScan
alias: t1
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
Filter Operator
predicate: cint is not null (type: boolean)
- Statistics: Num rows: 6144 Data size: 188618 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE
Select Operator
expressions: cint (type: int)
outputColumnNames: _col0
- Statistics: Num rows: 6144 Data size: 188618 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE
Reduce Output Operator
key expressions: _col0 (type: int)
sort order: +
Map-reduce partition columns: _col0 (type: int)
- Statistics: Num rows: 6144 Data size: 188618 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE
TableScan
alias: t1
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
Filter Operator
predicate: cint is not null (type: boolean)
- Statistics: Num rows: 6144 Data size: 188618 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE
Select Operator
expressions: cint (type: int)
outputColumnNames: _col0
- Statistics: Num rows: 6144 Data size: 188618 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE
Reduce Output Operator
key expressions: _col0 (type: int)
sort order: +
Map-reduce partition columns: _col0 (type: int)
- Statistics: Num rows: 6144 Data size: 188618 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE
Execution mode: vectorized
Reduce Operator Tree:
Join Operator
@@ -54,11 +54,11 @@ STAGE PLANS:
0 _col0 (type: int)
1 _col0 (type: int)
outputColumnNames: _col0, _col1
- Statistics: Num rows: 6758 Data size: 207479 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6758 Data size: 1453080 Basic stats: COMPLETE Column stats: NONE
Select Operator
expressions: _col0 (type: int), _col1 (type: int), (_col0 + _col1) (type: int)
outputColumnNames: _col0, _col1, _col2
- Statistics: Num rows: 6758 Data size: 207479 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 6758 Data size: 1453080 Basic stats: COMPLETE Column stats: NONE
Group By Operator
aggregations: count(_col0), max(_col1), min(_col0), avg(_col2)
mode: hash
Modified: hive/branches/spark/ql/src/test/results/clientpositive/vectorized_string_funcs.q.out
URL: http://svn.apache.org/viewvc/hive/branches/spark/ql/src/test/results/clientpositive/vectorized_string_funcs.q.out?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/ql/src/test/results/clientpositive/vectorized_string_funcs.q.out (original)
+++ hive/branches/spark/ql/src/test/results/clientpositive/vectorized_string_funcs.q.out Tue Feb 17 06:49:27 2015
@@ -56,17 +56,17 @@ STAGE PLANS:
Map Operator Tree:
TableScan
alias: alltypesorc
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
Filter Operator
predicate: ((((cbigint % 237) = 0) and (length(substr(cstring1, 1, 2)) <= 2)) and (cstring1 like '%')) (type: boolean)
- Statistics: Num rows: 1024 Data size: 31436 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 1024 Data size: 220163 Basic stats: COMPLETE Column stats: NONE
Select Operator
expressions: substr(cstring1, 1, 2) (type: string), substr(cstring1, 2) (type: string), lower(cstring1) (type: string), upper(cstring1) (type: string), upper(cstring1) (type: string), length(cstring1) (type: int), trim(cstring1) (type: string), ltrim(cstring1) (type: string), rtrim(cstring1) (type: string), concat(cstring1, cstring2) (type: string), concat('>', cstring1) (type: string), concat(cstring1, '<') (type: string), concat(substr(cstring1, 1, 2), substr(cstring2, 1, 2)) (type: string)
outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
- Statistics: Num rows: 1024 Data size: 31436 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 1024 Data size: 220163 Basic stats: COMPLETE Column stats: NONE
File Output Operator
compressed: false
- Statistics: Num rows: 1024 Data size: 31436 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 1024 Data size: 220163 Basic stats: COMPLETE Column stats: NONE
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Modified: hive/branches/spark/ql/src/test/results/clientpositive/windowing_streaming.q.out
URL: http://svn.apache.org/viewvc/hive/branches/spark/ql/src/test/results/clientpositive/windowing_streaming.q.out?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/ql/src/test/results/clientpositive/windowing_streaming.q.out (original)
+++ hive/branches/spark/ql/src/test/results/clientpositive/windowing_streaming.q.out Tue Feb 17 06:49:27 2015
@@ -80,6 +80,25 @@ STAGE PLANS:
outputColumnNames: _col0, _col1
Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
PTF Operator
+ Function definitions:
+ Input definition
+ input alias: ptf_0
+ output shape: _col0: string, _col1: string
+ type: WINDOWING
+ Windowing table definition
+ input alias: ptf_1
+ name: windowingtablefunction
+ order by: _col0
+ partition by: _col1
+ raw input shape:
+ window functions:
+ window function definition
+ alias: _wcol0
+ arguments: _col0
+ name: rank
+ window function: GenericUDAFRankEvaluator
+ window frame: PRECEDING(MAX)~FOLLOWING(MAX)
+ isPivotResult: true
Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
Select Operator
expressions: _col1 (type: string), _wcol0 (type: int)
@@ -136,6 +155,25 @@ STAGE PLANS:
outputColumnNames: _col0, _col1
Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
PTF Operator
+ Function definitions:
+ Input definition
+ input alias: ptf_0
+ output shape: _col0: string, _col1: string
+ type: WINDOWING
+ Windowing table definition
+ input alias: ptf_1
+ name: windowingtablefunction
+ order by: _col0
+ partition by: _col1
+ raw input shape:
+ window functions:
+ window function definition
+ alias: _wcol0
+ arguments: _col0
+ name: rank
+ window function: GenericUDAFRankEvaluator
+ window frame: PRECEDING(MAX)~FOLLOWING(MAX)
+ isPivotResult: true
Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
Filter Operator
predicate: (_wcol0 < 4) (type: boolean)
@@ -273,34 +311,53 @@ STAGE PLANS:
Map Operator Tree:
TableScan
alias: alltypesorc
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
Select Operator
expressions: ctinyint (type: tinyint), cdouble (type: double)
outputColumnNames: _col0, _col1
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
Reduce Output Operator
key expressions: _col0 (type: tinyint), _col1 (type: double)
sort order: ++
Map-reduce partition columns: _col0 (type: tinyint)
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
TopN Hash Memory Usage: 0.8
Reduce Operator Tree:
Select Operator
expressions: KEY.reducesinkkey0 (type: tinyint), KEY.reducesinkkey1 (type: double)
outputColumnNames: _col0, _col1
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
PTF Operator
- Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Function definitions:
+ Input definition
+ input alias: ptf_0
+ output shape: _col0: tinyint, _col1: double
+ type: WINDOWING
+ Windowing table definition
+ input alias: ptf_1
+ name: windowingtablefunction
+ order by: _col1
+ partition by: _col0
+ raw input shape:
+ window functions:
+ window function definition
+ alias: _wcol0
+ arguments: _col1
+ name: rank
+ window function: GenericUDAFRankEvaluator
+ window frame: PRECEDING(MAX)~FOLLOWING(MAX)
+ isPivotResult: true
+ Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE
Filter Operator
predicate: (_wcol0 < 5) (type: boolean)
- Statistics: Num rows: 4096 Data size: 125745 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 4096 Data size: 880654 Basic stats: COMPLETE Column stats: NONE
Select Operator
expressions: _col0 (type: tinyint), _col1 (type: double), _wcol0 (type: int)
outputColumnNames: _col0, _col1, _col2
- Statistics: Num rows: 4096 Data size: 125745 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 4096 Data size: 880654 Basic stats: COMPLETE Column stats: NONE
File Output Operator
compressed: false
- Statistics: Num rows: 4096 Data size: 125745 Basic stats: COMPLETE Column stats: NONE
+ Statistics: Num rows: 4096 Data size: 880654 Basic stats: COMPLETE Column stats: NONE
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Modified: hive/branches/spark/ql/src/test/results/clientpositive/windowing_windowspec.q.out
URL: http://svn.apache.org/viewvc/hive/branches/spark/ql/src/test/results/clientpositive/windowing_windowspec.q.out?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/ql/src/test/results/clientpositive/windowing_windowspec.q.out (original)
+++ hive/branches/spark/ql/src/test/results/clientpositive/windowing_windowspec.q.out Tue Feb 17 06:49:27 2015
@@ -830,3 +830,20 @@ alice allen 65609 20.0
alice allen 65662 20.0
alice allen 65670 20.0
alice allen 65720 20.0
+PREHOOK: query: -- HIVE-9228
+select s, i from ( select s, i, round((avg(d) over w1 + 10.0) - (avg(d) over w1 - 10.0),2) from over10k window w1 as (partition by s order by i)) X limit 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@over10k
+#### A masked pattern was here ####
+POSTHOOK: query: -- HIVE-9228
+select s, i from ( select s, i, round((avg(d) over w1 + 10.0) - (avg(d) over w1 - 10.0),2) from over10k window w1 as (partition by s order by i)) X limit 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@over10k
+#### A masked pattern was here ####
+alice allen 65545
+alice allen 65557
+alice allen 65600
+alice allen 65609
+alice allen 65662
+alice allen 65670
+alice allen 65720
Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java (original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java Tue Feb 17 06:49:27 2015
@@ -24,6 +24,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe;
+import org.apache.hadoop.hive.serde2.lazy.LazySerDeParameters;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
@@ -53,7 +54,7 @@ public class DelimitedJSONSerDe extends
@Override
protected void serializeField(ByteStream.Output out, Object obj, ObjectInspector objInspector,
- SerDeParameters serdeParams) throws SerDeException {
+ LazySerDeParameters serdeParams) throws SerDeException {
if (!objInspector.getCategory().equals(Category.PRIMITIVE) || (objInspector.getTypeName().equalsIgnoreCase(serdeConstants.BINARY_TYPE_NAME))) {
//do this for all complex types and binary
try {
Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/ColumnarSerDe.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/ColumnarSerDe.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/ColumnarSerDe.java (original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/ColumnarSerDe.java Tue Feb 17 06:49:27 2015
@@ -29,14 +29,12 @@ import org.apache.commons.logging.LogFac
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.ColumnProjectionUtils;
-import org.apache.hadoop.hive.serde2.SerDe;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeSpec;
import org.apache.hadoop.hive.serde2.SerDeUtils;
import org.apache.hadoop.hive.serde2.lazy.LazyFactory;
import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe;
-import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.SerDeParameters;
-import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyObjectInspectorParametersImpl;
+import org.apache.hadoop.hive.serde2.lazy.LazySerDeParameters;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
@@ -60,7 +58,9 @@ import org.apache.hadoop.io.Writable;
serdeConstants.SERIALIZATION_LAST_COLUMN_TAKES_REST,
serdeConstants.ESCAPE_CHAR,
serdeConstants.SERIALIZATION_ENCODING,
- LazySimpleSerDe.SERIALIZATION_EXTEND_NESTING_LEVELS})
+ LazySerDeParameters.SERIALIZATION_EXTEND_NESTING_LEVELS,
+ LazySerDeParameters.SERIALIZATION_EXTEND_ADDITIONAL_NESTING_LEVELS
+ })
public class ColumnarSerDe extends ColumnarSerDeBase {
@Override
@@ -82,7 +82,7 @@ public class ColumnarSerDe extends Colum
public ColumnarSerDe() throws SerDeException {
}
- protected SerDeParameters serdeParams = null;
+ protected LazySerDeParameters serdeParams = null;
/**
* Initialize the SerDe given the parameters.
@@ -92,7 +92,7 @@ public class ColumnarSerDe extends Colum
@Override
public void initialize(Configuration conf, Properties tbl) throws SerDeException {
- serdeParams = LazySimpleSerDe.initSerdeParams(conf, tbl, getClass().getName());
+ serdeParams = new LazySerDeParameters(conf, tbl, getClass().getName());
// Create the ObjectInspectors for the fields. Note: Currently
// ColumnarObject uses same ObjectInpector as LazyStruct
Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/LazyBinaryColumnarSerDe.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/LazyBinaryColumnarSerDe.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/LazyBinaryColumnarSerDe.java (original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/columnar/LazyBinaryColumnarSerDe.java Tue Feb 17 06:49:27 2015
@@ -26,8 +26,7 @@ import org.apache.hadoop.hive.serde.serd
import org.apache.hadoop.hive.serde2.ColumnProjectionUtils;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeSpec;
-import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.SerDeParameters;
-import org.apache.hadoop.hive.serde2.lazy.LazyUtils;
+import org.apache.hadoop.hive.serde2.lazy.LazySerDeParameters;
import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryFactory;
import org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
@@ -63,8 +62,8 @@ public class LazyBinaryColumnarSerDe ext
@Override
public void initialize(Configuration conf, Properties tbl) throws SerDeException {
- SerDeParameters serdeParams = new SerDeParameters();
- LazyUtils.extractColumnInfo(tbl, serdeParams, getClass().getName());
+ LazySerDeParameters serdeParams = new LazySerDeParameters(conf, tbl, getClass().getName());
+
columnNames = serdeParams.getColumnNames();
columnTypes = serdeParams.getColumnTypes();
Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java (original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java Tue Feb 17 06:49:27 2015
@@ -220,9 +220,9 @@ public final class LazyFactory {
*/
@Deprecated
public static ObjectInspector createLazyObjectInspector(TypeInfo typeInfo,
- byte[] separator, int separatorIndex, Text nullSequence, boolean escaped,
+ byte[] separators, int separatorIndex, Text nullSequence, boolean escaped,
byte escapeChar, ObjectInspectorOptions option) throws SerDeException {
- return createLazyObjectInspector(typeInfo, separator, separatorIndex, nullSequence,
+ return createLazyObjectInspector(typeInfo, separators, separatorIndex, nullSequence,
escaped, escapeChar, false, option);
}
@@ -245,9 +245,9 @@ public final class LazyFactory {
*/
@Deprecated
public static ObjectInspector createLazyObjectInspector(TypeInfo typeInfo,
- byte[] separator, int separatorIndex, Text nullSequence, boolean escaped,
+ byte[] separators, int separatorIndex, Text nullSequence, boolean escaped,
byte escapeChar) throws SerDeException {
- return createLazyObjectInspector(typeInfo, separator, separatorIndex, nullSequence,
+ return createLazyObjectInspector(typeInfo, separators, separatorIndex, nullSequence,
escaped, escapeChar, false, ObjectInspectorOptions.JAVA);
}
@@ -267,9 +267,9 @@ public final class LazyFactory {
*/
@Deprecated
public static ObjectInspector createLazyObjectInspector(TypeInfo typeInfo,
- byte[] separator, int separatorIndex, Text nullSequence, boolean escaped,
+ byte[] separators, int separatorIndex, Text nullSequence, boolean escaped,
byte escapeChar, boolean extendedBooleanLiteral) throws SerDeException {
- return createLazyObjectInspector(typeInfo, separator, separatorIndex, nullSequence, escaped,
+ return createLazyObjectInspector(typeInfo, separators, separatorIndex, nullSequence, escaped,
escapeChar, extendedBooleanLiteral, ObjectInspectorOptions.JAVA);
}
@@ -289,10 +289,10 @@ public final class LazyFactory {
*/
@Deprecated
public static ObjectInspector createLazyObjectInspector(TypeInfo typeInfo,
- byte[] separator, int separatorIndex, Text nullSequence, boolean escaped,
+ byte[] separators, int separatorIndex, Text nullSequence, boolean escaped,
byte escapeChar, boolean extendedBooleanLiteral, ObjectInspectorOptions option) throws SerDeException {
LazyObjectInspectorParametersImpl lazyParams = new LazyObjectInspectorParametersImpl(
- escaped, escapeChar, extendedBooleanLiteral, null, separator, nullSequence);
+ escaped, escapeChar, extendedBooleanLiteral, null, separators, nullSequence);
return createLazyObjectInspector(typeInfo, separatorIndex, lazyParams, option);
}
@@ -332,7 +332,7 @@ public final class LazyFactory {
.getListElementTypeInfo(), separatorIndex + 1,
lazyParams, option), LazyUtils.getSeparator(lazyParams.getSeparators(), separatorIndex),
lazyParams);
- case STRUCT:
+ case STRUCT:
StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
List<TypeInfo> fieldTypeInfos = structTypeInfo
@@ -347,7 +347,7 @@ public final class LazyFactory {
fieldNames, fieldObjectInspectors, null,
LazyUtils.getSeparator(lazyParams.getSeparators(), separatorIndex),
lazyParams, option);
- case UNION:
+ case UNION:
UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
List<ObjectInspector> lazyOIs = new ArrayList<ObjectInspector>();
for (TypeInfo uti : unionTypeInfo.getAllUnionObjectTypeInfos()) {
@@ -357,7 +357,7 @@ public final class LazyFactory {
return LazyObjectInspectorFactory.getLazyUnionObjectInspector(lazyOIs,
LazyUtils.getSeparator(lazyParams.getSeparators(), separatorIndex),
lazyParams);
- }
+ }
throw new RuntimeException("Hive LazySerDe Internal error.");
}
@@ -396,7 +396,7 @@ public final class LazyFactory {
*/
@Deprecated
public static ObjectInspector createLazyStructInspector(
- List<String> columnNames, List<TypeInfo> typeInfos, byte[] separators,
+ List<String> columnNames, List<TypeInfo> typeInfos, byte[] separators,
Text nullSequence, boolean lastColumnTakesRest, boolean escaped,
byte escapeChar, boolean extendedBooleanLiteral) throws SerDeException {
LazyObjectInspectorParametersImpl lazyParams = new LazyObjectInspectorParametersImpl(
Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySimpleSerDe.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySimpleSerDe.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySimpleSerDe.java (original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySimpleSerDe.java Tue Feb 17 06:49:27 2015
@@ -19,13 +19,14 @@
package org.apache.hadoop.hive.serde2.lazy;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@@ -33,7 +34,6 @@ import org.apache.hadoop.hive.conf.HiveC
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.AbstractEncodingAwareSerDe;
import org.apache.hadoop.hive.serde2.ByteStream;
-import org.apache.hadoop.hive.serde2.SerDe;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeSpec;
import org.apache.hadoop.hive.serde2.SerDeStats;
@@ -58,6 +58,7 @@ import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hive.common.util.HiveStringUtils;
+
/**
* LazySimpleSerDe can be used to read the same data format as
* MetadataTypedColumnsetSerDe and TCTLSeparatedProtocol.
@@ -75,16 +76,15 @@ import org.apache.hive.common.util.HiveS
serdeConstants.SERIALIZATION_LAST_COLUMN_TAKES_REST,
serdeConstants.ESCAPE_CHAR,
serdeConstants.SERIALIZATION_ENCODING,
- LazySimpleSerDe.SERIALIZATION_EXTEND_NESTING_LEVELS})
+ LazySerDeParameters.SERIALIZATION_EXTEND_NESTING_LEVELS,
+ LazySerDeParameters.SERIALIZATION_EXTEND_ADDITIONAL_NESTING_LEVELS
+ })
public class LazySimpleSerDe extends AbstractEncodingAwareSerDe {
public static final Log LOG = LogFactory.getLog(LazySimpleSerDe.class
.getName());
- public static final String SERIALIZATION_EXTEND_NESTING_LEVELS
- = "hive.serialization.extend.nesting.levels";
-
- public static final byte[] DefaultSeparators = {(byte) 1, (byte) 2, (byte) 3};
+ private LazySerDeParameters serdeParams = null;
private ObjectInspector cachedObjectInspector;
@@ -97,11 +97,11 @@ public class LazySimpleSerDe extends Abs
public String toString() {
return getClass().toString()
+ "["
- + Arrays.asList(serdeParams.separators)
+ + Arrays.asList(serdeParams.getSeparators())
+ ":"
- + ((StructTypeInfo) serdeParams.rowTypeInfo).getAllStructFieldNames()
+ + ((StructTypeInfo) serdeParams.getRowTypeInfo()).getAllStructFieldNames()
+ ":"
- + ((StructTypeInfo) serdeParams.rowTypeInfo)
+ + ((StructTypeInfo) serdeParams.getRowTypeInfo())
.getAllStructFieldTypeInfos() + "]";
}
@@ -109,100 +109,6 @@ public class LazySimpleSerDe extends Abs
}
/**
- * Return the byte value of the number string.
- *
- * @param altValue
- * The string containing a number.
- * @param defaultVal
- * If the altValue does not represent a number, return the
- * defaultVal.
- */
- public static byte getByte(String altValue, byte defaultVal) {
- if (altValue != null && altValue.length() > 0) {
- try {
- return Byte.valueOf(altValue).byteValue();
- } catch (NumberFormatException e) {
- return (byte) altValue.charAt(0);
- }
- }
- return defaultVal;
- }
-
- /**
- * SerDeParameters.
- *
- */
- public static class SerDeParameters implements LazyObjectInspectorParameters {
- byte[] separators = DefaultSeparators;
- String nullString;
- Text nullSequence;
- TypeInfo rowTypeInfo;
- boolean lastColumnTakesRest;
- List<String> columnNames;
- List<TypeInfo> columnTypes;
-
- boolean escaped;
- byte escapeChar;
- boolean[] needsEscape;
-
- boolean extendedBooleanLiteral;
- List<String> timestampFormats;
-
- public SerDeParameters() {
- }
-
- public List<TypeInfo> getColumnTypes() {
- return columnTypes;
- }
-
- public List<String> getColumnNames() {
- return columnNames;
- }
-
- public byte[] getSeparators() {
- return separators;
- }
-
- public String getNullString() {
- return nullString;
- }
-
- public Text getNullSequence() {
- return nullSequence;
- }
-
- public TypeInfo getRowTypeInfo() {
- return rowTypeInfo;
- }
-
- public boolean isLastColumnTakesRest() {
- return lastColumnTakesRest;
- }
-
- public boolean isEscaped() {
- return escaped;
- }
-
- public byte getEscapeChar() {
- return escapeChar;
- }
-
- public boolean[] getNeedsEscape() {
- return needsEscape;
- }
-
- public boolean isExtendedBooleanLiteral() {
- return extendedBooleanLiteral;
- }
-
- public List<String> getTimestampFormats() {
- return timestampFormats;
- }
- }
-
- SerDeParameters serdeParams = null;
-
- /**
* Initialize the SerDe given the parameters. serialization.format: separator
* char or byte code (only supports byte-value up to 127) columns:
* ","-separated column names columns.types: ",", ":", or ";"-separated column
@@ -216,8 +122,7 @@ public class LazySimpleSerDe extends Abs
super.initialize(job, tbl);
- serdeParams = LazySimpleSerDe.initSerdeParams(job, tbl, getClass()
- .getName());
+ serdeParams = new LazySerDeParameters(job, tbl, getClass().getName());
// Create the ObjectInspectors for the fields
cachedObjectInspector = LazyFactory.createLazyStructInspector(serdeParams
@@ -227,10 +132,10 @@ public class LazySimpleSerDe extends Abs
.createLazyObject(cachedObjectInspector);
LOG.debug(getClass().getName() + " initialized with: columnNames="
- + serdeParams.columnNames + " columnTypes=" + serdeParams.columnTypes
- + " separator=" + Arrays.asList(serdeParams.separators)
- + " nullstring=" + serdeParams.nullString + " lastColumnTakesRest="
- + serdeParams.lastColumnTakesRest + " timestampFormats=" + serdeParams.timestampFormats);
+ + serdeParams.getColumnNames() + " columnTypes=" + serdeParams.getColumnTypes()
+ + " separator=" + Arrays.asList(serdeParams.getSeparators())
+ + " nullstring=" + serdeParams.getNullString() + " lastColumnTakesRest="
+ + serdeParams.isLastColumnTakesRest() + " timestampFormats=" + serdeParams.getTimestampFormats());
serializedSize = 0;
stats = new SerDeStats();
@@ -238,115 +143,6 @@ public class LazySimpleSerDe extends Abs
lastOperationDeserialize = false;
}
- public static SerDeParameters initSerdeParams(Configuration job,
- Properties tbl, String serdeName) throws SerDeException {
- SerDeParameters serdeParams = new SerDeParameters();
- // Read the separators: We use 8 levels of separators by default,
- // and 24 if SERIALIZATION_EXTEND_NESTING_LEVELS is set to true
- // The levels possible are the set of control chars that we can use as
- // special delimiters, ie they should absent in the data or escaped.
- // To increase this level further, we need to stop relying
- // on single control chars delimiters
-
- serdeParams.separators = new byte[8];
- serdeParams.separators[0] = getByte(tbl.getProperty(serdeConstants.FIELD_DELIM,
- tbl.getProperty(serdeConstants.SERIALIZATION_FORMAT)), DefaultSeparators[0]);
- serdeParams.separators[1] = getByte(tbl
- .getProperty(serdeConstants.COLLECTION_DELIM), DefaultSeparators[1]);
- serdeParams.separators[2] = getByte(
- tbl.getProperty(serdeConstants.MAPKEY_DELIM), DefaultSeparators[2]);
- String extendedNesting =
- tbl.getProperty(SERIALIZATION_EXTEND_NESTING_LEVELS);
- if(extendedNesting == null || !extendedNesting.equalsIgnoreCase("true")){
- //use the default smaller set of separators for backward compatibility
- for (int i = 3; i < serdeParams.separators.length; i++) {
- serdeParams.separators[i] = (byte) (i + 1);
- }
- }
- else{
- //If extended nesting is enabled, set the extended set of separator chars
-
- final int MAX_CTRL_CHARS = 29;
- byte[] extendedSeparators = new byte[MAX_CTRL_CHARS];
- int extendedSeparatorsIdx = 0;
-
- //get the first 3 separators that have already been set (defaults to 1,2,3)
- for(int i = 0; i < 3; i++){
- extendedSeparators[extendedSeparatorsIdx++] = serdeParams.separators[i];
- }
-
- for (byte asciival = 4; asciival <= MAX_CTRL_CHARS; asciival++) {
-
- //use only control chars that are very unlikely to be part of the string
- // the following might/likely to be used in text files for strings
- // 9 (horizontal tab, HT, \t, ^I)
- // 10 (line feed, LF, \n, ^J),
- // 12 (form feed, FF, \f, ^L),
- // 13 (carriage return, CR, \r, ^M),
- // 27 (escape, ESC, \e [GCC only], ^[).
-
- //reserving the following values for future dynamic level impl
- // 30
- // 31
-
- switch(asciival){
- case 9:
- case 10:
- case 12:
- case 13:
- case 27:
- continue;
- }
- extendedSeparators[extendedSeparatorsIdx++] = asciival;
- }
-
- serdeParams.separators =
- Arrays.copyOfRange(extendedSeparators, 0, extendedSeparatorsIdx);
- }
-
- serdeParams.nullString = tbl.getProperty(
- serdeConstants.SERIALIZATION_NULL_FORMAT, "\\N");
- serdeParams.nullSequence = new Text(serdeParams.nullString);
-
- String lastColumnTakesRestString = tbl
- .getProperty(serdeConstants.SERIALIZATION_LAST_COLUMN_TAKES_REST);
- serdeParams.lastColumnTakesRest = (lastColumnTakesRestString != null && lastColumnTakesRestString
- .equalsIgnoreCase("true"));
-
- LazyUtils.extractColumnInfo(tbl, serdeParams, serdeName);
-
- // Create the LazyObject for storing the rows
- serdeParams.rowTypeInfo = TypeInfoFactory.getStructTypeInfo(
- serdeParams.columnNames, serdeParams.columnTypes);
-
- // Get the escape information
- String escapeProperty = tbl.getProperty(serdeConstants.ESCAPE_CHAR);
- serdeParams.escaped = (escapeProperty != null);
- if (serdeParams.escaped) {
- serdeParams.escapeChar = getByte(escapeProperty, (byte) '\\');
- }
- if (serdeParams.escaped) {
- serdeParams.needsEscape = new boolean[128];
- for (int i = 0; i < 128; i++) {
- serdeParams.needsEscape[i] = false;
- }
- serdeParams.needsEscape[serdeParams.escapeChar] = true;
- for (int i = 0; i < serdeParams.separators.length; i++) {
- serdeParams.needsEscape[serdeParams.separators[i]] = true;
- }
- }
-
- serdeParams.extendedBooleanLiteral = job == null ? false :
- job.getBoolean(ConfVars.HIVE_LAZYSIMPLE_EXTENDED_BOOLEAN_LITERAL.varname, false);
-
- String[] timestampFormatsArray =
- HiveStringUtils.splitAndUnEscape(tbl.getProperty(serdeConstants.TIMESTAMP_FORMATS));
- if (timestampFormatsArray != null) {
- serdeParams.timestampFormats = Arrays.asList(timestampFormatsArray);
- }
- return serdeParams;
- }
-
// The object for storing row data
LazyStruct cachedLazyStruct;
@@ -420,7 +216,7 @@ public class LazySimpleSerDe extends Abs
StructObjectInspector soi = (StructObjectInspector) objInspector;
List<? extends StructField> fields = soi.getAllStructFieldRefs();
List<Object> list = soi.getStructFieldsDataAsList(obj);
- List<? extends StructField> declaredFields = (serdeParams.rowTypeInfo != null && ((StructTypeInfo) serdeParams.rowTypeInfo)
+ List<? extends StructField> declaredFields = (serdeParams.getRowTypeInfo() != null && ((StructTypeInfo) serdeParams.getRowTypeInfo())
.getAllStructFieldNames().size() > 0) ? ((StructObjectInspector) getObjectInspector())
.getAllStructFieldRefs()
: null;
@@ -432,7 +228,7 @@ public class LazySimpleSerDe extends Abs
for (int i = 0; i < fields.size(); i++) {
// Append the separator if needed.
if (i > 0) {
- serializeStream.write(serdeParams.separators[0]);
+ serializeStream.write(serdeParams.getSeparators()[0]);
}
// Get the field objectInspector and the field object.
ObjectInspector foi = fields.get(i).getFieldObjectInspector();
@@ -441,7 +237,7 @@ public class LazySimpleSerDe extends Abs
if (declaredFields != null && i >= declaredFields.size()) {
throw new SerDeException("Error: expecting " + declaredFields.size()
+ " but asking for field " + i + "\n" + "data=" + obj + "\n"
- + "tableType=" + serdeParams.rowTypeInfo.toString() + "\n"
+ + "tableType=" + serdeParams.getRowTypeInfo().toString() + "\n"
+ "dataType="
+ TypeInfoUtils.getTypeInfoFromObjectInspector(objInspector));
}
@@ -460,10 +256,10 @@ public class LazySimpleSerDe extends Abs
}
protected void serializeField(ByteStream.Output out, Object obj, ObjectInspector objInspector,
- SerDeParameters serdeParams) throws SerDeException {
+ LazySerDeParameters serdeParams) throws SerDeException {
try {
- serialize(out, obj, objInspector, serdeParams.separators, 1, serdeParams.nullSequence,
- serdeParams.escaped, serdeParams.escapeChar, serdeParams.needsEscape);
+ serialize(out, obj, objInspector, serdeParams.getSeparators(), 1, serdeParams.getNullSequence(),
+ serdeParams.isEscaped(), serdeParams.getEscapeChar(), serdeParams.getNeedsEscape());
} catch (IOException e) {
throw new SerDeException(e);
}
@@ -489,9 +285,7 @@ public class LazySimpleSerDe extends Abs
* @param escapeChar
* Which char to use as the escape char, e.g. '\\'
* @param needsEscape
- * Which chars needs to be escaped. This array should have size of
- * 128. Negative byte values (or byte values >= 128) are never
- * escaped.
+ * Which byte needs to be escaped for 256 bytes.
* @throws IOException
* @throws SerDeException
*/
Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java (original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java Tue Feb 17 06:49:27 2015
@@ -23,16 +23,13 @@ import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Properties;
+import java.util.Map;
import org.apache.commons.codec.binary.Base64;
-import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.io.HiveCharWritable;
import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
-import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.SerDeParameters;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.BinaryObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.BooleanObjectInspector;
@@ -48,7 +45,6 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.primitive.ShortObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampObjectInspector;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Text;
@@ -140,10 +136,10 @@ public final class LazyUtils {
* @param escaped
* Whether the data should be written out in an escaped way.
* @param escapeChar
- * if escaped, the char for prefixing special characters.
+ * If escaped, the char for prefixing special characters.
* @param needsEscape
- * if escaped, whether a specific character needs escaping. This
- * array should have size of 128.
+ * If escaped, whether a specific character needs escaping. This
+ * array should have size of 256.
*/
public static void writeEscaped(OutputStream out, byte[] bytes, int start,
int len, boolean escaped, byte escapeChar, boolean[] needsEscape)
@@ -151,7 +147,7 @@ public final class LazyUtils {
if (escaped) {
int end = start + len;
for (int i = start; i <= end; i++) {
- if (i == end || (bytes[i] >= 0 && needsEscape[bytes[i]])) {
+ if (i == end || needsEscape[bytes[i] & 0xFF]) { // Converts negative byte to positive index
if (i > start) {
out.write(bytes, start, i - start);
}
@@ -176,8 +172,7 @@ public final class LazyUtils {
* @param o
* The primitive Object
* @param needsEscape
- * Whether a character needs escaping. This array should have size of
- * 128.
+ * Whether a character needs escaping.
*/
public static void writePrimitiveUTF8(OutputStream out, Object o,
PrimitiveObjectInspector oi, boolean escaped, byte escapeChar,
@@ -341,42 +336,7 @@ public final class LazyUtils {
return hash;
}
- public static void extractColumnInfo(Properties tbl, SerDeParameters serdeParams,
- String serdeName) throws SerDeException {
- // Read the configuration parameters
- String columnNameProperty = tbl.getProperty(serdeConstants.LIST_COLUMNS);
- // NOTE: if "columns.types" is missing, all columns will be of String type
- String columnTypeProperty = tbl.getProperty(serdeConstants.LIST_COLUMN_TYPES);
- // Parse the configuration parameters
-
- if (columnNameProperty != null && columnNameProperty.length() > 0) {
- serdeParams.columnNames = Arrays.asList(columnNameProperty.split(","));
- } else {
- serdeParams.columnNames = new ArrayList<String>();
- }
- if (columnTypeProperty == null) {
- // Default type: all string
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < serdeParams.columnNames.size(); i++) {
- if (i > 0) {
- sb.append(":");
- }
- sb.append(serdeConstants.STRING_TYPE_NAME);
- }
- columnTypeProperty = sb.toString();
- }
-
- serdeParams.columnTypes = TypeInfoUtils
- .getTypeInfosFromTypeString(columnTypeProperty);
-
- if (serdeParams.columnNames.size() != serdeParams.columnTypes.size()) {
- throw new SerDeException(serdeName + ": columns has "
- + serdeParams.columnNames.size()
- + " elements while columns.types has "
- + serdeParams.columnTypes.size() + " elements!");
- }
- }
/**
* gets a byte[] with copy of data from source BytesWritable
@@ -404,10 +364,15 @@ public final class LazyUtils {
String msg = "Number of levels of nesting supported for " +
"LazySimpleSerde is " + (separators.length - 1) +
" Unable to work with level " + level;
+
+ String txt = ". Use %s serde property for tables using LazySimpleSerde.";
+
if(separators.length < 9){
- msg += ". Use " + LazySimpleSerDe.SERIALIZATION_EXTEND_NESTING_LEVELS +
- " serde property for tables using LazySimpleSerde.";
+ msg += String.format(txt, LazySerDeParameters.SERIALIZATION_EXTEND_NESTING_LEVELS);
+ } else if (separators.length < 25) {
+ msg += String.format(txt, LazySerDeParameters.SERIALIZATION_EXTEND_ADDITIONAL_NESTING_LEVELS);
}
+
throw new SerDeException(msg, e);
}
}
@@ -450,6 +415,26 @@ public final class LazyUtils {
}
}
+ /**
+ * Return the byte value of the number string.
+ *
+ * @param altValue
+ * The string containing a number.
+ * @param defaultVal
+ * If the altValue does not represent a number, return the
+ * defaultVal.
+ */
+ public static byte getByte(String altValue, byte defaultVal) {
+ if (altValue != null && altValue.length() > 0) {
+ try {
+ return Byte.valueOf(altValue).byteValue();
+ } catch (NumberFormatException e) {
+ return (byte) altValue.charAt(0);
+ }
+ }
+ return defaultVal;
+ }
+
private LazyUtils() {
// prevent instantiation
}
Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryArray.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryArray.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryArray.java (original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryArray.java Tue Feb 17 06:49:27 2015
@@ -214,7 +214,7 @@ public class LazyBinaryArray extends
/**
* cachedList is reused every time getList is called. Different
- * LazyBianryArray instances cannot share the same cachedList.
+ * LazyBinaryArray instances cannot share the same cachedList.
*/
ArrayList<Object> cachedList;
Modified: hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyArrayMapStruct.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyArrayMapStruct.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyArrayMapStruct.java (original)
+++ hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazyArrayMapStruct.java Tue Feb 17 06:49:27 2015
@@ -638,7 +638,7 @@ public class TestLazyArrayMapStruct exte
private void testNestedinArrayAtLevelExtended(int nestingLevel,
ObjectInspector.Category dtype) throws SerDeException {
Properties tableProp = new Properties();
- tableProp.setProperty(LazySimpleSerDe.SERIALIZATION_EXTEND_NESTING_LEVELS, "true");
+ tableProp.setProperty(LazySerDeParameters.SERIALIZATION_EXTEND_NESTING_LEVELS, "true");
testNestedinArrayAtLevel(nestingLevel, dtype, tableProp);
}
@@ -693,9 +693,10 @@ public class TestLazyArrayMapStruct exte
tableProp.setProperty("columns", "narray");
tableProp.setProperty("columns.types", schema.toString());
SerDeUtils.initializeSerDe(serDe, conf, tableProp, null);
-
+ LazySerDeParameters serdeParams = new LazySerDeParameters(conf, tableProp, LazySimpleSerDe.class.getName());
+
//create the serialized string for type
- byte[] separators = serDe.serdeParams.getSeparators();
+ byte[] separators = serdeParams.getSeparators();
System.err.println("Using separator " + (char)separators[nestingLevel]);
byte [] serializedRow = null;
switch(dtype){
Modified: hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java (original)
+++ hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java Tue Feb 17 06:49:27 2015
@@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hive.serde2.lazy;
+import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -25,13 +27,20 @@ import junit.framework.TestCase;
import org.apache.commons.codec.binary.Base64;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.ByteStream;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeUtils;
import org.apache.hadoop.hive.serde2.io.ByteWritable;
import org.apache.hadoop.hive.serde2.io.DoubleWritable;
import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+import org.apache.hadoop.hive.serde2.objectinspector.SimpleMapEqualComparer;
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions;
+import org.apache.hadoop.hive.serde2.objectinspector.TestSimpleMapEqualComparer.TextStringMapHolder;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
@@ -79,41 +88,7 @@ public class TestLazySimpleSerDe extends
}
}
- private void deserializeAndSerialize(LazySimpleSerDe serDe, Text t, String s,
- Object[] expectedFieldsData) throws SerDeException {
- // Get the row structure
- StructObjectInspector oi = (StructObjectInspector) serDe
- .getObjectInspector();
- List<? extends StructField> fieldRefs = oi.getAllStructFieldRefs();
- assertEquals(expectedFieldsData.length, fieldRefs.size());
- // Deserialize
- Object row = serDe.deserialize(t);
- for (int i = 0; i < fieldRefs.size(); i++) {
- Object fieldData = oi.getStructFieldData(row, fieldRefs.get(i));
- if (fieldData != null) {
- fieldData = ((LazyPrimitive) fieldData).getWritableObject();
- }
- assertEquals("Field " + i, expectedFieldsData[i], fieldData);
- }
- // Serialize
- assertEquals(Text.class, serDe.getSerializedClass());
- Text serializedText = (Text) serDe.serialize(row, oi);
- assertEquals("Serialized data", s, serializedText.toString());
- }
-
- private Properties createProperties() {
- Properties tbl = new Properties();
-
- // Set the configuration parameters
- tbl.setProperty(serdeConstants.SERIALIZATION_FORMAT, "9");
- tbl.setProperty("columns",
- "abyte,ashort,aint,along,adouble,astring,anullint,anullstring");
- tbl.setProperty("columns.types",
- "tinyint:smallint:int:bigint:double:string:int:string");
- tbl.setProperty(serdeConstants.SERIALIZATION_NULL_FORMAT, "NULL");
- return tbl;
- }
/**
* Test the LazySimpleSerDe class with LastColumnTakesRest option.
@@ -199,5 +174,53 @@ public class TestLazySimpleSerDe extends
throw e;
}
}
+
+ Object serializeAndDeserialize(List<Integer> o1, StructObjectInspector oi1,
+ LazySimpleSerDe serde,
+ LazySerDeParameters serdeParams) throws IOException, SerDeException {
+ ByteStream.Output serializeStream = new ByteStream.Output();
+ LazySimpleSerDe.serialize(serializeStream, o1, oi1, serdeParams
+ .getSeparators(), 0, serdeParams.getNullSequence(), serdeParams
+ .isEscaped(), serdeParams.getEscapeChar(), serdeParams
+ .getNeedsEscape());
+ Text t = new Text(serializeStream.toByteArray());
+ return serde.deserialize(t);
+ }
+
+
+ private void deserializeAndSerialize(LazySimpleSerDe serDe, Text t, String s,
+ Object[] expectedFieldsData) throws SerDeException {
+ // Get the row structure
+ StructObjectInspector oi = (StructObjectInspector) serDe
+ .getObjectInspector();
+ List<? extends StructField> fieldRefs = oi.getAllStructFieldRefs();
+ assertEquals(expectedFieldsData.length, fieldRefs.size());
+
+ // Deserialize
+ Object row = serDe.deserialize(t);
+ for (int i = 0; i < fieldRefs.size(); i++) {
+ Object fieldData = oi.getStructFieldData(row, fieldRefs.get(i));
+ if (fieldData != null) {
+ fieldData = ((LazyPrimitive) fieldData).getWritableObject();
+ }
+ assertEquals("Field " + i, expectedFieldsData[i], fieldData);
+ }
+ // Serialize
+ assertEquals(Text.class, serDe.getSerializedClass());
+ Text serializedText = (Text) serDe.serialize(row, oi);
+ assertEquals("Serialized data", s, serializedText.toString());
+ }
+ private Properties createProperties() {
+ Properties tbl = new Properties();
+
+ // Set the configuration parameters
+ tbl.setProperty(serdeConstants.SERIALIZATION_FORMAT, "9");
+ tbl.setProperty("columns",
+ "abyte,ashort,aint,along,adouble,astring,anullint,anullstring");
+ tbl.setProperty("columns.types",
+ "tinyint:smallint:int:bigint:double:string:int:string");
+ tbl.setProperty(serdeConstants.SERIALIZATION_NULL_FORMAT, "NULL");
+ return tbl;
+ }
}
Modified: hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestCrossMapEqualComparer.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestCrossMapEqualComparer.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestCrossMapEqualComparer.java (original)
+++ hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestCrossMapEqualComparer.java Tue Feb 17 06:49:27 2015
@@ -28,7 +28,7 @@ import org.apache.hadoop.hive.serde2.Byt
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeUtils;
import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe;
-import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.SerDeParameters;
+import org.apache.hadoop.hive.serde2.lazy.LazySerDeParameters;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions;
import org.apache.hadoop.io.Text;
@@ -78,7 +78,7 @@ public class TestCrossMapEqualComparer e
Object serializeAndDeserialize(TextStringMapHolder o1, StructObjectInspector oi1,
LazySimpleSerDe serde,
- SerDeParameters serdeParams) throws IOException, SerDeException {
+ LazySerDeParameters serdeParams) throws IOException, SerDeException {
ByteStream.Output serializeStream = new ByteStream.Output();
LazySimpleSerDe.serialize(serializeStream, o1, oi1, serdeParams
.getSeparators(), 0, serdeParams.getNullSequence(), serdeParams
@@ -99,8 +99,7 @@ public class TestCrossMapEqualComparer e
Properties tbl = new Properties();
tbl.setProperty(serdeConstants.LIST_COLUMNS, ObjectInspectorUtils.getFieldNames(oi1));
tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES, ObjectInspectorUtils.getFieldTypes(oi1));
- SerDeParameters serdeParams = LazySimpleSerDe.initSerdeParams(conf, tbl,
- LazySimpleSerDe.class.getName());
+ LazySerDeParameters serdeParams = new LazySerDeParameters(conf, tbl, LazySimpleSerDe.class.getName());
SerDeUtils.initializeSerDe(serde, conf, tbl, null);
ObjectInspector oi2 = serde.getObjectInspector();
@@ -132,7 +131,7 @@ public class TestCrossMapEqualComparer e
Object serializeAndDeserialize(StringTextMapHolder o1, StructObjectInspector oi1,
LazySimpleSerDe serde,
- SerDeParameters serdeParams) throws IOException, SerDeException {
+ LazySerDeParameters serdeParams) throws IOException, SerDeException {
ByteStream.Output serializeStream = new ByteStream.Output();
LazySimpleSerDe.serialize(serializeStream, o1, oi1, serdeParams
.getSeparators(), 0, serdeParams.getNullSequence(), serdeParams
@@ -153,8 +152,7 @@ public class TestCrossMapEqualComparer e
Properties tbl = new Properties();
tbl.setProperty(serdeConstants.LIST_COLUMNS, ObjectInspectorUtils.getFieldNames(oi1));
tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES, ObjectInspectorUtils.getFieldTypes(oi1));
- SerDeParameters serdeParams = LazySimpleSerDe.initSerdeParams(conf, tbl,
- LazySimpleSerDe.class.getName());
+ LazySerDeParameters serdeParams = new LazySerDeParameters(conf, tbl, LazySimpleSerDe.class.getName());
SerDeUtils.initializeSerDe(serde, conf, tbl, null);
ObjectInspector oi2 = serde.getObjectInspector();
Modified: hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestSimpleMapEqualComparer.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestSimpleMapEqualComparer.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestSimpleMapEqualComparer.java (original)
+++ hive/branches/spark/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestSimpleMapEqualComparer.java Tue Feb 17 06:49:27 2015
@@ -28,7 +28,7 @@ import org.apache.hadoop.hive.serde2.Byt
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeUtils;
import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe;
-import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.SerDeParameters;
+import org.apache.hadoop.hive.serde2.lazy.LazySerDeParameters;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions;
import org.apache.hadoop.io.Text;
@@ -78,7 +78,7 @@ public class TestSimpleMapEqualComparer
Object serializeAndDeserialize(TextStringMapHolder o1, StructObjectInspector oi1,
LazySimpleSerDe serde,
- SerDeParameters serdeParams) throws IOException, SerDeException {
+ LazySerDeParameters serdeParams) throws IOException, SerDeException {
ByteStream.Output serializeStream = new ByteStream.Output();
LazySimpleSerDe.serialize(serializeStream, o1, oi1, serdeParams
.getSeparators(), 0, serdeParams.getNullSequence(), serdeParams
@@ -99,8 +99,7 @@ public class TestSimpleMapEqualComparer
Properties tbl = new Properties();
tbl.setProperty(serdeConstants.LIST_COLUMNS, ObjectInspectorUtils.getFieldNames(oi1));
tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES, ObjectInspectorUtils.getFieldTypes(oi1));
- SerDeParameters serdeParams = LazySimpleSerDe.initSerdeParams(conf, tbl,
- LazySimpleSerDe.class.getName());
+ LazySerDeParameters serdeParams = new LazySerDeParameters(conf, tbl, LazySimpleSerDe.class.getName());
SerDeUtils.initializeSerDe(serde, conf, tbl, null);
ObjectInspector oi2 = serde.getObjectInspector();
@@ -132,7 +131,7 @@ public class TestSimpleMapEqualComparer
Object serializeAndDeserialize(StringTextMapHolder o1, StructObjectInspector oi1,
LazySimpleSerDe serde,
- SerDeParameters serdeParams) throws IOException, SerDeException {
+ LazySerDeParameters serdeParams) throws IOException, SerDeException {
ByteStream.Output serializeStream = new ByteStream.Output();
LazySimpleSerDe.serialize(serializeStream, o1, oi1, serdeParams
.getSeparators(), 0, serdeParams.getNullSequence(), serdeParams
@@ -153,8 +152,7 @@ public class TestSimpleMapEqualComparer
Properties tbl = new Properties();
tbl.setProperty(serdeConstants.LIST_COLUMNS, ObjectInspectorUtils.getFieldNames(oi1));
tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES, ObjectInspectorUtils.getFieldTypes(oi1));
- SerDeParameters serdeParams = LazySimpleSerDe.initSerdeParams(conf, tbl,
- LazySimpleSerDe.class.getName());
+ LazySerDeParameters serdeParams = new LazySerDeParameters(conf, tbl, LazySimpleSerDe.class.getName());
SerDeUtils.initializeSerDe(serde, conf, tbl, null);
ObjectInspector oi2 = serde.getObjectInspector();
Modified: hive/branches/spark/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java (original)
+++ hive/branches/spark/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java Tue Feb 17 06:49:27 2015
@@ -18,7 +18,6 @@
package org.apache.hive.service.auth;
import java.io.IOException;
-import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
@@ -33,6 +32,9 @@ import javax.security.sasl.Sasl;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
+import org.apache.hadoop.hive.metastore.HiveMetaStore;
+import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
+import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.shims.HadoopShims.KerberosNameShim;
import org.apache.hadoop.hive.shims.ShimLoader;
import org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge;
@@ -108,8 +110,11 @@ public class HiveAuthFactory {
conf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL));
// start delegation token manager
try {
- saslServer.startDelegationTokenSecretManager(conf, null, ServerMode.HIVESERVER2);
- } catch (IOException e) {
+ HMSHandler baseHandler = new HiveMetaStore.HMSHandler(
+ "new db based metaserver", conf, true);
+ saslServer.startDelegationTokenSecretManager(conf, baseHandler.getMS(), ServerMode.HIVESERVER2);
+ }
+ catch (MetaException|IOException e) {
throw new TTransportException("Failed to start token manager", e);
}
}
Modified: hive/branches/spark/service/src/java/org/apache/hive/service/cli/CLIService.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/service/src/java/org/apache/hive/service/cli/CLIService.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/service/src/java/org/apache/hive/service/cli/CLIService.java (original)
+++ hive/branches/spark/service/src/java/org/apache/hive/service/cli/CLIService.java Tue Feb 17 06:49:27 2015
@@ -77,11 +77,6 @@ public class CLIService extends Composit
@Override
public synchronized void init(HiveConf hiveConf) {
- try {
- applyAuthorizationConfigPolicy(hiveConf);
- } catch (HiveException e) {
- throw new RuntimeException("Error applying authorization policy on hive configuration", e);
- }
this.hiveConf = hiveConf;
sessionManager = new SessionManager(hiveServer2);
addService(sessionManager);
@@ -111,6 +106,12 @@ public class CLIService extends Composit
}
}
}
+ // creates connection to HMS and thus *must* occur after kerberos login above
+ try {
+ applyAuthorizationConfigPolicy(hiveConf);
+ } catch (HiveException e) {
+ throw new RuntimeException("Error applying authorization policy on hive configuration", e);
+ }
setupBlockedUdfs();
super.init(hiveConf);
}
Modified: hive/branches/spark/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java (original)
+++ hive/branches/spark/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java Tue Feb 17 06:49:27 2015
@@ -30,6 +30,7 @@ import java.util.Properties;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
+import org.apache.commons.codec.binary.Base64;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.Schema;
@@ -92,6 +93,14 @@ public class SQLOperation extends Execut
try {
driver = new Driver(sqlOperationConf, getParentSession().getUserName());
+
+ // set the operation handle information in Driver, so that thrift API users
+ // can use the operation handle they receive, to lookup query information in
+ // Yarn ATS
+ String guid64 = Base64.encodeBase64URLSafeString(getHandle().getHandleIdentifier()
+ .toTHandleIdentifier().getGuid()).trim();
+ driver.setOperationId(guid64);
+
// In Hive server mode, we are not able to retry in the FetchTask
// case, when calling fetch queries since execute() has returned.
// For now, we disable the test attempts.
Modified: hive/branches/spark/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java (original)
+++ hive/branches/spark/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java Tue Feb 17 06:49:27 2015
@@ -20,7 +20,7 @@ package org.apache.hive.service.cli.thri
import java.util.Arrays;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -63,9 +63,10 @@ public class ThriftHttpCLIService extend
httpServer = new org.eclipse.jetty.server.Server();
// Server thread pool
+ // Start with minWorkerThreads, expand till maxWorkerThreads and reject subsequent requests
String threadPoolName = "HiveServer2-HttpHandler-Pool";
ExecutorService executorService = new ThreadPoolExecutor(minWorkerThreads, maxWorkerThreads,
- workerKeepAliveTime, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
+ workerKeepAliveTime, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
new ThreadFactoryWithGarbageCleanup(threadPoolName));
ExecutorThreadPool threadPool = new ExecutorThreadPool(executorService);
httpServer.setThreadPool(threadPool);
Modified: hive/branches/spark/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java (original)
+++ hive/branches/spark/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java Tue Feb 17 06:49:27 2015
@@ -39,6 +39,7 @@ import org.apache.commons.lang.StringUti
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.crypto.key.KeyProvider;
import org.apache.hadoop.crypto.key.KeyProvider.Options;
+import org.apache.hadoop.crypto.key.KeyProviderCryptoExtension;
import org.apache.hadoop.crypto.key.KeyProviderFactory;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.DefaultFileAccess;
@@ -495,8 +496,10 @@ public class Hadoop23Shims extends Hadoo
// Need to set the client's KeyProvider to the NN's for JKS,
// else the updates do not get flushed properly
- miniDFSCluster.getFileSystem().getClient().setKeyProvider(
- miniDFSCluster.getNameNode().getNamesystem().getProvider());
+ KeyProviderCryptoExtension keyProvider = miniDFSCluster.getNameNode().getNamesystem().getProvider();
+ if (keyProvider != null) {
+ miniDFSCluster.getFileSystem().getClient().setKeyProvider(keyProvider);
+ }
cluster = new MiniDFSShim(miniDFSCluster);
return cluster;
Modified: hive/branches/spark/shims/common/src/main/java/org/apache/hadoop/hive/shims/Utils.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/shims/common/src/main/java/org/apache/hadoop/hive/shims/Utils.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/shims/common/src/main/java/org/apache/hadoop/hive/shims/Utils.java (original)
+++ hive/branches/spark/shims/common/src/main/java/org/apache/hadoop/hive/shims/Utils.java Tue Feb 17 06:49:27 2015
@@ -26,7 +26,6 @@ import javax.security.auth.login.AppConf
import javax.security.auth.login.LoginException;
import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.thrift.DelegationTokenIdentifier;
import org.apache.hadoop.hive.thrift.DelegationTokenSelector;
import org.apache.hadoop.io.Text;
Modified: hive/branches/spark/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientImpl.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientImpl.java?rev=1660293&r1=1660292&r2=1660293&view=diff
==============================================================================
--- hive/branches/spark/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientImpl.java (original)
+++ hive/branches/spark/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientImpl.java Tue Feb 17 06:49:27 2015
@@ -63,6 +63,8 @@ class SparkClientImpl implements SparkCl
private static final long DEFAULT_SHUTDOWN_TIMEOUT = 10000; // In milliseconds
private static final String OSX_TEST_OPTS = "SPARK_OSX_TEST_OPTS";
+ private static final String SPARK_HOME_ENV = "SPARK_HOME";
+ private static final String SPARK_HOME_KEY = "spark.home";
private static final String DRIVER_OPTS_KEY = "spark.driver.extraJavaOptions";
private static final String EXECUTOR_OPTS_KEY = "spark.executor.extraJavaOptions";
private static final String DRIVER_EXTRA_CLASSPATH = "spark.driver.extraClassPath";
@@ -211,9 +213,12 @@ class SparkClientImpl implements SparkCl
// If a Spark installation is provided, use the spark-submit script. Otherwise, call the
// SparkSubmit class directly, which has some caveats (like having to provide a proper
// version of Guava on the classpath depending on the deploy mode).
- String sparkHome = conf.get("spark.home");
+ String sparkHome = conf.get(SPARK_HOME_KEY);
if (sparkHome == null) {
- sparkHome = System.getProperty("spark.home");
+ sparkHome = System.getenv(SPARK_HOME_ENV);
+ }
+ if (sparkHome == null) {
+ sparkHome = System.getProperty(SPARK_HOME_KEY);
}
String sparkLogDir = conf.get("hive.spark.log.dir");
if (sparkLogDir == null) {