private static long getCompactorTxnId(Configuration jobConf) { String snapshot = jobConf.get(ValidTxnList.VALID_TXNS_KEY); if(Strings.isNullOrEmpty(snapshot)) { throw new IllegalStateException(ValidTxnList.VALID_TXNS_KEY + " not found for writing to " + jobConf.get(FINAL_LOCATION)); } ValidTxnList validTxnList = new ValidReadTxnList(); validTxnList.readFromString(snapshot); //this is id of the current (compactor) txn return validTxnList.getHighWatermark(); } private void getWriter(Reporter reporter, ObjectInspector inspector,
public String toDotString() { return Strings.join(p, "."); }
/** * Expands a string according to {@link #expandGlob(String)}, and then constructs a {@link WildcardPath} * for each expanded result which can be used to match strings as described in {@link WildcardPath}. * * @param globPattern a String to be passed to {@link #expandGlob(String)} * @param delim the delimeter used by {@link WildcardPath} * @return a list of wildcard paths, one for each expanded result */ public static List<WildcardPath> expandGlobToWildCardPaths(String globPattern, char delim) { List<WildcardPath> ret = new ArrayList<WildcardPath>(); for (String expandedGlob : Strings.expandGlob(globPattern)) { ret.add(new WildcardPath(globPattern, expandedGlob, delim)); } return ret; } }
/** * Construct a StrictFieldProjectionFilter from a list of Strings in the format expected by * {@link Strings#expandGlobToWildCardPaths(String, char)} * @param columnsToKeepGlobs glob patterns for columns to keep */ public StrictFieldProjectionFilter(List<String> columnsToKeepGlobs) { this.columnsToKeep = new ArrayList<WildcardPathStatus>(); for (String glob : columnsToKeepGlobs) { for (WildcardPath wp : Strings.expandGlobToWildCardPaths(glob, '.')) { columnsToKeep.add(new WildcardPathStatus(wp)); } } }
public String toDotString() { return Strings.join(p, "."); }
/** * Expands a string according to {@link #expandGlob(String)}, and then constructs a {@link WildcardPath} * for each expanded result which can be used to match strings as described in {@link WildcardPath}. * * @param globPattern a String to be passed to {@link #expandGlob(String)} * @param delim the delimeter used by {@link WildcardPath} * @return a list of wildcard paths, one for each expanded result */ public static List<WildcardPath> expandGlobToWildCardPaths(String globPattern, char delim) { List<WildcardPath> ret = new ArrayList<WildcardPath>(); for (String expandedGlob : Strings.expandGlob(globPattern)) { ret.add(new WildcardPath(globPattern, expandedGlob, delim)); } return ret; } }
while (!initialized && currentLocationIndex < locations.length) { String address = locations[currentLocationIndex++]; if (Strings.isNullOrEmpty(address)) { throw new IOException("can not fetch results from empty or null host value");
public String prettyMessages() { return Strings.join(messages, "\n"); }
+ "CMVAS or CTAS statement"); segmentGranularity = Strings.isNullOrEmpty(segmentGranularity) ? HiveConf .getVar(parseCtx.getConf(), HiveConf.ConfVars.HIVE_DRUID_INDEXING_GRANULARITY
/** * Join an Array of Strings into a single string with a delimiter. * For example, join(new String[] {"foo","","bar","x"}, "|") would return * "foo||bar|x" * * @param s an iterable of strings * @param on the delimiter * @return a single joined string */ public static String join(String[] s, String on) { return join(Arrays.asList(s), on); }
@Override public void set(@NotEmpty final String key, @NonNull final StringValue value) throws MetadataException { Preconditions.checkArgument(!Strings.isNullOrEmpty(key)); this.metadataMap.put(key, value); }
/** * Join an Iterable of Strings into a single string with a delimiter. * For example, join(Arrays.asList("foo","","bar","x"), "|") would return * "foo||bar|x" * * @param s an iterable of strings * @param on the delimiter * @return a single joined string */ public static String join(Iterable<String> s, String on) { return join(s.iterator(), on); }
@Override public Optional<StringValue> get(@NotEmpty final String key) throws MetadataException { Preconditions.checkArgument(!Strings.isNullOrEmpty(key)); return this.metadataMap.containsKey(key) ? Optional.of(this.metadataMap.get(key)) : Optional.absent(); }
/** * Join an Array of Strings into a single string with a delimiter. * For example, join(new String[] {"foo","","bar","x"}, "|") would return * "foo||bar|x" * * @param s an iterable of strings * @param on the delimiter * @return a single joined string */ public static String join(String[] s, String on) { return join(Arrays.asList(s), on); }
public ParsedVersion(String application, String version, String appBuildHash) { checkArgument(!Strings.isNullOrEmpty(application), "application cannot be null or empty"); this.application = application; this.version = Strings.isNullOrEmpty(version) ? null : version; this.appBuildHash = Strings.isNullOrEmpty(appBuildHash) ? null : appBuildHash; SemanticVersion sv; boolean hasSemver; try { sv = SemanticVersion.parse(version); hasSemver = true; } catch (RuntimeException e) { sv = null; hasSemver = false; } catch (SemanticVersionParseException e) { sv = null; hasSemver = false; } this.semver = sv; this.hasSemver = hasSemver; }
/** * Join an Iterable of Strings into a single string with a delimiter. * For example, join(Arrays.asList("foo","","bar","x"), "|") would return * "foo||bar|x" * * @param s an iterable of strings * @param on the delimiter * @return a single joined string */ public static String join(Iterable<String> s, String on) { return join(s.iterator(), on); }
public ParsedVersion(String application, String version, String appBuildHash) { checkArgument(!Strings.isNullOrEmpty(application), "application cannot be null or empty"); this.application = application; this.version = Strings.isNullOrEmpty(version) ? null : version; this.appBuildHash = Strings.isNullOrEmpty(appBuildHash) ? null : appBuildHash; SemanticVersion sv; boolean hasSemver; try { sv = SemanticVersion.parse(version); hasSemver = true; } catch (RuntimeException e) { sv = null; hasSemver = false; } catch (SemanticVersionParseException e) { sv = null; hasSemver = false; } this.semver = sv; this.hasSemver = hasSemver; }
public static FieldProjectionFilter getFieldProjectionFilter(Configuration conf) { String deprecated = conf.get(THRIFT_COLUMN_FILTER_KEY); String strict = conf.get(STRICT_THRIFT_COLUMN_FILTER_KEY); if (Strings.isNullOrEmpty(deprecated) && Strings.isNullOrEmpty(strict)) { return null; } if(!Strings.isNullOrEmpty(deprecated) && !Strings.isNullOrEmpty(strict)) { throw new ThriftProjectionException( "You cannot provide both " + THRIFT_COLUMN_FILTER_KEY + " and " + STRICT_THRIFT_COLUMN_FILTER_KEY +"! " + THRIFT_COLUMN_FILTER_KEY + " is deprecated." ); } if (!Strings.isNullOrEmpty(deprecated)) { LOG.warn("Using {} is deprecated. Please see the docs for {}!", THRIFT_COLUMN_FILTER_KEY, STRICT_THRIFT_COLUMN_FILTER_KEY); return new DeprecatedFieldProjectionFilter(deprecated); } return StrictFieldProjectionFilter.fromSemicolonDelimitedString(strict); }
/** * Returns a string that represents the dataset * * @param node String or List<String> that contains the dsId list * @return String: the dsName like "sales (CSV)" * List with 2 elements: dsName list like "lineitem, customer" * List with N (>2) elements: "N datasets" */ private String shortenDatasetList(Object node) { assert node instanceof Map : node; Map map = (Map) node; if (map.containsKey("escapedValue")) { String dsId = (String) ((Map) node).get("escapedValue"); PrDataset dataset = datasetRepository.findRealOne(datasetRepository.findOne(dsId)); return dataset.getDsName(); } List<String> dsIds = (List<String>) map.get("value"); List<String> dsNames = new ArrayList(); if (dsIds.size() >= 3) { return dsIds.size() + " datasets"; } for (String dsId : dsIds) { PrDataset dataset = datasetRepository.findRealOne(datasetRepository.findOne(dsId.replace("'", ""))); // Currently, map contains ' dsNames.add(dataset.getDsName()); } return Strings.join(dsNames, ", "); }