This is an automated email from the ASF dual-hosted git repository. ptupitsyn pushed a commit to branch ignite-27278 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 76948a582a2e601d2dbc742428613bb2ab4e773c Author: Pavel Tupitsyn <[email protected]> AuthorDate: Tue Dec 23 20:10:48 2025 +0200 Fix emitted code - SqlResultSetObjectMappingTests green --- .../Table/PocoAllColumnsSqlNullableMapper.cs | 3 ++- .../Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs | 2 +- .../dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs | 16 +++++++++------- .../platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests.Common/Table/PocoAllColumnsSqlNullableMapper.cs b/modules/platforms/dotnet/Apache.Ignite.Tests.Common/Table/PocoAllColumnsSqlNullableMapper.cs index 6ced7807b0a..80c0dc443b9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Tests.Common/Table/PocoAllColumnsSqlNullableMapper.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Tests.Common/Table/PocoAllColumnsSqlNullableMapper.cs @@ -187,7 +187,8 @@ public class PocoAllColumnsSqlNullableMapper : IMapper<PocoAllColumnsSqlNullable break; default: - throw new InvalidOperationException("Unexpected column: " + col.Name); + rowReader.Skip(); + break; } } diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs index f332f41578a..378bebcae9d 100644 --- a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs +++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs @@ -139,7 +139,7 @@ internal sealed class IgniteQueryExecutor : IQueryExecutor IResultSet<T> resultSet = await _sql.ExecuteAsyncInternal( _transaction, statement, - meta => ResultSelector.Get<T>(meta.Columns, queryModel.SelectClause.Selector, selectorOptions), + meta => ResultSelector.Get<T>(meta, queryModel.SelectClause.Selector, selectorOptions), rowReaderArg: null, queryData.Parameters, CancellationToken.None) diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs index 72c969a3fe7..ceed9c24599 100644 --- a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs +++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs @@ -62,13 +62,15 @@ internal static class ResultSelector /// LINQ handles type conversion when possible; /// LINQ allows more ways to instantiate resulting objects. /// </summary> - /// <param name="columns">Columns.</param> + /// <param name="meta">Metadata.</param> /// <param name="selectorExpression">Selector expression.</param> /// <param name="options">Options.</param> /// <typeparam name="T">Result type.</typeparam> /// <returns>Row reader.</returns> - public static RowReader<T> Get<T>(IReadOnlyList<IColumnMetadata> columns, Expression? selectorExpression, ResultSelectorOptions options) + public static RowReader<T> Get<T>(ResultSetMetadata meta, Expression? selectorExpression, ResultSelectorOptions options) { + var columns = meta.Columns; + // Anonymous type projections use a constructor call. But user-defined types can also be used with constructor call. if (selectorExpression is NewExpression newExpr) { @@ -115,7 +117,7 @@ internal static class ResultSelector }) { // Select everything from a sub-query - use nested selector. - return Get<T>(columns, subQuery.QueryModel.SelectClause.Selector, options); + return Get<T>(meta, subQuery.QueryModel.SelectClause.Selector, options); } var readerCacheKey = new ResultSelectorCacheKey<Type>(typeof(T), columns, options); @@ -130,7 +132,7 @@ internal static class ResultSelector var method = new DynamicMethod( name: $"SingleColumnFromBinaryTupleReader_{typeof(T).FullName}_{GetNextId()}", returnType: typeof(T), - parameterTypes: new[] { typeof(IReadOnlyList<IColumnMetadata>), typeof(BinaryTupleReader).MakeByRefType() }, + parameterTypes: [typeof(ResultSetMetadata), typeof(BinaryTupleReader).MakeByRefType(), typeof(object)], m: typeof(IIgnite).Module, skipVisibility: true); @@ -151,7 +153,7 @@ internal static class ResultSelector var method = new DynamicMethod( name: $"ConstructorFromBinaryTupleReader_{typeof(T).FullName}_{GetNextId()}", returnType: typeof(T), - parameterTypes: new[] { typeof(IReadOnlyList<IColumnMetadata>), typeof(BinaryTupleReader).MakeByRefType() }, + parameterTypes: [typeof(ResultSetMetadata), typeof(BinaryTupleReader).MakeByRefType(), typeof(object)], m: typeof(IIgnite).Module, skipVisibility: true); @@ -183,7 +185,7 @@ internal static class ResultSelector var method = new DynamicMethod( name: $"UninitializedObjectFromBinaryTupleReader_{typeof(T).FullName}_{GetNextId()}", returnType: typeof(T), - parameterTypes: new[] { typeof(IReadOnlyList<IColumnMetadata>), typeof(BinaryTupleReader).MakeByRefType() }, + parameterTypes: [typeof(ResultSetMetadata), typeof(BinaryTupleReader).MakeByRefType(), typeof(object)], m: typeof(IIgnite).Module, skipVisibility: true); @@ -219,7 +221,7 @@ internal static class ResultSelector var method = new DynamicMethod( name: $"MemberInitFromBinaryTupleReader_{typeof(T).FullName}_{GetNextId()}", returnType: typeof(T), - parameterTypes: new[] { typeof(IReadOnlyList<IColumnMetadata>), typeof(BinaryTupleReader).MakeByRefType() }, + parameterTypes: [typeof(ResultSetMetadata), typeof(BinaryTupleReader).MakeByRefType(), typeof(object)], m: typeof(IIgnite).Module, skipVisibility: true); diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs index 48dd712f6d4..b89451b50e2 100644 --- a/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs +++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/Sql.cs @@ -353,7 +353,7 @@ namespace Apache.Ignite.Internal.Sql [RequiresUnreferencedCode(ReflectionUtils.TrimWarning)] private static RowReader<T> GetReaderFactory<T>(ResultSetMetadata metadata) => - ResultSelector.Get<T>(metadata.Columns, selectorExpression: null, ResultSelectorOptions.None); + ResultSelector.Get<T>(metadata, selectorExpression: null, ResultSelectorOptions.None); private static void WriteBatchArgs(PooledArrayBuffer writer, IEnumerable<IEnumerable<object?>> args) {
