| 64 | |
| 65 | template <typename LonAndLatType, typename PrecisionType> |
| 66 | void execute( |
| 67 | const IColumn * lon_min_column, |
| 68 | const IColumn * lat_min_column, |
| 69 | const IColumn * lon_max_column, |
| 70 | const IColumn * lat_max_column, |
| 71 | const IColumn * precision_column, |
| 72 | ColumnPtr & result, |
| 73 | size_t input_rows_count) const |
| 74 | { |
| 75 | static constexpr size_t max_array_size = 10'000'000; |
| 76 | |
| 77 | const auto * lon_min_const = typeid_cast<const ColumnConst *>(lon_min_column); |
| 78 | const auto * lat_min_const = typeid_cast<const ColumnConst *>(lat_min_column); |
| 79 | const auto * lon_max_const = typeid_cast<const ColumnConst *>(lon_max_column); |
| 80 | const auto * lat_max_const = typeid_cast<const ColumnConst *>(lat_max_column); |
| 81 | const auto * precision_const = typeid_cast<const ColumnConst *>(precision_column); |
| 82 | |
| 83 | if (lon_min_const) |
| 84 | lon_min_column = &lon_min_const->getDataColumn(); |
| 85 | if (lat_min_const) |
| 86 | lat_min_column = &lat_min_const->getDataColumn(); |
| 87 | if (lon_max_const) |
| 88 | lon_max_column = &lon_max_const->getDataColumn(); |
| 89 | if (lat_max_const) |
| 90 | lat_max_column = &lat_max_const->getDataColumn(); |
| 91 | if (precision_const) |
| 92 | precision_column = &precision_const->getDataColumn(); |
| 93 | |
| 94 | const auto * lon_min = checkAndGetColumn<ColumnVector<LonAndLatType>>(lon_min_column); |
| 95 | const auto * lat_min = checkAndGetColumn<ColumnVector<LonAndLatType>>(lat_min_column); |
| 96 | const auto * lon_max = checkAndGetColumn<ColumnVector<LonAndLatType>>(lon_max_column); |
| 97 | const auto * lat_max = checkAndGetColumn<ColumnVector<LonAndLatType>>(lat_max_column); |
| 98 | const auto * precision = checkAndGetColumn<ColumnVector<PrecisionType>>(precision_column); |
| 99 | |
| 100 | if (!lon_min || !lat_min || !lon_max || !lat_max || !precision) |
| 101 | { |
| 102 | throw Exception(ErrorCodes::LOGICAL_ERROR, "Unsupported argument types for function {} : {}, {}, {}, {}.", |
| 103 | getName(), lon_min_column->getName(), |
| 104 | lat_min_column->getName(), lon_max_column->getName(), lat_max_column->getName()); |
| 105 | } |
| 106 | |
| 107 | auto col_res = ColumnArray::create(ColumnString::create()); |
| 108 | ColumnString & res_strings = typeid_cast<ColumnString &>(col_res->getData()); |
| 109 | ColumnArray::Offsets & res_offsets = col_res->getOffsets(); |
| 110 | ColumnString::Chars & res_strings_chars = res_strings.getChars(); |
| 111 | ColumnString::Offsets & res_strings_offsets = res_strings.getOffsets(); |
| 112 | |
| 113 | for (size_t row = 0; row < input_rows_count; ++row) |
| 114 | { |
| 115 | const LonAndLatType lon_min_value = lon_min->getElement(lon_min_const ? 0 : row); |
| 116 | const LonAndLatType lat_min_value = lat_min->getElement(lat_min_const ? 0 : row); |
| 117 | const LonAndLatType lon_max_value = lon_max->getElement(lon_max_const ? 0 : row); |
| 118 | const LonAndLatType lat_max_value = lat_max->getElement(lat_max_const ? 0 : row); |
| 119 | const PrecisionType precision_value = precision->getElement(precision_const ? 0 : row); |
| 120 | |
| 121 | const auto prepared_args = geohashesInBoxPrepare( |
| 122 | static_cast<Float64>(lon_min_value), static_cast<Float64>(lat_min_value), |
| 123 | static_cast<Float64>(lon_max_value), static_cast<Float64>(lat_max_value), |
nothing calls this directly
no test coverage detected