You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2023/01/16 08:58:34 UTC

[ignite-3] branch main updated: IGNITE-18509 .NET: Remove unused CompileMemberReader logic (#1522)

This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new a1e355f02c IGNITE-18509 .NET: Remove unused CompileMemberReader logic (#1522)
a1e355f02c is described below

commit a1e355f02c2a95a52ae42c9393394bfbdc807f62
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon Jan 16 10:58:28 2023 +0200

    IGNITE-18509 .NET: Remove unused CompileMemberReader logic (#1522)
    
    This logic was ported from 2.x, but even there it is not used (not covered by any tests). Most likely it was required on .NET 4, which was used to develop LINQ provider initially, where compiler produced different expression trees.
---
 .../dotnet/Apache.Ignite.Tests/JavaServer.cs       |  8 +++-
 .../Internal/Linq/ExpressionWalker.cs              | 49 +---------------------
 modules/platforms/dotnet/DEVNOTES.md               |  6 ++-
 3 files changed, 12 insertions(+), 51 deletions(-)

diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs b/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
index ca60a14a03..d589a615f6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/JavaServer.cs
@@ -36,7 +36,7 @@ namespace Apache.Ignite.Tests
         private const int ConnectTimeoutSeconds = 120;
 
         private const string GradleCommandExec = ":ignite-runner:runnerPlatformTest --no-daemon"
-          + " -x compileJava -x compileTestFixturesJava -x compileIntegrationTestJava -x compileTestJava";
+          + " -x compileJava -x compileTestFixturesJava -x compileIntegrationTestJava -x compileTestJava --parallel";
 
          /** Full path to Gradle binary. */
         private static readonly string GradlePath = GetGradle();
@@ -177,7 +177,11 @@ namespace Apache.Ignite.Tests
         {
             try
             {
-                var cfg = new IgniteClientConfiguration("127.0.0.1:" + port);
+                var cfg = new IgniteClientConfiguration("127.0.0.1:" + port)
+                {
+                    SocketTimeout = TimeSpan.FromSeconds(0.5)
+                };
+
                 using var client = await IgniteClient.StartAsync(cfg);
 
                 return null;
diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ExpressionWalker.cs b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ExpressionWalker.cs
index bb348f6e74..5869eb53ff 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ExpressionWalker.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ExpressionWalker.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Internal.Linq;
 
 using System;
 using System.Collections;
-using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
@@ -33,9 +32,6 @@ using Remotion.Linq.Clauses.Expressions;
 /// </summary>
 internal static class ExpressionWalker
 {
-    /** Compiled member readers. */
-    private static readonly ConcurrentDictionary<MemberInfo, Func<object?, object?>> MemberReaders = new();
-
     /// <summary>
     /// Gets the queryable.
     /// </summary>
@@ -271,31 +267,13 @@ internal static class ExpressionWalker
     /// <param name="expr">Expression.</param>
     /// <typeparam name="T">Expression type.</typeparam>
     /// <returns>Evaluation result.</returns>
-    public static T? EvaluateExpression<T>(Expression expr)
+    public static T EvaluateExpression<T>(Expression expr)
     {
         if (expr is ConstantExpression constExpr)
         {
             return (T)constExpr.Value!;
         }
 
-        if (expr is MemberExpression memberExpr)
-        {
-            var targetExpr = memberExpr.Expression as ConstantExpression;
-
-            if (memberExpr.Expression == null || targetExpr != null)
-            {
-                // Instance or static member
-                var target = targetExpr?.Value;
-
-                if (MemberReaders.TryGetValue(memberExpr.Member, out var reader))
-                {
-                    return (T) reader(target)!;
-                }
-
-                return (T?) MemberReaders.GetOrAdd(memberExpr.Member, static (_, me) => CompileMemberReader(me), memberExpr)(target);
-            }
-        }
-
         // Case for compiled queries: return unchanged.
         // ReSharper disable once CanBeReplacedWithTryCastAndCheckForNull
         if (expr is ParameterExpression)
@@ -359,29 +337,4 @@ internal static class ExpressionWalker
     /// <param name="queryable">Queryable.</param>
     /// <returns>Table name with schema.</returns>
     public static string GetTableNameWithSchema(IIgniteQueryableInternal queryable) => $"PUBLIC.{queryable.TableName}";
-
-    /// <summary>
-    /// Compiles the member reader.
-    /// </summary>
-    private static Func<object?, object?> CompileMemberReader(MemberExpression memberExpr)
-    {
-        // Field or property
-        var fld = memberExpr.Member as FieldInfo;
-
-        if (fld != null)
-        {
-            // TODO: IGNITE-18509 Replace reflection with emitted delegates.
-            return o => fld.GetValue(o);
-        }
-
-        var prop = memberExpr.Member as PropertyInfo;
-
-        if (prop != null)
-        {
-            // TODO: IGNITE-18509 Replace reflection with emitted delegates.
-            return o => prop.GetValue(o, null);
-        }
-
-        throw new NotSupportedException("Expression not supported: " + memberExpr);
-    }
 }
diff --git a/modules/platforms/dotnet/DEVNOTES.md b/modules/platforms/dotnet/DEVNOTES.md
index 9517b127b0..5928d00a8a 100644
--- a/modules/platforms/dotnet/DEVNOTES.md
+++ b/modules/platforms/dotnet/DEVNOTES.md
@@ -3,7 +3,11 @@
 * Java 11 SDK
 
 ## Build Java
-In repo root: `gradlew clean build -x test`
+In repo root:
+`./gradlew assemble compileIntegrationTestJava`
+
+Or a faster variant:
+`./gradlew assemble compileIntegrationTestJava -x check -x assembleDist -x distTar -x distZip --parallel`
 
 ## Build .NET
 In this dir: `dotnet build`