Forwarding this one on behalf of Nuno, that is having problems sending this
mail directly
Cheers
Andrea
---------- Forwarded message ----------
From: Nuno Miguel Carvalho Oliveira <nmco51...@gmail.com>
Date: Fri, Feb 5, 2016 at 6:44 PM
Subject: Adding "group by" support to the current aggregation visitors
To: geotools-devel@lists.sourceforge.net
Hi,
The current aggregation visitors (AverageVisitor, CountVisitor, MaxVisitor,
MedianVisitor, MinVisitor, StandardDeviationVisitor and SumVisitor) don’t
support a “group by” behavior. For example, we are able to compute the
average electrical consumption per building. But we are not able to ask the
average electrical consumption per building type.
We have came up with three solutions to implement this behavior but none of
them is perfect.
The most straightforward solution would be adding the list of “group by”
attributes to each current aggregator visitor implementation. But this will
break backward compatibility with custom store implementations that we are
not aware of. This solution will also make the current visitors
unnecessarily more complex, each of them will need to know how to handle
the “group by” behavior (this can also lead to some code duplication).
Another solution is to implement a “group by” visitor that will receive an
aggregation visitor as a prototype (basically a visitor that will be
cloned) and a list of “group by” attributes. The current visitors have in
common the FeatureVisitor interface which is not cloneable. In Java 8 we
could make the FeatureVisitor extends Cloneable interface and implement a
default method, but this will not work in GeoServer 2.8.x. So if we extend
the FeatureVisitor to support Cloneable behavior we are breaking backward
compatibility. An (awful) solution for this could be implement the
Cloneable interface in every existing visitor and in the “group by” visitor
do an “instanceof” checking if the visitor is cloneable. If the visitor is
not cloneable we could throw an exception or (let's be crazy) do a deep
serialization copy.
Another solution is to implement a “group by” visitor that will receive an
aggregation visitor name (this would be an Enum), the name of the attribute
that should be used by the aggregation visitor and a list of “group by”
attributes. The “group by” visitor will be responsible to instantiate the
aggregation visitor using the attribute name. The drawback of this solution
is that the list of supported aggregation visitors will be an Enum, which
will kill pluggability. So if someone wants to use a new aggregation
visitor with the “group by” visitor the implementation needs to be updated.
We will also extend the JDBCDataStore current support for aggregation
functions to support the "group by" clause.
Any feedback on this will be highly appreciated.
Regards,
Nuno Oliveira
--
==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==
Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 333 8128928
http://www.geo-solutions.ithttp://twitter.com/geosolutions_it
-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono
da considerarsi strettamente riservate. Il loro utilizzo è consentito
esclusivamente al destinatario del messaggio, per le finalità indicate
nel messaggio stesso. Qualora riceviate questo messaggio senza esserne
il destinatario, Vi preghiamo cortesemente di darcene notizia via e
-mail e di procedere alla distruzione del messaggio stesso,
cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo
anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario
ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely
for the attention and use of
the named addressee(s) and may be confidential or proprietary in
nature or covered by the provisions of privacy act (Legislative Decree
June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not
in accord with its purpose, any disclosure, reproduction, copying,
distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The
sender does not give any warranty or accept liability as the content,
accuracy or completeness of sent messages and accepts no
responsibility for changes made after they were sent or for other
risks which
arise as a result of e-mail transmission, viruses, etc.
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
-------------------------------------------------------
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel