auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void expireLocks() { try { int c = autoCommit((handle, dao) -> { if (isEmbededDatabase()) { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < :expireTime" ) .bind("expireTime", Instant.now().getEpochSecond()) .execute(); } else { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < " + statementUnixTimestampSql() ) .execute(); } }); if (c > 0) { logger.warn("{} task locks are expired. Tasks will be retried.", c); } } catch (Throwable t) { logger.error("An uncaught exception is ignored. Lock expireation thread will be retried.", t); } }

Target:
void expireLocks() { try { int c = autoCommit((handle, dao) -> { if (isEmbededDatabase()) { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < :expireTime" ) .bind("expireTime", Instant.now().getEpochSecond()) .execute(); } else { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < " + statementUnixTimestampSql() ) .execute(); } }); if (c > 0) { logger.warn("{} task locks are expired. Tasks will be retried.", c); } } catch (Throwable t) { logger.error("An uncaught exception is ignored. This lock expiration thread will be restarted.", t); } }
Source:
public void run() { Set<Class<? extends CTEProvider>> rootProviders = viewMapping.getCteProviders(); if (rootProviders != null) { Map<Class<?>, CTEProvider> providers = context.getCteProviders(); for (Class<? extends CTEProvider> clazz : rootProviders) { if (!providers.containsKey(clazz)) { CTEProvider provider = new SimpleCTEProviderFactory(clazz).create(); providers.put(clazz, provider); } ManagedViewTypeImpl.this.cteProviders.add(providers.get(clazz)); } } for (AbstractMethodAttribute<? super X, ?> attribute : ManagedViewTypeImpl.this.recursiveSubviewAttributes.values()) { ManagedViewType<?> viewType = (ManagedViewType<?>) attribute.getElementType(); ManagedViewTypeImpl.this.cteProviders.addAll(viewType.getCteProviders()); } }

Target:
public void run() { Set<Class<? extends CTEProvider>> rootProviders = viewMapping.getCteProviders(); if (rootProviders != null) { Map<Class<?>, CTEProvider> providers = context.getCteProviders(); for (Class<? extends CTEProvider> clazz : rootProviders) { CTEProvider provider = providers.get(clazz); if (provider == null) { provider = new SimpleCTEProviderFactory(clazz).create(); providers.put(clazz, provider); } this.viewType.cteProviders.add(provider); } } for (AbstractMethodAttribute<?, ?> attribute : this.viewType.recursiveSubviewAttributes.values()) { com.blazebit.persistence.view.metamodel.Type<?> elementType = attribute.getElementType(); if (elementType instanceof ManagedViewTypeImpl) { ManagedViewType<?> viewType = (ManagedViewType<?>) attribute.getElementType(); this.viewType.cteProviders.addAll(viewType.getCteProviders()); } } }
Source:
public SortableItem(JsonNode node,SortFieldInfo[] sortFields) { this.node=node; this.sortFields=sortFields; keyValues=new Object[sortFields.length]; for(int i=0;i<sortFields.length;i++) { if (sortFields[i] != null) { JsonNode valueNode=JsonDoc.get(node,sortFields[i].getName()); keyValues[i]=sortFields[i].getField().getType().fromJson(valueNode); } } }

Target:
public SortableItem(JsonNode node,SortFieldInfo[] sortFields) { this.node=node; this.sortFields=sortFields; keyValues=new Object[sortFields.length]; for(int i=0;i<sortFields.length;i++) { JsonNode valueNode=JsonDoc.get(node,sortFields[i].getName()); keyValues[i]=sortFields[i].getField().getType().fromJson(valueNode); } }
Source:
private int calculateDefendersDamagePerRound() { int baseHP = getDefender().calculateHP(); int damagePerRound = 0; List<String> defenderTypes = Arrays.asList(getDefender().getType()); if ((getDefender().getAbility().equals("Solar Power") || getDefender().getAbility().equals("Dry Skin")) && mActiveWeather == Weather.SUN) { damagePerRound += (baseHP * 0.125); } if (!getDefender().getAbility().equals("Overcoat") && !getDefender().getAbility().equals("Magic Guard")) { if (mActiveWeather == Weather.SAND && !getDefender().getAbility().equals("Sand Veil") && !getDefender().getAbility().equals("Sand Rush") && !getDefender().getAbility().equals("Sand Force") && !defenderTypes.contains("Rock") && !defenderTypes.contains("Steel") && !defenderTypes.contains("Ground")) { damagePerRound += (baseHP / 16); } else if (mActiveWeather == Weather.HAIL && !getDefender().getAbility().equals("Ice Body") && !getDefender().getAbility().equals("Snow Cloak") && !defenderTypes.contains("Ice")) { damagePerRound += (baseHP / 16); } } if (getDefender().getAbility().equals("Dry Skin") && mActiveWeather == Weather.RAIN) { damagePerRound -= (baseHP * 0.125); } if ((getDefender().getAbility().equals("Rain Dish")) && mActiveWeather == Weather.RAIN) { damagePerRound -= (baseHP / 16); } if ((getDefender().getAbility().equals("Ice Body")) && mActiveWeather == Weather.HAIL) { damagePerRound -= (baseHP / 16); } return damagePerRound; }

Target:
private int calculateDefendersDamagePerRound() { int baseHP = getDefender().calculateHP(); int damagePerRound = 0; String defenderAbility = getDefender().getAbility(); List<String> defenderTypes = Arrays.asList(getDefender().getType()); if ((defenderAbility.equals("Solar Power") || defenderAbility.equals("Dry Skin")) && mActiveWeather == Weather.SUN) { damagePerRound += (baseHP * 0.125); } if (!defenderAbility.equals("Overcoat") && !defenderAbility.equals("Magic Guard")) { if (mActiveWeather == Weather.SAND && !defenderAbility.equals("Sand Veil") && !defenderAbility.equals("Sand Rush") && !defenderAbility.equals("Sand Force") && !defenderTypes.contains("Rock") && !defenderTypes.contains("Steel") && !defenderTypes.contains("Ground")) { damagePerRound += (baseHP / 16); } else if (mActiveWeather == Weather.HAIL && !defenderAbility.equals("Ice Body") && !defenderAbility.equals("Snow Cloak") && !defenderTypes.contains("Ice")) { damagePerRound += (baseHP / 16); } } if (defenderAbility.equals("Dry Skin") && mActiveWeather == Weather.RAIN) { damagePerRound -= (baseHP * 0.125); } if ((defenderAbility.equals("Rain Dish")) && mActiveWeather == Weather.RAIN) { damagePerRound -= (baseHP / 16); } if ((defenderAbility.equals("Ice Body")) && mActiveWeather == Weather.HAIL) { damagePerRound -= (baseHP / 16); } return damagePerRound; }
Source:
public ScriptResultConversionException(Object value) { super(ERROR_CODE); this.value = value; }

Target:
public ScriptResultConversionException(Object value) { super(ERROR_CODE); this.value = requireNonNull(value); }
Source:
private <T extends ObjectId> void findAllImpl(PackList packList, Collection<T> pending, List<FoundObject<T>> r) { DfsPackFile[] packs = packList.packs; if (packs.length == 0) { return; } int lastIdx = 0; DfsPackFile lastPack = packs[lastIdx]; boolean noGarbage = avoidUnreachable; OBJECT_SCAN: for (Iterator<T> it = pending.iterator(); it.hasNext();) { T t = it.next(); if (!noGarbage || !lastPack.isGarbage()) { try { long p = lastPack.findOffset(this, t); if (0 < p) { r.add(new FoundObject<T>(t, lastIdx, lastPack, p)); it.remove(); continue; } } catch (IOException e) { } } for (int i = 0; i < packs.length; i++) { if (i == lastIdx) continue; DfsPackFile pack = packs[i]; if (noGarbage && pack.isGarbage()) continue; try { long p = pack.findOffset(this, t); if (0 < p) { r.add(new FoundObject<T>(t, i, pack, p)); it.remove(); lastIdx = i; lastPack = pack; continue OBJECT_SCAN; } } catch (IOException e) { } } } last = lastPack; }

Target:
private <T extends ObjectId> void findAllImpl(PackList packList, Collection<T> pending, List<FoundObject<T>> r) { DfsPackFile[] packs = packList.packs; if (packs.length == 0) { return; } int lastIdx = 0; DfsPackFile lastPack = packs[lastIdx]; for (Iterator<T> it = pending.iterator(); it.hasNext();) { T t = it.next(); if (!skipGarbagePack(lastPack)) { try { long p = lastPack.findOffset(this, t); if (0 < p) { r.add(new FoundObject<T>(t, lastIdx, lastPack, p)); it.remove(); continue; } } catch (IOException e) { } } for (int i = 0; i < packs.length; i++) { if (i == lastIdx) continue; DfsPackFile pack = packs[i]; if (skipGarbagePack(pack)) continue; try { long p = pack.findOffset(this, t); if (0 < p) { r.add(new FoundObject<T>(t, i, pack, p)); it.remove(); lastIdx = i; lastPack = pack; break; } } catch (IOException e) { } } } last = lastPack; }
Source:
public void deleted (Path path) { LOG.info("Deleted called. Ignoring since it is not supported"); }

Target:
public void deleted (Path path) { throw new UnsupportedOperationException("Deleted file watcher event not supported for custom processor file handlers."); }
Source:
protected final void addEclFilter(BranchContext context, ExpressionBuilder queryBuilder, Collection<String> optionValues, Function<Collection<String>, Expression> matchingIdsToExpression) { if (optionValues.isEmpty()) { return; } Collection<String> idFilter = FluentIterable.from(optionValues).transform(new Function<String, String>() { @Override public String apply(String input) { return input.trim(); } }).toSet(); if (idFilter.size() == 1) { final String expression = Iterables.getOnlyElement(idFilter); if (!SnomedIdentifiers.isConceptIdentifier(expression)) { if ("*".equals(expression)) { return; } SnomedConcepts matchingConcepts = SnomedRequests.prepareSearchConcept() .all() .filterByEcl(expression) .setFields(ImmutableSet.of(SnomedConceptDocument.Fields.ID)) .build() .execute(context); idFilter = FluentIterable.from(matchingConcepts).transform(IComponent.ID_FUNCTION).toSet(); if (idFilter.isEmpty()) { throw new BaseSearchRequest.NoResultException(); } } } queryBuilder.must(matchingIdsToExpression.apply(idFilter)); }

Target:
protected final void addEclFilter(BranchContext context, ExpressionBuilder queryBuilder, Collection<String> optionValues, Function<Collection<String>, Expression> matchingIdsToExpression) { if (optionValues.isEmpty()) { return; } Collection<String> idFilter = FluentIterable.from(optionValues).transform(new Function<String, String>() { @Override public String apply(String input) { return input.trim(); } }).toSet(); if (idFilter.size() == 1) { final String expression = Iterables.getOnlyElement(idFilter); if (!SnomedIdentifiers.isConceptIdentifier(expression)) { if (Ecl.ANY.equals(expression)) { return; } SnomedConcepts matchingConcepts = SnomedRequests.prepareSearchConcept() .all() .filterByEcl(expression) .setFields(ImmutableSet.of(SnomedConceptDocument.Fields.ID)) .build() .execute(context); idFilter = FluentIterable.from(matchingConcepts).transform(IComponent.ID_FUNCTION).toSet(); if (idFilter.isEmpty()) { throw new BaseSearchRequest.NoResultException(); } } } queryBuilder.must(matchingIdsToExpression.apply(idFilter)); }
Source:
private void processSuccess(LockWatchStateUpdate.Success success) { Preconditions.checkState(latestVersion.isPresent(), "Must have a known version to process successful updates"); Optional<IdentifiedVersion> snapshotVersion = snapshot.getSnapshotVersion(); Preconditions.checkState(snapshotVersion.isPresent(), "Must have a snapshot before processing successful updates"); if (success.lastKnownVersion() < snapshotVersion.get().version()) { throw new TransactionLockWatchFailedException("Cannot process events before the oldest event"); } if (success.lastKnownVersion() > latestVersion.get().version()) { assertEventsAreContiguousAndNoEventsMissing(success.events()); latestVersion = Optional.of(IdentifiedVersion.of(success.logId(), eventStore.putAll(success.events()))); } }

Target:
private void processSuccess(LockWatchStateUpdate.Success success) { Preconditions.checkState(latestVersion.isPresent(), "Must have a known version to process successful updates"); Optional<IdentifiedVersion> snapshotVersion = snapshot.getSnapshotVersion(); Preconditions.checkState(snapshotVersion.isPresent(), "Must have a snapshot before processing successful updates"); if (success.lastKnownVersion() < snapshotVersion.get().version()) { throw new TransactionLockWatchFailedException( "Cannot process events before the oldest event. The transaction should be retried, although this" + " should only happen very rarely."); } if (success.lastKnownVersion() > latestVersion.get().version()) { assertEventsAreContiguousAndNoEventsMissing(success.events()); latestVersion = Optional.of(IdentifiedVersion.of(success.logId(), eventStore.putAll(success.events()))); } }
Source:
protected void configure() { bind(new TypeLiteral<UiHandlersStrategy<SettingsUiHandlers>>() {}) .to(new TypeLiteral<SetterUiHandlersStrategy<SettingsUiHandlers>>() {}); bindPresenter(SettingsPresenter.class, SettingsPresenter.MyView.class, SettingsView.class, SettingsPresenter.MyProxy.class); bindSingletonPresenterWidget(GlobalParamDetailsPresenter.class, GlobalParamDetailsPresenter.MyView.class, GlobalParamDetailsView.class); install(new GinFactoryModuleBuilder().build(MyTreeViewModelFactory.class)); }

Target:
protected void configure() { bind(new TypeLiteral<UiHandlersStrategy<SettingsUiHandlers>>() {}) .to(new TypeLiteral<SetterUiHandlersStrategy<SettingsUiHandlers>>() {}); bindPresenter(SettingsPresenter.class, SettingsPresenter.MyView.class, SettingsView.class, SettingsPresenter.MyProxy.class); bindSingletonPresenterWidget(GlobalParamDetailsPresenter.class, GlobalParamDetailsPresenter.MyView.class, GlobalParamDetailsView.class); install(new GinFactoryModuleBuilder().build(NiveauEtudeInfosTreeFactory.class)); }
Source:
public void testTaskWithAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", null); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Reserved, task.getStatus()); assertEquals("Darth Vader", task.getActualOwner().getId()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }

Target:
public void testTaskWithAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Reserved, task.getStatus()); assertEquals("Darth Vader", task.getActualOwner().getId()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }
Source:
public void testUpdateGlusterHookStatus() { dao.updateGlusterHookStatus(FixturesTool.HOOK_ID, null, GlusterHookStatus.ENABLED); GlusterHookEntity hook = dao.getById(FixturesTool.HOOK_ID); assertNotNull(hook); assertEquals(GlusterHookStatus.ENABLED, hook.getStatus()); }

Target:
public void testUpdateGlusterHookStatus() { dao.updateGlusterHookStatus(FixturesTool.HOOK_ID, GlusterHookStatus.ENABLED); GlusterHookEntity hook = dao.getById(FixturesTool.HOOK_ID); assertNotNull(hook); assertEquals(GlusterHookStatus.ENABLED, hook.getStatus()); }
Source:
protected List<String> getVmsWithAttachedISO() { List<VmStatic> vms = getVmStaticDAO().getAllByStoragePoolId(getStorageDomain().getStoragePoolId()); List<String> vmNames = new LinkedList<>(); for (VmStatic vmStatic : vms) { VmDynamic vmDynamic = getVmDynamicDAO().get(vmStatic.getId()); if (getVmDynamicDAO().get(vmStatic.getId()).getStatus() != VMStatus.Down && StringUtils.isEmpty(vmDynamic.getCurrentCd() != null ? vmDynamic.getCurrentCd() : vmStatic.getIsoPath())) { vmNames.add(vmStatic.getName()); } } return vmNames; }

Target:
protected List<String> getVmsWithAttachedISO() { List<VmStatic> vms = getVmStaticDAO().getAllByStoragePoolId(getStorageDomain().getStoragePoolId()); List<String> vmNames = new LinkedList<>(); for (VmStatic vmStatic : vms) { VmDynamic vmDynamic = getVmDynamicDAO().get(vmStatic.getId()); if (getVmDynamicDAO().get(vmStatic.getId()).getStatus() != VMStatus.Down && !StringUtils.isEmpty(vmDynamic.getCurrentCd() != null ? vmDynamic.getCurrentCd() : vmStatic.getIsoPath())) { vmNames.add(vmStatic.getName()); } } return vmNames; }
Source:
public void placeNewMarketOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Order order; if (orderType == OrderType.BUY) { if (price * volume > this.cashInHand) throw new StockMarketExpection("You don't have enough cash."); for(Order o: this.ordersPlaced) { if (o.getStockSymbol() == symbol) { throw new StockMarketExpection("You've already ordered this stock."); } } order = new BuyOrder(symbol, volume, true, this); ordersPlaced.add(order); } else { for(Order o: this.stocksOwned) { if (o.getStockSymbol() == symbol) { if (o.getSize() < volume) throw new StockMarketExpection("You don't have enough stocks."); } } order = new SellOrder(symbol, volume, true, this); } m.addOrder(order); }

Target:
public void placeNewMarketOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Order order; if (orderType == OrderType.BUY) { if (price * volume > this.cashInHand) throw new StockMarketExpection("You don't have enough cash."); for(Order o: this.ordersPlaced) { if (o.getStockSymbol() == symbol) { throw new StockMarketExpection("You've already ordered this stock."); } } order = new BuyOrder(symbol, volume, true, this); ordersPlaced.add(order); } else { for(Order o: this.stocksOwned) { if (o.getStockSymbol() == symbol && o.getSize() < volume) { throw new StockMarketExpection("You don't have enough stocks."); } } order = new SellOrder(symbol, volume, true, this); } m.addOrder(order); }
Source:
private Callback<Void> securityPostProcessRequestCallback() { return buildCallback(frontendMetrics.getAccountsSecurityPostProcessRequestMetrics, securityCheckResult -> { ReadableStreamChannel channel = serializeJsonToChannel(AccountCollectionSerde.toJson(getAccounts())); restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, "application/json"); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, channel.getSize()); finalCallback.onCompletion(channel, null); }, uri, LOGGER, finalCallback); }

