Skip to content
Permalink
Browse files
Followup 9ba41e9, SQL convention is sum of no records=NULL
  • Loading branch information
nyalldawson committed Aug 29, 2016
1 parent 7300cda commit 235204f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
@@ -506,13 +506,13 @@ QVariant QgsAggregateCalculator::defaultValue( QgsAggregateCalculator::Aggregate
case Count:
case CountDistinct:
case CountMissing:
case Sum:
return 0;

case StringConcatenate:
return ""; // zero length string - not null!

// undefined - nothing makes sense here
case Sum:
case Min:
case Max:
case Mean:
@@ -396,7 +396,7 @@ def testExpressionNoMatch(self):
agg = QgsAggregateCalculator(layer)
val, ok = agg.calculate(QgsAggregateCalculator.Sum, 'fldint * 2')
self.assertTrue(ok)
self.assertEqual(val, 0)
self.assertEqual(val, None)

# count
agg = QgsAggregateCalculator(layer)

0 comments on commit 235204f

Please sign in to comment.