auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String getListTransactions(int limit) throws Exception { String region = SPLICE_PREFIX + HBaseConfiguration.TRANSACTION_TABLE; Utils.Tabular tabular = new Utils.Tabular(Utils.Tabular.SortHint.AsInteger, TBL_TXN_COL0, TBL_TXN_COL1, TBL_TXN_COL2, TBL_TXN_COL3, TBL_TXN_COL4, TBL_TXN_COL5, TBL_TXN_COL6, TBL_TXN_COL7, TBL_TXN_COL8, TBL_TXN_COL9); TxnTableRowPrinter rowVisitor = new TxnTableRowPrinter(); <START> int scanLimit = limit == 0 ? 0 : limit+1, count = 0; <END> ConnectionWrapper c = getCachedConnection().withRegion(region); try(final ResultScanner rs = c.scanVersions(scanLimit, 0 ) ) { for (Result row : rs) { if( count++ == limit ) { break; } List<String> rowString = rowVisitor.processRow(row); tabular.addRow(rowString.toArray(new String[0])); } } String result = Utils.printTabularResults(tabular); if(count > limit) result = result + Utils.limitString(limit); return result; }</code><technical_language>separate lines instead of comma</technical_language>

Target:
public String getListTransactions(int limit) throws Exception { String region = SPLICE_PREFIX + HBaseConfiguration.TRANSACTION_TABLE; Utils.Tabular tabular = new Utils.Tabular(Utils.Tabular.SortHint.AsInteger, TBL_TXN_COL0, TBL_TXN_COL1, TBL_TXN_COL2, TBL_TXN_COL3, TBL_TXN_COL4, TBL_TXN_COL5, TBL_TXN_COL6, TBL_TXN_COL7, TBL_TXN_COL8, TBL_TXN_COL9); TxnTableRowPrinter rowVisitor = new TxnTableRowPrinter(); int scanLimit = limit == 0 ? 0 : limit+1; int count = 0; ConnectionWrapper c = getCachedConnection().withRegion(region); try(final ResultScanner rs = c.scanVersions(scanLimit, 0 ) ) { for (Result row : rs) { if( count++ == limit ) { break; } List<String> rowString = rowVisitor.processRow(row); tabular.addRow(rowString.toArray(new String[0])); } } String result = Utils.printTabularResults(tabular); if(count > limit) result = result + Utils.limitString(limit); return result; }
Source:
<code>private Callable<Trace> thatSetsTraceInCurrentThreadLocalWithInitialTrace() { return new Callable<Trace>() { @Override public Trace call() throws Exception { <START> TraceContextHolder.setCurrentTrace(Mockito.mock(Trace.class)); <END> return TraceContextHolder.getCurrentTrace(); } }; }</code><technical_language>Usage of TraceContextHolder is basically banned heavily discouraged this in real user code</technical_language>

Target:
private Callable<Trace> thatSetsTraceInCurrentThreadLocalWithInitialTrace() { return new Callable<Trace>() { @Override public Trace call() throws Exception { return TraceContextHolder.getCurrentTrace(); } }; }
Source:
<code>private Mono<CosmosConflictResponse> readInternal(RequestOptions options, Context context) { String spanName = "readConflict." + getId(); Mono<CosmosConflictResponse> responseMono = this.readInternal(options); return this.container.getDatabase().getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, spanName, <START> this.container.getDatabase().getId(), <END> this.container.getDatabase().getClient().getServiceEndpoint()); }</code><technical_language>Is getId() L111 database Id this line</technical_language>

Target:
private Mono<CosmosConflictResponse> readInternal(RequestOptions options, Context context) { String spanName = "readConflict." + getId(); Mono<CosmosConflictResponse> responseMono = this.container.getDatabase().getDocClientWrapper().readConflict(getLink(), options) .map(response -> ModelBridgeInternal.createCosmosConflictResponse(response)).single(); return this.container.getDatabase().getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, spanName, this.container.getDatabase().getId(), this.container.getDatabase().getClient().getServiceEndpoint()); }
Source:
<code>static Result emptyResult() { DeliveryErrors noErrors = DeliveryErrors.newBuilder() .build(); <START> return new Result(0, noErrors); <END> }</code><technical_language>if a constant</technical_language>

Target:
static Result emptyResult() { return EMPTY_RESULT; }
Source:
<code>public ArrayList<Class<? extends Player>> getProfiles() { PMS r = PMS.get(); PMS r1 = PMS.get(); PMS r2 = PMS.get(); if (PMS.getConfiguration().getEnginesAsList(r.getRegistry()) == null || PMS.getConfiguration().getEnginesAsList(r1.getRegistry()).isEmpty() || PMS.getConfiguration().getEnginesAsList(r2.getRegistry()).contains("none")) { return null; } ArrayList<Class<? extends Player>> a = new ArrayList<Class<? extends Player>>(); PMS r3 = PMS.get(); for (String engine : PMS.getConfiguration().getEnginesAsList(r3.getRegistry())) { <START> if(engine.equals(VLCVideo.ID)) <END> a.add(VLCVideo.class); else if (engine.equals(MEncoderVideo.ID)) { a.add(MEncoderVideo.class); } else if (engine.equals(MEncoderAviSynth.ID) && PMS.get().getRegistry().isAvis()) { a.add(MEncoderAviSynth.class); } else if (engine.equals(FFMpegVideo.ID)) { a.add(FFMpegVideo.class); } else if (engine.equals(FFMpegAviSynthVideo.ID) && PMS.get().getRegistry().isAvis()) { a.add(FFMpegAviSynthVideo.class); } else if (engine.equals(TSMuxerVideo.ID) ) { a.add(TSMuxerVideo.class); } } return a; }</code><technical_language>Space if curly brackets</technical_language>

