Index: metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java =================================================================== --- metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java (revision 1151047) +++ metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java (working copy) @@ -675,7 +675,10 @@ if (parameters != null) { for (Entry e : parameters.entrySet()) { - schema.setProperty(e.getKey(), e.getValue()); + // add non-null parameters to the schema + if ( e.getValue() != null) { + schema.setProperty(e.getKey(), e.getValue()); + } } } Index: ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java (revision 1151047) +++ ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java (working copy) @@ -164,7 +164,7 @@ "at least one column must be specified for the table"); } if (!isView()) { - if (null == getDeserializer()) { + if (null == getDeserializerFromMetaStore()) { throw new HiveException("must specify a non-null serDe"); } if (null == getInputFormatClass()) { @@ -250,17 +250,21 @@ final public Deserializer getDeserializer() { if (deserializer == null) { - try { - deserializer = MetaStoreUtils.getDeserializer(Hive.get().getConf(), tTable); - } catch (MetaException e) { - throw new RuntimeException(e); - } catch (HiveException e) { - throw new RuntimeException(e); - } + deserializer = getDeserializerFromMetaStore(); } return deserializer; } + private Deserializer getDeserializerFromMetaStore() { + try { + return MetaStoreUtils.getDeserializer(Hive.get().getConf(), tTable); + } catch (MetaException e) { + throw new RuntimeException(e); + } catch (HiveException e) { + throw new RuntimeException(e); + } + } + public HiveStorageHandler getStorageHandler() { if (storageHandler != null) { return storageHandler; Index: ql/src/test/queries/clientnegative/alter_table_wrong_regex.q =================================================================== --- ql/src/test/queries/clientnegative/alter_table_wrong_regex.q (revision 0) +++ ql/src/test/queries/clientnegative/alter_table_wrong_regex.q (revision 0) @@ -0,0 +1,7 @@ +drop table aa; +create table aa ( test STRING ) + ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' + WITH SERDEPROPERTIES ("input.regex" = "(.*)", "output.format.string" = "$1s"); + +alter table aa set serdeproperties ("input.regex" = "[^\\](.*)", "output.format.string" = "$1s"); + Index: ql/src/test/queries/clientnegative/create_table_wrong_regex.q =================================================================== --- ql/src/test/queries/clientnegative/create_table_wrong_regex.q (revision 0) +++ ql/src/test/queries/clientnegative/create_table_wrong_regex.q (revision 0) @@ -0,0 +1,4 @@ +drop table aa; +create table aa ( test STRING ) + ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' + WITH SERDEPROPERTIES ("input.regex" = "[^\\](.*)", "output.format.string" = "$1s"); Index: ql/src/test/results/clientnegative/alter_table_wrong_regex.q.out =================================================================== --- ql/src/test/results/clientnegative/alter_table_wrong_regex.q.out (revision 0) +++ ql/src/test/results/clientnegative/alter_table_wrong_regex.q.out (revision 0) @@ -0,0 +1,21 @@ +PREHOOK: query: drop table aa +PREHOOK: type: DROPTABLE +POSTHOOK: query: drop table aa +POSTHOOK: type: DROPTABLE +PREHOOK: query: create table aa ( test STRING ) + ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' + WITH SERDEPROPERTIES ("input.regex" = "(.*)", "output.format.string" = "$1s") +PREHOOK: type: CREATETABLE +POSTHOOK: query: create table aa ( test STRING ) + ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' + WITH SERDEPROPERTIES ("input.regex" = "(.*)", "output.format.string" = "$1s") +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: default@aa +PREHOOK: query: alter table aa set serdeproperties ("input.regex" = "[^\\](.*)", "output.format.string" = "$1s") +PREHOOK: type: ALTERTABLE_SERDEPROPERTIES +PREHOOK: Input: default@aa +PREHOOK: Output: default@aa +Failed with exception Unclosed character class near index 7 +[^\](.*) + ^ +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask Index: ql/src/test/results/clientnegative/create_table_wrong_regex.q.out =================================================================== --- ql/src/test/results/clientnegative/create_table_wrong_regex.q.out (revision 0) +++ ql/src/test/results/clientnegative/create_table_wrong_regex.q.out (revision 0) @@ -0,0 +1,12 @@ +PREHOOK: query: drop table aa +PREHOOK: type: DROPTABLE +POSTHOOK: query: drop table aa +POSTHOOK: type: DROPTABLE +PREHOOK: query: create table aa ( test STRING ) + ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' + WITH SERDEPROPERTIES ("input.regex" = "[^\\](.*)", "output.format.string" = "$1s") +PREHOOK: type: CREATETABLE +FAILED: Error in metadata: java.util.regex.PatternSyntaxException: Unclosed character class near index 7 +[^\](.*) + ^ +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask