Index: serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java =================================================================== --- serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java (revision 1414513) +++ serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java (working copy) @@ -37,6 +37,7 @@ import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyShortObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyStringObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyTimestampObjectInspector; +import org.apache.hadoop.hive.serde2.lazy.LazyFactoryVoidException; import org.apache.hadoop.hive.serde2.lazydio.LazyDioBoolean; import org.apache.hadoop.hive.serde2.lazydio.LazyDioByte; import org.apache.hadoop.hive.serde2.lazydio.LazyDioDouble; @@ -112,6 +113,10 @@ return new LazyTimestamp((LazyTimestampObjectInspector) oi); case BINARY: return new LazyBinary((LazyBinaryObjectInspector) oi); + case VOID: + throw new LazyFactoryVoidException( + "Construct resulted in unsupported VOID data type. " + + "Please explicitly cast as a supported data type."); default: throw new RuntimeException("Internal error: no LazyObject for " + p); } Index: serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactoryVoidException.java =================================================================== --- serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactoryVoidException.java (revision 0) +++ serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactoryVoidException.java (working copy) @@ -0,0 +1,44 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.serde2.lazy; + +/** + * Generic exception class for VoidObject data type being returns. + * + */ + +public class LazyFactoryVoidException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public LazyFactoryVoidException() { + super(); + } + + public LazyFactoryVoidException(String message) { + super(message); + } + + public LazyFactoryVoidException(Throwable cause) { + super(cause); + } + + public LazyFactoryVoidException(String message, Throwable cause) { + super(message, cause); + } +} Index: ql/src/test/results/clientnegative/void_datatype_error.q.out =================================================================== --- ql/src/test/results/clientnegative/void_datatype_error.q.out (revision 0) +++ ql/src/test/results/clientnegative/void_datatype_error.q.out (working copy) @@ -0,0 +1,24 @@ +PREHOOK: query: drop table hive_test_src +PREHOOK: type: DROPTABLE +POSTHOOK: query: drop table hive_test_src +POSTHOOK: type: DROPTABLE +PREHOOK: query: drop table void_test_table +PREHOOK: type: DROPTABLE +POSTHOOK: query: drop table void_test_table +POSTHOOK: type: DROPTABLE +PREHOOK: query: create table hive_test_src (key string) +PREHOOK: type: CREATETABLE +POSTHOOK: query: create table hive_test_src (key string) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: default@hive_test_src +PREHOOK: query: load data local inpath '../data/files/smbbucket_1.rc' overwrite into table hive_test_src +PREHOOK: type: LOAD +PREHOOK: Output: default@hive_test_src +POSTHOOK: query: load data local inpath '../data/files/smbbucket_1.rc' overwrite into table hive_test_src +POSTHOOK: type: LOAD +POSTHOOK: Output: default@hive_test_src +PREHOOK: query: create table void_test_table as select key,null from hive_test_src +PREHOOK: type: CREATETABLE_AS_SELECT +PREHOOK: Input: default@hive_test_src +FAILED: Error in metadata: org.apache.hadoop.hive.serde2.lazy.LazyFactoryVoidException: Construct resulted in unsupported VOID data type. Please explicitly cast as a support data type. +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask Index: ql/src/test/queries/clientnegative/void_datatype_error.q =================================================================== --- ql/src/test/queries/clientnegative/void_datatype_error.q (revision 0) +++ ql/src/test/queries/clientnegative/void_datatype_error.q (working copy) @@ -0,0 +1,7 @@ +set hive.exec.mode.local.auto=true; +set hive.default.fileformat=RCFILE; +drop table hive_test_src; +drop table void_test_table; +create table hive_test_src (key string); +load data local inpath '../data/files/smbbucket_1.rc' overwrite into table hive_test_src; +create table void_test_table as select key,null from hive_test_src;