1 Reply Latest reply on May 25, 2017 11:14 AM by Gregory Orciuch

    ISPN028502: Unknown alias - when Group By with advanced where clause

    Gregory Orciuch Newbie

      Hi,

       

      We do have a challenge with GroupBy using projections including not so complicated (but nasted field) WHERE conditions;

      For example running this query (via Ickle or via DSL):

      select min(_gen0.publicId) FROM Offering _gen0  WHERE (_gen0.imagesVTOList.name = 'MEN') GROUP BY _gen0.relationSetId
      

      Results in having exception root cause (debug in ISPN server side)

      [org.infinispan.query.dsl.embedded.impl.QueryEngine] (HotRod-ServerHandler-6-8) Building query 'select min(_gen0.publicId) FROM Offering _gen0  WHERE (_gen0.imagesVTOList.name = 'MEN') GROUP BY _gen0.relationSetId  ' with parameters null

      [org.infinispan.server.hotrod.HotRodExceptionHandler] (HotRod-ServerWorker-4-1) Exception caught: org.infinispan.objectfilter.ParsingException: ISPN028502: Unknown alias: imagesVTOList.

       

      However, when removing grouping, query against nasted property inside imagesVTOList works very well.  Query like that is very fine:  'select _gen0.publicId FROM Offering _gen0  WHERE (_gen0.imagesVTOList.name = 'MEN')  ' - -OK.

      Meaning it can understand nested field clause query, just grouping causes a problem that it lost an alias?

      What I do wrong? or maybe, what is worse, such query is not supported.

       

      I stepped into this infinispan/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/query at master · infinispan/infinispan · Git…  but there is no grouping example on a List based WHERE.

       

      Environment is like that:

      1. Infinispan Server 9.0.0. Final. HotRod connector enabled.

      2. RemoteCache client which fires above queries against the server over hotrod protocol; Proto schemas registered well, Other DSL queries which dont require grouping and projections work well.

      3. Entities annotated with @ProtoField and @ProtoDoc

      4. I've tried various combinations of below but now luck.

          //@ProtoDoc("@Field(name=\"hierarchyTypes\",store = Store.YES, analyze = Analyze.NO)")

          //@ProtoDoc("@IndexedEmbedded(prefix=\"bla\")")

          //@ProtoDoc("@ContainedIn")

          //@ProtoDoc("@IndexedEmbedded(includePaths = { \"name\" })")

          //@ProtoDoc("@Field(store = Store.YES)")

          //@ProtoDoc("@IndexedField")

      5. Below I pasted full stack trace from server as well as samples of my entities;

       

      Tagging anistor as author of tests in ispn and as author of QueryResolverDelegateImpl which thrown runtime execption at :101 because of empty map : Map<String, PropertyPath<TypeDescriptor<TypeMetadata>>> aliasToPropertyPath;

       

      Thanks in advance for any help.

      BR,

      Gregory

       

      ----

      0:47:49,546 DEBUG [org.infinispan.server.hotrod.HotRodExceptionHandler] (HotRod-ServerWorker-4-1) Exception caught: org.infinispan.objectfilter.ParsingException: ISPN028502: Unknown alias: imagesVTOList.
        at org.infinispan.objectfilter.impl.syntax.parser.QueryResolverDelegateImpl.normalizeUnqualifiedRoot(QueryResolverDelegateImpl.java:101)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.pathedPropertyReferenceSource(QueryResolver.java:7858)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.pathedPropertyReference(QueryResolver.java:7716)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.propertyReferencePath(QueryResolver.java:7567)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.propertyReferenceExpression(QueryResolver.java:5689)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.valueExpressionPrimary(QueryResolver.java:5495)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.valueExpression(QueryResolver.java:5271)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.rowValueConstructor(QueryResolver.java:4490)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.predicate(QueryResolver.java:3326)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.searchCondition(QueryResolver.java:2979)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.whereClause(QueryResolver.java:655)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.querySpec(QueryResolver.java:510)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.queryStatement(QueryResolver.java:379)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.queryStatementSet(QueryResolver.java:292)
        at org.infinispan.objectfilter.impl.ql.parse.QueryResolver.statement(QueryResolver.java:220)
        at org.infinispan.objectfilter.impl.ql.QueryParser.resolve(QueryParser.java:81)
        at org.infinispan.objectfilter.impl.ql.QueryParser.parseQuery(QueryParser.java:69)
        at org.infinispan.objectfilter.impl.syntax.parser.IckleParser.parse(IckleParser.java:19)
        at org.infinispan.query.dsl.embedded.impl.QueryEngine.lambda$parse$1(QueryEngine.java:663)
        at org.infinispan.query.dsl.embedded.impl.QueryCache.lambda$get$0(QueryCache.java:79)
        at org.infinispan.cache.impl.TypeConverterDelegatingAdvancedCache.lambda$convertFunction$1(TypeConverterDelegatingAdvancedCache.java:101)
        at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324)
        at org.infinispan.cache.impl.AbstractDelegatingCache.computeIfAbsent(AbstractDelegatingCache.java:343)
        at org.infinispan.cache.impl.TypeConverterDelegatingAdvancedCache.computeIfAbsent(TypeConverterDelegatingAdvancedCache.java:161)
        at org.infinispan.query.dsl.embedded.impl.QueryCache.get(QueryCache.java:79)
        at org.infinispan.query.dsl.embedded.impl.QueryEngine.parse(QueryEngine.java:663)
        at org.infinispan.query.dsl.embedded.impl.QueryEngine.buildQueryWithAggregations(QueryEngine.java:299)
        at org.infinispan.query.dsl.embedded.impl.QueryEngine.buildQuery(QueryEngine.java:139)
        at org.infinispan.query.dsl.embedded.impl.DelegatingQuery.createQuery(DelegatingQuery.java:91)
        at org.infinispan.query.dsl.embedded.impl.DelegatingQuery.list(DelegatingQuery.java:98)
        at org.infinispan.query.remote.impl.QueryFacadeImpl.makeResponse(QueryFacadeImpl.java:61)
        at org.infinispan.query.remote.impl.QueryFacadeImpl.query(QueryFacadeImpl.java:53)
        at org.infinispan.server.hotrod.HotRodServer.query(HotRodServer.java:116)
        at org.infinispan.server.hotrod.ContextHandler.realRead(ContextHandler.java:148)
        at org.infinispan.server.hotrod.ContextHandler.lambda$null$0(ContextHandler.java:59)
        at org.infinispan.security.Security.doAs(Security.java:143)
        at org.infinispan.server.hotrod.ContextHandler.lambda$channelRead0$1(ContextHandler.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
        at java.lang.Thread.run(Thread.java:748)
      

       

       

      and classses:

       

       

      @ProtoDoc("@Indexed")
      public class Offering implements Serializable {
      
      
        private String name;
        private List<String> imageUrl = new ArrayList<>();
        private List<ImagesVTO> imagesVTOList = new ArrayList<>();
        private Integer relationSetId;
      
        @ProtoDoc("@Field(store = Store.YES, analyze = Analyze.YES)")
          @ProtoField(number = 5, required = true)
          public String getName() {
              return name;
          }
      
      
          public void setName(String name) {
              this.name = name;
          }
      
        @ProtoField(number = 15, collectionImplementation = ArrayList.class)
          public List<String> getImageUrl() {
              return imageUrl;
          }
      
      
          public void setImageUrl(List<String> imageUrl) {
              this.imageUrl = imageUrl;
          }
      
        @ProtoDoc("@Field(store = Store.YES)")
          @ProtoField(number = 30, collectionImplementation = ArrayList.class)
          public List<ImagesVTO> getImagesVTOList() {
              return imagesVTOList;
          }
      
      
          public void setImagesVTOList(List<ImagesVTO> imagesVTOList) {
              this.imagesVTOList = imagesVTOList;
          }
      
        @ProtoField(number = 44)
          public Integer getRelationSetId() {
              return relationSetId;
          }
      
      
          public void setRelationSetId(Integer relationSetId) {
              this.relationSetId = relationSetId;
          }
      
      }
      
      
      @ProtoDoc("@Indexed")
      public class ImagesVTO implements Serializable {
      
      
        private String name;
      
      
        private List<String> images = new ArrayList<>();
      
      
        @ProtoDoc("@Field(store = Store.YES)")
        @ProtoField(number = 1, required = true)
        public String getName() {
        return name;
        }
      
      
        public void setName(String name) {
        this.name = name;
        }
      
      
        @ProtoField(number = 2, collectionImplementation = ArrayList.class)
        public List<String> getImages() {
        return images;
        }
      
      
        public void setImages(List<String> images) {
        this.images = images;
        }
      }