Closed mrt181 closed 8 months ago
Hi @mrt181, thank you for the detailed explanation. I have submitted a hot-fix pull request. Could you please review it?
Just for the record, positioning the SELECT clause last facilitates more advanced filtering capabilities. The query provided below functions correctly in the current version 4.0.0:
var ksql = dbContext.CreatePullQuery<SubProperty>()
.Where(c => c.Property == "test")
.Select(c => new { c.Property })
.ToQueryString();
In C# LINQ, it's important to note that the positioning of the FROM
, GROUPBY
, and SELECT
clauses differs from SQL statements.
Describe the bug When defining a query like this:
Where
SubProperty
is defined like thisThe create query string uses the wrong column name
Property
instead ofprop
.To Reproduce Add this unit test to
ksqlDb.RestApi.Client.Tests.KSql.Linq.PullQueries.PullQueryExtensionsTests
Expected behavior The returned strings should be:
But instead they are
Environment (please complete the following information):
ksqlDb
version: 7.6.0]ksqlDb.RestApi.Client
Nuget package version 4.0.0Additional context For the
new
expression in theSELECT
the attribute information from the property is used (see KSqlVisitor#ProcessVisitNewMember), but in theWHERE
expression the Property from the dynamic new type is used which does not have those attributes. The whereClauses need to carry the original members in case anew
expression is used and check if those have any relevant attributes.