Target:
public ArrayList<Class<? extends Player>> getProfiles() { PMS r = PMS.get(); PMS r1 = PMS.get(); PMS r2 = PMS.get(); if (PMS.getConfiguration().getEnginesAsList(r.getRegistry()) == null || PMS.getConfiguration().getEnginesAsList(r1.getRegistry()).isEmpty() || PMS.getConfiguration().getEnginesAsList(r2.getRegistry()).contains("none")) { return null; } ArrayList<Class<? extends Player>> a = new ArrayList<Class<? extends Player>>(); PMS r3 = PMS.get(); for (String engine : PMS.getConfiguration().getEnginesAsList(r3.getRegistry())) { if (engine.equals(VLCVideo.ID)) { a.add(VLCVideo.class); } else if (engine.equals(MEncoderVideo.ID)) { a.add(MEncoderVideo.class); } else if (engine.equals(MEncoderAviSynth.ID) && PMS.get().getRegistry().isAvis()) { a.add(MEncoderAviSynth.class); } else if (engine.equals(FFMpegVideo.ID)) { a.add(FFMpegVideo.class); } else if (engine.equals(FFMpegAviSynthVideo.ID) && PMS.get().getRegistry().isAvis()) { a.add(FFMpegAviSynthVideo.class); } else if (engine.equals(TSMuxerVideo.ID) ) { a.add(TSMuxerVideo.class); } } return a; }
Source:
<code>public MysqlConnector(Properties config) throws DatastreamException { _defaultUserName = config.getProperty(CFG_MYSQL_USERNAME); _defaultPassword = config.getProperty(CFG_MYSQL_PASSWORD); String strServerId = config.getProperty(CFG_MYSQL_SERVER_ID); _sourceType = SourceType.valueOf(config.getProperty(CFG_MYSQL_SOURCE_TYPE, DEFAULT_MYSQL_SOURCE_TYPE)); if (strServerId == null) { <START> throw new DatastreamException("Missing serverId property."); <END> } if (_sourceType == SourceType.MYSQLSERVER && (_defaultUserName == null || _defaultPassword == null)) { throw new DatastreamException("Missing mysql username or password."); } _defaultServerId = Integer.valueOf(strServerId); _mysqlProducers = new ConcurrentHashMap<>(); _numDatastreamTasks = () -> _numTasks; }</code><technical_language>this a RuntimeException if config is wrong</technical_language>

Target:
public MysqlConnector(Properties config) throws DatastreamException { _defaultUserName = config.getProperty(CFG_MYSQL_USERNAME); _defaultPassword = config.getProperty(CFG_MYSQL_PASSWORD); String strServerId = config.getProperty(CFG_MYSQL_SERVER_ID); _sourceType = SourceType.valueOf(config.getProperty(CFG_MYSQL_SOURCE_TYPE, DEFAULT_MYSQL_SOURCE_TYPE)); if (strServerId == null) { throw new DatastreamRuntimeException("Missing serverId property."); } if (_sourceType == SourceType.MYSQLSERVER && (_defaultUserName == null || _defaultPassword == null)) { throw new DatastreamRuntimeException("Missing mysql username or password."); } _defaultServerId = Integer.valueOf(strServerId); _mysqlProducers = new ConcurrentHashMap<>(); _numDatastreamTasks = () -> _numTasks; }
Source:
<code>public static ExceptionThrowingSubTest expectThrowable(Runnable runnable) { <START> return expectException( runnable.toString(), runnable ); <END> }</code><technical_language>expectThrowable for consistency</technical_language>

Target:
public static ExceptionThrowingSubTest expectThrowable(Runnable runnable) { return expectThrowable( runnable.toString(), runnable ); }
Source:
<code>public boolean isInstanceOf(Object o) { if ( o == null || !(o instanceof Map) ) { return false; } Map<?, ?> instance = (Map<?, ?>) o; for ( Entry<String, Type> f : fields.entrySet() ) { Object instanceValueForKey = instance.get(f.getKey()); <START> if ( instance.get(f.getKey()) == null || !f.getValue().isInstanceOf(instanceValueForKey) ) { <END> return false; } } return true; }</code><technical_language>@tarilabs is this correct? cases, a map backed instance a attribute, attribute is null. For instance, a Person instance require "Last Name" attribute considered a person, attribute set null. is a person if name is null, in duck typing is a person if name attribute exist</technical_language>

Target:
public boolean isInstanceOf(Object o) { if ( o == null || !(o instanceof Map) ) { return false; } Map<?, ?> instance = (Map<?, ?>) o; for ( Entry<String, Type> f : fields.entrySet() ) { if ( !instance.containsKey(f.getKey()) ) { return false; } Object instanceValueForKey = instance.get(f.getKey()); if ( instanceValueForKey != null && !f.getValue().isInstanceOf(instanceValueForKey) ) { return false; } } return true; }
Source:
<code>public ElasticsearchColumn( @JsonProperty("name") String name, @JsonProperty("type") Type type, @JsonProperty("jsonPath") String jsonPath, @JsonProperty("jsonType") String jsonType, @JsonProperty("isList") boolean isList, @JsonProperty("ordinalPosition") int ordinalPosition) { <START> checkArgument(!isNullOrEmpty(name), "name is null or is empty"); <END> this.name = name; this.type = requireNonNull(type, "type is null"); this.jsonPath = requireNonNull(jsonPath, "jsonPath is null"); this.jsonType = requireNonNull(jsonType, "jsonType is null"); this.isList = isList; this.ordinalPosition = ordinalPosition; }</code><technical_language>name is null empty</technical_language>

Target:
public ElasticsearchColumn( @JsonProperty("name") String name, @JsonProperty("type") Type type, @JsonProperty("jsonPath") String jsonPath, @JsonProperty("jsonType") String jsonType, @JsonProperty("isList") boolean isList, @JsonProperty("ordinalPosition") int ordinalPosition) { checkArgument(!isNullOrEmpty(name), "name is null or empty"); this.name = name; this.type = requireNonNull(type, "type is null"); this.jsonPath = requireNonNull(jsonPath, "jsonPath is null"); this.jsonType = requireNonNull(jsonType, "jsonType is null"); this.isList = isList; this.ordinalPosition = ordinalPosition; }
Source:
<code><START> private void enqueueThrownExceptionalPaths(Symbol symbol) { <END> if (symbol.isMethodSymbol()) { ProgramState ps = programState.clearStack(); ((Symbol.MethodSymbol) symbol).thrownTypes().stream() .map(constraintManager::createExceptionalSymbolicValue) .forEach(exceptionSV -> enqueueExceptionalPaths(ps, exceptionSV)); } }</code><technical_language>I this rely MethodInvocationTree : allow declare methodSymbol local variable</technical_language>

Target:
private void enqueueThrownExceptionalPaths(Symbol symbol) { if (!symbol.isMethodSymbol()) { return; } ProgramState ps = programState.clearStack(); ((Symbol.MethodSymbol) symbol).thrownTypes().stream() .map(constraintManager::createExceptionalSymbolicValue) .forEach(exceptionSV -> enqueueExceptionalPaths(ps, exceptionSV)); }
Source:
<code>public int read() throws IOException { <START> if (++count < maxcount) { <END> if (count % ((maxcount / 2) / maxlines) == 0) { return '\n'; } else { return letters.charAt((int) (Math.random() % letters.length())); } } return -1; }</code><technical_language>Iterating in conditional possibly miscounts read() is done get -1</technical_language>

Target:
public int read() throws IOException { int ret; if (charCount < maxCharCount) { if (charCount > 0 && lines < maxLines - 1 && charCount == lineBreaks[lines]) { ret = '\n'; lines++; } else { ret = letters.charAt(ThreadLocalRandom.current().nextInt(0, letters.length())); } result += String.format("%c", ret); charCount++; return ret; } return -1; }
Source:
<code><START> public List<TaskSummary> findTasksAssignedAsPotentialOwner(String userId, String filter, List<String> status, Integer page, Integer pageSize) { <END> TaskSummaryList taskSummaryList = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); String userQuery = getUserQueryStr(userId); String statusQuery = getAdditionalParams(userQuery, "status", status); String queryString = getPagingQueryString(statusQuery, page, pageSize)+"&filter="+filter; taskSummaryList = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), QUERY_URI + "/" + TASKS_ASSIGN_POT_OWNERS_GET_URI, valuesMap) + queryString , TaskSummaryList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "QueryService", "getTasksAssignedAsPotentialOwner", new Object[]{status, new ArrayList(), userId, page, pageSize, "", true, filter}) ) ); ServiceResponse<TaskSummaryList> response = (ServiceResponse<TaskSummaryList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } taskSummaryList = response.getResult(); } if (taskSummaryList != null && taskSummaryList.getTasks() != null) { return Arrays.asList(taskSummaryList.getTasks()); } return Collections.emptyList(); }</code><technical_language>This is unnecessary duplication, call other findTasksAssignedAsPotentialOwner default sorting</technical_language>

Target:
public List<TaskSummary> findTasksAssignedAsPotentialOwner(String userId, String filter, List<String> status, Integer page, Integer pageSize) { return findTasksAssignedAsPotentialOwner(userId, filter, status, page, pageSize, "", true); }
Source:
<code><START> private String getParentArticleDoiFromComment(Map<String, Object> comment) { <END> return (String) ((Map<String, Object>) ((Map<String, Object>) comment.get("parentArticle")).get("doi")).get("doiName"); }</code><technical_language>This static</technical_language>

Target:
private static String getParentArticleDoiFromComment(Map<String, Object> comment) { return (String) (((Map<String, Object>) comment.get("parentArticle")).get("doi")); }
Source:
<code>private void closeJMSResources() { if (clientCaching) { sessionPool.clear(); connections.forEach(connection -> { try { connection.getConnection().close(); } catch (JMSException e) { <START> logger.error("Error closing the connection" + e); <END> } }); connections.clear(); } }</code><technical_language>logging e a string pass this throwable argument for logger.error method</technical_language>

Target:
public void closeJMSResources() throws JMSConnectorException { if (clientCaching) { sessionPool.clear(); sessionPool.close(); for (int i = 0; i < connections.size(); i++) { try { closeConnection(connections.get(i).getConnection()); } catch (JMSException e) { throw new JMSConnectorException("Error closing the connection.", e); } } } }
Source:
<code>protected String getUnitTestFileName(String className) { String fileName = getUnitTestClassName(className); <START> fileName = fileName.replace('.', File.separator.charAt(0)); <END> fileName = fileName + ".js"; return fileName; }</code><technical_language>@pwillworth File#separatorChar</technical_language>

Target:
protected String getUnitTestFileName(String className) { String fileName = getUnitTestClassName(className); fileName = fileName.replace('.', File.separatorChar); fileName = fileName + ".js"; return fileName; }
Source:
<code><START> protected Map<String, Pair<String, String>> getSharedLocks() { <END> final Map<String, Pair<String, String>> result = new HashMap<>(super.getSharedLocks()); result.put(getVmId().toString(), LockMessagesMatchUtil.makeLockingPair( LockingGroup.VM, new LockMessage(EngineMessage.ACTION_TYPE_FAILED_CLUSTER_IS_BEING_UPDATED) .with("vmName", getVmName()))); return result; }</code><technical_language>I if change this command receive device id unplug - ui user pick device remove in vm-devices subtab UpdateVm for actual device remove. simply lock device prevent multiple simultaneous unplug operations device</technical_language>

Target:
protected Map<String, Pair<String, String>> getSharedLocks() { final Map<String, Pair<String, String>> result = new HashMap<>(super.getSharedLocks()); result.put(getVmId().toString(), LockMessagesMatchUtil.makeLockingPair( LockingGroup.VM, new LockMessage(EngineMessage.ACTION_TYPE_FAILED_MEMORY_DEVICE_IS_BEING_HOT_UNPLUGGED) .with("vmName", getVmName()))); return result; }
Source:
<code>private void sendEmailReportingTheException(Exception exp) { StringBuffer bodyMsg = new StringBuffer(); bodyMsg.append("Background Polling has some Exceptions due to "+exp.getMessage()); bodyMsg.append(Utils.CONSTANT_LINE_FEED); StringWriter errors = new StringWriter(); exp.printStackTrace(new PrintWriter(errors)); bodyMsg.append(errors.toString()); M_log.debug(bodyMsg.toString()); Properties properties = getMailProperties(); Session session = Session.getInstance(properties); MimeMessage message = new MimeMessage(session); try { String ccmSupportAddress = appExtPropertiesFile.getProperty(Utils.SIS_REPORT_CCM_SUPPORT_ADDRESS); String fromAddress = appExtPropertiesFile.getProperty(Utils.FRIEND_CONTACT_EMAIL); message.addRecipient(Message.RecipientType.TO, new InternetAddress(ccmSupportAddress)); message.setFrom(new InternetAddress(fromAddress)); <START> message.setSubject("Polling Thread Exceptions"); <END> Multipart multipart = new MimeMultipart(); BodyPart body = new MimeBodyPart(); body.setText(bodyMsg.toString()); multipart.addBodyPart(body); message.setContent(multipart); Transport.send(message); } catch (MessagingException e) { M_log.error("Email failed due to " + e.getMessage()); } catch (Exception e) { M_log.error("Email failed due to " + e.getMessage()); } }</code><technical_language>Add project name (CCM) subject</technical_language>

Target:
private void sendEmailReportingTheException(Exception exp) { StringBuffer bodyMsg = new StringBuffer(); bodyMsg.append("Background Polling has some Exceptions due to "+exp.getMessage()); bodyMsg.append(Utils.CONSTANT_LINE_FEED); StringWriter errors = new StringWriter(); exp.printStackTrace(new PrintWriter(errors)); bodyMsg.append(errors.toString()); M_log.debug(bodyMsg.toString()); Properties properties = getMailProperties(); Session session = Session.getInstance(properties); MimeMessage message = new MimeMessage(session); try { String ccmSupportAddress = appExtPropertiesFile.getProperty(Utils.SIS_REPORT_CCM_SUPPORT_ADDRESS); String fromAddress = appExtPropertiesFile.getProperty(Utils.FRIEND_CONTACT_EMAIL); message.addRecipient(Message.RecipientType.TO, new InternetAddress(ccmSupportAddress)); message.setFrom(new InternetAddress(fromAddress)); message.setSubject("Canvas Course Manage: Polling Thread Exceptions"); Multipart multipart = new MimeMultipart(); BodyPart body = new MimeBodyPart(); body.setText(bodyMsg.toString()); multipart.addBodyPart(body); message.setContent(multipart); Transport.send(message); } catch (MessagingException e) { M_log.error("Email failed due to " + e.getMessage()); } catch (Exception e) { M_log.error("Email failed due to " + e.getMessage()); } }
Source:
<code>private static byte[] serialize(Metadata metadata) { try { <START> return new ObjectMapper().writeValueAsBytes(metadata); <END> } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>pull ObjectMapper out a static final Afterburner, avoid thrashing testing serDe private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper().registerModule(new AfterburnerModule());</technical_language>

Target:
private static byte[] serialize(Metadata metadata) { try { return MAPPER.writeValueAsBytes(metadata); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code><START> public OafBodyWithOrderedUpdates(List<QualifiedOafJsonRecord> infoSpaceRecords) { <END> Preconditions.checkNotNull(infoSpaceRecords); SortedMap<String, String> updatesOrderedByQualifier = null; for (QualifiedOafJsonRecord record : infoSpaceRecords) { if (BODY_QUALIFIER_NAME.equals(record.getQualifier().toString())) { this.body = record.getOafJson().toString(); } else { if (updatesOrderedByQualifier==null) { updatesOrderedByQualifier = Maps.newTreeMap(); } updatesOrderedByQualifier.put(record.getQualifier().toString(), record.getOafJson().toString()); } } this.orderedUpdates = updatesOrderedByQualifier!=null?updatesOrderedByQualifier.values():Collections.emptyList(); }</code><technical_language>Constructors in code section</technical_language>

Target:
public OafBodyWithOrderedUpdates(List<QualifiedOafJsonRecord> infoSpaceRecords) { Preconditions.checkNotNull(infoSpaceRecords); SortedMap<String, String> updatesOrderedByQualifier = null; for (QualifiedOafJsonRecord record : infoSpaceRecords) { if (BODY_QUALIFIER_NAME.equals(record.getQualifier())) { this.body = record.getOafJson(); } else { if (updatesOrderedByQualifier==null) { updatesOrderedByQualifier = Maps.newTreeMap(); } updatesOrderedByQualifier.put(record.getQualifier(), record.getOafJson()); } } this.orderedUpdates = updatesOrderedByQualifier!=null?updatesOrderedByQualifier.values():Collections.emptyList(); }
Source:
<code>protected void updateLeaseStorageDomains(final Guid selectedStorageDomainId) { AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>( returnValue -> { List<StorageDomain> domains = new ArrayList<>(); domains.add(null); <START> returnValue.stream() <END> .filter(d -> d.getStorageDomainType().isDataDomain()) .filter(d -> d.getStatus() == StorageDomainStatus.Active) .forEach(d -> domains.add(d)); getModel().getLease().setItems(domains); if (selectedStorageDomainId != null) { returnValue.stream() .filter(d -> d.getStorageDomainType().isDataDomain()) .filter(d -> selectedStorageDomainId.equals(d.getId())) .findFirst().ifPresent(d -> getModel().getLease().setSelectedItem(d)); } setVmLeasesAvailability(); }), getModel().getSelectedDataCenter().getId()); }</code><technical_language>please extract refactor a separate patch</technical_language>

Target:
protected void updateLeaseStorageDomains(final Guid selectedStorageDomainId) { AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>( returnValue -> { List<StorageDomain> domains = new ArrayList<>(); domains.add(null); for (StorageDomain domain : returnValue) { if (domain.getStorageDomainType().isDataDomain() && domain.getStatus() == StorageDomainStatus.Active) { domains.add(domain); } } getModel().getLease().setItems(domains); if (selectedStorageDomainId != null) { returnValue.stream() .filter(d -> d.getStorageDomainType().isDataDomain()) .filter(d -> selectedStorageDomainId.equals(d.getId())) .findFirst().ifPresent(d -> getModel().getLease().setSelectedItem(d)); } setVmLeasesAvailability(); }), getModel().getSelectedDataCenter().getId()); }
Source:
<code>private boolean init(StreamConfig config) throws NotFoundException { URL url = null; if (config.getURL().isPresent()) { url = config.getURL().get(); } else if (config.getStreamFile().isPresent()) { try { url = config.getStreamFile().get().toURI().toURL(); } catch (MalformedURLException e) { throw new NotFoundException(e); } <START> } else { <END> throw new NotFoundException("StreamConfig requires either a URL or File to be specified"); } Map<String, Stream> streamsMap = StreamsJsonParser.parse(url); Set<String> toRetainMap = new HashSet<String>(streamsMap.keySet()); toRetainMap.retainAll(streamMap.keySet()); if (toRetainMap.size() > 0) { throw new IllegalArgumentException( "URL '" + url + "' contain entires that overlap: " + Arrays.toString(toRetainMap.toArray())); } this.streamMap.putAll(streamsMap); this.urlToStreamsMap.put(url, streamsMap.values()); return true; }</code><technical_language>_streamsMap_ named _parsedStreamMap_ clear difference other map called _streamMap_</technical_language>

Target:
private boolean init(StreamConfig config) throws NotFoundException { URL url = null; if (config.getURL().isPresent()) { url = config.getURL().get(); } else if (config.getStreamFile().isPresent()) { try { url = config.getStreamFile().get().toURI().toURL(); } catch (MalformedURLException e) { throw new NotFoundException(e); } } else { throw new NotFoundException("StreamConfig requires either a URL or File to be specified"); } Map<String, Stream> streamsMap = StreamsJsonParser.parse(url); Set<String> toRetainMap = new HashSet<String>(streamsMap.keySet()); toRetainMap.retainAll(parsedStreamsMap.keySet()); if (toRetainMap.size() > 0) { throw new IllegalArgumentException( "URL '" + url + "' contain entires that overlap: " + Arrays.toString(toRetainMap.toArray())); } this.parsedStreamsMap.putAll(streamsMap); this.urlToParsedStreams.put(url, streamsMap.values()); return true; }
Source:
<code>public FindInfo findEntriesSince(FindToken token, long maxSizeOfEntries) throws StoreException { MockFindToken tokenmock = (MockFindToken) token; List<MessageInfo> entriesToReturn = new ArrayList<MessageInfo>(); long currentSizeOfEntries = 0; int index = 0; while (currentSizeOfEntries < maxSizeOfEntries && index < messageInfoList.size()) { entriesToReturn.add(messageInfoList.get(tokenmock.getIndex() + index)); index++; } return new FindInfo(entriesToReturn, new MockFindToken(tokenmock.getIndex() + entriesToReturn.size()), <START> entriesToReturn.size()); <END> }</code><technical_language>fix this</technical_language>

Target:
public FindInfo findEntriesSince(FindToken token, long maxSizeOfEntries) throws StoreException { MockFindToken tokenmock = (MockFindToken) token; List<MessageInfo> entriesToReturn = new ArrayList<MessageInfo>(); long currentSizeOfEntriesInBytes = 0; int index = 0; while (currentSizeOfEntriesInBytes < maxSizeOfEntries && index < messageInfoList.size()) { entriesToReturn.add(messageInfoList.get(tokenmock.getIndex() + index)); currentSizeOfEntriesInBytes += messageInfoList.get(tokenmock.getIndex() + index).getSize(); index++; } int startIndex = tokenmock.getIndex(); int totalSizeRead = 0; for (int i = 0; i < startIndex; i++) { totalSizeRead += messageInfoList.get(i).getSize(); } totalSizeRead += currentSizeOfEntriesInBytes; return new FindInfo(entriesToReturn, new MockFindToken(tokenmock.getIndex() + entriesToReturn.size(), totalSizeRead)); }
Source:
<code>public void initColumnValues(ColumnValueSelector selector, int columnIndex, Object[] valuess) { final DimensionSelector dimSelector = (DimensionSelector) selector; final IndexedInts row = dimSelector.getRow(); final int[] newIds = new int[row.size()]; for (int i = 0; i < row.size(); i++) { final String value = dimSelector.lookupName(row.get(i)); final int dictId = reverseDictionary.getInt(value); if (dictId < 0) { dictionary.add(value); reverseDictionary.put(value, nextId); newIds[i] = nextId; nextId++; } else { newIds[i] = dictId; } } <START> valuess[columnIndex] = ArrayBasedIndexedInts.of(newIds, newIds.length); <END> }</code><technical_language>ArrayBasedIndexedInts.of(newIds)</technical_language>

Target:
public void initColumnValues(ColumnValueSelector selector, int columnIndex, Object[] valuess) { final DimensionSelector dimSelector = (DimensionSelector) selector; final IndexedInts row = dimSelector.getRow(); final int[] newIds = new int[row.size()]; for (int i = 0; i < row.size(); i++) { final String value = dimSelector.lookupName(row.get(i)); final int dictId = reverseDictionary.getInt(value); if (dictId < 0) { dictionary.add(value); reverseDictionary.put(value, nextId); newIds[i] = nextId; nextId++; } else { newIds[i] = dictId; } } valuess[columnIndex] = ArrayBasedIndexedInts.of(newIds); }
Source:
<code>public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof Pair)) { return false; } <START> <END> Pair<?, ?> other = (Pair<?, ?>)obj; return Objects.equals(first, other.first) && Objects.equals(second, other.second); }</code><technical_language>a good reason for this, is considered more correct: java if (getClass() != obj.getClass()) { return false; }</technical_language>

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (getClass() != obj.getClass()) { return false; } Pair<?, ?> other = (Pair<?, ?>)obj; return Objects.equals(getFirst(), other.getFirst()) && Objects.equals(getSecond(), other.getSecond()); }
Source:
<code>private static Stream<Arguments> baosFactories() { final BAOSFactory syncBaosFactory = size -> new ByteArrayOutputStream(size); <START> final BAOSFactory nonSyncBaos = size -> new FastByteArrayOutputStream(size); <END> return Stream.of( Arguments.of(ByteArrayOutputStream.class.getSimpleName(), syncBaosFactory), Arguments.of(FastByteArrayOutputStream.class.getSimpleName(), nonSyncBaos) ); }</code><technical_language>rename nonSyncBaosFactory</technical_language>

Target:
private static Stream<Arguments> baosFactories() { return Stream.of( Arguments.of(ByteArrayOutputStream.class.getSimpleName(), new ByteArrayOutputStreamFactory()), Arguments.of(UnsynchronizedByteArrayOutputStream.class.getSimpleName(), new UnsynchronizedByteArrayOutputStreamFactory()) ); }
Source:
<code><START> default void onCheckpoint(Map<SystemStreamPartition, String> offsets) { } <END></code><technical_language>prefer rename this afterCheckpoint for symmetry. This require deprecating existing API, interface cleaner</technical_language>

Target:
default void onCheckpoint(Map<SystemStreamPartition, String> offsets) { afterCheckpoint(offsets); }
Source:
<code>private long periodNumber() { <START> return DateTime.now().getMillis() / 1000 / periodInSeconds; <END> }</code><technical_language>currentTimeMillis() instead of creating a new DateTime() object</technical_language>

Target:
private long periodNumber() { return currentTimeMillis() / 1000 / periodInSeconds; }
Source:
<code>public void testConvertToAvroMutation() { ByteBuf buffer = Mockito.mock(ByteBuf.class); Mockito.when(buffer.getByte(0)).thenReturn((byte)0x80); Mockito.when(buffer.getByte(1)).thenReturn((byte)0x57); Mockito.when(buffer.getByte(4)).thenReturn((byte)0x05); <START> Mockito.when(buffer.getShort(2)).thenReturn((short)10); <END> ByteBuf key = Mockito.mock(ByteBuf.class); Mockito.when(key.readableBytes()).thenReturn(4); Mockito.when(buffer.slice(29, 10)).thenReturn(key); Mockito.when(buffer.getByte(4)).thenReturn((byte)0x05); Mockito.when(buffer.getShort(2)).thenReturn((short)10); Mockito.when(buffer.getInt(8)).thenReturn(100); ByteBuf content = Mockito.mock(ByteBuf.class); Mockito.when(content.readableBytes()).thenReturn(85); Mockito.when(buffer.slice(39, 85)).thenReturn(content); IndexedRecord record = converter.convertToAvro(buffer); Assert.assertEquals(schema, record.getSchema()); assertIndexedRecordResult(record, "mutation", new byte[85]); }</code><technical_language>name this values in some final local variables</technical_language>

Target:
public void testConvertToAvroMutation() { ByteBuf buffer = Mockito.mock(ByteBuf.class); Mockito.when(buffer.getByte(0)).thenReturn(MessageUtil.MAGIC_REQ); Mockito.when(buffer.getByte(1)).thenReturn(MessageUtil.DCP_MUTATION_OPCODE); Mockito.when(buffer.getByte(4)).thenReturn(OFFSET); Mockito.when(buffer.getShort(2)).thenReturn(LENGTH); ByteBuf key = Mockito.mock(ByteBuf.class); Mockito.when(key.readableBytes()).thenReturn(4); Mockito.when(buffer.slice(29, 10)).thenReturn(key); Mockito.when(buffer.getByte(4)).thenReturn(OFFSET); Mockito.when(buffer.getShort(2)).thenReturn(LENGTH); Mockito.when(buffer.getInt(8)).thenReturn(100); ByteBuf content = Mockito.mock(ByteBuf.class); Mockito.when(content.readableBytes()).thenReturn(85); Mockito.when(buffer.slice(39, 85)).thenReturn(content); IndexedRecord record = converter.convertToAvro(buffer); Assert.assertEquals(schema, record.getSchema()); assertIndexedRecordResult(record, "mutation", new byte[85]); }
Source:
<code>private void applyStringFilter(String filterString) { try { FilterExpression filter = Parser.parse(filterString); if (filter != null) { this.applyFilterExpression(filter); } else { this.applyFilterExpression(Qualifier.EMPTY); } } catch (FilterException ex) { this.applyFilterExpression(Qualifier.EMPTY); UI.status.displayMessage("Panel " + (panelIndex + 1) <START> + ": " + ex.getMessage()); <END> } }</code><technical_language>This is a bit tangential, add panel name here, defaulting index if unnamed</technical_language>

Target:
private void applyStringFilter(String filterString) { try { FilterExpression filter = Parser.parse(filterString); if (filter != null) { this.applyFilterExpression(filter); } else { this.applyFilterExpression(Qualifier.EMPTY); } } catch (FilterException ex) { this.applyFilterExpression(Qualifier.EMPTY); UI.status.displayMessage(getUniquePanelName( panelMenuBar.getPanelName()) + ": " + ex.getMessage()); } }
Source:
<code>public <T extends RealType<T>> RandomAccessibleInterval<T> realTransform( final RandomAccessibleInterval<T> in, final InvertibleRealTransform transform) { final RandomAccessibleInterval<T> result = (RandomAccessibleInterval<T>) ops().run( net.imagej.ops.transform.realTransform.DefaultTransformView.class, in, <START> transform); <END> return result; }</code><technical_language>This ops().run(Ops.Transform.RealTransform.class, in, transform). way, in future, write op is a specialized version of this matched. Please change this for other realTransform(...) namespace methods well</technical_language>

Target:
public <T extends RealType<T>> RandomAccessibleInterval<T> realTransform( final RandomAccessibleInterval<T> in, final InvertibleRealTransform transform) { final RandomAccessibleInterval<T> result = (RandomAccessibleInterval<T>) ops().run( Ops.Transform.RealTransform.class, in, transform); return result; }
Source:
<code>public NettyServerFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, RequestResponseHandlerController requestResponseHandlerController) throws InstantiationException { if (verifiableProperties != null && metricRegistry != null && requestResponseHandlerController != null) { this.nettyConfig = new NettyConfig(verifiableProperties); this.nettyMetrics = new NettyMetrics(metricRegistry); this.requestResponseHandlerController = requestResponseHandlerController; } else { StringBuilder errorMessage = <START> new StringBuilder("Null arg(s) received during instantiation of NettyServerFactory -"); <END> if (verifiableProperties == null) { errorMessage.append(" [VerifiableProperties] "); } if (metricRegistry == null) { errorMessage.append(" [MetricRegistry] "); } if (requestResponseHandlerController == null) { errorMessage.append(" [RequestResponseHandlerController] "); } throw new InstantiationException(errorMessage.toString()); } logger.trace("Instantiated NettyServerFactory"); }</code><technical_language>simplify this if wish printing arguments if this - null printed "null"</technical_language>

