This method attempts to return a singleton instance of the given exec type. Only works for MR ExecTypes as these are the only ExecTypes that we have constants in the Pig codebase for. @param execType @return
(ExecType execType)
| 59 | * @return |
| 60 | */ |
| 61 | private static ExecType getSingleton(ExecType execType) { |
| 62 | if (execType instanceof MRExecType) { |
| 63 | return ExecType.MAPREDUCE; |
| 64 | } |
| 65 | if (execType instanceof LocalExecType) { |
| 66 | return ExecType.LOCAL; |
| 67 | } |
| 68 | // if it is not MR specific but rather a different |
| 69 | // execution engine, we don't have access to any |
| 70 | // constants that can act as singletons, so we just |
| 71 | // use the given instance |
| 72 | return execType; |
| 73 | } |
| 74 | |
| 75 | public static ExecType fromString(String execType) throws PigException { |
| 76 | Properties properties = PropertiesUtil.loadDefaultProperties(); |