コード例 #1
0
 /**
  * This is used only for serializing
  *
  * @param name attribute name
  * @param props Properties
  */
 public ReferencedDimAttribute(String name, Map<String, String> props) throws LensException {
   super(name, props);
   String chNamesStr = props.get(MetastoreUtil.getDimRefChainNameKey(getName()));
   if (!StringUtils.isBlank(chNamesStr)) {
     String refColsStr = props.get(MetastoreUtil.getDimRefChainColumnKey(getName()));
     String[] chainNames = StringUtils.split(chNamesStr, ",");
     String[] refCols = StringUtils.split(refColsStr, ",");
     for (int i = 0; i < chainNames.length; i++) {
       chainRefColumns.add(new ChainRefCol(chainNames[i], refCols[i]));
     }
   } else {
     throw new LensException(
         LensCubeErrorCode.ERROR_IN_ENTITY_DEFINITION.getLensErrorInfo(),
         " Ref column: " + getName() + " does not have any chain_ref_column defined");
   }
 }
コード例 #2
0
 @Override
 public void addProperties(Map<String, String> props) {
   super.addProperties(props);
   StringBuilder chainNamesValue = new StringBuilder();
   StringBuilder refColsValue = new StringBuilder();
   Iterator<ChainRefCol> iterator = chainRefColumns.iterator();
   // Add the first without appending separator
   ChainRefCol chainRefCol = iterator.next();
   chainNamesValue.append(chainRefCol.getChainName());
   refColsValue.append(chainRefCol.getRefColumn());
   while (iterator.hasNext()) {
     chainRefCol = iterator.next();
     chainNamesValue.append(CHAIN_REF_COL_SEPARATOR).append(chainRefCol.getChainName());
     refColsValue.append(CHAIN_REF_COL_SEPARATOR).append(chainRefCol.getRefColumn());
   }
   props.put(MetastoreUtil.getDimRefChainNameKey(getName()), chainNamesValue.toString());
   props.put(MetastoreUtil.getDimRefChainColumnKey(getName()), refColsValue.toString());
 }