Target:
public NettyServerFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, RequestResponseHandlerController requestResponseHandlerController) { if (verifiableProperties != null && metricRegistry != null && requestResponseHandlerController != null) { this.nettyConfig = new NettyConfig(verifiableProperties); this.nettyMetrics = new NettyMetrics(metricRegistry); this.requestResponseHandlerController = requestResponseHandlerController; } else { StringBuilder errorMessage = new StringBuilder("Null arg(s) received during instantiation of NettyServerFactory -"); if (verifiableProperties == null) { errorMessage.append(" [VerifiableProperties] "); } if (metricRegistry == null) { errorMessage.append(" [MetricRegistry] "); } if (requestResponseHandlerController == null) { errorMessage.append(" [RequestResponseHandlerController] "); } throw new IllegalArgumentException(errorMessage.toString()); } logger.trace("Instantiated NettyServerFactory"); }
Source:
<code>public boolean moveCellsDown() { boolean dirty = false; if <START> (moveCellsDownLoop()) dirty = true; <END> for (int i = 0; i < GRID_WIDTH; i++) { for (int j = GRID_WIDTH - 1; j > 0; j--) { int previousJ = j - 1; dirty = combineCells(i, previousJ, i, j, dirty); } } if (moveCellsDownLoop()) dirty = true; return dirty; }</code><technical_language>braces</technical_language>

Target:
public boolean moveCellsDown() { boolean dirty = false; if (moveCellsDownLoop()) { dirty = true; } for (int i = 0; i < GRID_WIDTH; i++) { for (int j = GRID_WIDTH - 1; j > 0; j--) { int previousJ = j - 1; dirty = combineCells(i, previousJ, i, j, dirty); } } if (moveCellsDownLoop()) { dirty = true; } return dirty; }
Source:
<code>protected int run() { String prelude = Kompile.REQUIRE_PRELUDE_K; if (options.noPrelude) { prelude = ""; } List<org.kframework.kil.Module> modules = null; modules = parser.slurp(prelude + FileUtil.load(options.mainDefinitionFile()), Source.apply(options.mainDefinitionFile().getAbsolutePath()), options.mainDefinitionFile().getParentFile(), ListUtils.union(options.includes.stream() .map(files::resolveWorkingDirectory).collect(Collectors.toList()), <START> Lists.newArrayList(Kompile.BUILTIN_DIRECTORY))); <END> Set<File> allFiles = modules.stream().map(m -> new File(m.getSource().source())).collect(Collectors.toSet()); System.out.println(files.resolveWorkingDirectory(".").toURI().relativize(files.resolveKompiled("timestamp").toURI()).getPath() + " : \\"); for (File file : allFiles) { System.out.println(" " + file.getAbsolutePath() + " \\"); } System.out.println(); return 0; }</code><technical_language>indentation in lines right (as displayed github least)</technical_language>

Target:
protected int run() { String prelude = Kompile.REQUIRE_PRELUDE_K; if (options.noPrelude) { prelude = ""; } List<org.kframework.kil.Module> modules = null; modules = parser.slurp(prelude + FileUtil.load(options.mainDefinitionFile(files)), Source.apply(options.mainDefinitionFile(files).getAbsolutePath()), options.mainDefinitionFile(files).getParentFile(), ListUtils.union(options.includes.stream() .map(files::resolveWorkingDirectory).collect(Collectors.toList()), Lists.newArrayList(Kompile.BUILTIN_DIRECTORY))); Set<File> allFiles = modules.stream().map(m -> new File(m.getSource().source())).collect(Collectors.toSet()); System.out.println(files.resolveWorkingDirectory(".").toURI().relativize(files.resolveKompiled("timestamp").toURI()).getPath() + " : \\"); for (File file : allFiles) { System.out.println(" " + file.getAbsolutePath() + " \\"); } System.out.println(); return 0; }
Source:
<code>public void beforeEachTest() { this.me = new WorkbenchUser(); this.me.setName("Mr. Breeder"); this.me.setUserid(1); this.me.setPassword("password"); this.myBreedingBuddy = new WorkbenchUser(); this.myBreedingBuddy.setName("My Breeding Buddy"); this.myBreedingBuddy.setUserid(2); this.myBreedingBuddy.setPassword("password"); this.loggedInUser = new UsernamePasswordAuthenticationToken(this.me.getName(), this.me.getPassword()); SecurityContextHolder.getContext().setAuthentication(this.loggedInUser); Mockito.when(this.workbenchDataManager.getUserById(this.me.getUserid())).thenReturn(this.me); Mockito.when(this.workbenchDataManager.getUserById(this.myBreedingBuddy.getUserid())).thenReturn(this.myBreedingBuddy); Mockito.when(this.workbenchDataManager.getUserByUsername(this.me.getName())).thenReturn(this.me); Mockito.when(this.workbenchDataManager.getUserByUsername(this.myBreedingBuddy.getName())).thenReturn(this.myBreedingBuddy); <START> Mockito.when(securityService.getCurrentlyLoggedInUser()).thenCallRealMethod(); <END> }</code><technical_language>replace a complete mock remove SecurityContextHolder method java Mockito.when(this.securityService.getCurrentlyLoggedInUser()).thenReturn(this.me);</technical_language>

Target:
public void beforeEachTest() { this.me = new WorkbenchUser(); this.me.setName("Mr. Breeder"); this.me.setUserid(1); this.me.setPassword("password"); this.myBreedingBuddy = new WorkbenchUser(); this.myBreedingBuddy.setName("My Breeding Buddy"); this.myBreedingBuddy.setUserid(2); this.myBreedingBuddy.setPassword("password"); Mockito.when(this.workbenchDataManager.getUserById(this.me.getUserid())).thenReturn(this.me); Mockito.when(this.workbenchDataManager.getUserById(this.myBreedingBuddy.getUserid())).thenReturn(this.myBreedingBuddy); Mockito.when(this.workbenchDataManager.getUserByUsername(this.me.getName())).thenReturn(this.me); Mockito.when(this.workbenchDataManager.getUserByUsername(this.myBreedingBuddy.getName())).thenReturn(this.myBreedingBuddy); Mockito.when(this.securityService.getCurrentlyLoggedInUser()).thenReturn(this.me); }
Source:
<code>public void beginTransaction_readOnlyThrows() { RealmConfiguration config = configFactory.createConfigurationBuilder() .name("readonly.realm") .schema(StringOnly.class) .assetFile("readonly.realm") .readOnly() .build(); realm = Realm.getInstance(config); try { realm.beginTransaction(); <START> } catch (IllegalStateException e) { <END> assertTrue(e.getMessage().startsWith("Write transactions cannot be used ")); } }</code><technical_language>missing fail()</technical_language>

Target:
public void beginTransaction_readOnlyThrows() { RealmConfiguration config = configFactory.createConfigurationBuilder() .name("readonly.realm") .schema(StringOnlyReadOnly.class) .assetFile("readonly.realm") .readOnly() .build(); Realm realm = Realm.getInstance(config); try { realm.beginTransaction(); fail(); } catch (IllegalStateException e) { assertTrue(e.getMessage().startsWith("Write transactions cannot be used ")); } finally { realm.close(); } }
Source:
<code>public boolean onCreateOptionsMenu(final Menu menu) { super.onCreateOptionsMenu(menu); <START> final Intent i = getIntent(); <END> menu.findItem(R.id.action_add_contact).setVisible(true); return true; }</code><technical_language>this line do</technical_language>

Target:
public boolean onCreateOptionsMenu(final Menu menu) { super.onCreateOptionsMenu(menu); menu.findItem(R.id.action_add_contact).setVisible(true); return true; }
Source:
<code>public void testIntervalAnnotationRejectsNonFixed12() { <START> for (int i = 1; i < 50; i += 1) { <END> final int length = i; if (length != 12) { assertThrows("Should reject fixed with length: " + i, IllegalStateException.class, new Callable<Type>() { @Override public Type call() throws Exception { return Types.required(FIXED_LEN_BYTE_ARRAY).length(length) .as(INTERVAL).named("interval"); } }); } } }</code><technical_language>thorough? check a single length is 12</technical_language>

Target:
public void testIntervalAnnotationRejectsNonFixed12() { assertThrows("Should reject fixed with length != 12: " + 11, IllegalStateException.class, new Callable<Type>() { @Override public Type call() throws Exception { return Types.required(FIXED_LEN_BYTE_ARRAY).length(11) .as(INTERVAL).named("interval"); } }); }
Source:
<code>protected boolean canDoAction() { VDS vds = getVds(); if (vds != null) { VDSGroup vdsGroup = getDbFacade().getVdsGroupDao().get(vds.getVdsGroupId()); if (vdsGroup != null && !vdsGroup.getFencingPolicy().isFencingEnabled()) { AuditLogableBase alb = new AuditLogableBase(); alb.setVds(vds); AuditLogDirector.log(alb, AuditLogType.VDS_FENCE_DISABLED_BY_CLUSTER_POLICY); addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED_BY_CLUSTER_POLICY); return false; } } return super.canDoAction(); <START> } <END></code><technical_language>soft fencing? run in case of issue</technical_language>

Target:
protected boolean canDoAction() { VDS vds = getVds(); if (vds != null) { VDSGroup vdsGroup = getDbFacade().getVdsGroupDao().get(vds.getVdsGroupId()); if (vdsGroup != null && !vdsGroup.getFencingPolicy().isFencingEnabled()) { AuditLogableBase alb = new AuditLogableBase(); alb.setVdsId(vds.getId()); AuditLogDirector.log(alb, AuditLogType.VDS_ALERT_FENCE_DISABLED_BY_CLUSTER_POLICY); addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED_BY_CLUSTER_POLICY); return false; } } return super.canDoAction(); }
Source:
<code>public void testPredicatePushDownOverProjection() { assertPlan( <START> "with t as (select orderkey * 2 x from orders) select * from t where x + x > 1", <END> anyTree( filter("((expr + expr) > BIGINT '1')", project(ImmutableMap.of("expr", expression("orderkey * BIGINT '2'")), tableScan("orders", ImmutableMap.of("ORDERKEY", "orderkey")))))); assertPlan( "with t as (select orderkey * 2 x, 1 y from orders) select * from t where x + y + y >1", anyTree( project( filter("(((orderkey * BIGINT '2') + BIGINT '1') + BIGINT '1') > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey")))))); assertPlan( "with t as (select orderkey * 2 x from orders) select * from t where x > 1", anyTree( project( filter("(orderkey * BIGINT '2') > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey")))))); assertPlan( "with t as (select orderkey * 2 x, orderkey y from orders) select * from t where x + y > 1", anyTree( project( filter("((orderkey * BIGINT '2') + orderkey) > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey")))))); assertPlan( "with t as (select orderkey x from orders) select * from t where x >1", anyTree( filter("orderkey > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey"))))); }</code><technical_language>I placing select in separate lines improve readability: java assertPlan( "with t (select orderkey * 2 x orders) " + "select * t x + x > 1", anyTree(...));</technical_language>

Target:
public void testPredicatePushDownOverProjection() { assertPlan( "WITH t AS (SELECT orderkey * 2 x FROM orders) " + "SELECT * FROM t WHERE x + x > 1", anyTree( filter("((expr + expr) > BIGINT '1')", project(ImmutableMap.of("expr", expression("orderkey * BIGINT '2'")), tableScan("orders", ImmutableMap.of("ORDERKEY", "orderkey")))))); assertPlan( "with t AS (SELECT orderkey * 2 x, 1 y FROM orders) " + "SELECT * FROM t WHERE x + y + y >1", anyTree( project( filter("(((orderkey * BIGINT '2') + BIGINT '1') + BIGINT '1') > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey")))))); assertPlan( "WITH t AS (SELECT orderkey * 2 x FROM orders) " + "SELECT * FROM t WHERE x > 1", anyTree( project( filter("(orderkey * BIGINT '2') > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey")))))); assertPlan( "with t AS (SELECT orderkey * 2 x, orderkey y FROM orders) " + "SELECT * FROM t WHERE x + y > 1", anyTree( project( filter("((orderkey * BIGINT '2') + orderkey) > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey")))))); assertPlan( "WITH t AS (SELECT orderkey x FROM orders) " + "SELECT * FROM t WHERE x >1", anyTree( filter("orderkey > BIGINT '1'", tableScan("orders", ImmutableMap.of( "orderkey", "orderkey"))))); assertPlan( "WITH t AS (SELECT rand() * orderkey x FROM orders) " + "SELECT * FROM t WHERE x > 5000", anyTree( filter("expr > 5E3", project(ImmutableMap.of("expr", expression("rand() * CAST(orderkey AS double)")), tableScan("orders", ImmutableMap.of( "ORDERKEY", "orderkey")))))); }