/** * Return the types for the composite key. * * @param tbl Properties for the table * @return a comma-separated list of composite key types * @throws SerDeException if something goes wrong while getting the composite key parts * */ @SuppressWarnings("unchecked") private static Map<String, String> getCompositeKeyParts(Properties tbl) throws SerDeException { String compKeyClassName = tbl.getProperty(HBaseSerDe.HBASE_COMPOSITE_KEY_CLASS); if (compKeyClassName == null) { // no custom composite key class provided. return null return null; } CompositeHBaseKeyFactory<HBaseCompositeKey> keyFactory = null; Class<?> keyClass; try { keyClass = JavaUtils.loadClass(compKeyClassName); keyFactory = new CompositeHBaseKeyFactory(keyClass); } catch (Exception e) { throw new SerDeException(e); } HBaseCompositeKey compKey = keyFactory.createKey(null); return compKey.getParts(); } }
private static HBaseKeyFactory createKeyFactory(Configuration job, Properties tbl) throws Exception { String factoryClassName = tbl.getProperty(HBaseSerDe.HBASE_COMPOSITE_KEY_FACTORY); if (factoryClassName != null) { Class<?> factoryClazz = loadClass(factoryClassName, job); return (HBaseKeyFactory) ReflectionUtils.newInstance(factoryClazz, job); } String keyClassName = tbl.getProperty(HBaseSerDe.HBASE_COMPOSITE_KEY_CLASS); if (keyClassName != null) { Class<?> keyClass = loadClass(keyClassName, job); return new CompositeHBaseKeyFactory(keyClass); } return new DefaultHBaseKeyFactory(); }
private static HBaseKeyFactory createKeyFactory(Configuration job, Properties tbl) throws Exception { String factoryClassName = tbl.getProperty(HBaseSerDe.HBASE_COMPOSITE_KEY_FACTORY); if (factoryClassName != null) { Class<?> factoryClazz = loadClass(factoryClassName, job); return (HBaseKeyFactory) ReflectionUtils.newInstance(factoryClazz, job); } String keyClassName = tbl.getProperty(HBaseSerDe.HBASE_COMPOSITE_KEY_CLASS); if (keyClassName != null) { Class<?> keyClass = loadClass(keyClassName, job); return new CompositeHBaseKeyFactory(keyClass); } return new DefaultHBaseKeyFactory(); }
/** * Return the types for the composite key. * * @param tbl Properties for the table * @return a comma-separated list of composite key types * @throws SerDeException if something goes wrong while getting the composite key parts * */ @SuppressWarnings("unchecked") private static Map<String, String> getCompositeKeyParts(Properties tbl) throws SerDeException { String compKeyClassName = tbl.getProperty(HBaseSerDe.HBASE_COMPOSITE_KEY_CLASS); if (compKeyClassName == null) { // no custom composite key class provided. return null return null; } CompositeHBaseKeyFactory<HBaseCompositeKey> keyFactory = null; Class<?> keyClass; try { keyClass = JavaUtils.loadClass(compKeyClassName); keyFactory = new CompositeHBaseKeyFactory(keyClass); } catch (Exception e) { throw new SerDeException(e); } HBaseCompositeKey compKey = keyFactory.createKey(null); return compKey.getParts(); } }