tomasfabian / ksqlDB.RestApi.Client-DotNet

ksqlDb.RestApi.Client is a C# LINQ-enabled client API for issuing and consuming ksqlDB push and pull queries and executing statements.
MIT License
93 stars 24 forks source link

Predicate with .StartsWith fails. #51

Closed bmmptlgc closed 6 months ago

bmmptlgc commented 6 months ago

String comparison using .Where(item => item.stringField.StartsWith("some string")) fails. It would be nice if it translated to WHERE instr(stringField, 'some string') > 0.

tomasfabian commented 6 months ago

Hi @bmmptlgc, the above predicate should be translated to WHERE stringField LIKE 'some string%'. Could you provide more details about how it fails, please?

bmmptlgc commented 6 months ago

It seems to be that ksql doesn't support AND and LIKE on the same query. image I Just erased the schema portion of the error. All the relevant data is there.

tomasfabian commented 6 months ago

It seems you've come across this ksql issue. I tested it with streams, and it behaves as anticipated. Could be the below approach a viable workaround for you until the issue is addressed in ksqldb?

using  ksqlDB.RestApi.Client.KSql.Query.Functions;

.Where(item => K.Functions.Instr(item.stringField, "some string") > 0)
bmmptlgc commented 6 months ago

That works perfectly, thank.