_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q162500
FileSystemMetadataProvider.pathForMetadata
train
private static Path pathForMetadata(Path root, String namespace, String name) { return new Path( FileSystemDatasetRepository.pathForDataset(root, namespace, name), METADATA_DIRECTORY); }
java
{ "resource": "" }
q162501
FileSystemMetadataProvider.checkExists
train
private static void checkExists(FileSystem fs, Path location) { try { if (!fs.exists(location)) { throw new DatasetNotFoundException( "Descriptor location does not exist: " + location); } } catch (IOException ex) { throw new DatasetIOException( "Cannot access desc...
java
{ "resource": "" }
q162502
SpecificAvroDao.buildCompositeDaoWithEntityManager
train
public static <K extends SpecificRecord, S extends SpecificRecord> Dao<Map<String, S>> buildCompositeDaoWithEntityManager( HTablePool tablePool, String tableName, List<Class<S>> subEntityClasses, SchemaManager schemaManager) { List<EntityMapper<S>> entityMappers = new ArrayList<EntityMapper<S>>(); ...
java
{ "resource": "" }
q162503
MultiLevelIterator.advance
train
private boolean advance() { // done when there are depth iterators and the last iterator has an item while (iterators.size() < depth || !iterators.getLast().hasNext()) { // each iteration: add an iterator for the next level from the current // last iterator, or remove the last iterator because it is...
java
{ "resource": "" }
q162504
DatasetSourceTarget.inputBundle
train
private static FormatBundle<DatasetKeyInputFormat> inputBundle(Configuration conf) { FormatBundle<DatasetKeyInputFormat> bundle = FormatBundle .forInput(DatasetKeyInputFormat.class); for (Map.Entry<String, String> entry : conf) { bundle.set(entry.getKey(), entry.getValue()); } return bundl...
java
{ "resource": "" }
q162505
Validator.validateEnum
train
public <T extends Enum<T>> T validateEnum(Config config, String value, Class<T> type, T... choices) { if (choices.length == 0) { choices = type.getEnumConstants(); } Preconditions.checkArgument(choices.length > 0); try { T result = Enum.valueOf(type, value); if (!Arrays.asList(choices...
java
{ "resource": "" }
q162506
ScalableStatistics.add
train
public void add(double value) { count++; min = Math.min(min, value); max = Math.max(max, value); sum += value; sumOfSquares += value * value; addQuantileValue(value); }
java
{ "resource": "" }
q162507
ScalableStatistics.add
train
public void add(ScalableStatistics other) { count += other.count; min = Math.min(min, other.min); max = Math.max(max, other.max); sum += other.sum; sumOfSquares += other.sumOfSquares; tdigest.add(other.tdigest); if (other.exactValues != null) { for (int i = 0; i < other.numExactValues;...
java
{ "resource": "" }
q162508
ScalableStatistics.asBytes
train
public byte[] asBytes() { byte[] className = tdigest.getClass().getName().getBytes(Charsets.UTF_8); int vlen = exactValues == null ? 0 : numExactValues; ByteBuffer buf = ByteBuffer.allocate(4 + 8*5 + 4 + 4 + 8*vlen + 4 + className.length + tdigest.byteSize() + 4); buf.putInt(MAGIC_CODE); // for sanity c...
java
{ "resource": "" }
q162509
ScalableStatistics.fromBytes
train
public static ScalableStatistics fromBytes(byte[] bytes) { Preconditions.checkArgument(bytes.length > 0); ByteBuffer buf = ByteBuffer.wrap(bytes); ScalableStatistics stats = new ScalableStatistics(); Preconditions.checkArgument(buf.getInt() == MAGIC_CODE); // read basic descriptive stats st...
java
{ "resource": "" }
q162510
JobClasspathHelper.createMd5SumFile
train
private void createMd5SumFile(FileSystem fs, String md5sum, Path remoteMd5Path) throws IOException { FSDataOutputStream os = null; try { os = fs.create(remoteMd5Path, true); os.writeBytes(md5sum); os.flush(); } catch (Exception e) { LOG.error("{}", e); } finally { if (os !=...
java
{ "resource": "" }
q162511
HBaseService.configureHBaseCluster
train
private static Configuration configureHBaseCluster(Configuration config, int zkClientPort, FileSystem hdfsFs, String bindIP, int masterPort, int regionserverPort) throws IOException { // Configure the zookeeper port config .set(HConstants.ZOOKEEPER_CLIENT_PORT, Integer.toString(zkClientPort)...
java
{ "resource": "" }
q162512
HBaseService.waitForHBaseToComeOnline
train
private static void waitForHBaseToComeOnline(MiniHBaseCluster hbaseCluster) throws IOException, InterruptedException { // Wait for the master to be initialized. This is required because even // before it's initialized, the regionserver can come online and the meta // table can be scannable. If the clu...
java
{ "resource": "" }
q162513
SignalManager.signalReady
train
public void signalReady(Constraints viewConstraints) { try { rootFileSystem.mkdirs(signalDirectory); } catch (IOException e) { throw new DatasetIOException("Unable to create signal manager directory: " + signalDirectory, e); } String normalizedConstraints = getNormalizedConstr...
java
{ "resource": "" }
q162514
SignalManager.getReadyTimestamp
train
public long getReadyTimestamp(Constraints viewConstraints) { String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); // check if the signal exists try { try { FileStatus signalStatus = rootFileSystem.get...
java
{ "resource": "" }
q162515
FileSystemDataset.viewForUri
train
View<E> viewForUri(URI location) { Preconditions.checkNotNull(location, "Partition location cannot be null"); PartitionView<E> view = getPartitionView(location); if (view == unbounded) { return this; } return view; }
java
{ "resource": "" }
q162516
HiveAbstractMetadataProvider.isExternal
train
protected boolean isExternal(String namespace, String name) { String resolved = resolveNamespace(namespace, name); if (resolved != null) { return isExternal(getMetaStoreUtil().getTable(resolved, name)); } return false; }
java
{ "resource": "" }
q162517
HiveAbstractMetadataProvider.isNamespace
train
private boolean isNamespace(String database) { Collection<String> tables = getMetaStoreUtil().getAllTables(database); for (String name : tables) { if (isReadable(database, name)) { return true; } } return false; }
java
{ "resource": "" }
q162518
HiveAbstractMetadataProvider.isReadable
train
private boolean isReadable(String namespace, String name) { Table table = getMetaStoreUtil().getTable(namespace, name); if (isManaged(table) || isExternal(table)) { // readable table types try { // get a descriptor for the table. if this succeeds, it is readable HiveUtils.descriptorForTabl...
java
{ "resource": "" }
q162519
Log4jAppender.append
train
@Override public synchronized void append(LoggingEvent event) throws FlumeException{ //If rpcClient is null, it means either this appender object was never //setup by setting hostname and port and then calling activateOptions //or this appender object was closed by calling close(), so we throw an //ex...
java
{ "resource": "" }
q162520
JarFinder.getJar
train
public static String getJar(Class<?> klass) { Preconditions.checkNotNull(klass, "klass"); ClassLoader loader = klass.getClassLoader(); if (loader != null) { String class_file = klass.getName().replaceAll("\\.", "/") + ".class"; try { for (Enumeration<?> itr = loader.getResources(class_fi...
java
{ "resource": "" }
q162521
ZooKeeperDownloader.readConfigName
train
public String readConfigName(SolrZkClient zkClient, String collection) throws KeeperException, InterruptedException { if (collection == null) { throw new IllegalArgumentException("collection must not be null"); } String configName = null; // first check for alias byte[] aliasData = zkClient...
java
{ "resource": "" }
q162522
ZooKeeperDownloader.downloadConfigDir
train
public File downloadConfigDir(SolrZkClient zkClient, String configName, File dir) throws IOException, InterruptedException, KeeperException { Preconditions.checkArgument(dir.exists()); Preconditions.checkArgument(dir.isDirectory()); ZkConfigManager manager = new ZkConfigManager(zkClient); manager.down...
java
{ "resource": "" }
q162523
Compatibility.check
train
public static void check(String namespace, String name, DatasetDescriptor descriptor) { checkDatasetName(namespace, name); checkDescriptor(descriptor); }
java
{ "resource": "" }
q162524
Compatibility.checkAndWarn
train
public static void checkAndWarn(String namespace, String datasetName, Schema schema) { try { checkDatasetName(namespace, datasetName); checkSchema(schema); } catch (IllegalArgumentException e) { LOG.warn(e.getMessage()); } catch (IllegalStateException e) { LOG.warn(e.getMessage()); ...
java
{ "resource": "" }
q162525
Compatibility.checkDatasetName
train
public static void checkDatasetName(String namespace, String name) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); ValidationException.check(Compatibility.isCompatibleName(namespace), "Namespace %s is not alphanume...
java
{ "resource": "" }
q162526
Compatibility.checkDescriptor
train
public static void checkDescriptor(DatasetDescriptor descriptor) { Preconditions.checkNotNull(descriptor, "Descriptor cannot be null"); Schema schema = descriptor.getSchema(); checkSchema(schema); if (descriptor.isPartitioned()) { // marked as [BUG] because this is checked in DatasetDescriptor ...
java
{ "resource": "" }
q162527
Compatibility.getIncompatibleNames
train
private static List<String> getIncompatibleNames(Schema schema) { NameValidation validation = new NameValidation(); SchemaUtil.visit(schema, validation); return validation.getIncompatibleNames(); }
java
{ "resource": "" }
q162528
Record.copy
train
public Record copy() { //return new Record(ArrayListMultimap.create(fields)); // adding fields later causes (slow) rehashing ArrayListMultimap<String,Object> copy = ArrayListMultimap.create(fields.size() + 16, 10); copy.putAll(fields); return new Record(copy); }
java
{ "resource": "" }
q162529
Record.getFirstValue
train
public Object getFirstValue(String key) { List values = fields.get(key); return values.size() > 0 ? values.get(0) : null; }
java
{ "resource": "" }
q162530
Record.replaceValues
train
public void replaceValues(String key, Object value) { // fields.replaceValues(key, Collections.singletonList(value)); // unnecessarily slow List<Object> list = fields.get(key); list.clear(); list.add(value); }
java
{ "resource": "" }
q162531
Record.putIfAbsent
train
public void putIfAbsent(String key, Object value) { if (!fields.containsEntry(key, value)) { fields.put(key, value); } }
java
{ "resource": "" }
q162532
URIBuilder.build
train
public static URI build(String repoUri, String namespace, String dataset) { return build(URI.create(repoUri), namespace, dataset); }
java
{ "resource": "" }
q162533
URIBuilder.build
train
public static URI build(URI repoUri, String namespace, String dataset) { return new URIBuilder(repoUri, namespace, dataset).build(); }
java
{ "resource": "" }
q162534
SchemaUtil.isConsistentWithExpectedType
train
public static boolean isConsistentWithExpectedType(Schema.Type type, Class<?> expectedClass) { Class<?> typeClass = TYPE_TO_CLASS.get(type); return typeClass != null && expectedClass.isAssignableFrom(typeClass); }
java
{ "resource": "" }
q162535
SchemaUtil.partitionFieldSchema
train
public static Schema partitionFieldSchema(FieldPartitioner<?, ?> fp, Schema schema) { if (fp instanceof IdentityFieldPartitioner) { // copy the schema directly from the entity to preserve annotations return fieldSchema(schema, fp.getSourceName()); } else { Class<?> fieldType = getPartitionType...
java
{ "resource": "" }
q162536
SchemaUtil.partitionField
train
private static Schema.Field partitionField(FieldPartitioner<?, ?> fp, Schema schema) { return new Schema.Field( fp.getName(), partitionFieldSchema(fp, schema), null, null); }
java
{ "resource": "" }
q162537
MediaType.set
train
public static Set<MediaType> set(MediaType... types) { Set<MediaType> set = new HashSet<MediaType>(); for (MediaType type : types) { if (type != null) { set.add(type); } } return Collections.unmodifiableSet(set); }
java
{ "resource": "" }
q162538
MediaType.set
train
public static Set<MediaType> set(String... types) { Set<MediaType> set = new HashSet<MediaType>(); for (String type : types) { MediaType mt = parse(type); if (mt != null) { set.add(mt); } } return Collections.unmodifiableSet(set); }
java
{ "resource": "" }
q162539
MediaType.unquote
train
private static String unquote(String s) { while (s.startsWith("\"") || s.startsWith("'")) { s = s.substring(1); } while (s.endsWith("\"") || s.endsWith("'")) { s = s.substring(0, s.length() - 1); } return s; }
java
{ "resource": "" }
q162540
AvroUtils.readAvroEntity
train
public static <T> T readAvroEntity(byte[] bytes, DatumReader<T> reader) { Decoder decoder = new DecoderFactory().binaryDecoder(bytes, null); return AvroUtils.<T> readAvroEntity(decoder, reader); }
java
{ "resource": "" }
q162541
AvroUtils.readAvroEntity
train
public static <T> T readAvroEntity(Decoder decoder, DatumReader<T> reader) { try { return reader.read(null, decoder); } catch (IOException e) { throw new SerializationException("Could not deserialize Avro entity", e); } }
java
{ "resource": "" }
q162542
AvroUtils.writeAvroEntity
train
public static <T> byte[] writeAvroEntity(T entity, DatumWriter<T> writer) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Encoder encoder = new EncoderFactory().binaryEncoder(outputStream, null); writeAvroEntity(entity, encoder, writer); return outputStream.toByteArray(); }
java
{ "resource": "" }
q162543
AvroUtils.writeAvroEntity
train
public static <T> void writeAvroEntity(T entity, Encoder encoder, DatumWriter<T> writer) { try { writer.write(entity, encoder); encoder.flush(); } catch (IOException e) { throw new SerializationException("Could not serialize Avro entity", e); } }
java
{ "resource": "" }
q162544
AvroUtils.cloneField
train
public static Field cloneField(Field field) { return new Field(field.name(), field.schema(), field.doc(), field.defaultValue()); }
java
{ "resource": "" }
q162545
AvroUtils.inputStreamToString
train
public static String inputStreamToString(InputStream in) { final int BUFFER_SIZE = 1024; BufferedReader bufferedReader; try { bufferedReader = new BufferedReader(new InputStreamReader(in, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new DatasetException( "Platform do...
java
{ "resource": "" }
q162546
AvroUtils.getDefaultValueMap
train
public static Map<String, Object> getDefaultValueMap(Schema avroRecordSchema) { List<Field> defaultFields = new ArrayList<Field>(); for (Field f : avroRecordSchema.getFields()) { if (f.defaultValue() != null) { // Need to create a new Field here or we will get // org.apache.avro.AvroRuntim...
java
{ "resource": "" }
q162547
JavaCompiler.compile
train
public Map<String, byte[]> compile(String fileName, String source, Writer err, String sourcePath, String classPath) { // to collect errors, warnings etc. DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>(); // create a new memory JavaFileManager MemoryJavaFileM...
java
{ "resource": "" }
q162548
DataModelUtil.getDataModelForType
train
public static <E> GenericData getDataModelForType(Class<E> type) { // Need to check if SpecificRecord first because specific records also // implement GenericRecord if (SpecificRecord.class.isAssignableFrom(type)) { return new SpecificData(type.getClassLoader()); } else if (IndexedRecord.class.isA...
java
{ "resource": "" }
q162549
DataModelUtil.getDatumReaderForType
train
@SuppressWarnings("unchecked") public static <E> DatumReader<E> getDatumReaderForType(Class<E> type, Schema writerSchema) { Schema readerSchema = getReaderSchema(type, writerSchema); GenericData dataModel = getDataModelForType(type); if (dataModel instanceof ReflectData) { return new ReflectDatumRea...
java
{ "resource": "" }
q162550
DataModelUtil.getReaderSchema
train
public static <E> Schema getReaderSchema(Class<E> type, Schema schema) { Schema readerSchema = schema; GenericData dataModel = getDataModelForType(type); if (dataModel instanceof SpecificData) { readerSchema = ((SpecificData)dataModel).getSchema(type); } return readerSchema; }
java
{ "resource": "" }
q162551
DataModelUtil.getWriterSchema
train
public static <E> Schema getWriterSchema(Class<E> type, Schema schema) { Schema writerSchema = schema; GenericData dataModel = getDataModelForType(type); if (dataModel instanceof AllowNulls) { // assume fields are non-null by default to avoid schema conflicts dataModel = ReflectData.get(); }...
java
{ "resource": "" }
q162552
DataModelUtil.createRecord
train
@SuppressWarnings("unchecked") public static <E> E createRecord(Class<E> type, Schema schema) { // Don't instantiate SpecificRecords or interfaces. if (isGeneric(type) && !type.isInterface()) { if (GenericData.Record.class.equals(type)) { return (E) GenericData.get().newRecord(null, schema); ...
java
{ "resource": "" }
q162553
HiveAbstractDatasetRepository.getHiveMetastoreUri
train
String getHiveMetastoreUri(Configuration conf) { String metastoreUris = conf.get(Loader.HIVE_METASTORE_URI_PROP); if (metastoreUris == null) { return null; } String[] uriArray = metastoreUris.split(HIVE_METASTORE_URIS_SEPARATOR); return uriArray[0]; }
java
{ "resource": "" }
q162554
BaseNCodec.isInAlphabet
train
public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) { for (int i = 0; i < arrayOctet.length; i++) { if (!isInAlphabet(arrayOctet[i]) && (!allowWSPad || (arrayOctet[i] != PAD) && !isWhiteSpace(arrayOctet[i]))) { return false; ...
java
{ "resource": "" }
q162555
BaseNCodec.containsAlphabetOrPad
train
protected boolean containsAlphabetOrPad(final byte[] arrayOctet) { if (arrayOctet == null) { return false; } for (final byte element : arrayOctet) { if (PAD == element || isInAlphabet(element)) { return true; } } return false; ...
java
{ "resource": "" }
q162556
BaseNCodec.getEncodedLength
train
public long getEncodedLength(final byte[] pArray) { // Calculate non-chunked size - rounded up to allow for padding // cast to long is needed to avoid possibility of overflow long len = ((pArray.length + unencodedBlockSize-1) / unencodedBlockSize) * (long) encodedBlockSize; if (lineLeng...
java
{ "resource": "" }
q162557
EntitySerDe.serialize
train
public PutAction serialize(byte[] keyBytes, FieldMapping fieldMapping, Object fieldValue) { Put put = new Put(keyBytes); PutAction putAction = new PutAction(put); String fieldName = fieldMapping.getFieldName(); if (fieldMapping.getMappingType() == MappingType.COLUMN || fieldMapping.getMapp...
java
{ "resource": "" }
q162558
EntitySerDe.deserialize
train
public Object deserialize(FieldMapping fieldMapping, Result result) { String fieldName = fieldMapping.getFieldName(); MappingType mappingType = fieldMapping.getMappingType(); if (mappingType == MappingType.COLUMN || mappingType == MappingType.COUNTER) { return deserializeColumn(fieldMapping.getFieldNa...
java
{ "resource": "" }
q162559
EntitySerDe.serializeColumn
train
private void serializeColumn(String fieldName, byte[] family, byte[] qualifier, Object fieldValue, Put put) { // column mapping, so simply serialize the value and add the bytes // to the put. byte[] bytes = serializeColumnValueToBytes(fieldName, fieldValue); put.add(family, qualifier, bytes); }
java
{ "resource": "" }
q162560
EntitySerDe.serializeKeyAsColumn
train
private void serializeKeyAsColumn(String fieldName, byte[] family, String prefix, Object fieldValue, Put put) { // keyAsColumn mapping, so extract each value from the keyAsColumn field // using the entityComposer, serialize them, and them to the put. Map<CharSequence, Object> keyAsColumnValues = entit...
java
{ "resource": "" }
q162561
EntitySerDe.serializeOCCColumn
train
private void serializeOCCColumn(Object fieldValue, PutAction putAction) { // OCC Version mapping, so serialize as a long to the version check // column qualifier in the system column family. Long currVersion = (Long) fieldValue; VersionCheckAction versionCheckAction = new VersionCheckAction(currVersion)...
java
{ "resource": "" }
q162562
EntitySerDe.deserializeColumn
train
private Object deserializeColumn(String fieldName, byte[] family, byte[] qualifier, Result result) { byte[] bytes = result.getValue(family, qualifier); if (bytes == null) { return getDefaultValue(fieldName); } else { return deserializeColumnValueFromBytes(fieldName, bytes); } }
java
{ "resource": "" }
q162563
EntitySerDe.deserializeKeyAsColumn
train
private Object deserializeKeyAsColumn(String fieldName, byte[] family, String prefix, Result result) { // Construct a map of keyAsColumn field values. From this we'll be able // to use the entityComposer to construct the entity field value. byte[] prefixBytes = prefix != null ? prefix.getBytes() : nul...
java
{ "resource": "" }
q162564
EntitySerDe.deserializeOCCColumn
train
private Object deserializeOCCColumn(Result result) { byte[] versionBytes = result.getValue(Constants.SYS_COL_FAMILY, Constants.VERSION_CHECK_COL_QUALIFIER); if (versionBytes == null) { return null; } else { return Bytes.toLong(versionBytes); } }
java
{ "resource": "" }
q162565
AvroEntitySchema.mappingCompatible
train
private static boolean mappingCompatible(EntitySchema oldSchema, EntitySchema newSchema) { for (FieldMapping oldFieldMapping : oldSchema.getColumnMappingDescriptor() .getFieldMappings()) { FieldMapping newFieldMapping = newSchema.getColumnMappingDescriptor() .getFieldMapping(oldFieldMa...
java
{ "resource": "" }
q162566
Compiler.compile
train
public Command compile(File morphlineFile, String morphlineId, MorphlineContext morphlineContext, Command finalChild, Config... overrides) { Config config; try { config = parse(morphlineFile, overrides); } catch (IOException e) { throw new MorphlineCompilationException("Cannot parse morphline fi...
java
{ "resource": "" }
q162567
Compiler.parse
train
public Config parse(File file, Config... overrides) throws IOException { if (file == null || file.getPath().trim().length() == 0) { throw new MorphlineCompilationException("Missing morphlineFile parameter", null); } if (!file.exists()) { throw new FileNotFoundException("File not found: " + file)...
java
{ "resource": "" }
q162568
Compiler.find
train
public Config find(String morphlineId, Config config, String nameForErrorMsg) { List<? extends Config> morphlineConfigs = config.getConfigList("morphlines"); if (morphlineConfigs.size() == 0) { throw new MorphlineCompilationException( "Morphline file must contain at least one morphline: " + name...
java
{ "resource": "" }
q162569
MiniCluster.start
train
public void start() throws IOException, InterruptedException { for (Service service : services) { service.configure(serviceConfig); logger.info("Running Minicluster Service: " + service.getClass().getName()); service.start(); serviceConfig.setHadoopConf(service.getHadoopConf()); ...
java
{ "resource": "" }
q162570
MiniCluster.stop
train
public void stop() throws IOException, InterruptedException { for (int i = services.size() - 1; i >= 0; i--) { Service service = services.get(i); logger.info("Stopping Minicluster Service: " + service.getClass().getName()); service.stop(); } logger.info("All Minicluster Services ...
java
{ "resource": "" }
q162571
DefaultSchemaManager.refreshManagedSchemaCache
train
@Override public void refreshManagedSchemaCache(String tableName, String entityName) { ManagedSchema managedSchema = managedSchemaDao.getManagedSchema(tableName, entityName); if (managedSchema != null) { getManagedSchemaMap().put( getManagedSchemaMapKey(managedSchema.getTable(), ...
java
{ "resource": "" }
q162572
DefaultSchemaManager.getManagedSchemaMap
train
private ConcurrentHashMap<String, ManagedSchema> getManagedSchemaMap() { if (managedSchemaMap == null) { synchronized (this) { if (managedSchemaMap == null) { managedSchemaMap = new ConcurrentHashMap<String, ManagedSchema>(); populateManagedSchemaMap(); } } } ...
java
{ "resource": "" }
q162573
DefaultSchemaManager.populateManagedSchemaMap
train
private void populateManagedSchemaMap() { Collection<ManagedSchema> schemas = managedSchemaDao.getManagedSchemas(); for (ManagedSchema managedSchema : schemas) { getManagedSchemaMap().put( getManagedSchemaMapKey(managedSchema.getTable(), managedSchema.getName()), managedSchema); ...
java
{ "resource": "" }
q162574
DefaultSchemaManager.getSchemaParser
train
@SuppressWarnings("unchecked") private KeyEntitySchemaParser<?, ?> getSchemaParser( String schemaParserClassName) { if (schemaParsers.contains(schemaParserClassName)) { return schemaParsers.get(schemaParserClassName); } else { try { Class<KeyEntitySchemaParser<?, ?>> schemaParserClas...
java
{ "resource": "" }
q162575
DefaultSchemaManager.getManagedSchemaVersions
train
private Map<Integer, String> getManagedSchemaVersions(String tableName, String entityName) { ManagedSchema managedSchema = getManagedSchema(tableName, entityName); Map<Integer, String> returnMap = new HashMap<Integer, String>(); for (Map.Entry<String, String> versionsEntry : managedSchema .ge...
java
{ "resource": "" }
q162576
DefaultSchemaManager.getManagedSchema
train
private ManagedSchema getManagedSchema(String tableName, String entityName) { ManagedSchema managedSchema = getManagedSchemaFromSchemaMap(tableName, entityName); if (managedSchema == null) { refreshManagedSchemaCache(tableName, entityName); managedSchema = getManagedSchemaFromSchemaMap(table...
java
{ "resource": "" }
q162577
DefaultSchemaManager.validateCompatibleWithTableSchemas
train
private void validateCompatibleWithTableSchemas(String tableName, KeySchema keySchema, EntitySchema entitySchema) { List<ManagedSchema> entitiesForTable = new ArrayList<ManagedSchema>(); for (Entry<String, ManagedSchema> entry : getManagedSchemaMap().entrySet()) { if (entry.getKey().startsWith(table...
java
{ "resource": "" }
q162578
DefaultSchemaManager.validateCompatibleWithTableColumns
train
private boolean validateCompatibleWithTableColumns( EntitySchema entitySchema1, EntitySchema entitySchema2) { // Populate two collections of field mappings. One that contains all // of the column mappings, and one that contains the keyAsColumn // mappings from the first schema. These will be used to ...
java
{ "resource": "" }
q162579
DefaultSchemaManager.validateCompatibleWithTableOccVersion
train
private boolean validateCompatibleWithTableOccVersion( EntitySchema entitySchema1, EntitySchema entitySchema2) { boolean foundOccMapping = false; for (FieldMapping fieldMapping : entitySchema1.getColumnMappingDescriptor() .getFieldMappings()) { if (fieldMapping.getMappingType() == MappingTyp...
java
{ "resource": "" }
q162580
MemcmpDecoder.readInt
train
@Override public int readInt() throws IOException { byte[] intBytes = new byte[4]; int i = in.read(intBytes); if (i < 4) { throw new EOFException(); } intBytes[0] = (byte) (intBytes[0] ^ 0x80); int value = 0; for (int j = 0; j < intBytes.length; ++j) { value = (value << 8) + (...
java
{ "resource": "" }
q162581
MemcmpDecoder.readLong
train
@Override public long readLong() throws IOException { byte[] longBytes = new byte[8]; int i = in.read(longBytes); if (i < 8) { throw new EOFException(); } longBytes[0] = (byte) (longBytes[0] ^ 0x80); long value = 0; for (int j = 0; j < longBytes.length; ++j) { value = (value <...
java
{ "resource": "" }
q162582
MemcmpDecoder.readString
train
@Override public Utf8 readString(Utf8 old) throws IOException { ByteBuffer stringBytes = readBytes(null); return new Utf8(stringBytes.array()); }
java
{ "resource": "" }
q162583
MemcmpDecoder.readBytes
train
@Override public ByteBuffer readBytes(ByteBuffer old) throws IOException { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); while (true) { int byteRead = in.read(); if (byteRead < 0) { throw new EOFException(); } if (byteRead == 0) { int secondByteRead = in...
java
{ "resource": "" }
q162584
MemcmpDecoder.readFixed
train
@Override public void readFixed(byte[] bytes, int start, int length) throws IOException { int i = in.read(bytes, start, length); if (i < length) { throw new EOFException(); } }
java
{ "resource": "" }
q162585
KerberosUtil.runPrivileged
train
public static <T> T runPrivileged(UserGroupInformation login, PrivilegedExceptionAction<T> action) { try { if (login == null) { return action.run(); } else { return login.doAs(action); } } catch (IOException ex) { throw new DatasetIOExc...
java
{ "resource": "" }
q162586
AbstractCommand.buildCommandChain
train
protected List<Command> buildCommandChain(Config rootConfig, String configKey, Command finalChild, boolean ignoreNotifications) { Preconditions.checkNotNull(rootConfig); Preconditions.checkNotNull(configKey); Preconditions.checkNotNull(finalChild); List<? extends Config> commandConfigs = new Configs().g...
java
{ "resource": "" }
q162587
AbstractCommand.buildCommand
train
protected Command buildCommand(Config cmdConfig, Command currentParent, Command finalChild) { Preconditions.checkNotNull(cmdConfig); Preconditions.checkNotNull(currentParent); Preconditions.checkNotNull(finalChild); Set<Map.Entry<String, Object>> entries = cmdConfig.root().unwrapped().entrySet();...
java
{ "resource": "" }
q162588
RetryingSolrServer.limitStringLength
train
private String limitStringLength(String str) { if (str.length() > MAX_STRING_LENGTH) { str = str.substring(0, MAX_STRING_LENGTH) + " ..."; } return str; }
java
{ "resource": "" }
q162589
SmtpMailer.getRateLimitTemplateProperties
train
private Map<String, Object> getRateLimitTemplateProperties(SingularityRequest request, final SingularityEmailType emailType) { final Builder<String, Object> templateProperties = ImmutableMap.<String, Object>builder(); templateProperties.put("singularityRequestLink", mailTemplateHelpers.getSingularityRequestLin...
java
{ "resource": "" }
q162590
SmtpMailer.queueMail
train
private void queueMail(final Collection<SingularityEmailDestination> destination, final SingularityRequest request, final SingularityEmailType emailType, final Optional<String> actionTaker, String subject, String body) { RateLimitResult result = checkRateLimitForMail(request, emailType); if (result == RateLimi...
java
{ "resource": "" }
q162591
SingularityClient.getSingularityRequests
train
public Collection<SingularityRequestParent> getSingularityRequests() { final Function<String, String> requestUri = (host) -> String.format(REQUESTS_FORMAT, getApiBase(host)); return getCollection(requestUri, "[ACTIVE, PAUSED, COOLDOWN] requests", REQUESTS_COLLECTION); }
java
{ "resource": "" }
q162592
SingularityClient.getActiveSingularityRequests
train
public Collection<SingularityRequestParent> getActiveSingularityRequests() { final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_ACTIVE_FORMAT, getApiBase(host)); return getCollection(requestUri, "ACTIVE requests", REQUESTS_COLLECTION); }
java
{ "resource": "" }
q162593
SingularityClient.getPausedSingularityRequests
train
public Collection<SingularityRequestParent> getPausedSingularityRequests() { final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_PAUSED_FORMAT, getApiBase(host)); return getCollection(requestUri, "PAUSED requests", REQUESTS_COLLECTION); }
java
{ "resource": "" }
q162594
SingularityClient.getCoolDownSingularityRequests
train
public Collection<SingularityRequestParent> getCoolDownSingularityRequests() { final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_COOLDOWN_FORMAT, getApiBase(host)); return getCollection(requestUri, "COOLDOWN requests", REQUESTS_COLLECTION); }
java
{ "resource": "" }
q162595
SingularityClient.getPendingSingularityRequests
train
public Collection<SingularityPendingRequest> getPendingSingularityRequests() { final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_PENDING_FORMAT, getApiBase(host)); return getCollection(requestUri, "pending requests", PENDING_REQUESTS_COLLECTION); }
java
{ "resource": "" }
q162596
SingularityClient.getSlaves
train
public Collection<SingularitySlave> getSlaves(Optional<MachineState> slaveState) { final Function<String, String> requestUri = (host) -> String.format(SLAVES_FORMAT, getApiBase(host)); Optional<Map<String, Object>> maybeQueryParams = Optional.absent(); String type = "slaves"; if (slaveState.isPresent...
java
{ "resource": "" }
q162597
SingularityClient.getSlave
train
public Optional<SingularitySlave> getSlave(String slaveId) { final Function<String, String> requestUri = (host) -> String.format(SLAVE_DETAIL_FORMAT, getApiBase(host), slaveId); return getSingle(requestUri, "slave", slaveId, SingularitySlave.class); }
java
{ "resource": "" }
q162598
SingularityClient.getHistoryForTask
train
public Optional<SingularityTaskHistory> getHistoryForTask(String taskId) { final Function<String, String> requestUri = (host) -> String.format(TASK_HISTORY_FORMAT, getApiBase(host), taskId); return getSingle(requestUri, "task history", taskId, SingularityTaskHistory.class); }
java
{ "resource": "" }
q162599
SingularityClient.getHistoryForTask
train
@Deprecated public Optional<SingularityTaskIdHistory> getHistoryForTask(String requestId, String runId) { return getTaskIdHistoryByRunId(requestId, runId); }
java
{ "resource": "" }