Target:
private Callback<Void> securityPostProcessRequestCallback() { return buildCallback(frontendMetrics.getAccountsSecurityPostProcessRequestMetrics, securityCheckResult -> { ReadableStreamChannel channel = serializeJsonToChannel(AccountCollectionSerde.toJson(getAccounts())); restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, RestUtils.JSON_CONTENT_TYPE); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, channel.getSize()); finalCallback.onCompletion(channel, null); }, uri, LOGGER, finalCallback); }
Source:
public String getVaultUrl() { unpackId(this.id); return this.vaultUrl; }

Target:
public String getVaultUrl() { return this.vaultUrl; }
Source:
private void drawCenteredString(Graphics2D g, String text, int x, int y, int limit) { FontMetrics metrics = g.getFontMetrics(); y = y - (metrics.getHeight() / 2); if(metrics.stringWidth(text) > limit && (text.contains(" ") || text.contains("-"))) { if(text.contains(" ")) { for (String line : text.split("\\s+")) { g.drawString(line, x- (metrics.stringWidth(line) / 2), y += g.getFontMetrics().getHeight()); } } else { String[] lines = text.split("-"); for (int i = 0; i < lines.length; i++) { String line = lines[i]; if(i != (lines.length-1)) { line = line + "-"; } g.drawString(line, x- (metrics.stringWidth(line) / 2), y += g.getFontMetrics().getHeight()); } } } else { g.drawString(text, x- (metrics.stringWidth(text) / 2), y += g.getFontMetrics().getHeight()); } }

Target:
private void drawCenteredString(Graphics2D g, String text, int x, int y, int limit) { FontMetrics metrics = g.getFontMetrics(); y = y - (metrics.getHeight() / 2); if(metrics.stringWidth(text) > limit && (text.contains(" ") || text.contains("-"))) { if(text.contains(" ")) { for (String line : text.split("\\s+")) { g.drawString(line, x- (metrics.stringWidth(line) / 2), y += g.getFontMetrics().getHeight()); } } else { String[] lines = text.split("-"); for (int i = 0; i < lines.length; i++) { String line = lines[i]; if(i != (lines.length-1)) { line = line + "-"; } g.drawString(line, x- (metrics.stringWidth(line) / 2), y += g.getFontMetrics().getHeight()); } } } else { g.drawString(text, x- (metrics.stringWidth(text) / 2), y + g.getFontMetrics().getHeight()); } }
Source:
public void start(Map<String, String> props) { MirrorTaskConfig config = new MirrorTaskConfig(props); stopping = false; sourceClusterAlias = config.sourceClusterAlias(); targetClusterAlias = config.targetClusterAlias(); consumerGroups = config.taskConsumerGroups(); checkpointsTopic = config.checkpointsTopic(); topicFilter = config.topicFilter(); replicationPolicy = config.replicationPolicy(); interval = config.emitCheckpointsInterval(); pollTimeout = config.consumerPollTimeout(); adminTimeout = config.adminTimeout(); offsetSyncStore = new OffsetSyncStore(config); sourceAdminClient = AdminClient.create(config.sourceAdminConfig()); targetAdminClient = (KafkaAdminClient) Admin.create(config.targetAdminConfig()); metrics = config.metrics(); scheduler = new Scheduler(MirrorCheckpointTask.class, config.adminTimeout()); if (config.groupOffsetSyncEnabled()) { scheduler .scheduleRepeatingDelayed(this::syncGroupOffset, config.syncGroupOffsetsInterval(), "sync consumer group offset from source to target"); } }

Target:
public void start(Map<String, String> props) { MirrorTaskConfig config = new MirrorTaskConfig(props); stopping = false; sourceClusterAlias = config.sourceClusterAlias(); targetClusterAlias = config.targetClusterAlias(); consumerGroups = config.taskConsumerGroups(); checkpointsTopic = config.checkpointsTopic(); topicFilter = config.topicFilter(); replicationPolicy = config.replicationPolicy(); interval = config.emitCheckpointsInterval(); pollTimeout = config.consumerPollTimeout(); offsetSyncStore = new OffsetSyncStore(config); sourceAdminClient = AdminClient.create(config.sourceAdminConfig()); targetAdminClient = AdminClient.create(config.targetAdminConfig()); metrics = config.metrics(); idleConsumerGroupsOffset = new HashMap<>(); checkpointsPerConsumerGroup = new HashMap<>(); scheduler = new Scheduler(MirrorCheckpointTask.class, config.adminTimeout()); scheduler.scheduleRepeating(this::refreshIdleConsumerGroupOffset, config.syncGroupOffsetsInterval(), "refreshing idle consumers group offsets at target cluster"); scheduler.scheduleRepeatingDelayed(this::syncGroupOffset, config.syncGroupOffsetsInterval(), "sync idle consumer group offset from source to target"); }
Source:
public void finish(final long dataFileLength) { if (indexes.isEmpty()) { throw new IllegalArgumentException("Cannot merge zero BAI files"); } final long[] offsets = partLengths.stream().mapToLong(i -> i).toArray(); Arrays.parallelPrefix(offsets, (a, b) -> a + b); try (BinaryBAMIndexWriter writer = new BinaryBAMIndexWriter(numReferences, out)) { for (int ref = 0; ref < numReferences; ref++) { final int r = ref; List<BAMIndexContent> bamIndexContentList = indexes.stream().map(index -> index.getQueryResults(r)).collect(Collectors.toList()); final BAMIndexContent bamIndexContent = mergeBAMIndexContent(ref, bamIndexContentList, offsets); writer.writeReference(bamIndexContent); } writer.writeNoCoordinateRecordCount(noCoordinateCount); } }

