Example #1
0
 private Collection<EntityIndexConfig> getPartitionIndexConfigs(final EntityConfig config) {
   return Filter.grep(
       new Predicate<EntityIndexConfig>() {
         public boolean f(EntityIndexConfig entityIndexConfig) {
           return entityIndexConfig.getIndexType().equals(IndexType.Partition);
         }
       },
       config.getEntityIndexConfigs());
 }
Example #2
0
 private void insertSecondaryIndexes(final EntityConfig config, final Object entity)
     throws HiveLockableException {
   Map<String, Collection<Object>> secondaryIndexMap =
       Transform.toMap(
           Filter.grep(
               new Filter.NotNullPredicate<Entry<String, Collection<Object>>>(),
               Transform.map(
                   new Unary<EntityIndexConfig, Entry<String, Collection<Object>>>() {
                     public Entry<String, Collection<Object>> f(
                         EntityIndexConfig entityIndexConfig) {
                       if (entityIndexConfig.getIndexValues(entity)
                           == null) // Protect against null properties
                       return null;
                       return new Pair<String, Collection<Object>>(
                           entityIndexConfig.getIndexName(),
                           entityIndexConfig.getIndexValues(entity));
                     }
                   },
                   getSecondaryIndexConfigs(config))));
   hive.directory()
       .insertSecondaryIndexKeys(
           config.getResourceName(), secondaryIndexMap, config.getId(entity));
 }