translate comments: etc

This commit is contained in:
f1yegor 2017-05-28 16:32:59 +02:00
parent b3e0533860
commit 0bf5182020
4 changed files with 49 additions and 49 deletions

View File

@ -216,7 +216,7 @@ struct StdDevPopImpl
} }
/** If `compute_marginal_moments` flag is set this class provides the heir /** If `compute_marginal_moments` flag is set this class provides the successor
* CovarianceData support of marginal moments for calculating the correlation. * CovarianceData support of marginal moments for calculating the correlation.
*/ */
template<bool compute_marginal_moments> template<bool compute_marginal_moments>

View File

@ -195,7 +195,7 @@ protected:
QuotaForIntervals * quota = nullptr; /// If nullptr - the quota is not used. QuotaForIntervals * quota = nullptr; /// If nullptr - the quota is not used.
double prev_elapsed = 0; double prev_elapsed = 0;
/// The heirs must implement this function. /// The successors must implement this function.
virtual Block readImpl() = 0; virtual Block readImpl() = 0;
/// Here you can do a preliminary initialization. /// Here you can do a preliminary initialization.

View File

@ -24,29 +24,29 @@ namespace ErrorCodes
struct ExpressionAction; struct ExpressionAction;
/** Интерфейс для обычных функций. /** Interface for normal functions.
* Обычные функции - это функции, которые не меняют количество строк в таблице, * Normal functions are functions that do not change the number of rows in the table,
* и результат работы которых для каждой строчки не зависит от других строк. * and the result of which for each row does not depend on other rows.
* *
* Функция может принимать произвольное количество аргументов; возвращает ровно одно значение. * A function can take an arbitrary number of arguments; returns exactly one value.
* Тип результата зависит от типов и количества аргументов. * The type of the result depends on the type and number of arguments.
* *
* Функция диспетчеризуется для целого блока. Это позволяет производить всевозможные проверки редко, * The function is dispatched for the whole block. This allows you to perform all kinds of checks rarely,
* и делать основную работу в виде эффективного цикла. * and do the main job as an efficient loop.
* *
* Функция применяется к одному или нескольким столбцам блока, и записывает свой результат, * The function is applied to one or more columns of the block, and writes its result,
* добавляя новый столбец к блоку. Функция не модифицирует свои агрументы. * adding a new column to the block. The function does not modify its arguments.
*/ */
class IFunction class IFunction
{ {
public: public:
/** Наследник IFunction должен реализовать: /** The successor of IFunction must implement:
* - getName * - getName
* - либо getReturnType, либо getReturnTypeAndPrerequisites * - either getReturnType, or getReturnTypeAndPrerequisites
* - одну из перегрузок execute. * - one of the overloads of `execute`.
*/ */
/// Получить основное имя функции. /// Get the main function name.
virtual String getName() const = 0; virtual String getName() const = 0;
/// Override and return true if function could take different number of arguments. /// Override and return true if function could take different number of arguments.
@ -97,8 +97,8 @@ public:
*/ */
virtual bool isDeterministicInScopeOfQuery() { return true; } virtual bool isDeterministicInScopeOfQuery() { return true; }
/// Получить тип результата по типам аргументов. Если функция неприменима для данных аргументов - кинуть исключение. /// Get the result type by argument type. If the function does not apply to these arguments, throw an exception.
/// Перегрузка для тех, кому не нужны prerequisites и значения константных аргументов. Снаружи не вызывается. /// Overloading for those who do not need prerequisites and values of constant arguments. Not called from outside.
DataTypePtr getReturnType(const DataTypes & arguments) const; DataTypePtr getReturnType(const DataTypes & arguments) const;
virtual DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const virtual DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const
@ -106,11 +106,11 @@ public:
throw Exception("getReturnType is not implemented for " + getName(), ErrorCodes::NOT_IMPLEMENTED); throw Exception("getReturnType is not implemented for " + getName(), ErrorCodes::NOT_IMPLEMENTED);
} }
/** Получить тип результата по типам аргументов и значениям константных аргументов. /** Get the result type by argument types and constant argument values.
* Если функция неприменима для данных аргументов - кинуть исключение. * If the function does not apply to these arguments, throw an exception.
* Еще можно вернуть описание дополнительных столбцов, которые требуются для выполнения функции. * You can also return a description of the additional columns that are required to perform the function.
* Для неконстантных столбцов arguments[i].column = nullptr. * For non-constant columns `arguments[i].column = nullptr`.
* Осмысленные типы элементов в out_prerequisites: APPLY_FUNCTION, ADD_COLUMN. * Meaningful element types in out_prerequisites: APPLY_FUNCTION, ADD_COLUMN.
*/ */
void getReturnTypeAndPrerequisites( void getReturnTypeAndPrerequisites(
const ColumnsWithTypeAndName & arguments, const ColumnsWithTypeAndName & arguments,
@ -138,12 +138,12 @@ public:
throw Exception("Function " + getName() + " can't have lambda-expressions as arguments", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); throw Exception("Function " + getName() + " can't have lambda-expressions as arguments", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
} }
/// Выполнить функцию над блоком. Замечание: может вызываться одновременно из нескольких потоков, для одного объекта. /// Execute the function on the block. Note: can be called simultaneously from several threads, for one object.
/// Перегрузка для тех, кому не нужны prerequisites. Снаружи не вызывается. /// Overloading for those who do not need `prerequisites`. Not called from outside.
void execute(Block & block, const ColumnNumbers & arguments, size_t result); void execute(Block & block, const ColumnNumbers & arguments, size_t result);
/// Выполнить функцию над блоком. Замечание: может вызываться одновременно из нескольких потоков, для одного объекта. /// Execute the function above the block. Note: can be called simultaneously from several threads, for one object.
/// prerequisites идут в том же порядке, что и out_prerequisites, полученные из getReturnTypeAndPrerequisites. /// `prerequisites` go in the same order as `out_prerequisites` obtained from getReturnTypeAndPrerequisites.
void execute(Block & block, const ColumnNumbers & arguments, const ColumnNumbers & prerequisites, size_t result); void execute(Block & block, const ColumnNumbers & arguments, const ColumnNumbers & prerequisites, size_t result);
virtual void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) virtual void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result)
@ -160,25 +160,25 @@ public:
/// that correspond to nullable columns and null columns. /// that correspond to nullable columns and null columns.
virtual bool hasSpecialSupportForNulls() const { return false; } virtual bool hasSpecialSupportForNulls() const { return false; }
/** Позволяет узнать, является ли функция монотонной в некотором диапазоне значений. /** Lets you know if the function is monotonic in a range of values.
* Это используется для работы с индексом в сортированном куске данных. * This is used to work with the index in a sorted chunk of data.
* И позволяет использовать индекс не только, когда написано, например date >= const, но и, например, toMonth(date) >= 11. * And allows to use the index not only when it is written, for example `date >= const`, but also, for example, `toMonth(date) >= 11`.
* Всё это рассматривается только для функций одного аргумента. * All this is considered only for functions of one argument.
*/ */
virtual bool hasInformationAboutMonotonicity() const { return false; } virtual bool hasInformationAboutMonotonicity() const { return false; }
/// Свойство монотонности на некотором диапазоне. /// The property of monotonicity for a certain range.
struct Monotonicity struct Monotonicity
{ {
bool is_monotonic = false; /// Является ли функция монотонной (неубывающей или невозрастающей). bool is_monotonic = false; /// Is the function monotonous (nondecreasing or nonincreasing).
bool is_positive = true; /// true, если функция неубывающая, false, если невозрастающая. Если is_monotonic = false, то не важно. bool is_positive = true; /// true if the function is nondecreasing, false, if notincreasing. If is_monotonic = false, then it does not matter.
Monotonicity(bool is_monotonic_ = false, bool is_positive_ = true) Monotonicity(bool is_monotonic_ = false, bool is_positive_ = true)
: is_monotonic(is_monotonic_), is_positive(is_positive_) {} : is_monotonic(is_monotonic_), is_positive(is_positive_) {}
}; };
/** Получить информацию о монотонности на отрезке значений. Вызывайте только если hasInformationAboutMonotonicity. /** Get information about monotonicity on a range of values. Call only if hasInformationAboutMonotonicity.
* В качестве одного из аргументов может быть передан NULL. Это значит, что соответствующий диапазон неограничен слева или справа. * NULL can be passed as one of the arguments. This means that the corresponding range is unlimited on the left or on the right.
*/ */
virtual Monotonicity getMonotonicityForRange(const IDataType & type, const Field & left, const Field & right) const virtual Monotonicity getMonotonicityForRange(const IDataType & type, const Field & left, const Field & right) const
{ {

View File

@ -18,8 +18,8 @@
namespace DB namespace DB
{ {
/** Позволяет получить тип результата применения функций +, -, *, /, %, div (целочисленное деление). /** Allows get the result type of the functions +, -, *, /, %, div (integer division).
* Правила отличаются от используемых в C++. * The rules are different from those used in C++.
*/ */
namespace NumberTraits namespace NumberTraits
@ -162,11 +162,11 @@ struct UpdateNullity
>::Type; >::Type;
}; };
/** Результат сложения или умножения вычисляется по следующим правилам: /** The result of addition or multiplication is calculated according to the following rules:
* - если один из аргументов с плавающей запятой, то результат - с плавающей запятой, иначе - целый; * - if one of the arguments is floating-point, the result is a floating point, otherwise - the whole;
* - если одно из аргументов со знаком, то результат - со знаком, иначе - без знака; * - if one of the arguments is signed, the result is signed, otherwise it is unsigned;
* - результат содержит больше бит (не только значащих), чем максимум в аргументах * - the result contains more bits (not only meaningful) than the maximum in the arguments
* (например, UInt8 + Int32 = Int64). * (for example, UInt8 + Int32 = Int64).
*/ */
template <typename A, typename B> struct ResultOfAdditionMultiplication template <typename A, typename B> struct ResultOfAdditionMultiplication
{ {
@ -186,14 +186,14 @@ template <typename A, typename B> struct ResultOfSubtraction
typename boost::mpl::or_<typename Traits<A>::Nullity, typename Traits<B>::Nullity>::type>::Type Type; typename boost::mpl::or_<typename Traits<A>::Nullity, typename Traits<B>::Nullity>::type>::Type Type;
}; };
/** При делении всегда получается число с плавающей запятой. /** When dividing, you always get a floating-point number.
*/ */
template <typename A, typename B> struct ResultOfFloatingPointDivision template <typename A, typename B> struct ResultOfFloatingPointDivision
{ {
using Type = Float64; using Type = Float64;
}; };
/** При целочисленном делении получается число, битность которого равна делимому. /** For integer division, we get a number with the same number of bits as in divisible.
*/ */
template <typename A, typename B> struct ResultOfIntegerDivision template <typename A, typename B> struct ResultOfIntegerDivision
{ {
@ -204,7 +204,7 @@ template <typename A, typename B> struct ResultOfIntegerDivision
typename boost::mpl::or_<typename Traits<A>::Nullity, typename Traits<B>::Nullity>::type>::Type Type; typename boost::mpl::or_<typename Traits<A>::Nullity, typename Traits<B>::Nullity>::type>::Type Type;
}; };
/** При взятии остатка получается число, битность которого равна делителю. /** Division with remainder you get a number with the same number of bits as in divisor.
*/ */
template <typename A, typename B> struct ResultOfModulo template <typename A, typename B> struct ResultOfModulo
{ {
@ -236,7 +236,7 @@ template <typename A> struct ResultOfAbs
typename Traits<A>::Nullity>::Type Type; typename Traits<A>::Nullity>::Type Type;
}; };
/** При побитовых операциях получается целое число, битность которого равна максимальной из битностей аргументов. /** For bitwise operations, an integer is obtained with number of bits is equal to the maximum of the arguments.
*/ */
template <typename A, typename B> struct ResultOfBit template <typename A, typename B> struct ResultOfBit
{ {
@ -265,7 +265,7 @@ template <typename A> struct ResultOfBitNot
}; };
/** Приведение типов для функции if: /** Type casting for `if` function:
* 1) void, Type -> Type * 1) void, Type -> Type
* 2) UInt<x>, UInt<y> -> UInt<max(x,y)> * 2) UInt<x>, UInt<y> -> UInt<max(x,y)>
* 3) Int<x>, Int<y> -> Int<max(x,y)> * 3) Int<x>, Int<y> -> Int<max(x,y)>
@ -294,7 +294,7 @@ struct ResultOfIf
typename Construct< typename Construct<
Signed, Signed,
Floating, Floating,
typename boost::mpl::max< /// Этот максимум нужен только потому что if_ всегда вычисляет все аргументы. typename boost::mpl::max< /// This maximum is needed only because `if_` always evaluates all arguments.
typename boost::mpl::max< typename boost::mpl::max<
typename boost::mpl::if_< typename boost::mpl::if_<
typename Traits<A>::Floatness, typename Traits<A>::Floatness,
@ -334,7 +334,7 @@ struct ResultOfIf
>::Type>::type>::type>::type>::type Type; >::Type>::type>::type>::type>::type Type;
}; };
/** Перед применением оператора % и побитовых операций, операнды приводятся к целым числам. */ /** Before applying operator `%` and bitwise operations, operands are casted to whole numbers. */
template <typename A> struct ToInteger template <typename A> struct ToInteger
{ {
typedef typename Construct< typedef typename Construct<