tkalkirill commented on code in PR #6357:
URL: https://github.com/apache/ignite-3/pull/6357#discussion_r2269619819


##########
migration-tools/modules/migration-tools-commons-tests/src/main/java/org/apache/ignite/migrationtools/tests/clusters/FullSampleCluster.java:
##########
@@ -43,9 +43,9 @@ public FullSampleCluster() {
     @Override
     protected Ignite2ClusterContainer createClusterContainers() {
         return new Ignite2ClusterContainer(
-                FullSampleCluster.CLUSTER_CFG_PATH,
-                FullSampleCluster.TEST_CLUSTER_PATH,
-                FullSampleCluster.clusterNodeIds
+                CLUSTER_CFG_PATH,

Review Comment:
   It doesn't look like a problem here, let's put it back the way it was.



##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/storage/UpdateLogImplTest.java:
##########
@@ -490,7 +490,7 @@ public void writeTo(MarshallableEntry value, 
CatalogObjectDataOutput output) thr
             } else if (id == MarshallableEntryType.VERSIONED_UPDATE.id()) {
                 serializer = new VersionedUpdateSerializerV1(this);
             } else {
-                serializer = 
CatalogEntrySerializerProvider.DEFAULT_PROVIDER.get(2, id);
+                serializer = DEFAULT_PROVIDER.get(2, id);

Review Comment:
   It doesn't look like a problem here, let's put it back the way it was.



##########
modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java:
##########
@@ -1540,7 +1540,7 @@ public int getJDBCMinorVersion() {
     /** {@inheritDoc} */
     @Override
     public int getSQLStateType() {
-        return DatabaseMetaData.sqlStateSQL99;
+        return sqlStateSQL99;

Review Comment:
   It doesn't look like a problem here, let's put it back the way it was.



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/DynamicCompletionInsider.java:
##########
@@ -36,16 +36,13 @@ public DynamicCompletionInsider() {
 
     private static String[] trim(String[] typedWords) {
         List<String> trimmedWords = new ArrayList<>(typedWords.length);
-        int offset = 0;
         for (String typedWord : typedWords) {
             String currentTrim = typedWord.trim();
-            if (currentTrim.isEmpty()) {
-                offset++;
-            } else {
+            if (!currentTrim.isEmpty()) {

Review Comment:
   It doesn't look like a problem here, let's put it back the way it was.



##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/SerializationType.java:
##########
@@ -49,7 +49,7 @@ public int value() {
      * @return Serialization type.
      */
     public static SerializationType getByValue(int value) {
-        for (SerializationType serializationType : SerializationType.values()) 
{
+        for (SerializationType serializationType : values()) {

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/IgniteThread.java:
##########
@@ -80,7 +80,7 @@ public IgniteThread(String finalName, Runnable r, 
ThreadOperation... allowedOper
      */
     @Nullable
     public static IgniteThread current() {
-        Thread thread = Thread.currentThread();
+        Thread thread = currentThread();

Review Comment:
   It doesn't look like a problem here, let's put it back the way it was.



##########
modules/table/src/test/java/org/apache/ignite/internal/table/type/NumericTypesSerializerTest.java:
##########
@@ -67,7 +67,7 @@ private static String[] stringDecimalRepresentation() {
      */
     private static List<Pair<BigDecimal, BigDecimal>> sameDecimals() {
         return Arrays.asList(
-                new Pair<>(new BigDecimal("10"), BigDecimal.valueOf(10)),
+                new Pair<>(BigDecimal.TEN, BigDecimal.valueOf(10)),

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/BaseAggregateTest.java:
##########
@@ -549,7 +549,7 @@ public void sumLongOverflow(TestAggregateType testAgg) {
 
         assertTrue(root.hasNext());
 
-        assertArrayEquals(row(0, new BigDecimal(Long.MAX_VALUE).add(new 
BigDecimal(10))), root.next());
+        assertArrayEquals(row(0, new 
BigDecimal(Long.MAX_VALUE).add(BigDecimal.TEN)), root.next());

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctionsTest.java:
##########
@@ -370,8 +371,8 @@ public void testRound2LongType(long input, int scale, long 
result) {
     /** Tests for TRUNCATE(x) function. */
     @Test
     public void testTruncate() {
-        assertEquals(new BigDecimal("1"), IgniteSqlFunctions.struncate(new 
BigDecimal("1.000")));
-        assertEquals(new BigDecimal("1"), IgniteSqlFunctions.struncate(new 
BigDecimal("1.5")));
+        assertEquals(BigDecimal.ONE, IgniteSqlFunctions.struncate(new 
BigDecimal("1.000")));

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java:
##########
@@ -1462,22 +1459,19 @@ public Unsafe run() throws Exception {
     private static long bufferAddressOffset() {
         final ByteBuffer maybeDirectBuf = ByteBuffer.allocateDirect(1);
 
-        Field addrField = AccessController.doPrivileged(new 
PrivilegedAction<Field>() {
-            @Override
-            public Field run() {
-                try {
-                    Field addrFld = Buffer.class.getDeclaredField("address");
-
-                    addrFld.setAccessible(true);
+        Field addrField = 
AccessController.doPrivileged((PrivilegedAction<Field>) () -> {

Review Comment:
   I'm not sure what needs to be changed, anonymous classes can be faster than 
lambdas because of the lambda cache.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java:
##########
@@ -305,7 +306,7 @@ void multiBoundConditionsAreMergedCorrectly() {
                 .add("C1", SqlTypeName.INTEGER)
                 .build();
 
-        RexNode intValue1 = rexBuilder.makeExactLiteral(new BigDecimal("1"));
+        RexNode intValue1 = rexBuilder.makeExactLiteral(BigDecimal.ONE);

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java:
##########
@@ -478,7 +480,7 @@ public void testInvalidConditions() {
                 .add("C1", SqlTypeName.INTEGER)
                 .build();
 
-        RexNode intValue1 = rexBuilder.makeExactLiteral(new BigDecimal("1"));
+        RexNode intValue1 = rexBuilder.makeExactLiteral(BigDecimal.ONE);

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/file-transfer/src/main/java/org/apache/ignite/internal/network/file/messages/FileHeader.java:
##########
@@ -62,7 +62,7 @@ static FileHeader fromPath(FileTransferFactory factory, Path 
path) {
      * @return List of file headers.
      */
     static List<FileHeader> fromPaths(FileTransferFactory factory, List<Path> 
paths) {
-        return paths.stream().map(path -> FileHeader.fromPath(factory, path))
+        return paths.stream().map(path -> fromPath(factory, path))

Review Comment:
   It doesn't look like a problem here, let's put it back the way it was.



##########
modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java:
##########
@@ -239,7 +239,7 @@ private static synchronized void register() {
         try {
             Driver registeredDriver = new IgniteJdbcDriver();
             DriverManager.registerDriver(registeredDriver);
-            IgniteJdbcDriver.instance = registeredDriver;
+            instance = registeredDriver;

Review Comment:
   It doesn't look like a problem here, let's put it back the way it was.



##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/BuiltInType.java:
##########
@@ -98,7 +98,7 @@ public enum BuiltInType {
 
     static {
         Int2ObjectMap<BuiltInType> map = new Int2ObjectOpenHashMap<>();
-        for (BuiltInType type : BuiltInType.values()) {
+        for (BuiltInType type : values()) {

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/PartitionSet.java:
##########
@@ -188,7 +188,7 @@ public int size() {
 
             @Override
             public PartitionSet copy() {
-                return PartitionSet.of(partId);
+                return of(partId);

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/BuiltInType.java:
##########
@@ -108,7 +108,7 @@ public enum BuiltInType {
 
     static {
         Map<Class<?>, BuiltInType> map = new HashMap<>();
-        for (BuiltInType type : BuiltInType.values()) {
+        for (BuiltInType type : values()) {

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctionsTest.java:
##########
@@ -251,8 +251,9 @@ public void testConvertDecimal(String input, int precision, 
int scale, String re
 
     /** Tests for ROUND(x) function. */
     @Test
+    @SuppressWarnings("PMD.BigIntegerInstantiation")
     public void testRound() {
-        assertEquals(new BigDecimal("1"), IgniteSqlFunctions.sround(new 
BigDecimal("1.000")));
+        assertEquals(BigDecimal.ONE, IgniteSqlFunctions.sround(new 
BigDecimal("1.000")));

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/marshaller/PartitionCommandsMarshallerImpl.java:
##########
@@ -42,7 +42,7 @@ public void patch(ByteBuffer raw, HybridTimestamp safeTs) {
     protected void beforeWriteMessage(Object o, ByteBuffer buffer) {
         int requiredCatalogVersion = o instanceof CatalogVersionAware
                 ? ((CatalogVersionAware) o).requiredCatalogVersion()
-                : PartitionCommandsMarshaller.NO_VERSION_REQUIRED;
+                : NO_VERSION_REQUIRED;

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctionsTest.java:
##########
@@ -370,8 +371,8 @@ public void testRound2LongType(long input, int scale, long 
result) {
     /** Tests for TRUNCATE(x) function. */
     @Test
     public void testTruncate() {
-        assertEquals(new BigDecimal("1"), IgniteSqlFunctions.struncate(new 
BigDecimal("1.000")));
-        assertEquals(new BigDecimal("1"), IgniteSqlFunctions.struncate(new 
BigDecimal("1.5")));
+        assertEquals(BigDecimal.ONE, IgniteSqlFunctions.struncate(new 
BigDecimal("1.000")));
+        assertEquals(BigDecimal.ONE, IgniteSqlFunctions.struncate(new 
BigDecimal("1.5")));

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java:
##########
@@ -1438,15 +1438,12 @@ private static Unsafe unsafe() {
         } catch (SecurityException ignored) {
             try {
                 return AccessController.doPrivileged(
-                        new PrivilegedExceptionAction<Unsafe>() {
-                            @Override
-                            public Unsafe run() throws Exception {
-                                Field f = 
Unsafe.class.getDeclaredField("theUnsafe");
+                        (PrivilegedExceptionAction<Unsafe>) () -> {

Review Comment:
   I'm not sure what needs to be changed, anonymous classes can be faster than 
lambdas because of the lambda cache.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctionsTest.java:
##########
@@ -89,17 +89,17 @@ public void testBooleanObjectToBigDecimal() {
     @Test
     public void testPrimitiveToDecimal() {
         assertEquals(
-                new BigDecimal(10),
+                BigDecimal.TEN,

Review Comment:
   This doesn't look like a problem, let's go back to how it was.
   And others in class.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java:
##########
@@ -122,7 +122,7 @@ void multiBoundConditionAreOrderedCorrectly() {
                 .add("C1", SqlTypeName.INTEGER)
                 .build();
 
-        RexNode intValue1 = rexBuilder.makeExactLiteral(new BigDecimal("1"));
+        RexNode intValue1 = rexBuilder.makeExactLiteral(BigDecimal.ONE);

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/io/BlobFragmentIo.java:
##########
@@ -40,7 +40,7 @@
  * </ul>
  */
 public class BlobFragmentIo extends PageIo {
-    private static final int NEXT_PAGE_ID_OFF = PageIo.COMMON_HEADER_END;
+    private static final int NEXT_PAGE_ID_OFF = COMMON_HEADER_END;

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctionsTest.java:
##########
@@ -370,8 +371,8 @@ public void testRound2LongType(long input, int scale, long 
result) {
     /** Tests for TRUNCATE(x) function. */
     @Test
     public void testTruncate() {
-        assertEquals(new BigDecimal("1"), IgniteSqlFunctions.struncate(new 
BigDecimal("1.000")));
-        assertEquals(new BigDecimal("1"), IgniteSqlFunctions.struncate(new 
BigDecimal("1.5")));
+        assertEquals(BigDecimal.ONE, IgniteSqlFunctions.struncate(new 
BigDecimal("1.000")));

Review Comment:
   This doesn't look like a problem, let's go back to how it was.



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/DataSourceScanNodeExecutionTest.java:
##########
@@ -300,37 +299,34 @@ static class IterableDataSource implements 
ScannableDataSource {
         public Publisher<InternalTuple> scan() {
             Iterator<InternalTuple> it = iterable.iterator();
 
-            return new Publisher<InternalTuple>() {
-                @Override
-                public void subscribe(Subscriber<? super InternalTuple> 
subscriber) {
-                    Subscription subscription = new Subscription() {
-                        @Override
-                        public void request(long n) {
-                            if (n <= 0) {
-                                subscriber.onError(new 
IllegalArgumentException());
+            return subscriber -> {

Review Comment:
   I'm not sure what needs to be changed, anonymous classes can be faster than 
lambdas because of the lambda cache.



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/agg/AccumulatorsFactory.java:
##########
@@ -229,14 +229,11 @@ private Function<Object[], Object[]> 
createInAdapter(Accumulator accumulator) {
             List<Function<Object, Object>> casts =
                     Commons.transform(Pair.zip(inTypes, outTypes), 
AccumulatorsFactory::cast);
 
-            return new Function<Object[], Object[]>() {
-                @Override
-                public Object[] apply(Object[] args) {
-                    for (int i = 0; i < args.length; i++) {
-                        args[i] = casts.get(i).apply(args[i]);
-                    }
-                    return args;
+            return args -> {

Review Comment:
   I'm not sure what needs to be changed, anonymous classes can be faster than 
lambdas because of the lambda cache.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to