@@ -1313,12 +1313,12 @@ bool SingleValueDataString::setIfGreater(const SingleValueDataBase & other, Aren
13131313 return false ;
13141314}
13151315
1316- void SingleValueDataGeneric::insertResultInto (IColumn & to, const DataTypePtr &) const
1316+ void SingleValueDataGeneric::insertResultInto (IColumn & to, const DataTypePtr & type ) const
13171317{
13181318 if (has ())
13191319 to.insert (value);
13201320 else
1321- to. insertDefault ( );
1321+ type-> insertDefaultInto (to );
13221322}
13231323
13241324void SingleValueDataGeneric::write (WriteBuffer & buf, const ISerialization & serialization, const DataTypePtr &) const
@@ -1332,7 +1332,7 @@ void SingleValueDataGeneric::write(WriteBuffer & buf, const ISerialization & ser
13321332 writeBinary (false , buf);
13331333}
13341334
1335- void SingleValueDataGeneric::read (ReadBuffer & buf, const ISerialization & serialization, const DataTypePtr &, Arena *)
1335+ void SingleValueDataGeneric::read (ReadBuffer & buf, const ISerialization & serialization, const DataTypePtr &, Arena *)
13361336{
13371337 bool is_not_null;
13381338 readBinary (is_not_null, buf);
@@ -1349,7 +1349,7 @@ bool SingleValueDataGeneric::isEqualTo(const IColumn & column, size_t row_num) c
13491349bool SingleValueDataGeneric::isEqualTo (const DB::SingleValueDataBase & other) const
13501350{
13511351 auto const & to = assert_cast<const Self &>(other);
1352- return has () && to.value == value;
1352+ return has () && to.has () && to. value == value;
13531353}
13541354
13551355void SingleValueDataGeneric::set (const IColumn & column, size_t row_num, Arena *)
@@ -1371,18 +1371,15 @@ bool SingleValueDataGeneric::setIfSmaller(const IColumn & column, size_t row_num
13711371 set (column, row_num, arena);
13721372 return true ;
13731373 }
1374- else
1374+
1375+ Field new_value;
1376+ column.get (row_num, new_value);
1377+ if (new_value < value)
13751378 {
1376- Field new_value;
1377- column.get (row_num, new_value);
1378- if (new_value < value)
1379- {
1380- value = new_value;
1381- return true ;
1382- }
1383- else
1384- return false ;
1379+ value = new_value;
1380+ return true ;
13851381 }
1382+ return false ;
13861383}
13871384
13881385bool SingleValueDataGeneric::setIfSmaller (const SingleValueDataBase & other, Arena *)
@@ -1393,8 +1390,7 @@ bool SingleValueDataGeneric::setIfSmaller(const SingleValueDataBase & other, Are
13931390 value = to.value ;
13941391 return true ;
13951392 }
1396- else
1397- return false ;
1393+ return false ;
13981394}
13991395
14001396bool SingleValueDataGeneric::setIfGreater (const IColumn & column, size_t row_num, Arena * arena)
@@ -1404,18 +1400,15 @@ bool SingleValueDataGeneric::setIfGreater(const IColumn & column, size_t row_num
14041400 set (column, row_num, arena);
14051401 return true ;
14061402 }
1407- else
1403+
1404+ Field new_value;
1405+ column.get (row_num, new_value);
1406+ if (new_value > value)
14081407 {
1409- Field new_value;
1410- column.get (row_num, new_value);
1411- if (new_value > value)
1412- {
1413- value = new_value;
1414- return true ;
1415- }
1416- else
1417- return false ;
1408+ value = new_value;
1409+ return true ;
14181410 }
1411+ return false ;
14191412}
14201413
14211414bool SingleValueDataGeneric::setIfGreater (const SingleValueDataBase & other, Arena *)
@@ -1426,8 +1419,7 @@ bool SingleValueDataGeneric::setIfGreater(const SingleValueDataBase & other, Are
14261419 value = to.value ;
14271420 return true ;
14281421 }
1429- else
1430- return false ;
1422+ return false ;
14311423}
14321424
14331425void SingleValueDataGenericWithColumn::insertResultInto (IColumn & to, const DataTypePtr & type) const
0 commit comments