/** * Enables creating summary statistics using {@link Summarizer}'s for the new table. * * @since 2.0.0 */ public NewTableConfiguration enableSummarization(SummarizerConfiguration... configs) { requireNonNull(configs); Map<String,String> tmp = SummarizerConfigurationUtil .toTablePropertiesMap(Arrays.asList(configs)); checkDisjoint(properties, tmp, "summarizer"); summarizerProps = tmp; return this; }
/** * Sets additional properties to be applied to tables created with this configuration. Additional * calls to this method replace properties set by previous calls. * * @param props * additional properties to add to the table when it is created * @return this */ public NewTableConfiguration setProperties(Map<String,String> props) { checkArgument(props != null, "properties is null"); checkDisjoint(props, samplerProps, "sampler"); checkDisjoint(props, summarizerProps, "summarizer"); checkDisjoint(props, localityProps, "locality group"); checkDisjoint(props, iteratorProps, "iterator"); checkTableProperties(props); try { LocalityGroupUtil.checkLocalityGroups(props.entrySet()); } catch (LocalityGroupConfigurationError e) { throw new IllegalArgumentException(e); } this.properties = new HashMap<>(props); return this; }
/** * Enable building a sample data set on the new table using the given sampler configuration. * * @since 1.8.0 */ public NewTableConfiguration enableSampling(SamplerConfiguration samplerConfiguration) { requireNonNull(samplerConfiguration); Map<String,String> tmp = new SamplerConfigurationImpl(samplerConfiguration) .toTablePropertiesMap(); checkDisjoint(properties, tmp, "sampler"); this.samplerProps = tmp; return this; }
/** * Configures a table's locality groups prior to initial table creation. * * Allows locality groups to be set prior to table creation. Additional calls to this method prior * to table creation will overwrite previous locality group mappings. * * @param groups * mapping of locality group names to column families in the locality group * * @since 2.0.0 * * @see TableOperations#setLocalityGroups */ public NewTableConfiguration setLocalityGroups(Map<String,Set<Text>> groups) { // ensure locality groups do not overlap LocalityGroupUtil.ensureNonOverlappingGroups(groups); Map<String,String> tmp = new HashMap<>(); for (Entry<String,Set<Text>> entry : groups.entrySet()) { Set<Text> colFams = entry.getValue(); String value = LocalityGroupUtil.encodeColumnFamilies(colFams); tmp.put(Property.TABLE_LOCALITY_GROUP_PREFIX + entry.getKey(), value); } tmp.put(Property.TABLE_LOCALITY_GROUPS.getKey(), String.join(",", groups.keySet())); checkDisjoint(properties, tmp, "locality groups"); localityProps = tmp; return this; }
checkDisjoint(properties, iteratorProps, "iterator");