* Revert "Simplification [#CLICKHOUSE-2]."

This reverts commit 98ad6a5db3.

* Fix error: comparison of unsigned expression < 0 is always false

* Fix float division by zero

* Fix float division by zero

* Disable PointInPolygon function if compiling with old clang

* Fix warning:
dbms/src/Functions/FunctionsCoding.h:336:21: error: comparison of constant -1 with expression of type 'const char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
            if (num != -1)

* Fix
This commit is contained in:
proller 2017-09-26 23:29:34 +03:00 committed by alexey-milovidov
parent 6e57272052
commit 5250650f65
5 changed files with 24 additions and 7 deletions

View File

@ -124,12 +124,15 @@ void ColumnGathererStream::readSuffixImpl()
return;
double seconds = profile_info.total_stopwatch.elapsedSeconds();
std::stringstream speed;
if (seconds)
speed << ", " << profile_info.rows / seconds << " rows/sec., "
<< profile_info.bytes / 1048576.0 / seconds << " MiB/sec.";
LOG_TRACE(log, std::fixed << std::setprecision(2)
<< "Gathered column " << name
<< " (" << static_cast<double>(profile_info.bytes) / profile_info.rows << " bytes/elem.)"
<< " in " << seconds << " sec., "
<< profile_info.rows / seconds << " rows/sec., "
<< profile_info.bytes / 1048576.0 / seconds << " MiB/sec.");
<< " in " << seconds << " sec."
<< speed.str());
}
}

View File

@ -333,7 +333,7 @@ public:
{
const auto num = unhex(ch);
if (num != -1)
if (num != '\xff')
{
val <<= 4;
val |= num;

View File

@ -31,6 +31,7 @@ namespace ErrorCodes
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
}
#if USE_POINT_IN_POLYGON
namespace FunctionPointInPolygonDetail
{
@ -271,16 +272,18 @@ template <>
const char * FunctionPointInPolygon<PointInPolygonFranklin>::name = "pointInPolygonFranklin";
template <>
const char * FunctionPointInPolygon<PointInPolygonWithGrid, true>::name = "pointInPolygon";
#endif
void registerFunctionsGeo(FunctionFactory & factory)
{
factory.registerFunction<FunctionGreatCircleDistance>();
factory.registerFunction<FunctionPointInEllipses>();
#if USE_POINT_IN_POLYGON
factory.registerFunction<FunctionPointInPolygon<PointInPolygonFranklin>>();
factory.registerFunction<FunctionPointInPolygon<PointInPolygonWinding>>();
factory.registerFunction<FunctionPointInPolygon<PointInPolygonCrossing>>();
factory.registerFunction<FunctionPointInPolygon<PointInPolygonWithGrid, true>>();
#endif
}
}

View File

@ -19,6 +19,11 @@
#pragma GCC diagnostic pop
#endif
#if __clang__ && __clang_major__ <= 4
#else
#define USE_POINT_IN_POLYGON 1
#endif
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
@ -78,6 +83,7 @@ UInt64 getMultiPolygonAllocatedBytes(const MultiPolygon & multi_polygon)
return size;
}
#if USE_POINT_IN_POLYGON
template <typename CoordinateType = Float32>
class PointInPolygonWithGrid
{
@ -577,6 +583,8 @@ ColumnPtr pointInPolygon(const IColumn & x, const IColumn & y, PointInPolygonImp
return Impl::call(x, y, impl);
}
#endif
/// Total angle (signed) between neighbor vectors in linestring. Zero if linestring.size() < 2.
template <typename Linestring>
float calcLinestringRotation(const Linestring & points)

View File

@ -43,11 +43,14 @@ int __gai_sigqueue(int sig, const union sigval val, pid_t caller_pid)
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)
long int __fdelt_chk(long int d)
{
if (d < 0)
abort();
#else
unsigned long int __fdelt_chk(unsigned long int d)
#endif
{
if (d < 0 || d >= FD_SETSIZE)
#endif
if (d >= FD_SETSIZE)
abort();
return d / __NFDBITS;
}