Refine search
@Override public final String getHeader(final String name) { if (!this.headers.containsKey(name)) { return null; } String[] values = this.headers.get(name); return values[0]; }
protected void initMethod() { String operator = BuiltInMethod.MAP.containsKey(name) ? name : converters.get(name); if (operator != null) { this.method = BuiltInMethod.MAP.get(operator).method; isValidFunc = true; } } }
/** * Increment the counter associated with enum value passed. * * @param e Counter to increment. * @param n the value to increment */ public void inc(E e, long n) { if (counters != null && counters.containsKey(e)) { counters.get(e).inc(n); } }
/** * Returns the value for the given variable. {@code element} must come from a call to {@link * LocalVariableNode#getElement()} or {@link * org.checkerframework.javacutil.TreeUtils#elementFromDeclaration} ({@link * org.checkerframework.dataflow.cfg.node.VariableDeclarationNode#getTree()}). */ @Nullable private V getInformation(Element element) { checkElementType(element); return contents.get(checkNotNull(element)); }
public static RequestExtractor<?> extractor(final String id) { if (extractors.containsKey(id)) { return extractors.get(id); } throw new IllegalArgumentException(format("unknown extractor for [%s]", id)); }
public static ActionType fromCode(final byte code) { if (INSTANCES.containsKey(code)) { return INSTANCES.get(code); } throw new RuntimeException("unknown action type code " + code); }
/** * Returns the attribute provider for the given view, or {@code null} if the given view is not * one of the attribute views this supports. */ @Nullable public static AttributeProvider get(String view) { AttributeProvider provider = PROVIDERS.get(view); if (provider == null && view.equals("unix")) { // create a new UnixAttributeProvider per file system, as it does some caching that should be // cleaned up when the file system is garbage collected return new UnixAttributeProvider(); } return provider; } }
/** * Get count for counter associated with enum value passed. * @param e Counter to query. * @return the count for this counter. */ public long getCount(E e) { if (counters.containsKey(e)) { return counters.get(e).getCount(); } else { return 0l; } } }
@Override public void setValue(PartitionFieldNode root, TreeMap<Long, Partition> partitions, TreeMap<Long, StorageDescriptor> sds, TreeMap<Long, SerDeInfo> serdes, TreeMap<Long, List<FieldSchema>> cds) throws MetaException { final String skewedStringListVals = fieldNameToTableName.containsKey("SKEWED_STRING_LIST_VALUES") ? fieldNameToTableName .get("SKEWED_STRING_LIST_VALUES") : "SKEWED_STRING_LIST_VALUES"; final String skewedVals = fieldNameToTableName.containsKey("SKEWED_VALUES") ? fieldNameToTableName .get("SKEWED_VALUES") : "SKEWED_VALUES"; MetastoreDirectSqlUtils.setSkewedColValues(skewedStringListVals, skewedVals, pm, sds, Joiner.on(',').join(sds.keySet())); } }
/** * Returns an attribute view of the given type for the given file lookup callback, or * {@code null} if the view type is not supported. */ @SuppressWarnings("unchecked") @Nullable public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { AttributeProvider provider = providersByViewType.get(type); if (provider != null) { return (V) provider.view(lookup, createInheritedViews(lookup, provider)); } return null; }
@Override public void setValue(PartitionFieldNode root, TreeMap<Long, Partition> partitions, TreeMap<Long, StorageDescriptor> sds, TreeMap<Long, SerDeInfo> serdes, TreeMap<Long, List<FieldSchema>> cds) throws MetaException { final String tableName = fieldNameToTableName.containsKey("SERDE_PARAMS") ? fieldNameToTableName .get("SERDE_PARAMS") : "SERDE_PARAMS"; MetastoreDirectSqlUtils.setSerdeParams(tableName, convertMapNullsToEmptyStrings, pm, serdes, Joiner.on(',').join(serdes.keySet())); } }
@Override public String depluralize(String name) { LinkedList<String> parts = Lists.newLinkedList(splitCamelCase(name)); String plural = parts.removeLast(); @Nullable String singular = dictionary.get(plural); if (singular != null) { parts.addLast(singular); return joinCamelCase(parts); } String detected = NAMING_IES_PLURAL.detect(name); if (!detected.isEmpty()) { return detected + "y"; } detected = NAMING_S_PLURAL.detect(name); if (!detected.isEmpty()) { return detected; } return name; }
@Override public void setValue(PartitionFieldNode root, TreeMap<Long, Partition> partitions, TreeMap<Long, StorageDescriptor> sds, TreeMap<Long, SerDeInfo> serdes, TreeMap<Long, List<FieldSchema>> cds) throws MetaException { final String tableName = fieldNameToTableName.containsKey("SKEWED_COL_NAMES") ? fieldNameToTableName .get("SKEWED_COL_NAMES") : "SKEWED_COL_NAMES"; MetastoreDirectSqlUtils .setSkewedColNames(tableName, pm, sds, Joiner.on(',').join(sds.keySet())); } }
private TypeMirror resolveType(TypeReference typeReference, boolean wrapIterable) { Preconditions.checkState(typeReference instanceof TypeDeclaration); TypeDeclaration typeDeclaration = (TypeDeclaration) typeReference; TypeIdentifier type = typeDeclaration.type(); @Nullable TypeMirror resolved = knife.imports.get(type.value()); if (resolved == null) { throw new TypingException(String.format("Could not resolve declared type '%s'", typeDeclaration)); } if (wrapIterable && typeDeclaration.kind() == Kind.ITERABLE) { resolved = knife.accessors.wrapIterable(resolved); } return resolved; } }
@Override public void setValue(PartitionFieldNode root, TreeMap<Long, Partition> partitions, TreeMap<Long, StorageDescriptor> sds, TreeMap<Long, SerDeInfo> serdes, TreeMap<Long, List<FieldSchema>> cds) throws MetaException { final String skewedStringListVals = fieldNameToTableName.containsKey("SKEWED_STRING_LIST_VALUES") ? fieldNameToTableName .get("SKEWED_STRING_LIST_VALUES") : "SKEWED_STRING_LIST_VALUES"; final String skewedColValLocMap = fieldNameToTableName.containsKey("SKEWED_COL_VALUE_LOC_MAP") ? fieldNameToTableName .get("SKEWED_COL_VALUE_LOC_MAP") : "SKEWED_COL_VALUE_LOC_MAP"; MetastoreDirectSqlUtils .setSkewedColLocationMaps(skewedColValLocMap, skewedStringListVals, pm, sds, Joiner.on(',').join(sds.keySet())); } }