Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-4817

.NET: Contains fails in LINQ when subquery comes from a variable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.9
    • 2.0
    • platforms

    Description

      Using Contains with subquery works when subquery is inline:

      var res = personsQry.Where(x => orgsQry.Where(o => o.Value.Size < 100000).Select(o => o.Key).Contains(x.Value.OrgId));
      

      And fails when extracted into a variable:

      var orgIds = orgsQry.Where(o => o.Value.Size < 100000).Select(o => o.Key);
      		
      var res = personsQry.Where(x => orgIds.Contains(x.Value.OrgId));
      

      Exception:

      Failed to parse query: select _T0._key, _T0._val from "persons-linq".Person as _T0 where (_T0.OrgId IN (select _T1._key, _T1._val from "orgs-linq".Organization as _T1 ))
      Caused by: org.h2.jdbc.JdbcSQLException: Subquery is not a single column query
      

      This can be reproduced in CacheLinqTest.TestContains by extracting a variable:

      var foo = orgCache
        .Where(orgEntry => orgEntry.Value.Name == "Org_1")
        .Select(orgEntry => orgEntry.Key);
      

      Attachments

        Issue Links

          Activity

            People

              ptupitsyn Pavel Tupitsyn
              ptupitsyn Pavel Tupitsyn
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: