auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<? extends Module> getJacksonModules() { return ImmutableList.<Module>of( new SimpleModule("DruidNamespacedExtractionModule") .registerSubtypes(NamespacedExtractor.class) .registerSubtypes(ExtractionNamespace.class) .registerSubtypes(NamespaceLookupExtractorFactory.class) ); }

Target:
public List<? extends Module> getJacksonModules() { return ImmutableList.<Module>of( new SimpleModule("DruidNamespacedExtractionModule") .registerSubtypes( ExtractionNamespace.class, NamespaceLookupExtractorFactory.class ) ); }
Source:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { if (extractionFn == null) { return factory.makeValueMatcher(dimension, value); } else { return factory.makeValueMatcher( dimension, new Predicate<String>() { @Override public boolean apply(String input) { // Assuming that a null/absent/empty dimension are equivalent from the druid perspective return value.equals(Strings.nullToEmpty(extractionFn.apply(Strings.emptyToNull(input)))); } } ); } }

Target:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { if (extractionFn == null) { return factory.makeValueMatcher(dimension, value); } else { return factory.makeValueMatcher( dimension, new Predicate<String>() { @Override public boolean apply(String input) { // Assuming that a null/absent/empty dimension are equivalent from the druid perspective return value.equals(Strings.nullToEmpty(extractionFn.apply(input))); } } ); } }
Source:
public AsyncQueryForwardingServlet( @Json ObjectMapper jsonMapper, @Smile ObjectMapper smileMapper, QueryHostFinder hostFinder, @Router Provider<HttpClient> httpClientProvider, DruidHttpClientConfig httpClientConfig, ServiceEmitter emitter, RequestLogger requestLogger ) { this.jsonMapper = jsonMapper; this.smileMapper = smileMapper; this.hostFinder = hostFinder; this.httpClientProvider = httpClientProvider; this.httpClientConfig = httpClientConfig; this.emitter = emitter; this.requestLogger = requestLogger; // separate client with more aggressive connection timeouts // to prevent cancellations requests from blocking queries this.broadcastClient = httpClientProvider.get(); broadcastClient.setConnectTimeout(CANCELLATION_TIMEOUT); broadcastClient.setMaxRequestsQueuedPerDestination(MAX_QUEUED_CANCELLATIONS); }

Target:
public AsyncQueryForwardingServlet( @Json ObjectMapper jsonMapper, @Smile ObjectMapper smileMapper, QueryHostFinder hostFinder, @Router Provider<HttpClient> httpClientProvider, DruidHttpClientConfig httpClientConfig, ServiceEmitter emitter, RequestLogger requestLogger ) { this.jsonMapper = jsonMapper; this.smileMapper = smileMapper; this.hostFinder = hostFinder; this.httpClientProvider = httpClientProvider; this.httpClientConfig = httpClientConfig; this.emitter = emitter; this.requestLogger = requestLogger; }
Source:
public ResourceHolder<T> get() { CountingHolder holder; size.decrementAndGet(); // items never stay out of the queue for long, so we'll get one eventually try { holder = queue.take(); } catch(InterruptedException e) { Thread.currentThread().interrupt(); throw Throwables.propagate(e); } // synchronize on item to ensure count cannot get changed by // CountingHolder.close right after we put the item back in the queue synchronized (holder) { holder.count.incrementAndGet(); queue.offer(holder); } return holder; }

Target:
public ResourceHolder<T> get() { final CountingHolder holder; // items never stay out of the queue for long, so we'll get one eventually try { holder = queue.take(); } catch(InterruptedException e) { Thread.currentThread().interrupt(); throw Throwables.propagate(e); } // synchronize on item to ensure count cannot get changed by // CountingHolder.close right after we put the item back in the queue synchronized (holder) { holder.count.incrementAndGet(); queue.offer(holder); } return holder; }
Source:
private AggregatorFactory[] getCombiningAggregators(AggregatorFactory[] aggregators) { AggregatorFactory[] combiningAggregators = new AggregatorFactory[aggregators.length]; for (int i = 0; i < aggregators.length; i++) { combiningAggregators[i] = aggregators[i].getCombiningFactory(); } return combiningAggregators; }

Target:
private static AggregatorFactory[] getCombiningAggregators(AggregatorFactory[] aggregators) { AggregatorFactory[] combiningAggregators = new AggregatorFactory[aggregators.length]; for (int i = 0; i < aggregators.length; i++) { combiningAggregators[i] = aggregators[i].getCombiningFactory(); } return combiningAggregators; }
Source:
public IndexTask( @JsonProperty("id") String id, @JsonProperty("resource") TaskResource taskResource, @JsonProperty("spec") IndexIngestionSpec ingestionSchema, @JacksonInject ObjectMapper jsonMapper ) { super( // _not_ the version, just something uniqueish makeId(id, ingestionSchema), String.format("index_%s", makeDataSource(ingestionSchema)), taskResource == null ? new TaskResource(makeId(id, ingestionSchema), 1) : taskResource, makeDataSource(ingestionSchema), makeInterval(ingestionSchema) ); this.ingestionSchema = ingestionSchema; this.jsonMapper = jsonMapper; }

Target:
public IndexTask( @JsonProperty("id") String id, @JsonProperty("resource") TaskResource taskResource, @JsonProperty("spec") IndexIngestionSpec ingestionSchema, @JacksonInject ObjectMapper jsonMapper ) { super( // _not_ the version, just something uniqueish makeId(id, ingestionSchema), taskResource, makeDataSource(ingestionSchema), makeInterval(ingestionSchema) ); this.ingestionSchema = ingestionSchema; this.jsonMapper = jsonMapper; }
Source:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, PROPERTY_BASE, LookupConfig.class); LifecycleModule.register(binder, LookupReferencesManager.class); JsonConfigProvider.bind(binder, PROPERTY_BASE, LookupListeningAnnouncerConfig.class); Jerseys.addResource(binder, LookupListeningResource.class); LifecycleModule.register(binder, LookupReferencesManager.class); LifecycleModule.register(binder, LookupResourceListenerAnnouncer.class); }

Target:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, PROPERTY_BASE, LookupConfig.class); LifecycleModule.register(binder, LookupReferencesManager.class); JsonConfigProvider.bind(binder, PROPERTY_BASE, LookupListeningAnnouncerConfig.class); Jerseys.addResource(binder, LookupListeningResource.class); LifecycleModule.register(binder, LookupResourceListenerAnnouncer.class); }
Source:
public AlphaNumericTopNMetricSpec( @JsonProperty("previousStop") String previousStop ) { // Set empty string as previousStop of super class otherwise we will get NPE super((previousStop == null) ? "" : previousStop); this.previousStop = (previousStop == null) ? "" : previousStop; }

Target:
public AlphaNumericTopNMetricSpec( @JsonProperty("previousStop") String previousStop ) { super(previousStop); }
Source:
public TopNMapFn( TopNQuery query, TopNAlgorithm topNAlgorithm ) { this.query = query; this.topNAlgorithm = topNAlgorithm; this.dimension = query.getDimensionSpec().getDimension(); this.extractionFn = query.getDimensionSpec().getExtractionFn(); }

Target:
public TopNMapFn( TopNQuery query, TopNAlgorithm topNAlgorithm ) { this.query = query; this.topNAlgorithm = topNAlgorithm; }
Source:
public long getSerializedSize() { return baseIntBuffers.getSerializedSize() + 1 + 4 + 4 + 1; }

Target:
public long getSerializedSize() { return 1 + // version 4 + // totalSize 4 + // sizePer 1 + // compressionId baseIntBuffers.getSerializedSize(); // data }
Source:
private void createAuditTable(final IDBI dbi, final String tableName) { createTable( dbi, tableName, ImmutableList.of( String.format( "CREATE TABLE %1$s (\n" + " id %2$s NOT NULL,\n" + " audit_key VARCHAR(255) NOT NULL,\n" + " type VARCHAR(255) NOT NULL,\n" + " author VARCHAR(255) NOT NULL,\n" + " email_id VARCHAR(255) NOT NULL,\n" + " comment VARCHAR(2048) NOT NULL,\n" + " created_date VARCHAR(255) NOT NULL,\n" + " payload %3$s NOT NULL,\n" + " PRIMARY KEY(id)\n" + ")", tableName, getSerialType(), getPayloadType() ), String.format("CREATE INDEX idx_%1$s_key_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_type_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_audit_time ON %1$s(created_date)", tableName) ) ); }

Target:
private void createAuditTable(final IDBI dbi, final String tableName) { createTable( dbi, tableName, ImmutableList.of( String.format( "CREATE TABLE %1$s (\n" + " id %2$s NOT NULL,\n" + " audit_key VARCHAR(255) NOT NULL,\n" + " type VARCHAR(255) NOT NULL,\n" + " author VARCHAR(255) NOT NULL,\n" + " comment VARCHAR(2048) NOT NULL,\n" + " created_date VARCHAR(255) NOT NULL,\n" + " payload %3$s NOT NULL,\n" + " PRIMARY KEY(id)\n" + ")", tableName, getSerialType(), getPayloadType() ), String.format("CREATE INDEX idx_%1$s_key_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_type_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_audit_time ON %1$s(created_date)", tableName) ) ); }
Source:
public OnheapIncrementalIndex(IncrementalIndexSchema incrementalIndexSchema, boolean deserializeComplexMetrics, int maxRowCount) { super(incrementalIndexSchema, deserializeComplexMetrics); this.facts = new ConcurrentSkipListMap<>(); this.maxRowCount = maxRowCount; this.aggList = new Aggregator[maxRowCount][];// To handle concurrency, we allocate up to maxRowCount for(int i = 0; i < this.aggList.length; ++i){ this.aggList[i] = null; } }

Target:
public OnheapIncrementalIndex( IncrementalIndexSchema incrementalIndexSchema, boolean deserializeComplexMetrics, int maxRowCount ) { super(incrementalIndexSchema, deserializeComplexMetrics); this.maxRowCount = maxRowCount; }
Source:
public byte[] compress(byte[] bytes) { LZFChunk chunk = null; try (final ResourceHolder<ChunkEncoder> encoder = CompressedPools.getChunkEncoder()) { chunk = encoder.get().encodeChunk(bytes, 0, bytes.length); } catch (IOException e) { log.error(e, "IOException thrown while closing ChunkEncoder."); } // IOException should be on ResourceHolder.close(), not encodeChunk, so this *should* never be null return null == chunk ? null : chunk.getData(); }

Target:
public byte[] compress(byte[] bytes) { try (final ResourceHolder<ChunkEncoder> encoder = CompressedPools.getChunkEncoder()) { final LZFChunk chunk = encoder.get().encodeChunk(bytes, 0, bytes.length); return chunk.getData(); } catch (IOException e) { log.error(e, "IOException thrown while closing ChunkEncoder."); } // IOException should be on ResourceHolder.close(), not encodeChunk, so this *should* never happen return null; }
Source:
public boolean isQueryCacheable(Query query) { return !Sets.newHashSet(unCacheable).contains(query.getType()); }

Target:
public boolean isQueryCacheable(Query query) { // O(n) impl, but I don't think we'll ever have a million query types here return !unCacheable.contains(query.getType()); }
Source:
public Iterable<String> getNames() { return Lists.newArrayList(name); }

Target:
public List<String> getNames() { return Arrays.asList(name); }
Source:
public boolean hasNext() { boolean hasNext = delegate.hasNext() || !cursor.isDone(); if(!hasNext) { // cleanup for(BufferAggregator agg : aggregators) { agg.close(); } } return hasNext; }

Target:
public boolean hasNext() { return delegate.hasNext() || !cursor.isDone(); }
Source:
Document(Database database, String id, FLDict body) { this(database, id, (C4Document) null); this._database = database; this._id = id; this._data = body; updateDictionary(); }

Target:
Document(Database database, String id, FLDict body) { this(database, id, (C4Document) null); this._data = body; updateDictionary(); }
Source:
public void testGetExistingDocWithIDInBatch() throws CouchbaseLiteException { final int NUM_DOCS = 10; Database.getLog().getConsole().setLevel(LogLevel.VERBOSE); // Save 10 docs: createDocs(NUM_DOCS); db.inBatch(new Runnable() { @Override public void run() { validateDocs(NUM_DOCS); } }); }

Target:
public void testGetExistingDocWithIDInBatch() throws CouchbaseLiteException { final int NUM_DOCS = 10; // Save 10 docs: createDocs(NUM_DOCS); db.inBatch(new Runnable() { @Override public void run() { validateDocs(NUM_DOCS); } }); }
Source:
private DocumentChangeListenerToken addDocumentChangeListener(Executor executor, DocumentChangeListener listener, String docID) { // NOTE: caller method is synchronized. if (!docListenerTokens.containsKey(docID)) { Set<DocumentChangeListenerToken> listeners = Collections.synchronizedSet(new HashSet<DocumentChangeListenerToken>()); docListenerTokens.put(docID, listeners); registerC4DocObserver(docID); } DocumentChangeListenerToken token = new DocumentChangeListenerToken(executor, listener, docID); docListenerTokens.get(docID).add(token); return token; }

Target:
private DocumentChangeListenerToken addDocumentChangeListener(Executor executor, DocumentChangeListener listener, String docID) { // NOTE: caller method is synchronized. if (!docListenerTokens.containsKey(docID)) { Set<DocumentChangeListenerToken> listeners = new HashSet<>(); docListenerTokens.put(docID, listeners); registerC4DocObserver(docID); } DocumentChangeListenerToken token = new DocumentChangeListenerToken(executor, listener, docID); docListenerTokens.get(docID).add(token); return token; }
Source:
private void postDocumentChanged(final String documentID) { synchronized (lock) { if (!c4DocObservers.containsKey(documentID) || c4db == null) return; // NOTE: docListenerTokens and its Set value are synchronized collections. // And DocumentChange is immutable Set<DocumentChangeListenerToken> tokens = docListenerTokens.get(documentID); if (tokens != null) { synchronized (tokens) { DocumentChange change = new DocumentChange(documentID); for (DocumentChangeListenerToken token : tokens) token.notify(change); } } } }

Target:
private void postDocumentChanged(final String documentID) { synchronized (lock) { if (!c4DocObservers.containsKey(documentID) || c4db == null) return; Set<DocumentChangeListenerToken> tokens = docListenerTokens.get(documentID); if (tokens != null) { DocumentChange change = new DocumentChange(documentID); for (DocumentChangeListenerToken token : tokens) token.notify(change); } } }
Source:
boolean selectConflictingRevision() throws CouchbaseLiteException { try { if (!c4doc.getRawDoc().selectNextLeaf(false, true)) return false; setC4Doc(c4doc); // self.c4Doc = _c4Doc; // This will update to the selected revision } catch (LiteCoreException e) { Log.e(TAG, "Failed to selectNextLeaf: doc -> " + c4doc, e); return false; } return true; }

Target:
boolean selectConflictingRevision() { try { if (!c4doc.getRawDoc().selectNextLeaf(false, true)) return false; setC4Doc(c4doc); // self.c4Doc = _c4Doc; // This will update to the selected revision } catch (LiteCoreException e) { Log.e(TAG, "Failed to selectNextLeaf: doc -> " + c4doc, e); return false; } return true; }
Source:
public void setLinkedId(final String linkedId) { if (this.linkedId != null) { // Don't allow unsetting of already set linked id CommonHelper.assertNotNull("linkedId", linkedId); } this.linkedId = linkedId; }

Target:
public void setLinkedId(final String linkedId) { this.linkedId = linkedId; }
Source:
protected MetadataResolver initServiceProviderMetadataResolver(final WebContext context) { this.spMetadataResolver = new SAML2ServiceProviderMetadataResolver(this.configuration.getServiceProviderMetadataPath(), computeFinalCallbackUrl(context), this.configuration.getServiceProviderEntityId(), this.configuration.isForceServiceProviderMetadataGeneration(), this.credentialProvider); return this.spMetadataResolver.resolve(); }

Target:
protected MetadataResolver initServiceProviderMetadataResolver(final WebContext context) { this.spMetadataResolver = new SAML2ServiceProviderMetadataResolver(this.configuration, computeFinalCallbackUrl(context), this.credentialProvider); return this.spMetadataResolver.resolve(); }
Source:
public long getOperationCount() { try { Long count = invokeMethod((operationCountWorkerInstance != null) ? operationCountWorkerInstance : testClassInstance, operationCountMethod); return (count == null ? -1 : count); } catch (Exception e) { LOGGER.warn("Exception while retrieving operation count from " + testCase.getId() + ": " + e.getMessage()); return -1; } }

Target:
public long getOperationCount() { try { Long count = invokeMethod((operationCountWorkerInstance != null) ? operationCountWorkerInstance : testClassInstance, operationCountMethod); return (count == null ? -1 : count); } catch (Exception e) { LOGGER.debug("Exception while retrieving operation count from " + testCase.getId() + ": " + e.getMessage()); return -1; } }
Source:
public void run() { long iteration = 0; while (!testContext.isStopped()) { for (int i = 0; i < keyCount; i++) { String key = keys[random.nextInt(keys.length)]; map.put(key, createValue(key,random)); iteration++; if (iteration % logFrequency == 0) { LOGGER.info(Thread.currentThread().getName() + " At iteration: " + iteration); } } } }

Target:
public void run() { long iteration = 0; while (!testContext.isStopped()) { String key = keys[random.nextInt(keys.length)]; map.put(key, createValue(key,random)); iteration++; if (iteration % logFrequency == 0) { LOGGER.info(Thread.currentThread().getName() + " At iteration: " + iteration); } } }
Source:
List<MetricFamilySamples> familySamplesList(Collector.Type type, List<MetricFamilySamples.Sample> samples) { MetricFamilySamples mfs = new MetricFamilySamples(fullname, type, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(1); mfsList.add(mfs); return mfsList; }

Target:
protected List<MetricFamilySamples> familySamplesList(Collector.Type type, List<MetricFamilySamples.Sample> samples) { MetricFamilySamples mfs = new MetricFamilySamples(fullname, type, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(1); mfsList.add(mfs); return mfsList; }
Source:
public static boolean isIanaResource(final RpslObject resource) { final RpslAttribute netname = resource.findAttribute(AttributeType.NETNAME); final boolean status = (netname != null && IANA_NETNAME.equals(netname.getValue().trim())); LOGGER.debug("Is inetnum with netname iana? {}", resource.getKey(), netname != null ? netname.getValue() : null, status); return status; }

Target:
public static boolean isIanaResource(final RpslObject resource) { final RpslAttribute netname = resource.findAttribute(AttributeType.NETNAME); //status return (netname != null && IANA_NETNAME.equals(netname.getValue().trim())); }
Source:
public synchronized void init() { // there should be only one LoggingDriver initialized per JVM (or we won't know which applicationContext's loggerContext to log to) try { Driver driver = DriverManager.getDriver(URL_PREFIX); LOGGER.error("LoggingDriver already installed; removing"); try { DriverManager.deregisterDriver(driver); } catch (SQLException e) { throw new IllegalStateException("Unable to de-register logging JDBC driver", e); } } catch (SQLException expected) { LOGGER.error("SQLException ", expected); } try { DriverManager.registerDriver(this); } catch (SQLException e) { throw new IllegalStateException("Unable to register logging JDBC driver", e); } }

Target:
public synchronized void init() { // there should be only one LoggingDriver initialized per JVM (or we won't know which applicationContext's loggerContext to log to) try { Driver driver = DriverManager.getDriver(URL_PREFIX); LOGGER.error("LoggingDriver already installed; removing"); try { DriverManager.deregisterDriver(driver); } catch (SQLException e) { throw new IllegalStateException("Unable to de-register logging JDBC driver", e); } } catch (SQLException expected) { LOGGER.debug(expected.getMessage(), expected); } try { DriverManager.registerDriver(this); } catch (SQLException e) { throw new IllegalStateException("Unable to register logging JDBC driver", e); } }
Source:
public List<Pipeline> getPipelines() { if (pagingEnabled) { if (!isFullScreenView()) { int startIndex = ((this.getCurrentPage() - 1) * noOfPipelines); int retrieveSize = Math.min(pipelines.size() - ((this.getCurrentPage() - 1) * noOfPipelines), noOfPipelines); return pipelines.subList(startIndex, startIndex + retrieveSize); } } return pipelines; }

Target:
public List<Pipeline> getPipelines() { if (pagingEnabled && !isFullScreenView()) { int startIndex = ((this.getCurrentPage() - 1) * noOfPipelines); int retrieveSize = Math.min(pipelines.size() - ((this.getCurrentPage() - 1) * noOfPipelines), noOfPipelines); return pipelines.subList(startIndex, startIndex + retrieveSize); } return pipelines; }
Source:
public void calculatePipelineRoutes(Task task, final Route route, List<Route> allRoutes) { if (task.getDownstreamTasks() != null && task.getDownstreamTasks().size() > 0) { for (String downstreamTaskName: task.getDownstreamTasks()) { // assume each task only appears once in the pipeline Route currentRoute = createRouteAndCopyTasks(route, task); calculatePipelineRoutes(getTaskFromName(downstreamTaskName), currentRoute, allRoutes); } } else { Route currentRoute = createRouteAndCopyTasks(route, task); allRoutes.add(currentRoute); } }

Target:
void calculatePipelineRoutes(Task task, final Route route, List<Route> allRoutes) { if (task.getDownstreamTasks() != null && task.getDownstreamTasks().size() > 0) { for (String downstreamTaskName: task.getDownstreamTasks()) { // assume each task only appears once in the pipeline Route currentRoute = createRouteAndCopyTasks(route, task); calculatePipelineRoutes(getTaskFromName(downstreamTaskName), currentRoute, allRoutes); } } else { Route currentRoute = createRouteAndCopyTasks(route, task); allRoutes.add(currentRoute); } }
Source:
public void testFileSize() throws Exception { File file = File.createTempFile("forge", "testFileSize"); file.deleteOnExit(); try (FileWriter write = new FileWriter(file)) { write.append("Test"); FileResource<?> fileResource = factory.create(file).reify(FileResource.class); Assert.assertEquals(file.length(), fileResource.getSize()); file.delete(); } }

Target:
public void testFileSize() throws Exception { File file = File.createTempFile("forge", "testFileSize"); file.deleteOnExit(); try (FileWriter write = new FileWriter(file)) { write.append("Test"); FileResource<?> fileResource = factory.create(file).reify(FileResource.class); Assert.assertEquals(file.length(), fileResource.getSize()); } file.delete(); }
Source:
public T call() throws Exception { try { Request.setPerThreadRequestData(requestData); UUIDs.setRandom(random); ThreadContext.bind(securityManager); ThreadContext.bind(subject); MDC.setContextMap(mdcContextMap); return delegate.call(); } finally { Request.resetPerThreadRequestData(); UUIDs.setRandom(null); ThreadContext.unbindSecurityManager(); ThreadContext.unbindSubject(); // Reset the MDC as before the call, in case the plugin fiddle'd with it MDC.setContextMap(mdcContextMap); } }

Target:
public T call() throws Exception { try { Request.setPerThreadRequestData(requestData); UUIDs.setRandom(random); ThreadContext.bind(securityManager); ThreadContext.bind(subject); MDC.setContextMap(mdcContextMap); return delegate.call(); } finally { Request.resetPerThreadRequestData(); UUIDs.setRandom(null); ThreadContext.unbindSecurityManager(); ThreadContext.unbindSubject(); MDC.clear(); } }
Source:
private boolean isDateTimeConstantType(Type type) { return type == DateType.DATE || type == TimestampType.TIMESTAMP || type == TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE; }

Target:
private static boolean isDateTimeConstantType(Type type) { return type == DateType.DATE || type == TimestampType.TIMESTAMP || type == TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE; }
Source:
public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { // URIStatus is the mechanism to pass the hiveFileContext to the source filesystem URIStatus uriStatus = mFileSystem.getStatus(getAlluxioPath(path)); AlluxioURIStatus alluxioURIStatus = new AlluxioURIStatus(uriStatus.getFileInfo(), hiveFileContext); FileInStream fileInStream = mFileSystem.openFile(alluxioURIStatus, OpenFilePOptions.getDefaultInstance()); return new FSDataInputStream(new AlluxioCachingHdfsFileInputStream(fileInStream, fileSystem.openFile(path, hiveFileContext), cacheValidationEnabled)); }

Target:
public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { // URIStatus is the mechanism to pass the hiveFileContext to the source filesystem URIStatus uriStatus = mFileSystem.getStatus(getAlluxioPath(path)); AlluxioURIStatus alluxioURIStatus = new AlluxioURIStatus(uriStatus.getFileInfo(), hiveFileContext); FileInStream fileInStream = mFileSystem.openFile(alluxioURIStatus, OpenFilePOptions.getDefaultInstance()); return new FSDataInputStream(new AlluxioCachingHdfsFileInputStream( fileInStream, (cacheValidationEnabled ? Optional.of(fileSystem.openFile(path, hiveFileContext)) : Optional.empty()), cacheValidationEnabled)); }
Source:
public static HivePartitioningHandle createHiveCompatiblePartitioningHandle( int bucketCount, List<HiveType> hiveTypes, OptionalInt maxCompatibleBucketCount) { return new HivePartitioningHandle( bucketCount, maxCompatibleBucketCount, BucketFunctionType.HIVE_COMPATIBLE, Optional.of(hiveTypes), Optional.empty()); }

Target:
public static HivePartitioningHandle createHiveCompatiblePartitioningHandle( int bucketCount, List<HiveType> hiveTypes, OptionalInt maxCompatibleBucketCount) { return new HivePartitioningHandle( bucketCount, maxCompatibleBucketCount, HIVE_COMPATIBLE, Optional.of(hiveTypes), Optional.empty()); }
Source:
public static HivePartitioningHandle createPrestoNativePartitioningHandle( int bucketCount, List<Type> types, OptionalInt maxCompatibleBucketCount) { return new HivePartitioningHandle( bucketCount, maxCompatibleBucketCount, BucketFunctionType.PRESTO_NATIVE, Optional.empty(), Optional.of(types)); }

Target:
public static HivePartitioningHandle createPrestoNativePartitioningHandle( int bucketCount, List<Type> types, OptionalInt maxCompatibleBucketCount) { return new HivePartitioningHandle( bucketCount, maxCompatibleBucketCount, PRESTO_NATIVE, Optional.empty(), Optional.of(types)); }
Source:
protected void setup(Binder binder) { bindAuthenticationModule( config -> config.getDruidAuthenticationType() == DruidConfig.DruidAuthenticationType.NONE, noneAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == DruidConfig.DruidAuthenticationType.BASIC, basicAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == DruidConfig.DruidAuthenticationType.KERBEROS, kerberosbAuthenticationModule()); }

Target:
protected void setup(Binder binder) { bindAuthenticationModule( config -> config.getDruidAuthenticationType() == NONE, noneAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == BASIC, basicAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == KERBEROS, kerberosbAuthenticationModule()); }
Source:
public void testDefaults() { assertRecordedDefaults(recordDefaults(DruidConfig.class) .setDruidBrokerUrl(null) .setDruidCoordinatorUrl(null) .setDruidSchema("druid") .setComputePushdownEnabled(false) .setHadoopConfiguration("") .setDruidAuthenticationType(DruidConfig.DruidAuthenticationType.NONE) .setBasicAuthenticationUsername(null) .setBasicAuthenticationPassword(null)); }

Target:
public void testDefaults() { assertRecordedDefaults(recordDefaults(DruidConfig.class) .setDruidBrokerUrl(null) .setDruidCoordinatorUrl(null) .setDruidSchema("druid") .setComputePushdownEnabled(false) .setHadoopConfiguration("") .setDruidAuthenticationType(NONE) .setBasicAuthenticationUsername(null) .setBasicAuthenticationPassword(null)); }
Source:
public void testDefaults() { assertRecordedDefaults(recordDefaults(DruidConfig.class) .setDruidBrokerUrl(null) .setDruidCoordinatorUrl(null) .setDruidSchema("druid") .setComputePushdownEnabled(false) .setHadoopConfiguration((String) null)); }

Target:
public void testDefaults() { assertRecordedDefaults(recordDefaults(DruidConfig.class) .setDruidBrokerUrl(null) .setDruidCoordinatorUrl(null) .setDruidSchema("druid") .setComputePushdownEnabled(false) .setHadoopConfiguration("")); }
Source:
private KeyProvider toKeyProvider(DwrfProto.Encryption.KeyProvider keyProvider) { switch (keyProvider) { case CRYPTO_SERVICE: return KeyProvider.CRYPTO_SERVICE; default: // TODO: should we throw an exception instead? return KeyProvider.UNKNOWN; } }

Target:
private static KeyProvider toKeyProvider(DwrfProto.Encryption.KeyProvider keyProvider) { switch (keyProvider) { case CRYPTO_SERVICE: return KeyProvider.CRYPTO_SERVICE; default: return KeyProvider.UNKNOWN; } }
Source:
public void close() { if (closed) { return; } closed = true; block = null; Throwable innerException = null; for (Closer closer : closers) { try { closer.close(); } catch (Throwable t) { if (innerException == null) { innerException = t; } else if (innerException != t) { // Self-suppression not permitted innerException.addSuppressed(t); } } } if (innerException != null) { // Convert to unchecked exception throw new RuntimeException(innerException); } }

Target:
public void close() { if (closed) { return; } closed = true; Throwable innerException = null; for (Closer closer : closers) { try { closer.close(); } catch (Throwable t) { if (innerException == null) { innerException = t; } else if (innerException != t) { // Self-suppression not permitted innerException.addSuppressed(t); } } } if (innerException != null) { // Convert to unchecked exception throw new RuntimeException(innerException); } }
Source:
public void serializeTo(SliceOutput output) { writeLengthPrefixedString(output, NAME); output.writeInt(bufferedPositionCount); serializeNullsTo(output); if (valuesBufferIndex > 0) { try { output.appendBytes(valuesBuffer, 0, valuesBufferIndex); } catch (Exception e) { e.printStackTrace(); } } }

Target:
public void serializeTo(SliceOutput output) { writeLengthPrefixedString(output, NAME); output.writeInt(bufferedPositionCount); serializeNullsTo(output); if (valuesBufferIndex > 0) { output.appendBytes(valuesBuffer, 0, valuesBufferIndex); } }
Source:
public void addInput(Page page) { requireNonNull(page, "page is null"); if (page.getPositionCount() == 0) { return; } page = pagePreprocessor.apply(page); pagePartitioner.partitionPage(page); System.out.println(pagePartitioner.getRetainedSizeInBytes()); // TODO: PartitionedOutputOperator reports incorrect output data size #11770 operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); systemMemoryContext.setBytes(pagePartitioner.getRetainedSizeInBytes()); }

Target:
public void addInput(Page page) { requireNonNull(page, "page is null"); if (page.getPositionCount() == 0) { return; } page = pagePreprocessor.apply(page); pagePartitioner.partitionPage(page); // TODO: PartitionedOutputOperator reports incorrect output data size #11770 operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); systemMemoryContext.setBytes(pagePartitioner.getRetainedSizeInBytes()); }
Source:
public Optional<List<InternalNode>> getBucketToNode() { if (bucketToNodeInfo.size() == 0) { return Optional.empty(); } return Optional.of(bucketToNodeInfo.values().stream().map(InternalNodeInfo::getInternalNode).collect(Collectors.toList())); }

Target:
public Optional<List<InternalNode>> getBucketToNode() { if (bucketToNodeInfo.isEmpty()) { return Optional.empty(); } return Optional.of(bucketToNodeInfo.values().stream().map(InternalNodeInfo::getInternalNode).collect(Collectors.toList())); }
Source:
public void testIpSubnetMax() { assertFunction("IP_SUBNET_MAX(IPPREFIX '1.2.3.128/26')", IPADDRESS, "1.2.3.191"); assertFunction("IP_SUBNET_MAX(IPPREFIX '192.168.128.4/32')", IPADDRESS, "192.168.128.4"); assertFunction("IP_SUBNET_MAX(IPPREFIX '10.1.16.3/9')", IPADDRESS, "10.127.255.255"); assertFunction("IP_SUBNET_MAX(IPPREFIX '2001:db8::16/127')", IPADDRESS, "2001:db8::17"); assertFunction("IP_SUBNET_MAX(IPPREFIX '2001:db8::16/128')", IPADDRESS, "2001:db8::16"); assertFunction("IP_SUBNET_MAX(IPPREFIX '64:ff9b::17/64')", IPADDRESS, "64:ff9b::ffff:ffff:ffff:ffff"); assertFunction("IP_SUBNET_MAX(IPPREFIX '64:ff9b::17/72')", IPADDRESS, "64:ff9b::ff:ffff:ffff:ffff"); assertFunction("IP_SUBNET_MAX(IPPREFIX '64:ff9b::17/0')", IPADDRESS, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"); assertInvalidCast("IP_SUBNET_MAX(IPPREFIX '64::ff9b::10/24')", "Cannot cast value to IPPREFIX: 64::ff9b::10/24"); assertInvalidCast("IP_SUBNET_MAX(IPPREFIX '123.456.789.012/-1')", "Cannot cast value to IPPREFIX: 123.456.789.012/-1"); }

Target:
public void testIpSubnetMax() { assertFunction("IP_SUBNET_MAX(IPPREFIX '1.2.3.128/26')", IPADDRESS, "1.2.3.191"); assertFunction("IP_SUBNET_MAX(IPPREFIX '192.168.128.4/32')", IPADDRESS, "192.168.128.4"); assertFunction("IP_SUBNET_MAX(IPPREFIX '10.1.16.3/9')", IPADDRESS, "10.127.255.255"); assertFunction("IP_SUBNET_MAX(IPPREFIX '2001:db8::16/127')", IPADDRESS, "2001:db8::17"); assertFunction("IP_SUBNET_MAX(IPPREFIX '2001:db8::16/128')", IPADDRESS, "2001:db8::16"); assertFunction("IP_SUBNET_MAX(IPPREFIX '64:ff9b::17/64')", IPADDRESS, "64:ff9b::ffff:ffff:ffff:ffff"); assertFunction("IP_SUBNET_MAX(IPPREFIX '64:ff9b::17/72')", IPADDRESS, "64:ff9b::ff:ffff:ffff:ffff"); assertFunction("IP_SUBNET_MAX(IPPREFIX '64:ff9b::17/0')", IPADDRESS, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"); }
Source:
public int getOffset() { int offset = row; ++row; return offset; }

Target:
public int getOffset() { // have to update row in getOffset, as BaseColumn requires ReadableOffset in makeColumnValuesSelector int offset = row; row++; return offset; }
Source:
protected BytesRange(byte[] lower, boolean lowerExclusive, byte[] upper, boolean upperExclusive, boolean nullAllowed) { super(true, nullAllowed); this.lower = lower; this.upper = upper; this.lowerExclusive = lowerExclusive; this.upperExclusive = upperExclusive; this.singleValue = !lowerExclusive && !upperExclusive && Arrays.equals(upper, lower); }

Target:
private BytesRange(byte[] lower, boolean lowerExclusive, byte[] upper, boolean upperExclusive, boolean nullAllowed) { super(true, nullAllowed); this.lower = lower; this.upper = upper; this.lowerExclusive = lowerExclusive; this.upperExclusive = upperExclusive; this.singleValue = !lowerExclusive && !upperExclusive && Arrays.equals(upper, lower); }
Source:
private PlanBuilder planBuilderFor(PlanBuilder builder, Scope scope, Iterable<? extends Expression> expressionsToRemap) { PlanBuilder newBuilder = planBuilderFor(builder, scope); for (Expression expression : expressionsToRemap) { // We can't deduplicate expressions here because even if two expressions are equal, // the TranslationMap maps sql names to symbols, and any lambda expressions will be // resolved differently since the lambdaDeclarationToVariableMap is identity based. newBuilder.getTranslations().put(expression, builder.translate(expression)); } return newBuilder; }

Target:
private PlanBuilder planBuilderFor(PlanBuilder builder, Scope scope, Iterable<? extends Expression> expressionsToRemap) { PlanBuilder newBuilder = planBuilderFor(builder, scope); // We can't deduplicate expressions here because even if two expressions are equal, // the TranslationMap maps sql names to symbols, and any lambda expressions will be // resolved differently since the lambdaDeclarationToVariableMap is identity based. stream(expressionsToRemap) .forEach(expression -> newBuilder.getTranslations().put(expression, builder.translate(expression))); return newBuilder; }
Source:
public void acknowledgeResultsAsync(long nextToken) { executor.execute(() -> { try { thriftClient.acknowledgeResults(taskId, outputBufferId, nextToken); } catch (Exception exception) { log.debug(exception, "Acknowledge request failed: %s/%s/%s", taskId, outputBufferId, nextToken); } }); }

Target:
public void acknowledgeResultsAsync(long nextToken) { // no need to handle the future thriftClient.acknowledgeResults(taskId, outputBufferId, nextToken); }
Source:
public void testTableTablesWithoutUpgrading() { // without perform upgrading operation would cause metadata incorrect long tableId = dao.insertTable("schema1", "table1", true, false, null, 0, false); assertNotNull(tableId); }

Target:
public void testTableTablesWithoutUpgrading() { // without perform upgrading operation would cause metadata incorrect dao.insertTable("schema1", "table1", true, false, null, 0, false); }
Source:
public Optional<BitSet> getRowsDeleted() { // Just load once if (!loaded && tableSupportsDeltaDelete && deltaShardUuid.isPresent()) { rowsDeleted = orcStorageManager.getRowsFromUuid(fileSystem, deltaShardUuid); loaded = true; } return rowsDeleted; }

Target:
private Optional<BitSet> getRowsDeleted() { // Just load once if (!loaded && tableSupportsDeltaDelete && deltaShardUuid.isPresent()) { rowsDeleted = orcStorageManager.getRowsFromUuid(fileSystem, deltaShardUuid); loaded = true; } return rowsDeleted; }
Source:
static String getAlphaNumericString(int length) { String alphaNumericString = "USINDIA"; StringBuilder stringBuilder = new StringBuilder(length); for (int index = 0; index < length; index++) { int arrayIndex = (int) (alphaNumericString.length() * Math.random()); stringBuilder.append(alphaNumericString.charAt(arrayIndex)); } return stringBuilder.toString(); }

Target:
private static String getAlphaNumericString(int length) { String alphaNumericString = "USINDIA"; StringBuilder stringBuilder = new StringBuilder(length); for (int index = 0; index < length; index++) { int arrayIndex = (int) (alphaNumericString.length() * Math.random()); stringBuilder.append(alphaNumericString.charAt(arrayIndex)); } return stringBuilder.toString(); }
Source:
public void testIsDistinctFrom() { long[] arr1 = {112L, 0L}; // DECIMAL '1.12' long[] arr2 = {185L, 0L}; // DECIMAL '1.85' Block left = new Int128ArrayBlock(1, Optional.empty(), arr1); Block right = new Int128ArrayBlock(1, Optional.empty(), arr2); assertFalse(DecimalInequalityOperators.distinctBlockPositionLongLong(left, 0, left, 0)); assertTrue(DecimalInequalityOperators.distinctBlockPositionLongLong(left, 0, right, 0)); }

Target:
public void testIsDistinctFrom() { Block left = new Int128ArrayBlock(1, Optional.empty(), new long[]{112L, 0L}); Block right = new Int128ArrayBlock(1, Optional.empty(), new long[]{185L, 0L}); assertFalse(distinctBlockPositionLongLong(left, 0, left, 0)); assertTrue(distinctBlockPositionLongLong(left, 0, right, 0)); }
Source:
private void transitionToFinished() { cleanupQueryQuietly(); queryStateTimer.endQuery(); session.getSessionLogger().log(() -> "Query state machine finished"); queryState.setIf(FINISHED, currentState -> !currentState.isDone()); }

Target:
private void transitionToFinished() { cleanupQueryQuietly(); queryStateTimer.endQuery(); queryState.setIf(FINISHED, currentState -> !currentState.isDone()); }
Source:
private synchronized void startSplit(PrioritizedSplitRunner split) { allSplits.add(split); split.getTaskHandle().getSessionLogger().log(() -> "offering split " + split); waitingSplits.offer(split); }

Target:
private synchronized void startSplit(PrioritizedSplitRunner split) { allSplits.add(split); waitingSplits.offer(split); }
Source:
public void start() { try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) { // to start we just need to trigger an update scheduleUpdate(); taskStatusFetcher.start(); taskInfoFetcher.start(); session.getSessionLogger().log(() -> String.format("started task %s", taskId)); } }

Target:
public void start() { try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) { // to start we just need to trigger an update scheduleUpdate(); taskStatusFetcher.start(); taskInfoFetcher.start(); } }
Source:
public TestFixedHistogramJacknifeAggregation() { super(DifferentialEntropyStateStrategy.FIXED_HISTOGRAM_JACKNIFE_METHOD_NAME); }

Target:
public TestFixedHistogramJacknifeAggregation() { super(FIXED_HISTOGRAM_JACKNIFE_METHOD_NAME); }
Source:
public Set<Class<?>> getFunctionTranslators() { return ImmutableSet.of(OperatorTranslators.class); }

Target:
private Set<Class<?>> getFunctionTranslators() { return ImmutableSet.of(OperatorTranslators.class); }
Source:
private int getValidPercentile(String fraction) { try { double p = Double.parseDouble(fraction); if (p < 0 || p > 1) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentile must be between 0 and 1"); } double percent = p * 100.0; if (percent == Math.floor(percent)) { return (int) percent; } } catch (NumberFormatException ne) { // Skip } return -1; }

Target:
private int getValidPercentile(String fraction) { try { double percent = Double.parseDouble(fraction); if (percent < 0 || percent > 1) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentile must be between 0 and 1"); } percent = percent * 100.0; if (percent == Math.floor(percent)) { return (int) percent; } } catch (NumberFormatException ne) { // Skip } return -1; }
Source:
public String sendHttpGetToController(String path) { return doHttpActionWithHeaders( Request.builder().prepareGet().setUri(URI.create(String.format("http://%s/%s", getControllerUrl(), path))), Optional.empty(), Optional.ofNullable(pinotConfig.getControllerRestService())); }

Target:
private String sendHttpGetToController(String path) { return doHttpActionWithHeaders( Request.builder().prepareGet().setUri(URI.create(String.format("http://%s/%s", getControllerUrl(), path))), Optional.empty(), Optional.ofNullable(pinotConfig.getControllerRestService())); }
Source:
public static TypeSignature removeTypeParameters(TypeSignature typeSignature) { return new TypeSignature(typeSignature.getBase()); }

Target:
private static TypeSignature removeTypeParameters(TypeSignature typeSignature) { return new TypeSignature(typeSignature.getBase()); }
Source:
static int getHashTableSize(int positionCount){ return HashCommon.arraySize(positionCount, 0.75f); }

Target:
private static int getHashTableSize(int positionCount) { return HashCommon.arraySize(positionCount, 0.75f); }
Source:
static long getEstimatedAdditionalSize(int positionCount){ int hashSize = getHashTableSize(positionCount); long predictedKeySize = sizeOfIntArray(hashSize); long predictedPositionToHashesSize = sizeOfByteArray(positionCount); long predictedPositionLinksSize = sizeOfIntArray(positionCount); return predictedKeySize + predictedPositionToHashesSize + predictedPositionLinksSize; }

Target:
public static long getEstimatedAdditionalSize(int positionCount) { int hashSize = getHashTableSize(positionCount); long predictedKeySize = sizeOfIntArray(hashSize); long predictedPositionToHashesSize = sizeOfByteArray(positionCount); long predictedPositionLinksSize = sizeOfIntArray(positionCount); return predictedKeySize + predictedPositionToHashesSize + predictedPositionLinksSize; }
Source:
protected BlockLease newLease(Block block) { valuesInUse = true; return ClosingBlockLease.newLease(block, () -> valuesInUse = false); }

Target:
private BlockLease newLease(Block block) { valuesInUse = true; return ClosingBlockLease.newLease(block, () -> valuesInUse = false); }
Source:
public void testBytes() { // Single tinyint column assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex WHERE ship_day < 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day > 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day is null"); // Two tinyint columns assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day = 1 AND ship_month = 1"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_month is null"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_day is not null AND ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day > 15 AND ship_month < 5 AND (ship_day + ship_month) < 20"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day_month[2] = 12"); assertQueryUsingH2Cte("SELECT ship_day_month_nulls FROM lineitem_ex WHERE ship_day_month_nulls[1] is NOT NULL AND ship_day_month[1] > 3"); }

Target:
public void testBytes() { // Single tinyint column assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex WHERE ship_day < 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day > 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day is null"); // Two tinyint columns assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day = 1 AND ship_month = 1"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_month is null"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_day is not null AND ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day > 15 AND ship_month < 5 AND (ship_day + ship_month) < 20"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day_month[2] = 12"); }
Source:
public void testCreateTableWithUnsupportedType() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); try { ConnectorTableMetadata raptorMetadata = buildTable(ImmutableMap.of(), tableMetadataBuilder(DEFAULT_TEST_ORDERS) .column("orderkey", BIGINT) .column("rowtype", RowType.withDefaultFieldNames(ImmutableList.of(BIGINT)))); metadata.createTable(SESSION, raptorMetadata, false); fail(); } catch (PrestoException e) { assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode()); } }

Target:
public void testCreateTableWithUnsupportedType() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); ConnectorTableMetadata raptorMetadata = buildTable(ImmutableMap.of(), tableMetadataBuilder(DEFAULT_TEST_ORDERS) .column("orderkey", BIGINT) .column("rowtype", RowType.withDefaultFieldNames(ImmutableList.of(BIGINT)))); try { metadata.createTable(SESSION, raptorMetadata, false); fail(); } catch (PrestoException e) { assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode()); } }
Source:
synchronized Map<QueryId, Map<String, Long>> getTaggedMemoryAllocations() { return taggedMemoryAllocations.keySet().stream() .collect(toImmutableMap(identity(), queryId -> getTaggedMemoryAllocations(queryId))); }

Target:
synchronized Map<QueryId, Map<String, Long>> getTaggedMemoryAllocations() { return taggedMemoryAllocations.keySet().stream() .collect(toImmutableMap(identity(), this::getTaggedMemoryAllocations)); }
Source:
protected UnweightedReservoirSampleStateStrategy(UnweightedReservoirSampleStateStrategy other) { reservoir = other.reservoir.clone(); }

Target:
private UnweightedReservoirSampleStateStrategy(UnweightedReservoirSampleStateStrategy other) { reservoir = other.reservoir.clone(); }
Source:
public void addInput(Page page) { requireNonNull(page, "page is null"); if (page.getPositionCount() == 0) { return; } page = pagePreprocessor.apply(page); if (useOptmizedPartitionedOutputOperator) { partitionFunction.ariaPartitionPage(page); } else { partitionFunction.partitionPage(page); } operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); // We use getSizeInBytes() here instead of getRetainedSizeInBytes() for an approximation of // the amount of memory used by the pageBuilders, because calculating the retained // size can be expensive especially for complex types. long partitionsSizeInBytes = partitionFunction.getSizeInBytes(); // We also add partitionsInitialRetainedSize as an approximation of the object overhead of the partitions. systemMemoryContext.setBytes(partitionsSizeInBytes + partitionsInitialRetainedSize); }

Target:
public void addInput(Page page) { requireNonNull(page, "page is null"); if (page.getPositionCount() == 0) { return; } page = pagePreprocessor.apply(page); partitionFunction.partitionPage(page); operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); // We use getSizeInBytes() here instead of getRetainedSizeInBytes() for an approximation of // the amount of memory used by the pageBuilders, because calculating the retained // size can be expensive especially for complex types. long partitionsSizeInBytes = partitionFunction.getSizeInBytes(); // We also add partitionsInitialRetainedSize as an approximation of the object overhead of the partitions. systemMemoryContext.setBytes(partitionsSizeInBytes + partitionsInitialRetainedSize); }