-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Option to Skip Link Check. This is helpful when going from clo…
…ud storage resources and not having to configure hms-mirror with credentials and libs for those storage environments.
- Loading branch information
Showing
5 changed files
with
127 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/com/cloudera/utils/hadoop/hms/util/StorageType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.cloudera.utils.hadoop.hms.util; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public enum StorageType { | ||
ORC("org.apache.hadoop.hive.ql.io.orc.OrcSerde","org.apache.hadoop.hive.ql.io.orc.OrcInputFormat", "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat"), | ||
TEXTFILE("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","org.apache.hadoop.mapred.TextInputFormat", "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"), | ||
SEQUENCEFILE("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","org.apache.hadoop.mapred.SequenceFileInputFormat", "org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat"), | ||
PARQUET("org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe","org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat", "org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat"), | ||
JSONFILE("org.apache.hadoop.hive.serde2.JsonSerDe","org.apache.hadoop.mapred.TextInputFormat","org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"), | ||
RCFILE("org.apache.hadoop.hive.serde2.columnar.LazyBinaryColumnarSerDe","org.apache.hadoop.hive.ql.io.RCFileInputFormat","org.apache.hadoop.hive.ql.io.RCFileOutputFormat"), | ||
AVRO("org.apache.hadoop.hive.serde2.avro.AvroSerDe","org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat", "org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat"), | ||
UNKNOWN("unknown", "unknown", "unknown"); | ||
|
||
private String rowFormatSerde; | ||
private String inputFormat; | ||
private String outputFormat; | ||
|
||
StorageType(String rowFormatSerde, String inputFormat, String outputFormat) { | ||
this.rowFormatSerde = rowFormatSerde; | ||
this.inputFormat = inputFormat; | ||
this.outputFormat = outputFormat; | ||
} | ||
|
||
public static StorageType from(String rowFormatSerde, String inputFormat) { | ||
StorageType rtn = UNKNOWN; | ||
// Remove Quotes if they exists. | ||
List<StorageType> storageTypeList = new ArrayList<StorageType>(); | ||
|
||
String inputFormatLcl = inputFormat; | ||
if (inputFormatLcl.startsWith("'")) { | ||
inputFormatLcl = inputFormat.substring(1, inputFormat.length() - 1); | ||
} | ||
String rowFormatSerdeLcl = rowFormatSerde; | ||
if (rowFormatSerdeLcl.startsWith("'")) { | ||
rowFormatSerdeLcl = rowFormatSerde.substring(1, rowFormatSerde.length() - 1); | ||
} | ||
if (rowFormatSerdeLcl != null) { | ||
for (StorageType storageType : StorageType.values()) { | ||
if (storageType.rowFormatSerde.equals(rowFormatSerdeLcl)) { | ||
storageTypeList.add(storageType); | ||
// rtn = storageType; | ||
// break; | ||
} | ||
} | ||
} | ||
|
||
for (StorageType storageType : storageTypeList) { | ||
if (storageType.inputFormat.equals(inputFormatLcl)) { | ||
rtn = storageType; | ||
break; | ||
} | ||
} | ||
return rtn; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters