Add a check to validate given subschema name in HiveSchema.getSubSchema()
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/0cbf6ad3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/0cbf6ad3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/0cbf6ad3 Branch: refs/heads/master Commit: 0cbf6ad30cc7f1dd2d751ba5d4d6d4e8dad5e09d Parents: e52d2b6 Author: vkorukanti <[email protected]> Authored: Mon Jul 14 08:19:29 2014 -0700 Committer: Jacques Nadeau <[email protected]> Committed: Sat Jul 26 21:40:57 2014 -0700 ---------------------------------------------------------------------- .../apache/drill/exec/store/hive/schema/HiveSchemaFactory.java | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0cbf6ad3/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java ---------------------------------------------------------------------- diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java index 7e6b92b..2f0b267 100644 --- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java +++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java @@ -194,6 +194,11 @@ public class HiveSchemaFactory implements SchemaFactory { public Schema getSubSchema(String name) { List<String> tables; try { + List<String> dbs = databases.get(DATABASES); + if (!dbs.contains(name)) { + logger.debug(String.format("Database '%s' doesn't exists in Hive storage '%s'", name, schemaName)); + return null; + } tables = tableNameLoader.get(name); HiveDatabaseSchema schema = new HiveDatabaseSchema(tables, this, name); if(name.equals("default")){
