Skip to content

Commit

Permalink
Followup 9ba41e9, SQL convention is sum of no records=NULL
Browse files Browse the repository at this point in the history
  • 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.
2 changes: 1 addition & 1 deletion src/core/qgsaggregatecalculator.cpp
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsaggregatecalculator.py
Expand Up @@ -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)
Expand Down

0 comments on commit 235204f

Please sign in to comment.