Fix existing unit test, add new tests

This commit is contained in:
Nyall Dawson 2017-09-08 09:19:01 +10:00
parent 2612c39578
commit c750cb2154
13 changed files with 852 additions and 13 deletions

View File

@ -0,0 +1,48 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>stats_by_cat_date</Name>
<ElementPath>stats_by_cat_date</ElementPath>
<GeometryType>100</GeometryType>
<DatasetSpecificInfo>
<FeatureCount>4</FeatureCount>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>date</Name>
<ElementPath>date</ElementPath>
<Type>String</Type>
<Width>10</Width>
</PropertyDefn>
<PropertyDefn>
<Name>count</Name>
<ElementPath>count</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>unique</Name>
<ElementPath>unique</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>empty</Name>
<ElementPath>empty</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>filled</Name>
<ElementPath>filled</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>min</Name>
<ElementPath>min</ElementPath>
<Type>String</Type>
<Width>10</Width>
</PropertyDefn>
<PropertyDefn>
<Name>max</Name>
<ElementPath>max</ElementPath>
<Type>String</Type>
<Width>10</Width>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
<gml:featureMember>
<ogr:stats_by_cat_date fid="stats_by_cat_date.0">
<ogr:date>2016/11/30</ogr:date>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:empty>0</ogr:empty>
<ogr:filled>1</ogr:filled>
<ogr:min>2016/11/30</ogr:min>
<ogr:max>2016/11/30</ogr:max>
</ogr:stats_by_cat_date>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_date fid="stats_by_cat_date.1">
<ogr:date>2016/11/10</ogr:date>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:empty>0</ogr:empty>
<ogr:filled>1</ogr:filled>
<ogr:min>2016/11/10</ogr:min>
<ogr:max>2016/11/10</ogr:max>
</ogr:stats_by_cat_date>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_date fid="stats_by_cat_date.2">
<ogr:count>1</ogr:count>
<ogr:unique>0</ogr:unique>
<ogr:empty>1</ogr:empty>
<ogr:filled>0</ogr:filled>
</ogr:stats_by_cat_date>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_date fid="stats_by_cat_date.3">
<ogr:date>2014/11/30</ogr:date>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:empty>0</ogr:empty>
<ogr:filled>1</ogr:filled>
<ogr:min>2014/11/30</ogr:min>
<ogr:max>2014/11/30</ogr:max>
</ogr:stats_by_cat_date>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,86 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>stats_by_cat_float</Name>
<ElementPath>stats_by_cat_float</ElementPath>
<GeometryType>100</GeometryType>
<DatasetSpecificInfo>
<FeatureCount>5</FeatureCount>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>2</Width>
</PropertyDefn>
<PropertyDefn>
<Name>count</Name>
<ElementPath>count</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>unique</Name>
<ElementPath>unique</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>min</Name>
<ElementPath>min</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>max</Name>
<ElementPath>max</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>range</Name>
<ElementPath>range</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>sum</Name>
<ElementPath>sum</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>mean</Name>
<ElementPath>mean</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>median</Name>
<ElementPath>median</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>stddev</Name>
<ElementPath>stddev</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>minority</Name>
<ElementPath>minority</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>majority</Name>
<ElementPath>majority</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>q1</Name>
<ElementPath>q1</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>q3</Name>
<ElementPath>q3</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>iqr</Name>
<ElementPath>iqr</ElementPath>
<Type>Real</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
<gml:featureMember>
<ogr:stats_by_cat_float fid="stats_by_cat_float.0">
<ogr:name>aa</ogr:name>
<ogr:count>2</ogr:count>
<ogr:unique>2</ogr:unique>
<ogr:min>3.33</ogr:min>
<ogr:max>44.123456</ogr:max>
<ogr:range>40.793456</ogr:range>
<ogr:sum>47.453456</ogr:sum>
<ogr:mean>23.726728</ogr:mean>
<ogr:median>23.726728</ogr:median>
<ogr:stddev>20.396728</ogr:stddev>
<ogr:minority>3.33</ogr:minority>
<ogr:majority>3.33</ogr:majority>
<ogr:q1>3.33</ogr:q1>
<ogr:q3>44.123456</ogr:q3>
<ogr:iqr>40.793456</ogr:iqr>
</ogr:stats_by_cat_float>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_float fid="stats_by_cat_float.1">
<ogr:name>dd</ogr:name>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>0</ogr:min>
<ogr:max>0</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>0</ogr:sum>
<ogr:mean>0</ogr:mean>
<ogr:median>0</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>0</ogr:minority>
<ogr:majority>0</ogr:majority>
<ogr:q1>0</ogr:q1>
<ogr:q3>0</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_float>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_float fid="stats_by_cat_float.2">
<ogr:name>bb</ogr:name>
<ogr:count>4</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>0.123</ogr:min>
<ogr:max>0.123</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>0.492</ogr:sum>
<ogr:mean>0.123</ogr:mean>
<ogr:median>0.123</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>0.123</ogr:minority>
<ogr:majority>0.123</ogr:majority>
<ogr:q1>0.123</ogr:q1>
<ogr:q3>0.123</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_float>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_float fid="stats_by_cat_float.3">
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>-100291.43213</ogr:min>
<ogr:max>-100291.43213</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>-100291.43213</ogr:sum>
<ogr:mean>-100291.43213</ogr:mean>
<ogr:median>-100291.43213</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>-100291.43213</ogr:minority>
<ogr:majority>-100291.43213</ogr:majority>
<ogr:q1>-100291.43213</ogr:q1>
<ogr:q3>-100291.43213</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_float>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_float fid="stats_by_cat_float.4">
<ogr:name>cc</ogr:name>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>0.123</ogr:min>
<ogr:max>0.123</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>0.123</ogr:sum>
<ogr:mean>0.123</ogr:mean>
<ogr:median>0.123</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>0.123</ogr:minority>
<ogr:majority>0.123</ogr:majority>
<ogr:q1>0.123</ogr:q1>
<ogr:q3>0.123</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_float>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,26 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>stats_by_cat_no_value</Name>
<ElementPath>stats_by_cat_no_value</ElementPath>
<GeometryType>100</GeometryType>
<DatasetSpecificInfo>
<FeatureCount>6</FeatureCount>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>2</Width>
</PropertyDefn>
<PropertyDefn>
<Name>count</Name>
<ElementPath>count</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
<gml:featureMember>
<ogr:stats_by_cat_no_value fid="stats_by_cat_no_value.0">
<ogr:intval>1</ogr:intval>
<ogr:name>aa</ogr:name>
<ogr:count>2</ogr:count>
</ogr:stats_by_cat_no_value>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_no_value fid="stats_by_cat_no_value.1">
<ogr:name>dd</ogr:name>
<ogr:count>2</ogr:count>
</ogr:stats_by_cat_no_value>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_no_value fid="stats_by_cat_no_value.2">
<ogr:intval>1</ogr:intval>
<ogr:name>bb</ogr:name>
<ogr:count>3</ogr:count>
</ogr:stats_by_cat_no_value>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_no_value fid="stats_by_cat_no_value.3">
<ogr:intval>120</ogr:intval>
<ogr:count>1</ogr:count>
</ogr:stats_by_cat_no_value>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_no_value fid="stats_by_cat_no_value.4">
<ogr:name>cc</ogr:name>
<ogr:count>1</ogr:count>
</ogr:stats_by_cat_no_value>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_no_value fid="stats_by_cat_no_value.5">
<ogr:intval>2</ogr:intval>
<ogr:name>bb</ogr:name>
<ogr:count>1</ogr:count>
</ogr:stats_by_cat_no_value>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,62 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>stats_by_cat_string</Name>
<ElementPath>stats_by_cat_string</ElementPath>
<GeometryType>100</GeometryType>
<DatasetSpecificInfo>
<FeatureCount>4</FeatureCount>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>count</Name>
<ElementPath>count</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>unique</Name>
<ElementPath>unique</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>empty</Name>
<ElementPath>empty</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>filled</Name>
<ElementPath>filled</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>min</Name>
<ElementPath>min</ElementPath>
<Type>String</Type>
<Width>2</Width>
</PropertyDefn>
<PropertyDefn>
<Name>max</Name>
<ElementPath>max</ElementPath>
<Type>String</Type>
<Width>2</Width>
</PropertyDefn>
<PropertyDefn>
<Name>min_length</Name>
<ElementPath>min_length</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>max_length</Name>
<ElementPath>max_length</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>mean_length</Name>
<ElementPath>mean_length</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
<gml:featureMember>
<ogr:stats_by_cat_string fid="stats_by_cat_string.0">
<ogr:intval>1</ogr:intval>
<ogr:count>5</ogr:count>
<ogr:unique>2</ogr:unique>
<ogr:empty>0</ogr:empty>
<ogr:filled>5</ogr:filled>
<ogr:min>aa</ogr:min>
<ogr:max>bb</ogr:max>
<ogr:min_length>2</ogr:min_length>
<ogr:max_length>2</ogr:max_length>
<ogr:mean_length>2</ogr:mean_length>
</ogr:stats_by_cat_string>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_string fid="stats_by_cat_string.1">
<ogr:count>3</ogr:count>
<ogr:unique>2</ogr:unique>
<ogr:empty>0</ogr:empty>
<ogr:filled>3</ogr:filled>
<ogr:min>cc</ogr:min>
<ogr:max>dd</ogr:max>
<ogr:min_length>2</ogr:min_length>
<ogr:max_length>2</ogr:max_length>
<ogr:mean_length>2</ogr:mean_length>
</ogr:stats_by_cat_string>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_string fid="stats_by_cat_string.2">
<ogr:intval>120</ogr:intval>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:empty>1</ogr:empty>
<ogr:filled>0</ogr:filled>
<ogr:min></ogr:min>
<ogr:max></ogr:max>
<ogr:min_length>0</ogr:min_length>
<ogr:max_length>0</ogr:max_length>
<ogr:mean_length>0</ogr:mean_length>
</ogr:stats_by_cat_string>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_string fid="stats_by_cat_string.3">
<ogr:intval>2</ogr:intval>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:empty>0</ogr:empty>
<ogr:filled>1</ogr:filled>
<ogr:min>bb</ogr:min>
<ogr:max>bb</ogr:max>
<ogr:min_length>2</ogr:min_length>
<ogr:max_length>2</ogr:max_length>
<ogr:mean_length>2</ogr:mean_length>
</ogr:stats_by_cat_string>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,91 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>stats_by_cat_two_fields</Name>
<ElementPath>stats_by_cat_two_fields</ElementPath>
<GeometryType>100</GeometryType>
<DatasetSpecificInfo>
<FeatureCount>6</FeatureCount>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>2</Width>
</PropertyDefn>
<PropertyDefn>
<Name>count</Name>
<ElementPath>count</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>unique</Name>
<ElementPath>unique</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>min</Name>
<ElementPath>min</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>max</Name>
<ElementPath>max</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>range</Name>
<ElementPath>range</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>sum</Name>
<ElementPath>sum</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>mean</Name>
<ElementPath>mean</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>median</Name>
<ElementPath>median</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>stddev</Name>
<ElementPath>stddev</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>minority</Name>
<ElementPath>minority</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>majority</Name>
<ElementPath>majority</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>q1</Name>
<ElementPath>q1</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>q3</Name>
<ElementPath>q3</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>iqr</Name>
<ElementPath>iqr</ElementPath>
<Type>Real</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
<gml:featureMember>
<ogr:stats_by_cat_two_fields fid="stats_by_cat_two_fields.0">
<ogr:intval>1</ogr:intval>
<ogr:name>aa</ogr:name>
<ogr:count>2</ogr:count>
<ogr:unique>2</ogr:unique>
<ogr:min>3.33</ogr:min>
<ogr:max>44.123456</ogr:max>
<ogr:range>40.793456</ogr:range>
<ogr:sum>47.453456</ogr:sum>
<ogr:mean>23.726728</ogr:mean>
<ogr:median>23.726728</ogr:median>
<ogr:stddev>20.396728</ogr:stddev>
<ogr:minority>3.33</ogr:minority>
<ogr:majority>3.33</ogr:majority>
<ogr:q1>3.33</ogr:q1>
<ogr:q3>44.123456</ogr:q3>
<ogr:iqr>40.793456</ogr:iqr>
</ogr:stats_by_cat_two_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_two_fields fid="stats_by_cat_two_fields.1">
<ogr:name>dd</ogr:name>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>0</ogr:min>
<ogr:max>0</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>0</ogr:sum>
<ogr:mean>0</ogr:mean>
<ogr:median>0</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>0</ogr:minority>
<ogr:majority>0</ogr:majority>
<ogr:q1>0</ogr:q1>
<ogr:q3>0</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_two_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_two_fields fid="stats_by_cat_two_fields.2">
<ogr:intval>1</ogr:intval>
<ogr:name>bb</ogr:name>
<ogr:count>3</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>0.123</ogr:min>
<ogr:max>0.123</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>0.369</ogr:sum>
<ogr:mean>0.123</ogr:mean>
<ogr:median>0.123</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>0.123</ogr:minority>
<ogr:majority>0.123</ogr:majority>
<ogr:q1>0.123</ogr:q1>
<ogr:q3>0.123</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_two_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_two_fields fid="stats_by_cat_two_fields.3">
<ogr:intval>120</ogr:intval>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>-100291.43213</ogr:min>
<ogr:max>-100291.43213</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>-100291.43213</ogr:sum>
<ogr:mean>-100291.43213</ogr:mean>
<ogr:median>-100291.43213</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>-100291.43213</ogr:minority>
<ogr:majority>-100291.43213</ogr:majority>
<ogr:q1>-100291.43213</ogr:q1>
<ogr:q3>-100291.43213</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_two_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_two_fields fid="stats_by_cat_two_fields.4">
<ogr:name>cc</ogr:name>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>0.123</ogr:min>
<ogr:max>0.123</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>0.123</ogr:sum>
<ogr:mean>0.123</ogr:mean>
<ogr:median>0.123</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>0.123</ogr:minority>
<ogr:majority>0.123</ogr:majority>
<ogr:q1>0.123</ogr:q1>
<ogr:q3>0.123</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_two_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_cat_two_fields fid="stats_by_cat_two_fields.5">
<ogr:intval>2</ogr:intval>
<ogr:name>bb</ogr:name>
<ogr:count>1</ogr:count>
<ogr:unique>1</ogr:unique>
<ogr:min>0.123</ogr:min>
<ogr:max>0.123</ogr:max>
<ogr:range>0</ogr:range>
<ogr:sum>0.123</ogr:sum>
<ogr:mean>0.123</ogr:mean>
<ogr:median>0.123</ogr:median>
<ogr:stddev>0</ogr:stddev>
<ogr:minority>0.123</ogr:minority>
<ogr:majority>0.123</ogr:majority>
<ogr:q1>0.123</ogr:q1>
<ogr:q3>0.123</ogr:q3>
<ogr:iqr>0</ogr:iqr>
</ogr:stats_by_cat_two_fields>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -11,6 +11,16 @@
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>count</Name>
<ElementPath>count</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>unique</Name>
<ElementPath>unique</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>min</Name>
<ElementPath>min</ElementPath>
@ -21,24 +31,54 @@
<ElementPath>max</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>range</Name>
<ElementPath>range</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>sum</Name>
<ElementPath>sum</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>mean</Name>
<ElementPath>mean</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>median</Name>
<ElementPath>median</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>stddev</Name>
<ElementPath>stddev</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>sum</Name>
<ElementPath>sum</ElementPath>
<Name>minority</Name>
<ElementPath>minority</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>count</Name>
<ElementPath>count</ElementPath>
<Name>majority</Name>
<ElementPath>majority</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>q1</Name>
<ElementPath>q1</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>q3</Name>
<ElementPath>q3</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>iqr</Name>
<ElementPath>iqr</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>

View File

@ -9,34 +9,58 @@
<gml:featureMember>
<ogr:stats_by_category fid="stats_by_category.0">
<ogr:id2>2</ogr:id2>
<ogr:count>2</ogr:count>
<ogr:unique>2</ogr:unique>
<ogr:min>1</ogr:min>
<ogr:max>4</ogr:max>
<ogr:mean>2.5</ogr:mean>
<ogr:stddev>2.12132034355964</ogr:stddev>
<ogr:range>3</ogr:range>
<ogr:sum>5</ogr:sum>
<ogr:count>2</ogr:count>
<ogr:mean>2.5</ogr:mean>
<ogr:median>2.5</ogr:median>
<ogr:stddev>1.5</ogr:stddev>
<ogr:minority>1</ogr:minority>
<ogr:majority>1</ogr:majority>
<ogr:q1>1</ogr:q1>
<ogr:q3>4</ogr:q3>
<ogr:iqr>3</ogr:iqr>
</ogr:stats_by_category>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_category fid="stats_by_category.1">
<ogr:id2>1</ogr:id2>
<ogr:count>2</ogr:count>
<ogr:unique>2</ogr:unique>
<ogr:min>2</ogr:min>
<ogr:max>5</ogr:max>
<ogr:mean>3.5</ogr:mean>
<ogr:stddev>2.12132034355964</ogr:stddev>
<ogr:range>3</ogr:range>
<ogr:sum>7</ogr:sum>
<ogr:count>2</ogr:count>
<ogr:mean>3.5</ogr:mean>
<ogr:median>3.5</ogr:median>
<ogr:stddev>1.5</ogr:stddev>
<ogr:minority>2</ogr:minority>
<ogr:majority>2</ogr:majority>
<ogr:q1>2</ogr:q1>
<ogr:q3>5</ogr:q3>
<ogr:iqr>3</ogr:iqr>
</ogr:stats_by_category>
</gml:featureMember>
<gml:featureMember>
<ogr:stats_by_category fid="stats_by_category.2">
<ogr:id2>0</ogr:id2>
<ogr:count>5</ogr:count>
<ogr:unique>5</ogr:unique>
<ogr:min>3</ogr:min>
<ogr:max>9</ogr:max>
<ogr:mean>6.6</ogr:mean>
<ogr:stddev>2.30217288664427</ogr:stddev>
<ogr:range>6</ogr:range>
<ogr:sum>33</ogr:sum>
<ogr:count>5</ogr:count>
<ogr:mean>6.6</ogr:mean>
<ogr:median>7</ogr:median>
<ogr:stddev>2.0591260281974</ogr:stddev>
<ogr:minority>3</ogr:minority>
<ogr:majority>3</ogr:majority>
<ogr:q1>6</ogr:q1>
<ogr:q3>8</ogr:q3>
<ogr:iqr>2</ogr:iqr>
</ogr:stats_by_category>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -3476,3 +3476,74 @@ tests:
name: expected/collect_two_fields.gml
type: vector
- algorithm: qgis:statisticsbycategories
name: Stats by cat (float field)
params:
CATEGORIES_FIELD_NAME:
- name
INPUT:
name: dissolve_polys.gml
type: vector
VALUES_FIELD_NAME: floatval
results:
OUTPUT:
name: expected/stats_by_cat_float.gml
type: vector
- algorithm: qgis:statisticsbycategories
name: Stats by cat (string field)
params:
CATEGORIES_FIELD_NAME:
- intval
INPUT:
name: dissolve_polys.gml
type: vector
VALUES_FIELD_NAME: name
results:
OUTPUT:
name: expected/stats_by_cat_string.gml
type: vector
- algorithm: qgis:statisticsbycategories
name: Stats by cat (two category fields)
params:
CATEGORIES_FIELD_NAME:
- intval
- name
INPUT:
name: dissolve_polys.gml
type: vector
VALUES_FIELD_NAME: floatval
results:
OUTPUT:
name: expected/stats_by_cat_two_fields.gml
type: vector
- algorithm: qgis:statisticsbycategories
name: Stats by cat (no value field)
params:
CATEGORIES_FIELD_NAME:
- intval
- name
INPUT:
name: dissolve_polys.gml
type: vector
results:
OUTPUT:
name: expected/stats_by_cat_no_value.gml
type: vector
- algorithm: qgis:statisticsbycategories
name: Stats by cat (date field)
params:
CATEGORIES_FIELD_NAME:
- date
INPUT:
name: custom/datetimes.tab
type: vector
VALUES_FIELD_NAME: date
results:
OUTPUT:
name: expected/stats_by_cat_date.gml
type: vector