/** * Extracts timeline implementation class from table params and instantiates it with other arguments, also in table * params. * * @param table * @throws LensException * @see #updateTableParams(org.apache.hadoop.hive.ql.metadata.Table) */ public void init(Table table) throws LensException { HashMap<String, String> props = Maps.newHashMap(); String prefix = MetastoreUtil.getPartitionInfoKeyPrefix(getUpdatePeriod(), getPartCol()); for (Map.Entry<String, String> entry : table.getParameters().entrySet()) { if (entry.getKey().startsWith(prefix)) { props.put(entry.getKey().substring(prefix.length()), entry.getValue()); } } log.info("initializing timeline from table properties: {},{},{}", getStorageTableName(), getUpdatePeriod(), getPartCol()); initFromProperties(props); log.info("initialized to: {}", this); }
/** * Extracts timeline implementation class from table params and instantiates it with other arguments, also in table * params. * * @param table * @throws LensException * @see #updateTableParams(org.apache.hadoop.hive.ql.metadata.Table) */ public void init(Table table) throws LensException { HashMap<String, String> props = Maps.newHashMap(); String prefix = MetastoreUtil.getPartitionInfoKeyPrefix(getUpdatePeriod(), getPartCol()); for (Map.Entry<String, String> entry : table.getParameters().entrySet()) { if (entry.getKey().startsWith(prefix)) { props.put(entry.getKey().substring(prefix.length()), entry.getValue()); } } log.info("initializing timeline from table properties: {},{},{}", getStorageTableName(), getUpdatePeriod(), getPartCol()); initFromProperties(props); log.info("initialized to: {}", this); }
assertTrue(inst2.initFromProperties(props)); assertEquals(inst1, inst2); assertTrue(inst2.initFromProperties(props)); assertFalse(inst1.equals(inst2)); assertTrue(inst2.initFromProperties(inst1.toProperties())); assertEquals(inst1, inst2); inst1.initFromProperties(props); inst2.initFromProperties(props); inst2.initFromProperties(inst1.toProperties()); assertTrue(inst2.isConsistent()); assertEquals(inst1, inst2);