Uploaded image for project: 'GeoServer'
  1. GEOS-8490

Exception with NULL values with AggregateProcess

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.12.4, 2.13.1, 2.14-RC
    • Component/s: None
    • Labels:

      Description

      Aggregate numeric values with a numeric operation (e.g. SUM) fails when some NULL value is present on database.

      Setup
      • Layer from a ORACLE JNDI Data Store
      • GeoServer 9.2
      Steps to reproduce

      Perform the following request to a layer LAYER in the workspace WORKSPACE.
      The NUMERIC_ATTRIBUTE have to be numeric with sone NULL values on database (tested on oracle)

      curl 'http://localhost:8080/geoserver-test/wps?service=WPS&ms2-authkey=97d6f395-bc5f-4b17-bee5-9d58285457ec' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://localhost:8080/MapStore2/' -H 'Origin: http://localhost:8080' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36' -H 'Content-Type: text/xml' --data-binary $'<?xml version="1.0" encoding="UTF-8"?>
      <wps:Execute service="WPS"   version="1.0.0"
          xmlns="http://www.opengis.net/wps/1.0.0"
          xmlns:gml="http://www.opengis.net/gml"
          xmlns:ogc="http://www.opengis.net/ogc"
          xmlns:ows="http://www.opengis.net/ows/1.1"
          xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
          xmlns:wfs="http://www.opengis.net/wfs"
          xmlns:wps="http://www.opengis.net/wps/1.0.0"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.opengis.net/wps/1.0.0  http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
          <ows:Identifier>gs:Aggregate</ows:Identifier>
          <wps:DataInputs>
              <wps:Input>
                  <ows:Identifier>features</ows:Identifier>
                  <wps:Reference method="POST" mimeType="text/xml" xlink:href="http://geoserver/wfs">
                      <wps:Body>
                          <wfs:GetFeature outputFormat="GML2" service="WFS" version="1.0.0">
                              <wfs:Query typeName="WORKSPACE:LAYER">
                              
                              </wfs:Query>
                          </wfs:GetFeature>
                      </wps:Body>
                  </wps:Reference>
              </wps:Input>
              <wps:Input>
                  <ows:Identifier>aggregationAttribute</ows:Identifier>
                  <wps:Data>
                      <wps:LiteralData>NUMERIC_ATTRIBUTE</wps:LiteralData>
                  </wps:Data>
              </wps:Input>
              <wps:Input>
                          <ows:Identifier>function</ows:Identifier>
                          <wps:Data>
                              <wps:LiteralData>Sum</wps:LiteralData>
                          </wps:Data>
                          </wps:Input>
              <wps:Input>
                  <ows:Identifier>singlePass</ows:Identifier>
                  <wps:Data>
                      <wps:LiteralData>false</wps:LiteralData>
                  </wps:Data>
              </wps:Input>
              <wps:Input>
                  <ows:Identifier>groupByAttributes</ows:Identifier>
                  <wps:Data>
                      <wps:LiteralData>GROUPBY_ATTRIBUTE</wps:LiteralData>
                  </wps:Data>
              </wps:Input>
          </wps:DataInputs>
          <wps:ResponseForm>
              <wps:RawDataOutput mimeType="application/json">
                  <ows:Identifier>result</ows:Identifier>
              </wps:RawDataOutput>
          </wps:ResponseForm>
      </wps:Execute>' --compressed
      
      GeoServer Log:
      2017-11-20 09:29:19,629 DEBUG [geoserver.wps] - Saving status ExecutionStatus [processName=gs:Aggregate, executionId=645e8c3a-22b0-4b8a-86e9-2299b564e4f4, asynchronous=false, phase=RUNNING, progress=50.0, userName=anonymous, creationTime=Mon Nov 20 09:29:14 GMT 2017, completionTime=null, lastUpdated=Mon Nov 20 09:29:19 GMT 2017, task=Retrieving/parsing process input: groupByAttributes, exception=null, nodeId=192.168.153.6]
      2017-11-20 09:29:19,629 DEBUG [geoserver.wps] - Saving status ExecutionStatus [processName=gs:Aggregate, executionId=645e8c3a-22b0-4b8a-86e9-2299b564e4f4, asynchronous=false, phase=FAILED, progress=50.0, userName=anonymous, creationTime=Mon Nov 20 09:29:14 GMT 2017, completionTime=Mon Nov 20 09:29:19 GMT 2017, lastUpdated=Mon Nov 20 09:29:19 GMT 2017, task=Retrieving/parsing process input: groupByAttributes, exception=java.lang.NullPointerException, nodeId=192.168.153.6]
      2017-11-20 09:29:19,629 ERROR [wps.executor] - Process execution failed
      org.geotools.process.ProcessException: java.lang.NullPointerException
          at org.geotools.process.factory.AnnotationDrivenProcessFactory$InvokeMethodProcess.execute(AnnotationDrivenProcessFactory.java:565)
          at org.geoserver.wps.executor.ProcessStartupFilter$ProcessStartupWrapper.execute(ProcessStartupFilter.java:51)
          at org.geoserver.wps.executor.DefaultProcessManager$ProcessCallable.call(DefaultProcessManager.java:201)
          at org.geoserver.wps.executor.DefaultProcessManager$ProcessCallable.call(DefaultProcessManager.java:169)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NullPointerException
          at java.util.HashMap.merge(HashMap.java:1224)
          at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
          at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
          at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1691)
          at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
          at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
          at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
          at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
          at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
          at org.geotools.feature.visitor.GroupByVisitor$GroupByResult.toMap(GroupByVisitor.java:334)
          at org.geotools.process.vector.AggregateProcess.lambda$handleGroupByVisitor$1(AggregateProcess.java:169)
          at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
          at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
          at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
          at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
          at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
          at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
          at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
          at org.geotools.process.vector.AggregateProcess.handleGroupByVisitor(AggregateProcess.java:170)
          at org.geotools.process.vector.AggregateProcess.execute(AggregateProcess.java:84)
          at sun.reflect.GeneratedMethodAccessor5336.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.geotools.process.factory.AnnotationDrivenProcessFactory$InvokeMethodProcess.execute(AnnotationDrivenProcessFactory.java:549)
          ... 7 more
      2017-11-20 09:29:19,630 DEBUG [geoserver.wps] - Saving status ExecutionStatus [processName=gs:Aggregate, executionId=645e8c3a-22b0-4b8a-86e9-2299b564e4f4, asynchronous=false, phase=FAILED, progress=50.0, userName=anonymous, creationTime=Mon Nov 20 09:29:14 GMT 2017, completionTime=Mon Nov 20 09:29:19 GMT 2017, lastUpdated=Mon Nov 20 09:29:19 GMT 2017, task=Retrieving/parsing process input: groupByAttributes, exception=org.geotools.process.ProcessException: java.lang.NullPointerException, nodeId=192.168.153.6]
      2017-11-20 09:29:19,630 DEBUG [geotools.util] - CRSConverterFactory can be applied from Strings to CRS  only.
      2017-11-20 09:29:19,637 DEBUG [geoserver.wps] - Saving status ExecutionStatus [processName=gs:Aggregate, executionId=645e8c3a-22b0-4b8a-86e9-2299b564e4f4, asynchronous=false, phase=FAILED, progress=50.0, userName=anonymous, creationTime=Mon Nov 20 09:29:14 GMT 2017, completionTime=Mon Nov 20 09:29:19 GMT 2017, lastUpdated=Mon Nov 20 09:29:19 GMT 2017, task=Retrieving/parsing process input: groupByAttributes, exception=org.geotools.process.ProcessException: java.lang.NullPointerException, nodeId=192.168.153.6]
      

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                offtherailz Lorenzo Natali
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: