Skip to content

Commit 52c7d01

Browse files
committed
HIVE-29484: Addressed review comments
1 parent 4d670c1 commit 52c7d01

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

common/src/java/org/apache/hadoop/hive/conf/HiveConf.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,7 @@ public static enum ConfVars {
19931993
"org.apache.hadoop.hive.serde2.columnar.LazyBinaryColumnarSerDe," +
19941994
"org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe," +
19951995
"org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe," +
1996-
"org.apache.hadoop.hive.serde2.OpenCSVSerde," +
1997-
"org.apache.hadoop.hive.hbase.HBaseSerDe",
1996+
"org.apache.hadoop.hive.serde2.OpenCSVSerde",
19981997
"SerDes retrieving schema from metastore. This is an internal parameter."),
19991998

20001999
@Deprecated

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestStorageSchemaReader.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.hadoop.hive.metastore.api.Table;
2626
import org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder;
2727
import org.apache.hadoop.hive.metastore.client.builder.TableBuilder;
28+
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
2829
import org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat;
2930
import org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat;
3031
import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
@@ -60,6 +61,8 @@ public class TestStorageSchemaReader {
6061
@Before public void setUp() throws Exception {
6162
dbName = "sampleDb";
6263
hiveConf = new HiveConf(this.getClass());
64+
// Unset the deprecated HiveConf value so MetastoreConf uses its own default
65+
hiveConf.unset(HiveConf.ConfVars.SERDES_USING_METASTORE_FOR_SCHEMA.varname);
6366
new DatabaseBuilder().setName(dbName).create(new HiveMetaStoreClient(hiveConf), hiveConf);
6467
avroTableParams.put("avro.schema.literal",
6568
"{\"name\":\"nullable\", \"type\":\"record\", \"fields\":[{\"name\":\"id\", \"type\":\"int\"}, {\"name\":\"value\", \"type\":\"int\"}]}");
@@ -111,31 +114,31 @@ private void checkFields(List<FieldSchema> fieldSchemas, List<FieldSchema> field
111114
}
112115

113116
@Test public void testAvroTableWithDefaultSSR() throws Exception {
114-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
117+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
115118
String tblName = "avroTable";
116119
Table tbl = createTable(tblName, AvroSerDe.class.getName(), AvroContainerInputFormat.class.getName(),
117120
AvroContainerOutputFormat.class.getName(), avroTableParams, new HashMap<>());
118121
checkSchema(tblName, tbl);
119122
}
120123

121124
@Test public void testAvroTableWithSerdeSSR() throws Exception {
122-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
125+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
123126
String tblName = "avroTable";
124127
Table tbl = createTable(tblName, AvroSerDe.class.getName(), AvroContainerInputFormat.class.getName(),
125128
AvroContainerOutputFormat.class.getName(), avroTableParams, new HashMap<>());
126129
checkSchema(tblName, tbl);
127130
}
128131

129132
@Test public void testHbaseTableWithDefaultSSR() throws Exception {
130-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
133+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
131134
String tblName = "hbaseTable";
132135

133136
Table table = createTable(tblName, HBaseSerDe.class.getName(), null, null, hbaseTableParams, hbaseSerdeParams);
134137
checkSchema(tblName, table);
135138
}
136139

137140
@Test public void testHbaseTableWithSerdeSSR() throws Exception {
138-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
141+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
139142
String tblName = "hbaseTableSerde";
140143

141144
Table table =
@@ -144,23 +147,23 @@ private void checkFields(List<FieldSchema> fieldSchemas, List<FieldSchema> field
144147
}
145148

146149
@Test public void testJdbcTableWithDefaultSSR() throws Exception {
147-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
150+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
148151
String tblName = "jdbcTable";
149152

150153
createTable(tblName, JdbcSerDe.class.getName(), null, null, jdbcTableParams, jdbcSerdeParams);
151154
assertThrows("Storage schema reading not supported", MetaException.class, () -> client.getSchema(dbName, tblName));
152155
}
153156

154157
@Test public void testJdbcTableWithSerdeSSR() throws Exception {
155-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
158+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
156159
String tblName = "jdbcTable";
157160

158161
Table table = createTable(tblName, JdbcSerDe.class.getName(), null, null, jdbcTableParams, jdbcSerdeParams);
159162
checkSchema(tblName, table);
160163
}
161164

162165
@Test public void testOrcTableWithDefaultSSR() throws Exception {
163-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
166+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.DefaultStorageSchemaReader");
164167
String tblName = "orcTable2";
165168
Table tbl =
166169
createTable(tblName, OrcSerde.class.getName(), OrcInputFormat.class.getName(), OrcOutputFormat.class.getName(),
@@ -169,7 +172,7 @@ private void checkFields(List<FieldSchema> fieldSchemas, List<FieldSchema> field
169172
}
170173

171174
@Test public void testOrcTableWithSerdeSSR() throws Exception {
172-
hiveConf.set("metastore.storage.schema.reader.impl", "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
175+
MetastoreConf.setVar(hiveConf, MetastoreConf.ConfVars.STORAGE_SCHEMA_READER_IMPL, "org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader");
173176
String tblName = "orcTable";
174177
Table tbl =
175178
createTable(tblName, OrcSerde.class.getName(), OrcInputFormat.class.getName(), OrcOutputFormat.class.getName(),

0 commit comments

Comments
 (0)