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 235204fc3dd5e3a32ba6d9f6ed64af3003666956
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/core/qgsaggregatecalculator.cpp
  2. +1 −1 tests/src/python/test_qgsaggregatecalculator.py
@@ -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.
You can’t perform that action at this time.