Target:
public void finish(final long dataFileLength) { if (indexes.isEmpty()) { throw new IllegalArgumentException("Cannot merge zero BAI files"); } final long[] offsets = partLengths.stream().mapToLong(i -> i).toArray(); Arrays.parallelPrefix(offsets, Long::sum); try (BinaryBAMIndexWriter writer = new BinaryBAMIndexWriter(numReferences, out)) { for (int ref = 0; ref < numReferences; ref++) { final int r = ref; List<BAMIndexContent> bamIndexContentList = indexes.stream().map(index -> index.getQueryResults(r)).collect(Collectors.toList()); final BAMIndexContent bamIndexContent = mergeBAMIndexContent(ref, bamIndexContentList, offsets); writer.writeReference(bamIndexContent); } writer.writeNoCoordinateRecordCount(noCoordinateCount); } }
Source:
private RemoteFileArtifactValue getRemoteInputMetadata(String execPathString) { FileArtifactValue m = inputArtifactData.getMetadata(execPathString); if (m != null && m.isRemote()) { return (RemoteFileArtifactValue) m; } RemoteFileArtifactValue rm = injectedMetadata.get(execPathString); if (rm != null) { return rm; } return null; }

Target:
private RemoteFileArtifactValue getRemoteInputMetadata(String execPathString) { FileArtifactValue m = inputArtifactData.getMetadata(execPathString); if (m != null && m.isRemote()) { return (RemoteFileArtifactValue) m; } return injectedMetadata.get(execPathString); }
Source:
public void setColumnWidth(Column<T, ?> column, String width) { if (!initializedColumns.contains(column) && columnResizePersistenceEnabled) { String persistedWidth = readColumnWidth(column); if (persistedWidth != null) { width = persistedWidth; } initializedColumns.add(column); } super.setColumnWidth(column, width); if (columnResizingEnabled) { int columnIndex = getColumnIndex(column); TableElement tableElement = getElement().cast(); for (TableCellElement cell : getTableBodyCells(tableElement, columnIndex)) { cell.getStyle().setProperty("width", width); } for (TableCellElement cell : getTableHeaderCells(tableElement, columnIndex)) { cell.getStyle().setProperty("width", width); } } }

Target:
public void setColumnWidth(Column<T, ?> column, String width) { if (columnResizePersistenceEnabled && !initializedColumns.contains(column)) { String persistedWidth = readColumnWidth(column); if (persistedWidth != null) { width = persistedWidth; } initializedColumns.add(column); } super.setColumnWidth(column, width); if (columnResizingEnabled) { int columnIndex = getColumnIndex(column); TableElement tableElement = getElement().cast(); for (TableCellElement cell : getTableBodyCells(tableElement, columnIndex)) { cell.getStyle().setProperty("width", width); } for (TableCellElement cell : getTableHeaderCells(tableElement, columnIndex)) { cell.getStyle().setProperty("width", width); } } }
Source:
public void testNonExistentCipherSuite() throws Exception { fail("IGNITE-10245"); cipherSuites = new String[] { "TLS_RSA_WITH_AES_128_GCM_SHA256" }; startGrid(); checkClientStartFailure( new String[][] { new String[] { "TLC_FAKE_CIPHER", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" } }, null, GridClientException.class, "Unsupported ciphersuite" ); }

Target:
public void testNonExistentCipherSuite() throws Exception { cipherSuites = new String[] { "TLS_RSA_WITH_AES_128_GCM_SHA256" }; startGrid(); checkClientStartFailure( new String[] { "TLC_FAKE_CIPHER", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" }, null, "Unsupported ciphersuite" ); }
Source:
public AbstractArtifactCoordinates getArtifactCoordinates() { return artifactCoordinates; }

Target:
public ArtifactCoordinates getArtifactCoordinates() { return artifactCoordinates; }
Source:
public ArtificialIntelligence(Level level) { this.level = level; this.enemies = new ArrayList<Enemy>(); this.units = new ArrayList<Unit>(); this.movementsX = new ArrayList<Integer>(); this.movementsY = new ArrayList<Integer>(); }

Target:
public ArtificialIntelligence(Level level) { this.level = level; this.enemies = new ArrayList<>(); this.units = new ArrayList<>(); }
Source:
public void updateOutput() { int o = (maximumIOSize() == EnumConnectionType.Size.SIXTEEN) ? size / 2 - 8 : 1; for (int i = 0; i < ((maximumIOSize() == EnumConnectionType.Size.SIXTEEN) ? 16 : 1); i++) { Vec2 pos1 = new Vec2(size - 1 - (i + o), 0); Vec2 pos2 = new Vec2(size - 1, size - 1 - (i + o)); Vec2 pos3 = new Vec2(i + o, size - 1); Vec2 pos4 = new Vec2(0, i + o); CircuitPart part1 = getPart(pos1); CircuitPart part2 = getPart(pos2); CircuitPart part3 = getPart(pos3); CircuitPart part4 = getPart(pos4); if (part1 instanceof PartIOBit) ((PartIOBit) part1).updateExternalOutput(pos1, parent); if (part1 instanceof PartIOBit) ((PartIOBit) part2).updateExternalOutput(pos2, parent); if (part1 instanceof PartIOBit) ((PartIOBit) part3).updateExternalOutput(pos3, parent); if (part1 instanceof PartIOBit) ((PartIOBit) part4).updateExternalOutput(pos4, parent); } }

Target:
public void updateOutput() { int o = supportsBundled() ? size / 2 - 8 : 1; for (int i = 0; i < (supportsBundled() ? 16 : 1); i++) { Vec2 pos1 = new Vec2(size - 1 - (i + o), 0); Vec2 pos2 = new Vec2(size - 1, size - 1 - (i + o)); Vec2 pos3 = new Vec2(i + o, size - 1); Vec2 pos4 = new Vec2(0, i + o); CircuitPart part1 = getPart(pos1); CircuitPart part2 = getPart(pos2); CircuitPart part3 = getPart(pos3); CircuitPart part4 = getPart(pos4); if (part1 instanceof PartIOBit) ((PartIOBit) part1).updateExternalOutput(pos1, parent); if (part2 instanceof PartIOBit) ((PartIOBit) part2).updateExternalOutput(pos2, parent); if (part3 instanceof PartIOBit) ((PartIOBit) part3).updateExternalOutput(pos3, parent); if (part4 instanceof PartIOBit) ((PartIOBit) part4).updateExternalOutput(pos4, parent); } }
Source:
public String convert(Object tuple) { try { StringWriter stringWriter = new StringWriter(); ICsvBeanWriter beanWriter = new CsvBeanWriter(stringWriter, preference); beanWriter.write(tuple, nameMapping,processors); beanWriter.flush(); beanWriter.close(); return stringWriter.toString(); } catch (SuperCsvException e) { logger.error("Error while converting tuple ", tuple + " " + e.getMessage()); }catch (IOException e) { DTThrowable.rethrow(e); } return null; }

Target:
public String convert(Object tuple) { try { StringWriter stringWriter = new StringWriter(); ICsvBeanWriter beanWriter = new CsvBeanWriter(stringWriter, preference); beanWriter.write(tuple, nameMapping, processors); beanWriter.flush(); beanWriter.close(); return stringWriter.toString(); } catch (SuperCsvException e) { logger.debug("Error while converting tuple {}",tuple,e.getMessage()); } catch (IOException e) { DTThrowable.rethrow(e); } return null; }
Source:
private void addHeaders(Span span, SpanTextMap textMap) { addHeader(textMap, TraceMessageHeaders.TRACE_ID_NAME, Span.idToHex(span.getTraceId())); addHeader(textMap, TraceMessageHeaders.SPAN_ID_NAME, Span.idToHex(span.getSpanId())); if (span.isExportable()) { addAnnotations(this.traceKeys, textMap, span); Long parentId = getFirst(span.getParents()); if (parentId != null) { addHeader(textMap, TraceMessageHeaders.PARENT_ID_NAME, Span.idToHex(parentId)); } addHeader(textMap, TraceMessageHeaders.SPAN_NAME_NAME, span.getName()); addHeader(textMap, TraceMessageHeaders.PROCESS_ID_NAME, span.getProcessId()); addHeader(textMap, TraceMessageHeaders.SAMPLED_NAME, Span.SPAN_SAMPLED); } else { addHeader(textMap, TraceMessageHeaders.SAMPLED_NAME, Span.SPAN_NOT_SAMPLED); } addHeader(textMap, TraceMessageHeaders.SPAN_HEADER, storeSpanAsJson(span)); }

Target:
private void addHeaders(Span span, SpanTextMap textMap) { addHeader(textMap, TraceMessageHeaders.TRACE_ID_NAME, Span.idToHex(span.getTraceId())); addHeader(textMap, TraceMessageHeaders.SPAN_ID_NAME, Span.idToHex(span.getSpanId())); if (span.isExportable()) { addAnnotations(this.traceKeys, textMap, span); Long parentId = getFirst(span.getParents()); if (parentId != null) { addHeader(textMap, TraceMessageHeaders.PARENT_ID_NAME, Span.idToHex(parentId)); } addHeader(textMap, TraceMessageHeaders.SPAN_NAME_NAME, span.getName()); addHeader(textMap, TraceMessageHeaders.PROCESS_ID_NAME, span.getProcessId()); addHeader(textMap, TraceMessageHeaders.SAMPLED_NAME, Span.SPAN_SAMPLED); } else { addHeader(textMap, TraceMessageHeaders.SAMPLED_NAME, Span.SPAN_NOT_SAMPLED); } }
Source:
public void run() { logger.info( "START ClusterEventProcessor thread for cluster " + _clusterName + ", processor name: " + _processorName); while (!isInterrupted()) { try { ClusterEvent newClusterEvent = _eventBlockingQueue.take(); String currentThreadName = this.getName().split("_")[0]; this.setName(currentThreadName + "_" + newClusterEvent.getEventId()); handleEvent(newClusterEvent, _cache); } catch (InterruptedException e) { logger.warn("ClusterEventProcessor interrupted " + _processorName, e); interrupt(); } catch (ZkInterruptedException e) { logger .warn("ClusterEventProcessor caught a ZK connection interrupt " + _processorName, e); interrupt(); } catch (ThreadDeath death) { logger.error("ClusterEventProcessor caught a ThreadDeath " + _processorName, death); throw death; } catch (Throwable t) { logger.error("ClusterEventProcessor failed while running the controller pipeline " + _processorName, t); } } logger.info("END ClusterEventProcessor thread " + _processorName); }

Target:
public void run() { logger.info( "START ClusterEventProcessor thread for cluster " + _clusterName + ", processor name: " + _processorName); while (!isInterrupted()) { try { ClusterEvent newClusterEvent = _eventBlockingQueue.take(); String threadName = String.format( "HelixController-pipeline-%s-(%s)", _processorName, newClusterEvent.getEventId()); this.setName(threadName); handleEvent(newClusterEvent, _cache); } catch (InterruptedException e) { logger.warn("ClusterEventProcessor interrupted " + _processorName, e); interrupt(); } catch (ZkInterruptedException e) { logger .warn("ClusterEventProcessor caught a ZK connection interrupt " + _processorName, e); interrupt(); } catch (ThreadDeath death) { logger.error("ClusterEventProcessor caught a ThreadDeath " + _processorName, death); throw death; } catch (Throwable t) { logger.error("ClusterEventProcessor failed while running the controller pipeline " + _processorName, t); } } logger.info("END ClusterEventProcessor thread " + _processorName); }
Source:
public TasksView(String authority, ContentProviderClient client) { super(new BaseView<TaskContract.Tasks>(client, TaskContract.Properties.getContentUri(authority))); }

Target:
public TasksView(String authority, ContentProviderClient client) { super(new BaseView<TaskContract.Tasks>(client, TaskContract.Tasks.getContentUri(authority))); }
Source:
protected byte[] prepareCompressedData(byte[] uncompressed) { try { byte[] compressed = new byte[org.xerial.snappy.Snappy.maxCompressedLength(uncompressed.length)]; int compressedSize = org.xerial.snappy.Snappy.compress( uncompressed, 0, uncompressed.length, compressed, 0); return Arrays.copyOf(compressed, compressedSize); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
protected byte[] prepareCompressedData(byte[] uncompressed) { return LZ4Factory.fastestInstance().fastCompressor().compress(uncompressed); }
Source:
public static org.apache.parquet.schema.Type getParquetType(Type prestoType, MessageType messageType, boolean useParquetColumnNames, String columnName, int columnHiveIndex, HiveType hiveType) { org.apache.parquet.schema.Type type = null; if (useParquetColumnNames) { type = getParquetTypeByName(columnName, messageType); } if (columnHiveIndex < messageType.getFieldCount()) { type = messageType.getType(columnHiveIndex); } if (type == null) { return null; } if (useParquetColumnNames) { return type; } if (!schemaMatch(type, prestoType)) { String parquetTypeName = null; if (type.isPrimitive()) { parquetTypeName = type.asPrimitiveType().getPrimitiveTypeName().toString(); } else { GroupType group = type.asGroupType(); StringBuilder builder = new StringBuilder(); group.writeToStringBuilder(builder, " "); parquetTypeName = builder.toString(); } throw new PrestoException(HIVE_PARTITION_SCHEMA_MISMATCH, format("The column %s is declared as type %s, but the Parquet file declares the column as type %s", columnName, hiveType, parquetTypeName)); } return type; }

Target:
public static org.apache.parquet.schema.Type getParquetType(Type prestoType, MessageType messageType, boolean useParquetColumnNames, String columnName, int columnHiveIndex, HiveType hiveType) { org.apache.parquet.schema.Type type = null; if (useParquetColumnNames) { type = getParquetTypeByName(columnName, messageType); } else if (columnHiveIndex < messageType.getFieldCount()) { type = messageType.getType(columnHiveIndex); } if (type == null) { return null; } if (!checkSchemaMatch(type, prestoType)) { String parquetTypeName; if (type.isPrimitive()) { parquetTypeName = type.asPrimitiveType().getPrimitiveTypeName().toString(); } else { GroupType group = type.asGroupType(); StringBuilder builder = new StringBuilder(); group.writeToStringBuilder(builder, ""); parquetTypeName = builder.toString(); } throw new PrestoException(HIVE_PARTITION_SCHEMA_MISMATCH, format("The column %s is declared as type %s, but the Parquet file declares the column as type %s", columnName, hiveType, parquetTypeName)); } return type; }
Source:
public void store(Map<TopicPartition, Long> partitionsAndOffsets) { if (rdfClient == null) return; UpdateBuilder ub = new UpdateBuilder(UPDATE_OFFSETS); StringBuilder sb = new StringBuilder(); for (Map.Entry<TopicPartition, Long> partitionAndOffset : partitionsAndOffsets.entrySet()) { TopicPartition tp = partitionAndOffset.getKey(); Long offset = partitionAndOffset.getValue(); sb.append(String.format(Locale.ROOT, "<%s> wikibase:kafka ( \"%s:%d\" %d ) .\n", root, tp.topic(), tp.partition(), offset)); } ub.bindUri("root", root); ub.bind("data", sb.toString()); rdfClient.update(ub.toString()); }

Target:
public void store(Map<TopicPartition, Long> partitionsAndOffsets) { if (rdfClient == null) { return; } UpdateBuilder ub = new UpdateBuilder(UPDATE_OFFSETS); StringBuilder sb = new StringBuilder(); for (Map.Entry<TopicPartition, Long> partitionAndOffset : partitionsAndOffsets.entrySet()) { TopicPartition tp = partitionAndOffset.getKey(); Long offset = partitionAndOffset.getValue(); sb.append(String.format(Locale.ROOT, "<%s> wikibase:kafka ( \"%s:%d\" %d ) .\n", root, tp.topic(), tp.partition(), offset)); } ub.bindUri("root", root); ub.bind("data", sb.toString()); rdfClient.update(ub.toString()); }
Source:
protected void ExecuteVdsBrokerCommand() { boolean filteringLUNsEnabled = Config.<Boolean> GetValue( ConfigValues.FilteringLUNsEnabled, getParameters().getcompatibility_version().getValue()); XmlRpcStruct options = new XmlRpcStruct(); if (!filteringLUNsEnabled) { options.add(VdsProperties.includePartitioned, Boolean.TRUE.toString()); } int storageType = (int) getParameters().getStorageType().getValue(); _result = getBroker().getDeviceList(storageType, options); ProceedProxyReturnValue(); setReturnValue(ParseLUNList(_result.lunList)); }

Target:
protected void ExecuteVdsBrokerCommand() { boolean filteringLUNsEnabled = getParameters().getcompatibility_version().compareTo(new Version(VERSION_3_1)) < 0; XmlRpcStruct options = new XmlRpcStruct(); options.add(VdsProperties.includePartitioned, Boolean.toString(filteringLUNsEnabled)); int storageType = (int) getParameters().getStorageType().getValue(); _result = getBroker().getDeviceList(storageType, options); ProceedProxyReturnValue(); setReturnValue(ParseLUNList(_result.lunList)); }
Source:
public boolean shouldThrottle() { return shouldThrotle; }

Target:
public boolean shouldThrottle() { return shouldThrottle; }
Source:
private boolean hardDelete(boolean throttle) throws IOException, StoreException, InterruptedException { if (indexes.size() > 0) { final Timer.Context context = metrics.hardDeleteTime.time(); try { FindInfo info = findDeletedEntriesSince(startToken, scanSizeInBytes, SystemTime.getInstance().seconds() - messageRetentionSeconds); endToken = info.getFindToken(); if (!endToken.equals(startToken)) { persistCleanupToken(); if (!info.getMessageEntries().isEmpty()) { performHardDeletes(info.getMessageEntries(), throttle); } startToken = endToken; return true; } } finally { context.stop(); } } return false; }

Target:
private boolean hardDelete(boolean throttle) throws StoreException, InterruptedException { if (indexes.size() > 0) { final Timer.Context context = metrics.hardDeleteTime.time(); try { FindInfo info = findDeletedEntriesSince(startToken, scanSizeInBytes, SystemTime.getInstance().seconds() - messageRetentionSeconds); endToken = info.getFindToken(); if (!endToken.equals(startToken)) { persistCleanupToken(); if (!info.getMessageEntries().isEmpty()) { performHardDeletes(info.getMessageEntries(), throttle); } startToken = endToken; return true; } } catch (InterruptedException e) { throw e; } catch (StoreException e) { metrics.hardDeleteExceptionsCount.inc(); throw e; } catch (IOException e) { metrics.hardDeleteExceptionsCount.inc(); throw new StoreException(e, StoreErrorCodes.IOError); } catch (Exception e) { metrics.hardDeleteExceptionsCount.inc(); throw new StoreException(e, StoreErrorCodes.Unknown_Error); } finally { context.stop(); } } return false; }
Source:
public CompletableFuture<Void> close() { List<CompletableFuture<Void>> futures = partitions.values().stream() .map(RaftPartition::close) .collect(Collectors.toList()); return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])).thenRun(() -> { try { threadContextFactory.close(); } catch (Exception e) { } LOGGER.info("Stopped"); }); }

Target:
public CompletableFuture<Void> close() { List<CompletableFuture<Void>> futures = partitions.values().stream() .map(RaftPartition::close) .collect(Collectors.toList()); return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])).thenRun(() -> { threadContextFactory.close(); LOGGER.info("Stopped"); }); }
Source:
public void snapshotAllMetrics(MetricRegistry metricRegistry, MetricsRecordBuilder builder) { Map<String, Metric> metrics = metricRegistry.getMetrics(); Iterator i$ = metrics.entrySet().iterator(); while(i$.hasNext()) { Entry<String, Metric> e = (Entry)i$.next(); String name = StringUtils.capitalize((String)e.getKey()); Metric metric = (Metric)e.getValue(); if (metric instanceof Gauge) { this.addGauge(name, (Gauge)metric, builder); } else if (metric instanceof Counter) { this.addCounter(name, (Counter)metric, builder); } else if (metric instanceof Histogram) { this.addHistogram(name, (Histogram)metric, builder); } else if (metric instanceof Meter) { this.addMeter(name, (Meter)metric, builder); } else if (metric instanceof Timer) { this.addTimer(name, (Timer)metric, builder); } else { LOG.info("Ignoring unknown Metric class " + metric.getClass().getName()); } } }

Target:
private void snapshotAllMetrics(MetricRegistry metricRegistry, MetricsRecordBuilder builder) { Map<String, Metric> metrics = metricRegistry.getMetrics(); Iterator iterator = metrics.entrySet().iterator(); while(iterator.hasNext()) { Entry<String, Metric> e = (Entry)iterator.next(); String name = StringUtils.capitalize(e.getKey()); Metric metric = e.getValue(); if (metric instanceof Gauge) { this.addGauge(name, (Gauge)metric, builder); } else if (metric instanceof Counter) { this.addCounter(name, (Counter)metric, builder); } else if (metric instanceof Histogram) { this.addHistogram(name, (Histogram)metric, builder); } else if (metric instanceof Meter) { this.addMeter(name, (Meter)metric, builder); } else if (metric instanceof Timer) { this.addTimer(name, (Timer)metric, builder); } else { LOG.info("Ignoring unknown Metric class " + metric.getClass().getName()); } } }
Source:
public Supplier<IntIterator> makeDimensionProcessor(DimensionSelector selector, boolean multiValue) { if (selector.getValueCardinality() == DimensionDictionarySelector.CARDINALITY_UNKNOWN) { return () -> { final IndexedInts row = selector.getRow(); if (row.size() == 1) { int dimensionId = row.get(0); IntList rowNumbers = getRowNumbers(selector, dimensionId); return rowNumbers.iterator(); } else { throw new QueryException("Unsupported query", "Unsupported query on multi-valued column", QueryException.class.getName(), null); } }; } else { return () -> { final IndexedInts row = selector.getRow(); if (row.size() == 1) { int dimensionId = row.get(0); IntList rowNumbers = getAndCacheRowNumbers(selector, dimensionId); return rowNumbers.iterator(); } else { throw new QueryException("Unsupported query", "Unsupported query on multi-valued column", QueryException.class.getName(), null); } }; } }

Target:
public Supplier<IntIterator> makeDimensionProcessor(DimensionSelector selector, boolean multiValue) { if (selector.getValueCardinality() == DimensionDictionarySelector.CARDINALITY_UNKNOWN) { return () -> { final IndexedInts row = selector.getRow(); if (row.size() == 1) { int dimensionId = row.get(0); IntList rowNumbers = getRowNumbers(selector, dimensionId); return rowNumbers.iterator(); } else if (row.size() == 0) { return IntIterators.EMPTY_ITERATOR; } else { throw new QueryUnsupportedException("Joining against a multi-value dimension is not supported."); } }; } else { return () -> { final IndexedInts row = selector.getRow(); if (row.size() == 1) { int dimensionId = row.get(0); IntList rowNumbers = getAndCacheRowNumbers(selector, dimensionId); return rowNumbers.iterator(); } else if (row.size() == 0) { return IntIterators.EMPTY_ITERATOR; } else { throw new QueryUnsupportedException("Joining against a multi-value dimension is not supported."); } }; } }
Source:
public RangeSet<String> getDimensionRangeSet(String dimension) { if (field instanceof AndDimFilter) { List<DimFilter> fields = ((AndDimFilter) field).getFields(); return Druids.newOrDimFilterBuilder().fields(Lists.transform(fields, negate)).build().getDimensionRangeSet(dimension); } if (field instanceof OrDimFilter) { List<DimFilter> fields = ((OrDimFilter) field).getFields(); return Druids.newAndDimFilterBuilder().fields(Lists.transform(fields, negate)).build().getDimensionRangeSet(dimension); } if (field instanceof NotDimFilter) { return ((NotDimFilter) field).getField().getDimensionRangeSet(dimension); } RangeSet<String> rangeSet = field.getDimensionRangeSet(dimension); return rangeSet == null ? null : rangeSet.complement(); }

Target:
public RangeSet<String> getDimensionRangeSet(String dimension) { if (field instanceof AndDimFilter) { List<DimFilter> fields = ((AndDimFilter) field).getFields(); return Druids.newOrDimFilterBuilder().fields(Lists.transform(fields, NEGATE)).build().getDimensionRangeSet(dimension); } if (field instanceof OrDimFilter) { List<DimFilter> fields = ((OrDimFilter) field).getFields(); return Druids.newAndDimFilterBuilder().fields(Lists.transform(fields, NEGATE)).build().getDimensionRangeSet(dimension); } if (field instanceof NotDimFilter) { return ((NotDimFilter) field).getField().getDimensionRangeSet(dimension); } RangeSet<String> rangeSet = field.getDimensionRangeSet(dimension); return rangeSet == null ? null : rangeSet.complement(); }