mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
dbms: removed useless code, fixed error [#METR-10719].
This commit is contained in:
parent
aae61e105b
commit
a4fc77a8cb
@ -204,32 +204,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/** То же самое, но выводит состояние вычислений в строке в текстовом виде.
|
||||
* Используется, если какой-то внешней программе (сейчас это ███████████)
|
||||
* надо получить это состояние и потом использовать по-своему.
|
||||
*/
|
||||
template <typename T, typename Data>
|
||||
class AggregateFunctionUniqState : public AggregateFunctionUniq<T, Data>
|
||||
{
|
||||
public:
|
||||
String getName() const { return Data::getName() + "State"; }
|
||||
|
||||
DataTypePtr getReturnType() const
|
||||
{
|
||||
return new DataTypeString;
|
||||
}
|
||||
|
||||
void insertResultInto(ConstAggregateDataPtr place, IColumn & to) const
|
||||
{
|
||||
String res;
|
||||
{
|
||||
WriteBufferFromString wb(res);
|
||||
this->data(place).set.writeText(wb);
|
||||
}
|
||||
|
||||
static_cast<ColumnString &>(to).insertDataWithTerminatingZero(res.data(), res.size() + 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
@ -205,46 +205,6 @@ AggregateFunctionPtr AggregateFunctionFactory::get(const String & name, const Da
|
||||
else
|
||||
throw Exception("Illegal type " + argument_types[0]->getName() + " of argument for aggregate function " + name, ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
else if (name == "uniqState")
|
||||
{
|
||||
if (argument_types.size() != 1)
|
||||
throw Exception("Incorrect number of arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
const IDataType & argument_type = *argument_types[0];
|
||||
|
||||
AggregateFunctionPtr res = createWithNumericType<AggregateFunctionUniqState, AggregateFunctionUniqUniquesHashSetData>(*argument_types[0]);
|
||||
|
||||
if (res)
|
||||
return res;
|
||||
else if (dynamic_cast<const DataTypeDate *>(&argument_type))
|
||||
return new AggregateFunctionUniqState<DataTypeDate::FieldType, AggregateFunctionUniqUniquesHashSetData>;
|
||||
else if (dynamic_cast<const DataTypeDateTime*>(&argument_type))
|
||||
return new AggregateFunctionUniqState<DataTypeDateTime::FieldType, AggregateFunctionUniqUniquesHashSetData>;
|
||||
else if (dynamic_cast<const DataTypeString*>(&argument_type) || dynamic_cast<const DataTypeFixedString*>(&argument_type))
|
||||
return new AggregateFunctionUniqState<String, AggregateFunctionUniqUniquesHashSetData>;
|
||||
else
|
||||
throw Exception("Illegal type " + argument_types[0]->getName() + " of argument for aggregate function " + name, ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
else if (name == "uniqHLL12State")
|
||||
{
|
||||
if (argument_types.size() != 1)
|
||||
throw Exception("Incorrect number of arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
const IDataType & argument_type = *argument_types[0];
|
||||
|
||||
AggregateFunctionPtr res = createWithNumericType<AggregateFunctionUniqState, AggregateFunctionUniqHLL12Data>(*argument_types[0]);
|
||||
|
||||
if (res)
|
||||
return res;
|
||||
else if (dynamic_cast<const DataTypeDate *>(&argument_type))
|
||||
return new AggregateFunctionUniqState<DataTypeDate::FieldType, AggregateFunctionUniqHLL12Data>;
|
||||
else if (dynamic_cast<const DataTypeDateTime*>(&argument_type))
|
||||
return new AggregateFunctionUniqState<DataTypeDateTime::FieldType, AggregateFunctionUniqHLL12Data>;
|
||||
else if (dynamic_cast<const DataTypeString*>(&argument_type) || dynamic_cast<const DataTypeFixedString*>(&argument_type))
|
||||
return new AggregateFunctionUniqState<String, AggregateFunctionUniqHLL12Data>;
|
||||
else
|
||||
throw Exception("Illegal type " + argument_types[0]->getName() + " of argument for aggregate function " + name, ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
else if (name == "median" || name == "quantile")
|
||||
{
|
||||
if (argument_types.size() != 1)
|
||||
@ -364,9 +324,7 @@ bool AggregateFunctionFactory::isAggregateFunctionName(const String & name, int
|
||||
"sum",
|
||||
"avg",
|
||||
"uniq",
|
||||
"uniqState",
|
||||
"uniqHLL12",
|
||||
"uniqHLL12State",
|
||||
"uniqExact",
|
||||
"groupArray",
|
||||
"groupUniqArray",
|
||||
|
@ -82,8 +82,6 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "replaceRegexpOne") return new FunctionReplaceRegexpOne;
|
||||
else if (name == "replaceRegexpAll") return new FunctionReplaceRegexpAll;
|
||||
else if (name == "substringUTF8") return new FunctionSubstringUTF8;
|
||||
else if (name == "bitmaskToList") return new FunctionBitmaskToList;
|
||||
else if (name == "bitmaskToArray") return new FunctionBitmaskToArray;
|
||||
|
||||
else if (name == "toUInt8") return new FunctionToUInt8;
|
||||
else if (name == "toUInt16") return new FunctionToUInt16;
|
||||
@ -99,6 +97,7 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "toDateTime") return new FunctionToDateTime;
|
||||
else if (name == "toString") return new FunctionToString;
|
||||
else if (name == "toFixedString") return new FunctionToFixedString;
|
||||
else if (name == "toStringCutToZero") return new FunctionToStringCutToZero;
|
||||
|
||||
else if (name == "reinterpretAsUInt8") return new FunctionReinterpretAsUInt8;
|
||||
else if (name == "reinterpretAsUInt16") return new FunctionReinterpretAsUInt16;
|
||||
@ -157,7 +156,8 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "IPv4StringToNum") return new FunctionIPv4StringToNum;
|
||||
else if (name == "hex") return new FunctionHex;
|
||||
else if (name == "unhex") return new FunctionUnhex;
|
||||
else if (name == "toStringCutToZero") return new FunctionToStringCutToZero;
|
||||
else if (name == "bitmaskToList") return new FunctionBitmaskToList;
|
||||
else if (name == "bitmaskToArray") return new FunctionBitmaskToArray;
|
||||
|
||||
else if (name == "rand") return new FunctionRand;
|
||||
else if (name == "rand64") return new FunctionRand64;
|
||||
@ -170,16 +170,16 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "queryString") return new FunctionQueryString;
|
||||
else if (name == "fragment") return new FunctionFragment;
|
||||
else if (name == "queryStringAndFragment") return new FunctionQueryStringAndFragment;
|
||||
else if (name == "extractURLParameter") return new FunctionExtractURLParameter;
|
||||
else if (name == "extractURLParameters") return new FunctionExtractURLParameters;
|
||||
else if (name == "extractURLParameterNames") return new FunctionExtractURLParameterNames;
|
||||
else if (name == "URLHierarchy") return new FunctionURLHierarchy;
|
||||
else if (name == "URLPathHierarchy") return new FunctionURLPathHierarchy;
|
||||
else if (name == "cutWWW") return new FunctionCutWWW;
|
||||
else if (name == "cutQueryString") return new FunctionCutQueryString;
|
||||
else if (name == "cutFragment") return new FunctionCutFragment;
|
||||
else if (name == "cutQueryStringAndFragment") return new FunctionCutQueryStringAndFragment;
|
||||
else if (name == "extractURLParameter") return new FunctionExtractURLParameter;
|
||||
else if (name == "extractURLParameters") return new FunctionExtractURLParameters;
|
||||
else if (name == "extractURLParameterNames") return new FunctionExtractURLParameterNames;
|
||||
else if (name == "cutURLParameter") return new FunctionCutURLParameter;
|
||||
else if (name == "URLHierarchy") return new FunctionURLHierarchy;
|
||||
else if (name == "URLPathHierarchy") return new FunctionURLPathHierarchy;
|
||||
|
||||
else if (name == "hostName") return new FunctionHostName;
|
||||
else if (name == "visibleWidth") return new FunctionVisibleWidth;
|
||||
|
@ -28,7 +28,7 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
void HTTPHandler::processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response, String query_id)
|
||||
void HTTPHandler::processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response)
|
||||
{
|
||||
LOG_TRACE(log, "Request URI: " << request.getURI());
|
||||
|
||||
@ -68,6 +68,7 @@ void HTTPHandler::processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net
|
||||
}
|
||||
|
||||
std::string quota_key = params.get("quota_key", "");
|
||||
std::string query_id = params.get("query_id", "");
|
||||
|
||||
Context context = *server.global_context;
|
||||
context.setGlobalContext(*server.global_context);
|
||||
@ -124,7 +125,9 @@ void HTTPHandler::processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net
|
||||
|| it->first == "compress"
|
||||
|| it->first == "decompress"
|
||||
|| it->first == "user"
|
||||
|| it->first == "password")
|
||||
|| it->first == "password"
|
||||
|| it->first == "quota_key"
|
||||
|| it->first == "query_id")
|
||||
{
|
||||
}
|
||||
else /// Все неизвестные параметры запроса рассматриваются, как настройки.
|
||||
|
@ -23,7 +23,7 @@ private:
|
||||
|
||||
Logger * log;
|
||||
|
||||
void processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response, String query_id = "");
|
||||
void processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response);
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user