diff options
author | robot-piglet <[email protected]> | 2025-02-26 19:56:03 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2025-02-26 20:08:35 +0300 |
commit | f9a1896b7299c05b3275949378e221e044872d6f (patch) | |
tree | 6953ef34b963d665a2130771efa7e5d9dcb785ec /yql/essentials/docs/en | |
parent | 5a3aa70af58a490cada682b229eef368bd42340c (diff) |
Intermediate changes
commit_hash:17a903d36007950139a4f3a7676d0c6190090981
Diffstat (limited to 'yql/essentials/docs/en')
31 files changed, 293 insertions, 293 deletions
diff --git a/yql/essentials/docs/en/builtins/aggregation.md b/yql/essentials/docs/en/builtins/aggregation.md index 96a395d61da..0c881f23095 100644 --- a/yql/essentials/docs/en/builtins/aggregation.md +++ b/yql/essentials/docs/en/builtins/aggregation.md @@ -6,7 +6,7 @@ Counting the number of rows in the table (if `*` or constant is specified as the Like other aggregate functions, it can be combined with [GROUP BY](../syntax/group_by.md) to get statistics on the parts of the table that correspond to the values in the columns being grouped. Use the modifier [DISTINCT](../syntax/group_by.md#distinct) to count distinct values. -### Examples +#### Examples ```yql SELECT COUNT(*) FROM my_table; @@ -26,7 +26,7 @@ Minimum or maximum value. As an argument, you may use an arbitrary computable expression with a numeric result. -### Examples +#### Examples ```yql SELECT MIN(value), MAX(value) FROM my_table; @@ -52,7 +52,7 @@ As an argument, you may use an arbitrary computable expression with a numeric re Integer values and time intervals are automatically converted to Double. -### Examples +#### Examples ```yql SELECT AVG(value) FROM my_table; @@ -66,7 +66,7 @@ The value `NULL` is equated to `false` (if the argument type is `Bool?`). The function *does not* do the implicit type casting to Boolean for strings and numbers. -### Examples +#### Examples ```yql SELECT @@ -85,7 +85,7 @@ Sum or arithmetic average, but only for the rows that satisfy the condition pass Therefore, `SUM_IF(value, condition)` is a slightly shorter notation for `SUM(IF(condition, value))`, same for `AVG`. The argument's data type expansion is similar to the same-name functions without a suffix. -### Examples +#### Examples ```yql SELECT @@ -112,7 +112,7 @@ Get the value for an expression specified as an argument, for one of the table r Because of no guarantee, `SOME` is computationally cheaper than [MIN / MAX](#min-max) often used in similar situations. -### Examples +#### Examples ```yql SELECT @@ -141,7 +141,7 @@ By selecting accuracy, you can trade added resource and RAM consumption for decr All the three functions are aliases at the moment, but `CountDistinctEstimate` may start using a different algorithm in the future. -### Examples +#### Examples ```yql SELECT @@ -169,7 +169,7 @@ To return a list of multiple values from one line, **DO NOT** use the `AGGREGATE For example, you can combine it with `DISTINCT` and the function [String::JoinFromList](../udf/list/string.md) (it's an equivalent of `','.join(list)` in Python) to output to a string all the values found in the column after [GROUP BY](../syntax/group_by.md). -### Examples +#### Examples ```yql SELECT @@ -219,7 +219,7 @@ If the second argument is always `NULL`, the aggregation result is `NULL`. When you use [aggregation factories](basic.md#aggregationfactory), a `Tuple` containing a value and a key is passed as the first [AGGREGATE_BY](#aggregate-by) argument. -### Examples +#### Examples ```yql SELECT @@ -244,7 +244,7 @@ FROM my_table; Return a list of the maximum/minimum values of an expression. The first argument is an expression, the second argument limits the number of items. -### Examples +#### Examples ```yql SELECT @@ -269,7 +269,7 @@ Return a list of values of the first argument for the rows containing the maximu When you use [aggregation factories](basic.md#aggregationfactory), a `Tuple` containing a value and a key is passed as the first [AGGREGATE_BY](#aggregate-by) argument. In this case, the limit for the number of items is passed by the second argument at factory creation. -### Examples +#### Examples ```yql SELECT @@ -304,7 +304,7 @@ Optional arguments: 1. For `TOPFREQ`, the desired number of items in the result. `MODE` is an alias to `TOPFREQ` with this argument set to 1. For `TOPFREQ`, this argument is also 1 by default. 2. The number of items in the buffer used: lets you trade memory consumption for accuracy. Default: 100. -### Examples +#### Examples ```yql SELECT @@ -328,7 +328,7 @@ Several abbreviated aliases are also defined, for example, `VARPOP` or `STDDEVSA If all the values passed are `NULL`, it returns `NULL`. -### Examples +#### Examples ```yql SELECT @@ -349,7 +349,7 @@ Unlike most other aggregate functions, they don't skip `NULL`, but accept it as When you use [aggregation factories](basic.md#aggregationfactory), a `Tuple` containing two values is passed as the first [AGGREGATE_BY](#aggregate-by) argument. -### Examples +#### Examples ```yql SELECT @@ -458,7 +458,7 @@ While FastGreedyShrink is used most of the time, SlowShrink is mostly used for h When you use [aggregation factories](basic.md#aggregationfactory), a `Tuple` containing a value and a weight is passed as the first [AGGREGATE_BY](#aggregate-by) argument. -### Examples +#### Examples ```yql SELECT @@ -498,7 +498,7 @@ The format of the result is totally similar to [adaptive histograms](#histogram) If the spread of input values is uncontrollably large, we recommend that you specify the minimum and maximum values to prevent potential failures due to high memory consumption. -### Examples +#### Examples ```yql SELECT @@ -510,7 +510,7 @@ FROM my_table; ## BOOL_AND, BOOL_OR and BOOL_XOR {#bool-and-or-xor} -### Signature +#### Signature ```yql BOOL_AND(Bool?)->Bool? @@ -543,7 +543,7 @@ Examples of such behavior can be found below. To skip `NULL` values during aggregation, use the `MIN`/`MAX` or `BIT_AND`/`BIT_OR`/`BIT_XOR` functions. -### Examples +#### Examples ```yql $data = [ @@ -572,7 +572,7 @@ FROM AS_TABLE($data); Apply the relevant bitwise operation to all values of a numeric column or expression. -### Examples +#### Examples ```yql SELECT @@ -594,7 +594,7 @@ Applying an [aggregation factory](basic.md#aggregationfactory) to all values of 1. Column, `DISTINCT` column or expression. 2. Factory. -### Examples +#### Examples ```yql $count_factory = AggregationFactory("COUNT"); diff --git a/yql/essentials/docs/en/builtins/basic.md b/yql/essentials/docs/en/builtins/basic.md index 4e74b6d5def..e14a6de065a 100644 --- a/yql/essentials/docs/en/builtins/basic.md +++ b/yql/essentials/docs/en/builtins/basic.md @@ -13,7 +13,7 @@ Lets you pass potentially empty values to functions that can't handle them by th A short format using the low-priority `??` operator is available (lower than the Boolean operations). You can use the `NVL` alias. -### Examples +#### Examples ```yql SELECT COALESCE( @@ -43,7 +43,7 @@ All three examples above are equivalent. Returns the length of the string in bytes. This function is also available under the `LEN` name . -### Examples +#### Examples ```yql SELECT LENGTH("foo"); @@ -76,7 +76,7 @@ Optional arguments: Indexing starts from zero. If the specified position and length are beyond the string, returns an empty string. If the input string is optional, the result is also optional. -### Examples +#### Examples ```yql SELECT SUBSTRING("abcdefg", 3, 1); -- d @@ -107,7 +107,7 @@ Optional arguments: Returns the first substring position found or `NULL` (meaning that the desired substring hasn't been found starting from the specified position). -### Examples +#### Examples ```yql SELECT FIND("abcdefg_abcdefg", "abc"); -- 0 @@ -136,7 +136,7 @@ Optional arguments: Returns the first substring position found or `NULL` (meaning that the desired substring hasn't been found starting from the specified position). -### Examples +#### Examples ```yql SELECT RFIND("abcdefg_abcdefg", "bcd"); -- 9 @@ -163,7 +163,7 @@ Required arguments: The arguments can be of the `String` or `Utf8` type and can be optional. -### Examples +#### Examples ```yql SELECT StartsWith("abc_efg", "abc") AND EndsWith("abc_efg", "efg"); -- true @@ -191,7 +191,7 @@ It's a simplified alternative for [CASE WHEN ... THEN ... ELSE ... END](../synta You may omit the `else_expression` argument. In this case, if the condition is false (`condition_expression` returned `false`), an empty value is returned with the type corresponding to `then_expression` and allowing for `NULL`. Hence, the result will have an [optional data type](../types/optional.md). -### Examples +#### Examples ```yql SELECT @@ -213,7 +213,7 @@ Arguments: If one of the arguments is `Double`, the result is`Double`, otherwise, it's `Float`. If one of the arguments is `Optional`, then the result is `Optional`. -### Examples +#### Examples ```yql SELECT @@ -231,7 +231,7 @@ Generates a pseudorandom number: * `RandomNumber()`: An integer from the complete Uint64 range. * `RandomUuid()`: [Uuid version 4](https://tools.ietf.org/html/rfc4122#section-4.4). -### Signatures +#### Signatures ```yql Random(T1[, T2, ...])->Double @@ -260,7 +260,7 @@ Use cases: * `SELECT RANDOM(some_column), RANDOM(some_column) FROM table;`: Different random numbers for each row of the table, but two identical numbers within the same row. * `SELECT RANDOM(some_column), RANDOM(some_column + 1) FROM table;` or `SELECT RANDOM(some_column), RANDOM(other_column) FROM table;`: Two columns, with different numbers in both. -### Examples +#### Examples ```yql SELECT @@ -296,7 +296,7 @@ FROM my_table; The arguments are optional and work same as [RANDOM](#random). -### Examples +#### Examples ```yql SELECT CurrentUtcDate(); @@ -314,7 +314,7 @@ SELECT CurrentUtcTimestamp(TableRow()) FROM my_table; The arguments that follow are optional and work same as [RANDOM](#random). -### Examples +#### Examples ```yql SELECT CurrentTzDate("Europe/Moscow"); @@ -335,7 +335,7 @@ Arguments: Result type: `TzDate`/`TzDatetime`/`TzTimestamp`, depending on the input data type. -### Examples +#### Examples ```yql SELECT AddTimezone(Datetime("2018-02-01T12:00:00Z"), "Europe/Moscow"); @@ -351,7 +351,7 @@ Arguments: Result type: `Date`/`Datetime`/`Timestamp`, depending on the input data type. -### Examples +#### Examples ```yql SELECT RemoveTimezone(TzDatetime("2018-02-01T12:00:00,Europe/Moscow")); @@ -363,7 +363,7 @@ SELECT RemoveTimezone(TzDatetime("2018-02-01T12:00:00,Europe/Moscow")); `Version()` returns a string describing the current version of the node processing the request. In some cases, such as during rolling upgrades, it might return different strings depending on which node processes the request. It does not accept any arguments. -### Examples +#### Examples ```yql SELECT Version(); @@ -379,7 +379,7 @@ The argument types must be mutually castable and accept `NULL`. `GREATEST` is a synonym for `MAX_OF` and `LEAST` is a synonym for `MIN_OF`. -### Examples +#### Examples ```yql SELECT MIN_OF(1, 2, 3); @@ -406,7 +406,7 @@ Specifics: * `AsDict` and `AsDictStrict` expect `Tuple` of two elements as arguments (key and value, respectively). If the keys repeat, only the value for the first key remains in the dictionary. * `AsSet` and `AsSetStrict` expect keys as arguments. -### Examples +#### Examples ```yql SELECT @@ -442,7 +442,7 @@ For field names in the structure literal, you can use an expression that can be For nested lists, use [AsList](#as-container), for nested dictionaries, use [AsDict](#as-container), for nested sets, use [AsSet](#as-container), for nested tuples, use [AsTuple](#as-container), for nested structures, use [AsStruct](#as-container). -### Examples +#### Examples ```yql $name = "computed " || "member name"; @@ -475,7 +475,7 @@ Arguments: * String with a field name or tuple index * Variant type -### Example +#### Example ```yql $var_type = Variant<foo: Int32, bar: Bool>; @@ -494,7 +494,7 @@ Arguments: * Value * A string with the field name -### Example +#### Example ```yql SELECT @@ -505,7 +505,7 @@ SELECT Processes the possible values of a variant over a structure or tuple using the provided handler functions for each field/element of the variant. -### Signature +#### Signature ```yql Visit(Variant<key1: K1, key2: K2, ...>, K1->R AS key1, K2->R AS key2, ...)->R @@ -521,7 +521,7 @@ VisitOrDefault(Variant<key1: K1, key2: K2, ...>{Flags:AutoMap}, R, [K1->R AS key * For a variant over tuple: accepts the variant and handlers for each element of the variant as positional arguments. * `VisitOrDefault` includes an additional positional argument (on the second place) for the default value, enabling the omission of certain handlers. -### Example +#### Example ```yql $vartype = Variant<num: Int32, flag: Bool, str: String>; @@ -543,14 +543,14 @@ SELECT Returns the value of a homogeneous variant (i.e., a variant containing fields/elements of the same type). -### Signature +#### Signature ```yql VariantItem(Variant<key1: K, key2: K, ...>{Flags:AutoMap})->K VariantItem(Variant<K, K, ...>{Flags:AutoMap})->K ``` -### Example +#### Example ```yql $vartype1 = Variant<num1: Int32, num2: Int32, num3: Int32>; @@ -566,14 +566,14 @@ SELECT Returns an active field (active index) of a variant over a struct (tuple). -### Signature +#### Signature ```yql Way(Variant<key1: K1, key2: K2, ...>{Flags:AutoMap})->Utf8 Way(Variant<K1, K2, ...>{Flags:AutoMap})->Uint32 ``` -### Example +#### Example ```yql $vr = Variant(1, "0", Variant<Int32, String>); @@ -587,14 +587,14 @@ SELECT Way($vrs); -- "a" Creates a homogeneous variant instance (i.e. containing fields/elements of the same type), where the variant index or field can be set dynamically. If the index or field name does not exist, `NULL` will be returned. The inverse function is [VariantItem](#variantitem). -### Signature +#### Signature ```yql DynamicVariant(item:T,index:Uint32?,Variant<T, T, ...>)->Optional<Variant<T, T, ...>> DynamicVariant(item:T,index:Utf8?,Variant<key1: T, key2: T, ...>)->Optional<Variant<key1: T, key2: T, ...>> ``` -### Example +#### Example ```yql $dt = Int32; @@ -616,7 +616,7 @@ Arguments: * A string with the field name * Enumeration type -### Example +#### Example ```yql $enum_type = Enum<Foo, Bar>; @@ -633,7 +633,7 @@ Arguments: * A string with the name of an enumeration item -### Example +#### Example ```yql SELECT @@ -673,7 +673,7 @@ To avoid such a situation, create a subquery for calculating these functions, as {% endnote %} -### Examples +#### Examples ```yql SELECT TablePath() FROM CONCAT(table_a, table_b); @@ -693,7 +693,7 @@ Optional arguments: * Path to the table, `TablePath()` is used by default (see also its limitations). * Specifying the system ("yt") whose rules are used to determine the table name. You need to specify the system only if [USE](../syntax/use.md) doesn't specify the current cluster. -### Examples +#### Examples ```yql USE cluster; @@ -707,7 +707,7 @@ Access to the current sequence number of a row in the physical source table, **s No arguments. When used in combination with [CONCAT](../syntax/select/concat.md#concat), and other similar mechanisms, numbering restarts for each input table. If used in an incorrect context, it returns 0. -### Example +#### Example ```yql SELECT TableRecordIndex() FROM my_table; @@ -717,7 +717,7 @@ SELECT TableRecordIndex() FROM my_table; Getting the entire table row as a structure. No arguments. `JoinTableRow` in case of `JOIN` always returns a structure with table prefixes. -### Example +#### Example ```yql SELECT TableRow() FROM my_table; @@ -727,7 +727,7 @@ SELECT TableRow() FROM my_table; The `FileContent` and `FilePath` argument is a string with an alias. -### Examples +#### Examples ```yql SELECT "Content of " @@ -744,7 +744,7 @@ The argument is a string with a prefix among aliases. See also [PRAGMA File](../syntax/pragma.md#file) and [PRAGMA Folder](../syntax/pragma.md#folder). -### Examples +#### Examples ```yql PRAGMA File("foo/1.txt", "http://url/to/somewhere"); @@ -772,7 +772,7 @@ The return value is a lazy list. For repeat use, wrap it in the function [ListCo {% endnote %} -### Examples +#### Examples ```yql SELECT ListLength(ParseFile("String", "my_file.txt")); @@ -801,7 +801,7 @@ Arguments: To check the conditions based on the final calculation result, it's convenient to combine Ensure with [DISCARD SELECT](../syntax/discard.md). -### Examples +#### Examples ```yql SELECT Ensure( @@ -845,7 +845,7 @@ Restrictions: * The expression must not trigger MapReduce operations. * This functionality is fully locked in YQL over YDB. -### Examples +#### Examples ```yql $now = CurrentUtcDate(); @@ -860,7 +860,7 @@ SELECT EvaluateExpr( For primitive types, you can create literals based on string literals. -### Syntax +#### Syntax `<Primitive type>( <string>[, <additional attributes>] )` @@ -880,7 +880,7 @@ For the data types `TzDate`, `TzDatetime`, `TzTimestamp`, literals are also set {% include [decimal args](../_includes/decimal_args.md) %} -### Examples +#### Examples ```yql SELECT @@ -911,7 +911,7 @@ SELECT Conversion of [primitive data types](../types/primitive.md) to a string with their binary representation and back. Numbers are represented in the [little endian](https://en.wikipedia.org/wiki/Endianness#Little-endian) format. -### Examples +#### Examples ```yql SELECT @@ -933,7 +933,7 @@ Arguments: 1. String: `String` or `Utf8`. 2. Index: `Uint32`. -### Examples +#### Examples ```yql SELECT @@ -955,7 +955,7 @@ Arguments: TestBit returns `true/false`. The other functions return a copy of their first argument with the corresponding conversion. -### Examples +#### Examples ```yql SELECT @@ -969,7 +969,7 @@ SELECT The absolute value of the number. -### Examples +#### Examples ```yql SELECT Abs(-123); -- 123 @@ -983,7 +983,7 @@ SELECT Abs(-123); -- 123 The reverse operation is [Unwrap](#optional-ops). -### Examples +#### Examples ```yql SELECT @@ -1003,7 +1003,7 @@ Arguments: Reverse operation is [Just](#optional-ops). -### Examples +#### Examples ```yql $value = Just("value"); @@ -1015,7 +1015,7 @@ SELECT Unwrap($value, "Unexpected NULL for $value"); `Nothing()`: Create an empty value for the specified [Optional](../types/optional.md) data type. -### Examples +#### Examples ```yql SELECT @@ -1035,7 +1035,7 @@ Arguments: 1. Type. 2. Lambda function. -### Examples +#### Examples ```yql $lambda = ($x) -> { @@ -1058,7 +1058,7 @@ SELECT $callables.0(10), $callables.1(true); `Unpickle()` is the inverse operation (deserialization), where with the first argument being the data type of the result and the second argument is the string with the result of `Pickle()` or `StablePickle()`. -### Examples +#### Examples ```yql SELECT * @@ -1084,7 +1084,7 @@ Arguments: Result: a structure or tuple with the same number and naming of items as in the first argument, and with item data types determined by lambda results. -### Examples +#### Examples ```yql SELECT * @@ -1105,7 +1105,7 @@ Merges structures or tuples element-by-element. All arguments (one or more) must The result will be a structure or tuple, respectively. Each item of the result is a tuple comprised of items taken from arguments. -### Examples +#### Examples ```yql $one = <|k1:1, k2:2.0|>; @@ -1162,7 +1162,7 @@ Arguments: The resulting factory can be used as the second parameter of the function [AGGREGATE_BY](aggregation.md#aggregate-by). If the aggregate function is applied to two columns instead of one, as, for example, [MIN_BY](aggregation.md#minby), then in [AGGREGATE_BY](aggregation.md#aggregate-by), the first argument passes a `Tuple` of two values. See more details in the description of the applicable aggregate function. -### Examples +#### Examples ```yql $factory = AggregationFactory("MIN"); @@ -1180,7 +1180,7 @@ Arguments: 1. Aggregation factory. 2. A lambda function with one argument that converts an input item. -### Examples +#### Examples ```yql $f = AggregationFactory("sum"); @@ -1200,7 +1200,7 @@ Arguments: 1. Aggregation factory. 2. A lambda function with one argument that converts the result. -### Examples +#### Examples ```yql $f = AggregationFactory("sum"); @@ -1217,7 +1217,7 @@ Arguments: 1. Aggregation factory. -### Examples +#### Examples ```yql $i = AggregationFactory("AGGREGATE_LIST_DISTINCT"); diff --git a/yql/essentials/docs/en/builtins/codegen.md b/yql/essentials/docs/en/builtins/codegen.md index 2728742947a..59e787d5126 100644 --- a/yql/essentials/docs/en/builtins/codegen.md +++ b/yql/essentials/docs/en/builtins/codegen.md @@ -26,7 +26,7 @@ In the text representation, S-expressions have the following format: Serializing the code as [S-expressions](/docs/s_expressions). The code must not contain free arguments of functions, hence, to serialize the lambda function code, you must pass it completely, avoiding passing individual expressions that might contain lambda function arguments. -### Examples +#### Examples ```yql SELECT FormatCode(AtomCode("foo")); @@ -39,7 +39,7 @@ SELECT FormatCode(AtomCode("foo")); Build a code node with the `world` type. -### Examples +#### Examples ```yql SELECT FormatCode(WorldCode()); @@ -52,7 +52,7 @@ SELECT FormatCode(WorldCode()); Build a code node with the `atom` type from a string passed to the argument. -### Examples +#### Examples ```yql SELECT FormatCode(AtomCode("foo")); @@ -65,7 +65,7 @@ SELECT FormatCode(AtomCode("foo")); Build a code node with the `list` type from a set of nodes or lists of code nodes passed to arguments. In this case, lists of arguments are built in as separately listed code nodes. -### Examples +#### Examples ```yql SELECT FormatCode(ListCode( @@ -87,7 +87,7 @@ SELECT FormatCode(ListCode(AsList( Build a code node with the `built-in function call` from a string with the function name and a set of nodes or lists of code nodes passed to arguments. In this case, lists of arguments are built in as separately listed code nodes. -### Examples +#### Examples ```yql SELECT FormatCode(FuncCode( @@ -115,7 +115,7 @@ You can build a code node with the `lambda function declaration` type from: * [a Lambda function](../syntax/expressions.md#lambda), if you know the number of arguments in advance. In this case, the nodes of the `argument` type will be passed as arguments to this lambda function. * The number of arguments and a [lambda function](../syntax/expressions.md#lambda) with one argument. In this case, a list of nodes of the `argument`type will be passed as an argument to this lambda function. -### Examples +#### Examples ```yql SELECT FormatCode(LambdaCode(($x, $y) -> { @@ -137,7 +137,7 @@ SELECT FormatCode(LambdaCode(2, ($args) -> { Substituting the code node passed in the argument, into the main program code. -### Examples +#### Examples ```yql SELECT EvaluateCode(FuncCode("Int32", AtomCode("1"))); -- 1 @@ -152,7 +152,7 @@ SELECT $lambda(1, 2); -- 3 Substituting the code node representing the result of evaluating an expression passed in the argument, into the main program. -### Examples +#### Examples ```yql $add3 = EvaluateCode(LambdaCode(($x) -> { @@ -165,7 +165,7 @@ SELECT $add3(1); -- 4 Substituting into the main program the code node that represents an expression or a [lambda function](../syntax/expressions.md#lambda) passed in the argument. If free arguments of lambda functions were found during the substitution, they are calculated and substituted into the code as in the [ReprCode](#reprcode) function. -### Examples +#### Examples ```yql $lambda = ($x, $y) -> { RETURN $x + $y }; diff --git a/yql/essentials/docs/en/builtins/dict.md b/yql/essentials/docs/en/builtins/dict.md index 5659d9ff50e..57b01e54acf 100644 --- a/yql/essentials/docs/en/builtins/dict.md +++ b/yql/essentials/docs/en/builtins/dict.md @@ -6,7 +6,7 @@ Construct an empty dictionary. Two arguments are passed: for a key and a value. [Documentation for the type definition format](../types/type_string.md). -### Examples +#### Examples ```yql SELECT DictCreate(String, Tuple<String,Double?>); @@ -22,7 +22,7 @@ Construct an empty set. An argument is passed: the key type that can be built by [Documentation for the type definition format](../types/type_string.md). -### Examples +#### Examples ```yql SELECT SetCreate(String); @@ -36,7 +36,7 @@ SELECT SetCreate(Tuple<Int32?,String>); The count of items in the dictionary. -### Examples +#### Examples ```yql SELECT DictLength(AsDict(AsTuple(1, AsList("foo", "bar")))); @@ -50,7 +50,7 @@ SELECT DictLength(dict_column) FROM my_table; Check that the dictionary contains at least one item. -### Examples +#### Examples ```yql SELECT DictHasItems(AsDict(AsTuple(1, AsList("foo", "bar")))) FROM my_table; @@ -65,7 +65,7 @@ SELECT DictHasItems(dict_column) FROM my_table; Get dictionary contents as a list of tuples including key-value pairs (`List<Tuplekey_type,value_type>`). -### Examples +#### Examples ```yql SELECT DictItems(AsDict(AsTuple(1, AsList("foo", "bar")))); @@ -83,7 +83,7 @@ FROM my_table; Get a list of dictionary keys. -### Examples +#### Examples ```yql SELECT DictKeys(AsDict(AsTuple(1, AsList("foo", "bar")))); @@ -101,7 +101,7 @@ FROM my_table; Get a list of dictionary values. -### Examples +#### Examples ```yql SELECT DictPayloads(AsDict(AsTuple(1, AsList("foo", "bar")))); @@ -117,7 +117,7 @@ FROM my_table; Get a dictionary element by its key. -### Examples +#### Examples ```yql SELECT DictLookup(AsDict( @@ -136,7 +136,7 @@ FROM my_table; Checking if an element in the dictionary using its key. Returns true or false. -### Examples +#### Examples ```yql SELECT DictContains(AsDict( @@ -164,7 +164,7 @@ Arguments: 1. Dictionary. 2. [Aggregation factory](basic.md#aggregationfactory). -### Examples +#### Examples ```yql SELECT DictAggregate(AsDict( @@ -183,7 +183,7 @@ So there are two options to make a call: * With the `Dict<K,V1>` and `List<K>` arguments. * With the `Dict<K,V1>` and `Dict<K,V2>` arguments. -### Examples +#### Examples ```yql SELECT SetIsDisjoint(ToSet(AsList(1, 2, 3)), AsList(7, 4)); -- true @@ -199,7 +199,7 @@ Arguments: * Two dictionaries: `Dict<K,V1>` and `Dict<K,V2>`. * An optional function that combines the values from the source dictionaries to construct the values of the output dictionary. If such a function has the `(K,V1,V2) -> U` type, the result type is `Dict<K,U>`. If the function is not specified, the result type is `Dict<K,Void>`, and the values from the source dictionaries are ignored. -### Examples +#### Examples ```yql SELECT SetIntersection(ToSet(AsList(1, 2, 3)), ToSet(AsList(3, 4))); -- { 3 } @@ -219,7 +219,7 @@ So there are two options to make a call: * With the `Dict<K,V1>` and `List<K>` arguments. * With the `Dict<K,V1>` and `Dict<K,V2>` arguments. -### Examples +#### Examples ```yql SELECT SetIncludes(ToSet(AsList(1, 2, 3)), AsList(3, 4)); -- false @@ -235,7 +235,7 @@ Arguments: * Two dictionaries: `Dict<K,V1>` and `Dict<K,V2>`. * An optional function that combines the values from the source dictionaries to construct the values of the output dictionary. If such a function has the `(K,V1?,V2?) -> U` type, the result type is `Dict<K,U>`. If the function is not specified, the result type is `Dict<K,Void>`, and the values from the source dictionaries are ignored. -### Examples +#### Examples ```yql SELECT SetUnion(ToSet(AsList(1, 2, 3)), ToSet(AsList(3, 4))); -- { 1, 2, 3, 4 } @@ -250,7 +250,7 @@ SELECT SetUnion( Construct a dictionary containing all the keys with their values in the first dictionary with no matching key in the second dictionary. -### Examples +#### Examples ```yql SELECT SetDifference(ToSet(AsList(1, 2, 3)), ToSet(AsList(3, 4))); -- { 1, 2 } @@ -269,7 +269,7 @@ Arguments: * Two dictionaries: `Dict<K,V1>` and `Dict<K,V2>`. * An optional function that combines the values from the source dictionaries to construct the values of the output dictionary. If such a function has the `(K,V1?,V2?) -> U` type, the result type is `Dict<K,U>`. If the function is not specified, the result type is `Dict<K,Void>`, and the values from the source dictionaries are ignored. -### Examples +#### Examples ```yql SELECT SetSymmetricDifference(ToSet(AsList(1, 2, 3)), ToSet(AsList(3, 4))); -- { 1, 2, 4 } diff --git a/yql/essentials/docs/en/builtins/json.md b/yql/essentials/docs/en/builtins/json.md index d9168fa6d1d..975d3e93823 100644 --- a/yql/essentials/docs/en/builtins/json.md +++ b/yql/essentials/docs/en/builtins/json.md @@ -916,7 +916,7 @@ JSON_VALUE( The `JSON_EXISTS` function checks if a JSON value meets the specified JsonPath. -### Syntax +#### Syntax ```yql JSON_EXISTS( @@ -975,7 +975,7 @@ SELECT The `JSON_VALUE` function retrieves a scalar value from JSON (anything that isn't an array or object). -### Syntax +#### Syntax ```yql JSON_VALUE( @@ -1032,7 +1032,7 @@ Errors executing `JSON_VALUE` are as follows: `The RETURNING` section supports such types as numbers, `Date`, `DateTime`, `Timestamp`, `Utf8`, `String`, and `Bool`. -### Examples +#### Examples ```yql $json = CAST(@@{ @@ -1079,7 +1079,7 @@ SELECT The `JSON_QUERY` function lets you retrieve arrays and objects from JSON. -### Syntax +#### Syntax ```yql JSON_QUERY( diff --git a/yql/essentials/docs/en/builtins/list.md b/yql/essentials/docs/en/builtins/list.md index af8e48283ad..50b8182ee7a 100644 --- a/yql/essentials/docs/en/builtins/list.md +++ b/yql/essentials/docs/en/builtins/list.md @@ -6,7 +6,7 @@ Construct an empty list. The only argument specifies a string describing the dat [Documentation for the type definition format](../types/type_string.md). -### Examples +#### Examples ```yql SELECT ListCreate(Tuple<String,Double?>); @@ -20,7 +20,7 @@ SELECT ListCreate(OptionalType(DataType("String"))); Construct a list based on one or more arguments. The argument types must be compatible in the case of `AsList` and strictly match in the case of `AsListStrict`. -### Examples +#### Examples ```yql SELECT AsList(1, 2, 3, 4, 5); @@ -30,7 +30,7 @@ SELECT AsList(1, 2, 3, 4, 5); The count of items in the list. -### Examples +#### Examples ```yql SELECT ListLength(list_column) FROM my_table; @@ -40,7 +40,7 @@ SELECT ListLength(list_column) FROM my_table; Check that the list contains at least one item. -### Examples +#### Examples ```yql SELECT ListHasItems(list_column) FROM my_table; @@ -50,7 +50,7 @@ SELECT ListHasItems(list_column) FROM my_table; Convert a lazy list (it can be built by such functions as [ListFilter](#listmap), [ListMap](#listmap), [ListFlatMap](#listmap)) to an eager list. In contrast to a lazy list, where each new pass re-calculates the list contents, in an eager list the content is built at once by consuming more memory. -### Examples +#### Examples ```yql SELECT ListCollect(list_column) FROM my_table; @@ -65,7 +65,7 @@ Arguments: 1. List. 2. An optional expression to get the sort key from a list element (it's the element itself by default). -### Examples +#### Examples ```yql SELECT ListSortDesc(list_column) FROM my_table; @@ -97,7 +97,7 @@ If at least one of the lists is optional, then the result is also optional. If at least one argument is `NULL`, then the result type is `NULL`. -### Examples +#### Examples ```yql SELECT ListExtend( @@ -113,7 +113,7 @@ Sequentially join lists of structures (concatenation of lists). A field is added If at least one of the lists is optional, then the result is also optional. -### Examples +#### Examples ```yql SELECT ListUnionAll( @@ -130,7 +130,7 @@ Based on the input lists, build a list of pairs containing the list items with m The length of the returned list is determined by the shortest list for ListZip and the longest list for ListZipAll. When the shorter list is exhausted, a `NULL` value of a relevant [optional type](../types/optional.md) is paired with the elements of the longer list. -### Examples +#### Examples ```yql SELECT @@ -143,7 +143,7 @@ FROM my_table; Build a list of pairs (Tuple) containing the element number and the element itself (`List<TupleUint64,list_element_type>`). -### Examples +#### Examples ```yql SELECT ListEnumerate(list_column) FROM my_table; @@ -153,7 +153,7 @@ SELECT ListEnumerate(list_column) FROM my_table; Reverse the list. -### Examples +#### Examples ```yql SELECT ListReverse(list_column) FROM my_table; @@ -164,7 +164,7 @@ Returns a copy of the list, skipping the specified number of its first elements. The first argument specifies the source list and the second argument specifies how many elements to skip. -### Examples +#### Examples ```yql SELECT @@ -178,7 +178,7 @@ Returns a copy of the list containing a limited number of elements from the seco The first argument specifies the source list and the second argument specifies the maximum number of elements to be taken from the beginning of the list. -### Examples +#### Examples ```yql SELECT ListTake(list_column, 3) FROM my_table; @@ -196,7 +196,7 @@ If the probability/sample size is NULL, returns the original list. An optional argument is used to control randomness, see [documentation for `Random`](basic.md#random). -### Examples +#### Examples ```yql ListSample(List<T>, Double?[, U])->List<T> @@ -217,7 +217,7 @@ SELECT ListSampleN($list, 2); -- [4, 2] Returns a shuffled copy of the list. An optional argument is used to control randomness, see [documentation for `Random`](basic.md#random). -### Examples +#### Examples ```yql ListShuffle(List<T>[, U])->List<T> @@ -234,7 +234,7 @@ SELECT ListShuffle($list); -- [1, 3, 5, 2, 4] Searches the list for an element with the specified value and returns its index at the first occurrence. Indexes count from 0. If such element is missing, it returns `NULL`. -### Examples +#### Examples ```yql SELECT @@ -266,7 +266,7 @@ Arguments: If the source list is optional, then the output list is also optional. -### Examples +#### Examples ```yql $callable = Python::test(Callable<(Int64)->Bool>, "defMyFavouriteCrutchtest(i): return i % 2"); @@ -283,7 +283,7 @@ Applies transformation to the source list, skipping empty optional items and str If the source list is optional, then the output list is also optional. -### Examples +#### Examples ```yql SELECT ListNotNull([1,2]), -- [1,2] @@ -296,7 +296,7 @@ Expands the list of lists into a flat list, preserving the order of items. As th If the source list is optional, then the output list is also optional. -### Examples +#### Examples ```yql SELECT ListFlatten([[1,2],[3,4]]), -- [1,2,3,4] @@ -307,7 +307,7 @@ SELECT ListFlatten([[1,2],[3,4]]), -- [1,2,3,4] Returns a copy of the list containing only distinct elements. -### Examples +#### Examples ```yql SELECT @@ -324,7 +324,7 @@ Returns `true` for a list of Boolean values, if: Otherwise, it returns false. -### Examples +#### Examples ```yql SELECT @@ -337,7 +337,7 @@ FROM my_table; Show whether the list contains the specified element. In this case, `NULL` values are considered equal to each other, and with a `NULL` input list, the result is always `false`. -### Examples +#### Examples ```yql SELECT @@ -349,7 +349,7 @@ FROM my_table; Returns the first and last item of the list. -### Examples +#### Examples ```yql SELECT @@ -362,7 +362,7 @@ FROM my_table; Apply the appropriate aggregate function to all elements of the numeric list. -### Examples +#### Examples ```yql SELECT @@ -410,7 +410,7 @@ Arguments: Type returned: `List` of `U` items. -### Examples +#### Examples ```yql $l = [1, 4, 7, 2]; @@ -446,7 +446,7 @@ Specifics: * If any of the parameters is optional, the result list is optional. * If any of the parameters is `NULL`, the result is `NULL`. -### Examples +#### Examples ```yql SELECT @@ -454,7 +454,7 @@ SELECT ListFromRange(2, 1, -0.5); -- [2.0, 1.5] ``` -### Signature +#### Signature ```yql ListFromRange(T{Flags:AutoMap}, T{Flags:AutoMap}, T?)->LazyList<T> -- T — numeric type @@ -470,7 +470,7 @@ Required arguments: 1. Value. 2. Number of copies. -### Examples +#### Examples ```yql SELECT ListReplicate(true, 3); -- [true, true, true] @@ -481,7 +481,7 @@ SELECT ListReplicate(true, 3); -- [true, true, true] Concatenates a list of strings into a single string. You can set a separator as the second parameter. -### Examples +#### Examples ```yql SELECT @@ -494,7 +494,7 @@ FROM my_table; For a list of structures, it returns a list of contained fields having the specified name. -### Examples +#### Examples ```yql SELECT @@ -517,7 +517,7 @@ Required arguments: If the input list is optional, then the result is also optional. -### Examples +#### Examples ```yql $data = AsList(1, 2, 5, 1, 2, 7); @@ -540,7 +540,7 @@ Arguments: 1. List. 2. [Aggregation factory](basic.md#aggregationfactory). -### Examples +#### Examples ```yql SELECT ListAggregate(AsList(1, 2, 3), AggregationFactory("Sum")); -- 6 @@ -557,7 +557,7 @@ It means that: Optional lists are also supported, resulting in an optional dictionary. -### Examples +#### Examples ```yql SELECT @@ -572,7 +572,7 @@ An optional list is also supported, resulting in an optional dictionary. Inverse function: get a list of keys for the [DictKeys](dict.md#dictkeys) dictionary. -### Examples +#### Examples ```yql SELECT @@ -592,7 +592,7 @@ Arguments: 2. Size of selection. 3. An optional expression to get the sort key from a list element (it's the element itself by default). -### Examples +#### Examples ```yql ListTop(List<T>{Flags:AutoMap}, N)->List<T> diff --git a/yql/essentials/docs/en/builtins/struct.md b/yql/essentials/docs/en/builtins/struct.md index 9ab3442d728..5376e96a6ae 100644 --- a/yql/essentials/docs/en/builtins/struct.md +++ b/yql/essentials/docs/en/builtins/struct.md @@ -36,7 +36,7 @@ Arguments: * The first argument passes the source structure to be expanded. * All the other arguments must be named, each argument adds a new field and the argument's name is used as the field's name (as in [AsStruct](basic.md#asstruct)). -### Examples +#### Examples ```yql $struct = <|a:1|>; @@ -60,7 +60,7 @@ Arguments: 2. Name of the new field. 3. Value of the new field. -### Examples +#### Examples ```yql $struct = <|a:1|>; @@ -83,7 +83,7 @@ Arguments: 1. Source structure. 2. Field name. -### Examples +#### Examples ```yql $struct = <|a:1, b:2|>; @@ -105,7 +105,7 @@ Arguments: 1. Source structure. 2. Field name. -### Examples +#### Examples ```yql $struct = <|a:1, b:2|>; @@ -127,7 +127,7 @@ Arguments: 1. Source structure. 2. List of field names. -### Examples +#### Examples ```yql $struct = <|a:1, b:2, c:3|>; @@ -149,7 +149,7 @@ Arguments: 1. Source structure. 2. List of field names. -### Examples +#### Examples ```yql $struct = <|a:1, b:2, c:3|>; @@ -171,7 +171,7 @@ Arguments: 1. Source structure. 2. List of field names. -### Examples +#### Examples ```yql $struct = <|a:1, b:2, c:3|>; @@ -190,7 +190,7 @@ If the resulting field set contains duplicate values, an error is returned. Arguments: two or more structures. -### Examples +#### Examples ```yql $struct1 = <|a:1, b:2|>; @@ -210,7 +210,7 @@ If the resulting field set contains duplicate values, an error is returned. Arguments: two or more tuples of two items: prefix and structure. -### Examples +#### Examples ```yql $struct1 = <|a:1, b:2|>; @@ -228,7 +228,7 @@ Returns an unordered list of field names (possibly removing one Optional level) Argument: structure -### Examples +#### Examples ```yql $struct = <|a:1, b:2|>; @@ -245,7 +245,7 @@ Arguments: 1. Source structure. 2. A tuple of field names: the original name, the new name. -### Examples +#### Examples ```yql $struct = <|a:1, b:2|>; @@ -262,7 +262,7 @@ Arguments: 1. Source structure. 2. A tuple of field names: the original name, the new name. -### Examples +#### Examples ```yql $struct = <|a:1, b:2|>; @@ -276,7 +276,7 @@ Returns an unordered list of tuples including the field name and value. For the Argument: structure -### Examples +#### Examples ```yql $struct = <|a:1, b:2|>; @@ -293,7 +293,7 @@ Arguments: 1. List of tuples: field name, field value. 2. A list of all possible field names in the structure. -### Examples +#### Examples ```yql SELECT @@ -309,7 +309,7 @@ Arguments: 1. List of tuples: field name, field value. 2. A list of all possible field names in the structure. -### Examples +#### Examples ```yql SELECT @@ -325,7 +325,7 @@ Combine two structures using one of the four methods (using the provided lambda * `StructDifference` adds only the fields of `left`, which are absent in `right`. * `StructSymmetricDifference` adds all fields that are present in exactly one of the structures. -### Signatures +#### Signatures ```yql StructUnion(left:Struct<...>, right:Struct<...>[, mergeLambda:(name:String, l:T1?, r:T2?)->T])->Struct<...> @@ -340,7 +340,7 @@ Arguments: 2. `right` - second structure. 3. `mergeLambda` - _(optional)_ function to merge fields with the same name (arguments: field name, `Optional` field value of the first struct, `Optional` field value of the second struct - arguments are `Nothing<T?>` in case of absence of the corresponding struct field). By default, if present, the first structure's field value is used; otherwise, the second one's value is used. -### Examples +#### Examples ```yql $merge = ($name, $l, $r) -> { diff --git a/yql/essentials/docs/en/builtins/types.md b/yql/essentials/docs/en/builtins/types.md index 2b66d5528e1..b1e75055d86 100644 --- a/yql/essentials/docs/en/builtins/types.md +++ b/yql/essentials/docs/en/builtins/types.md @@ -8,7 +8,7 @@ Serializing a type or a handle type to a human-readable string. This helps at de Building a type from a string with description. [Documentation for its format](../types/type_string.md). -### Examples +#### Examples ```yql SELECT FormatType(ParseType("List<Int32>")); -- List<int32> @@ -18,7 +18,7 @@ SELECT FormatType(ParseType("List<Int32>")); -- List<int32> Getting the type of value passed to the argument. -### Examples +#### Examples ```yql SELECT FormatType(TypeOf("foo")); -- String @@ -34,7 +34,7 @@ Returns an instance of the specified type that can only be used to get the type If this instance remains in the computation graph by the end of optimization, the operation fails. -### Examples +#### Examples ```yql SELECT FormatType(TypeOf( @@ -47,7 +47,7 @@ SELECT FormatType(TypeOf( Returns a type for [primitive data types](../types/primitive.md) based on type name. -### Examples +#### Examples ```yql SELECT FormatType(DataType("Bool")); -- Bool @@ -58,7 +58,7 @@ SELECT FormatType(DataType("Decimal","5","1")); -- Decimal(5,1) Adds the option to assign `NULL` to the passed type. -### Examples +#### Examples ```yql SELECT FormatType(OptionalType(DataType("Bool"))); -- Bool? @@ -68,7 +68,7 @@ SELECT FormatType(OptionalType(DataType("Bool"))); -- Bool? Builds a list type or stream type based on the passed element type. -### Examples +#### Examples ```yql SELECT FormatType(ListType(DataType("Bool"))); -- List<Bool> @@ -78,7 +78,7 @@ SELECT FormatType(ListType(DataType("Bool"))); -- List<Bool> Builds a dictionary type based on the passed key types (first argument) and value types (second argument). -### Examples +#### Examples ```yql SELECT FormatType(DictType( @@ -91,7 +91,7 @@ SELECT FormatType(DictType( Builds the tuple type from the passed element types. -### Examples +#### Examples ```yql SELECT FormatType(TupleType( @@ -105,7 +105,7 @@ SELECT FormatType(TupleType( Builds the structure type based on the passed element types. The standard syntax of named arguments is used to specify the element names. -### Examples +#### Examples ```yql SELECT FormatType(StructType( @@ -118,7 +118,7 @@ SELECT FormatType(StructType( Returns the type of a variant based on the underlying type (structure or tuple). -### Examples +#### Examples ```yql SELECT FormatType(VariantType( @@ -130,7 +130,7 @@ SELECT FormatType(VariantType( Returns the type of the [resource](../types/special.md) based on the passed string label. -### Examples +#### Examples ```yql SELECT FormatType(ResourceType("Foo")); -- Resource<'Foo'> @@ -144,7 +144,7 @@ Constructs the type of the called value using the following arguments: 2. Result type. 3. All the next arguments of CallableType are treated as types of arguments of the callable value, but with a shift for two required arguments (for example, the third argument of the CallableType describes the type of the first argument in the callable value). -### Examples +#### Examples ```yql SELECT FormatType(CallableType( @@ -159,7 +159,7 @@ SELECT FormatType(CallableType( Return the same-name [special data types](../types/special.md). They have no arguments because they are not parameterized. -### Examples +#### Examples ```yql SELECT FormatType(VoidType()); -- Void @@ -171,7 +171,7 @@ If a type is passed to these functions, then they perform the action reverse to If a type handle is passed to these functions, then they perform the action reverse to [OptionalTypeHandle](#optionaltypehandle), [ListTypeHandle](#list-stream-typehandle), and [StreamTypeHandle](#list-stream-typehandle): they return the handle of the element type based on the type handle of its container. -### Examples +#### Examples ```yql SELECT FormatType(ListItemType( @@ -189,7 +189,7 @@ SELECT FormatType(ListItemType( Returns the type of the key or value based on the dictionary type. -### Examples +#### Examples ```yql SELECT FormatType(DictKeyType( @@ -201,7 +201,7 @@ SELECT FormatType(DictKeyType( Returns the tuple's element type based on the tuple type and the element index (index starts from zero). -### Examples +#### Examples ```yql SELECT FormatType(TupleElementType( @@ -213,7 +213,7 @@ SELECT FormatType(TupleElementType( Returns the type of the structure element based on the structure type and element name. -### Examples +#### Examples ```yql SELECT FormatType(StructMemberType( @@ -225,7 +225,7 @@ SELECT FormatType(StructMemberType( `CallableResultType` returns the result type based on the type of the called value. `CallableArgumentType` returns the argument type based on the called value type and its index (index starts from zero). -### Examples +#### Examples ```yql $callable_type = ParseType("(String,Bool)->Double"); @@ -244,7 +244,7 @@ If a type is passed to this function, then it performs an action reverse to [Var If a type handle is passed to this function, it performs the action reverse to [VariantTypeHandle](#varianttypehandle): returns the handle of the underlying type based on the handle of the variant type. -### Examples +#### Examples ```yql SELECT FormatType(VariantUnderlyingType( diff --git a/yql/essentials/docs/en/builtins/window.md b/yql/essentials/docs/en/builtins/window.md index f9a670167be..c764a305049 100644 --- a/yql/essentials/docs/en/builtins/window.md +++ b/yql/essentials/docs/en/builtins/window.md @@ -10,7 +10,7 @@ The syntax for calling window functions is detailed in a [separate article](../s All [aggregate functions](aggregation.md) can also be used as window functions. In this case, each row includes an aggregation result obtained on a set of rows from the [window frame](../syntax/window.md#frame). -### Examples +#### Examples ```yql SELECT @@ -28,13 +28,13 @@ WINDOW Row number within a [partition](../syntax/window.md#partition). No arguments. -### Signature +#### Signature ```yql ROW_NUMBER()->Uint64 ``` -### Examples +#### Examples ```yql SELECT @@ -49,14 +49,14 @@ WINDOW w AS (ORDER BY key); Accessing a value from a row in the [section](../syntax/window.md#partition) that lags behind (`LAG`) or leads (`LEAD`) the current row by a fixed number. The first argument specifies the expression to be accessed, and the second argument specifies the offset in rows. You may omit the offset. By default, the neighbor row is used: the previous or next, respectively (hence, 1 is assumed by default). For the rows having no neighbors at a given distance (for example, `LAG(expr, 3)` `NULL` is returned in the first and second rows of the section). -### Signature +#### Signature ```yql LEAD(T[,Int32])->T? LAG(T[,Int32])->T? ``` -### Examples +#### Examples ```yql SELECT @@ -97,14 +97,14 @@ Access values from the first and last rows (using the `ORDER BY` clause for the Optionally, `OVER` can be preceded by the additional modifier `IGNORE NULLS`. It changes the behavior of functions to the first or last **non-empty** (i.e., non-`NULL`) value among the window frame rows. The antonym of this modifier is `RESPECT NULLS`: it's the default behavior that can be omitted. -### Signature +#### Signature ```yql FIRST_VALUE(T)->T? LAST_VALUE(T)->T? ``` -### Examples +#### Examples ```yql SELECT @@ -128,13 +128,13 @@ Access a value from a row specified by position in the window's `ORDER BY` order Optionally, the `IGNORE NULLS` modifier can be specified before `OVER`, which causes rows with `NULL` in the first argument's value to be skipped. The antonym of this modifier is `RESPECT NULLS`, which is the default behavior and may be skipped. -### Signature +#### Signature ```yql NTH_VALUE(T,N)->T? ``` -### Examples +#### Examples ```yql SELECT @@ -166,7 +166,7 @@ Passing an argument to `RANK`/`DENSE_RANK`/`PERCENT_RANK` is a non-standard exte {% endnote %} -### Signature +#### Signature ```text RANK([T])->Uint64 @@ -174,7 +174,7 @@ DENSE_RANK([T])->Uint64 PERCENT_RANK([T])->Double ``` -### Examples +#### Examples ```yql SELECT @@ -203,13 +203,13 @@ WINDOW w AS (ORDER BY my_column); Distributes the rows of an ordered [partition](../syntax/window.md#partition) into a specified number of groups. The groups are numbered starting with one. For each row, the `NTILE` function returns the number of the group to which the row belongs. -### Signature +#### Signature ```yql NTILE(Uint64)->Uint64 ``` -### Examples +#### Examples ```yql SELECT @@ -224,13 +224,13 @@ WINDOW w AS (ORDER BY key); Returns the relative position (> 0 and <= 1) of a row within a [partition](../syntax/window.md#partition). No arguments. -### Signature +#### Signature ```yql CUME_DIST()->Double ``` -### Examples +#### Examples ```yql SELECT diff --git a/yql/essentials/docs/en/syntax/action.md b/yql/essentials/docs/en/syntax/action.md index 6ec0f0f71f3..ec6b785279b 100644 --- a/yql/essentials/docs/en/syntax/action.md +++ b/yql/essentials/docs/en/syntax/action.md @@ -4,7 +4,7 @@ Specifies a named action that is a parameterizable block of multiple top-level expressions. -### Syntax +#### Syntax 1. `DEFINE ACTION`: action definition. 1. [Action name](expressions.md#named-nodes) that will be used to access the defined action further in the query. @@ -19,7 +19,7 @@ One or more of the last parameters can be marked with a question mark `?` as opt Executes an `ACTION` with the specified parameters. -### Syntax +#### Syntax 1. `DO`: Executing an action. 1. The named expression for which the action is defined. @@ -33,7 +33,7 @@ In large queries, you can use separate files for action definition and include t {% endnote %} -### Example +#### Example ```yql DEFINE ACTION $hello_world($name, $suffix?) AS @@ -51,7 +51,7 @@ DO $hello_world(NULL, "Earth"); Performing an action without declaring it (anonymous action). -### Syntax +#### Syntax 1. `BEGIN`. 1. List of top-level expressions. @@ -59,7 +59,7 @@ Performing an action without declaring it (anonymous action). An anonymous action can't include any parameters. -### Example +#### Example ```yql DO BEGIN @@ -86,7 +86,7 @@ END DO 4. [DO](#do) with the name and parameters of an action or an anonymous action. In the parameters, you can use both the current element from the first paragraph and any named expressions declared above, including the list itself. 5. An optional `ELSE` followed by the second `DO` for the situation when the list is empty. -### Examples +#### Examples ```yql DEFINE ACTION $hello() AS diff --git a/yql/essentials/docs/en/syntax/export_import.md b/yql/essentials/docs/en/syntax/export_import.md index ddebe256bee..15fd0714a41 100644 --- a/yql/essentials/docs/en/syntax/export_import.md +++ b/yql/essentials/docs/en/syntax/export_import.md @@ -24,7 +24,7 @@ The file linked by the [PRAGMA Library](pragma.md#library) must be attached to t {% endnote %} -### Examples +#### Examples my_lib.sql: diff --git a/yql/essentials/docs/en/syntax/expressions.md b/yql/essentials/docs/en/syntax/expressions.md index 02ba8372dde..7d6ceceb9fd 100644 --- a/yql/essentials/docs/en/syntax/expressions.md +++ b/yql/essentials/docs/en/syntax/expressions.md @@ -10,7 +10,7 @@ As with other binary operators, if the data on either side is `NULL`, the result Don't confuse this operator with a logical "or": in SQL, it's denoted by the `OR` keyword. It's also not worth doing concatenation using `+`. -### Examples +#### Examples ```yql SELECT "fo" || "o"; @@ -38,7 +38,7 @@ All other characters are literals that represent themselves. The most popular way to use the `LIKE` and `REGEXP` keywords is to filter a table using the statements with the `WHERE` clause. However, there are no restrictions on using templates in this context: you can use them in most of contexts involving strings, for example, with concatenation by using `||`. -### Examples +#### Examples ```yql SELECT * FROM my_table @@ -161,7 +161,7 @@ The operators in the table are listed in descending order of precedence. Matching an empty value (`NULL`). Since `NULL` is a special value [equal to nothing](../types/optional.md#null_expr), the ordinary [comparison operators](#comparison-operators) can't be used to match it. -### Examples +#### Examples ```yql SELECT key FROM my_table @@ -188,7 +188,7 @@ For values of composite types, these rules are used recursively. Checking whether a value is in a range. It's equivalent to two conditions with `>=` and `<=` (range boundaries are included). Can be used with the `NOT` prefix to support inversion. -### Examples +#### Examples ```yql SELECT * FROM my_table @@ -215,7 +215,7 @@ The `COMPACT` modifier must be used with care. Since the hash table is built in- It is prefirable to add large lists of values to your query by URLs and use the [ParseFile](../builtins/basic.md#parsefile) function. -### Examples +#### Examples ```yql SELECT column IN (1, 2, 3) @@ -251,7 +251,7 @@ Can be used in the following scenarios: * Using named arguments in function calls. * To specify the target type in the case of explicit type casting, see [CAST](#cast). -### Examples +#### Examples ```yql SELECT key AS k FROM my_table; @@ -278,7 +278,7 @@ For more information about casting rules, see [here](../types/cast.md). {% include [decimal_args](../_includes/decimal_args.md) %} -### Examples +#### Examples {% include [cast_examples](../_includes/cast_examples.md) %} @@ -287,7 +287,7 @@ For more information about casting rules, see [here](../types/cast.md). Performs a bitwise conversion of an integer value to the specified integer type. The conversion is always successful, but may lose precision or high-order bits. -### Examples +#### Examples ```yql SELECT @@ -306,7 +306,7 @@ The `ELSE` branch is mandatory in the `CASE` expression. Expressions in `WHEN` a Since its syntax is quite sophisticated, it's often more convenient to use the built-in function [IF](../builtins/basic.md#if). -### Examples +#### Examples ```yql SELECT @@ -384,7 +384,7 @@ If named expression substitution results in completely identical subgraphs in th {% endnote %} -### Examples +#### Examples ```yql $multiplier = 712; @@ -496,7 +496,7 @@ Only use pure expressions inside the lambda body (those might also be other lamb One or more of the last lambda parameters can be marked with a question mark as optional: if they haven't been specified when calling lambda, they are assigned the `NULL` value. -### Examples +#### Examples ```yql $f = ($y) -> { @@ -530,7 +530,7 @@ For accessing the values inside containers: When using this syntax to access containers within table columns, be sure to specify the full column name, including the table name or table alias separated by a dot (see the first example below). -### Examples +#### Examples ```yql SELECT diff --git a/yql/essentials/docs/en/syntax/flatten.md b/yql/essentials/docs/en/syntax/flatten.md index b99f59ef49d..f6978fa41d0 100644 --- a/yql/essentials/docs/en/syntax/flatten.md +++ b/yql/essentials/docs/en/syntax/flatten.md @@ -22,7 +22,7 @@ For example: |d|2| -### Example +#### Example ```yql $sample = AsList( @@ -40,7 +40,7 @@ This conversion can be convenient in the following cases: * When the cells in a container column store IDs from another table that you want to join with [`JOIN`](join.md). -### Syntax +#### Syntax * `FLATTEN BY` is specified after `FROM`, but before `GROUP BY`, if `GROUP BY` is present in the query. * The type of the result column depends on the type of the source column: @@ -83,7 +83,7 @@ To specify the type of container to convert to, you can use: To filter the `NULL` values without serialization, specify the operation by using `FLATTEN OPTIONAL BY`. -### Examples +#### Examples ```yql SELECT @@ -129,7 +129,7 @@ Converts a table where all columns must be structures to a table with columns co The names of the source column structures are not used and not returned in the result. Be sure that the structure element names aren't repeated in the source columns. -### Example +#### Example ```yql SELECT x, y, z diff --git a/yql/essentials/docs/en/syntax/group_by.md b/yql/essentials/docs/en/syntax/group_by.md index 5740cc63808..794c866a2f4 100644 --- a/yql/essentials/docs/en/syntax/group_by.md +++ b/yql/essentials/docs/en/syntax/group_by.md @@ -2,7 +2,7 @@ Group the `SELECT` results by the values of the specified columns or expressions. `GROUP BY` is often combined with [aggregate functions](../builtins/aggregation.md) (`COUNT`, `MAX`, `MIN`, `SUM`, `AVG`) to perform calculations in each group. -### Syntax +#### Syntax ```yql SELECT -- In SELECT, you can use: @@ -31,7 +31,7 @@ Aggregate functions ignore `NULL` in their arguments, except for `COUNT`. YQL also provides aggregation factories implemented by the functions [`AGGREGATION_FACTORY`](../builtins/basic.md#aggregationfactory) and [`AGGREGATE_BY`](../builtins/aggregation.md#aggregateby). -### Examples +#### Examples ```yql SELECT key, COUNT(*) FROM my_table @@ -111,7 +111,7 @@ Where: Using the extended version of SessionWindow, you can, for example, do the following: divide a partition into sessions, as in the SessionWindow use case with two arguments, but with the maximum session length limited by a certain constant: -### Example +#### Example ```yql $max_len = 1000; -- is the maximum session length. @@ -140,7 +140,7 @@ You can use `SessionWindow` in `GROUP BY` only once. The results of calculating the aggregate function as subtotals for the groups and overall totals over individual columns or whole table. -### Syntax +#### Syntax ```yql SELECT @@ -169,7 +169,7 @@ The values of columns not used in calculations are replaced with `NULL` in the s * `0`: If `NULL` is used for the original empty value. * `1`: If `NULL` is added for a subtotal or overall total. -### Example +#### Example ```yql SELECT @@ -220,7 +220,7 @@ Applying `DISTINCT` to calculated values is not currently implemented. For this {% endnote %} -### Example +#### Example ```yql SELECT @@ -240,7 +240,7 @@ Improves aggregation efficiency if the query author knows in advance that none o Unlike the usual GROUP BY, the Map-side combiner stage and additional Reduce are disabled for each field with [DISTINCT](../syntax/group_by.md#distinct) aggregation. -### Example +#### Example ```yql SELECT @@ -256,7 +256,7 @@ LIMIT 3; Filtering a `SELECT` based on the calculation results of [aggregate functions](../builtins/aggregation.md). The syntax is similar to [WHERE](select/where.md). -### Example +#### Example ```yql SELECT diff --git a/yql/essentials/docs/en/syntax/join.md b/yql/essentials/docs/en/syntax/join.md index 14ec1ce566e..08367ff61bf 100644 --- a/yql/essentials/docs/en/syntax/join.md +++ b/yql/essentials/docs/en/syntax/join.md @@ -55,7 +55,7 @@ For any other JOIN types, specify the condition using one of the two methods: 1. `USING (column_name)`. Used if both the left and right subqueries share a column whose equality of values is a join condition. 2. `ON (equality_conditions)`. Lets you set a condition of equality for column values or expressions over columns in the left and right subqueries or use several such conditions combined by `and`. -### Examples +#### Examples ```yql SELECT a.value as a_value, b.value as b_value diff --git a/yql/essentials/docs/en/syntax/pragma.md b/yql/essentials/docs/en/syntax/pragma.md index afbfe502271..5bb89c276ec 100644 --- a/yql/essentials/docs/en/syntax/pragma.md +++ b/yql/essentials/docs/en/syntax/pragma.md @@ -4,7 +4,7 @@ Redefinition of settings. -### Syntax +#### Syntax `PRAGMA x.y = "z";` or `PRAGMA x.y("z", "z2", "z3");`: @@ -15,7 +15,7 @@ Redefinition of settings. * `Kb`, `Mb`, `Gb`: For the data amounts. * `sec`, `min`, `h`, `d`: For the time values. -### Examples +#### Examples ```yql PRAGMA AutoCommit; diff --git a/yql/essentials/docs/en/syntax/select/concat.md b/yql/essentials/docs/en/syntax/select/concat.md index e1170e72878..3a6733d620d 100644 --- a/yql/essentials/docs/en/syntax/select/concat.md +++ b/yql/essentials/docs/en/syntax/select/concat.md @@ -24,7 +24,7 @@ All arguments of the functions described above can be declared separately using To get the name of the source table from which you originally obtained each row, use [TablePath()](../../builtins/basic.md#tablepath). -### Examples +#### Examples ```yql USE some_cluster; diff --git a/yql/essentials/docs/en/syntax/select/from.md b/yql/essentials/docs/en/syntax/select/from.md index 924790d9def..67d5ef887af 100644 --- a/yql/essentials/docs/en/syntax/select/from.md +++ b/yql/essentials/docs/en/syntax/select/from.md @@ -4,7 +4,7 @@ Data source for `SELECT`. The argument can accept the table name, the result of The table is searched by name in the database specified by the operator [USE](../use.md). -### Examples +#### Examples ```yql SELECT key FROM my_table; diff --git a/yql/essentials/docs/en/syntax/select/from_as_table.md b/yql/essentials/docs/en/syntax/select/from_as_table.md index 459cd51b04b..bec8ae15090 100644 --- a/yql/essentials/docs/en/syntax/select/from_as_table.md +++ b/yql/essentials/docs/en/syntax/select/from_as_table.md @@ -4,7 +4,7 @@ Accessing named expressions as tables using the `AS_TABLE` function. `AS_TABLE($variable)` lets you use the value of `$variable` as the data source for the query. In this case, the variable `$variable` must have the type `List<Struct<...>>`. -### Example +#### Example ```yql $data = AsList( diff --git a/yql/essentials/docs/en/syntax/select/from_select.md b/yql/essentials/docs/en/syntax/select/from_select.md index 76373ca2510..b9ec8d8ced2 100644 --- a/yql/essentials/docs/en/syntax/select/from_select.md +++ b/yql/essentials/docs/en/syntax/select/from_select.md @@ -2,7 +2,7 @@ An inverted format, first specifying the data source and then the operation. -### Examples +#### Examples ```yql FROM my_table SELECT key, value; diff --git a/yql/essentials/docs/en/syntax/select/union.md b/yql/essentials/docs/en/syntax/select/union.md index 32b5ee18759..4b6097dc301 100644 --- a/yql/essentials/docs/en/syntax/select/union.md +++ b/yql/essentials/docs/en/syntax/select/union.md @@ -6,7 +6,7 @@ Union of the results of the underlying queries, with duplicates removed. Behavior is identical to using `UNION ALL` followed by `SELECT DISTINCT *`. Refer to [UNION ALL](#union-all) for more details. -### Examples +#### Examples ```yql SELECT key FROM T1 @@ -41,7 +41,7 @@ In the "by position" mode, the output of the resulting data schema uses the foll The order of the output columns in this mode is the same as the order of columns in the first input. -### Examples +#### Examples ```yql SELECT 1 AS x diff --git a/yql/essentials/docs/en/syntax/subquery.md b/yql/essentials/docs/en/syntax/subquery.md index 10767ed07d3..c1d1c5ebec0 100644 --- a/yql/essentials/docs/en/syntax/subquery.md +++ b/yql/essentials/docs/en/syntax/subquery.md @@ -32,7 +32,7 @@ $out1, $out2 = PROCESS $mySubquery($myParam1, $myParam2); -- next we use $out1 and $out2 as separate tables. ``` -### Examples +#### Examples ```yql DEFINE SUBQUERY $hello_world($name, $suffix?) AS @@ -128,7 +128,7 @@ These functions combine the results of one or more subquery templates passed by * `SubqueryMerge` uses the same constraints as `SubqueryExtend` and also outputs a sorted result if all subqueries have the same sort order. * `SubqueryUnionMerge` uses the same constraints as `SubqueryUnionAll` and also outputs a sorted result if all subqueries have the same sort order. -### Examples +#### Examples ```yql DEFINE SUBQUERY $sub1() as @@ -157,7 +157,7 @@ They substitute each item from the list into the subquery template as a paramete * `SubqueryMergeFor` uses the same constraints as `SubqueryExtendFor` and also outputs a sorted result if all subqueries have the same sort order. * `SubqueryUnionMergeFor` uses the same constraints as `SubqueryUnionAllFor` and also outputs a sorted result if all subqueries have the same sort order. -### Examples +#### Examples ```yql DEFINE SUBQUERY $sub($i) as @@ -177,7 +177,7 @@ The functions take the following arguments: And they build a new query template without parameters where sorting is performed or a comment on the use of sorting is added to the result. To use the resulting query template, call the `PROCESS` function, since, when using a `SELECT`, sorting is ignored. -### Examples +#### Examples ```yql DEFINE SUBQUERY $sub() as diff --git a/yql/essentials/docs/en/syntax/values.md b/yql/essentials/docs/en/syntax/values.md index c39805312cc..1482c843c97 100644 --- a/yql/essentials/docs/en/syntax/values.md +++ b/yql/essentials/docs/en/syntax/values.md @@ -20,7 +20,7 @@ SELECT expr_21, expr_22, ..., expr_2k UNION ALL SELECT expr_n1, expr_n2, ..., expr_nk; ``` -### Example +#### Example ```yql VALUES (1,2), (3,4); diff --git a/yql/essentials/docs/en/types/optional.md b/yql/essentials/docs/en/types/optional.md index d1e1f69cefc..f530320ccc8 100644 --- a/yql/essentials/docs/en/types/optional.md +++ b/yql/essentials/docs/en/types/optional.md @@ -13,7 +13,7 @@ The following operations are most often performed on optional data types: `Optional` (nullable) isn't a property of a data type or column, but a container type where [containers](containers.md) can be arbitrarily nested into each other. For example, a column with the type `Optional<Optional<Boolean>>` can accept 4 values: `NULL` of the whole container, `NULL` of the inner container, `TRUE`, and `FALSE`. The above-declared type differs from `List<List<Boolean>>`, because it uses `NULL` as an empty list, and you can't put more than one non-null element in it. In addition, `Optional<Optional<T>>` type values are returned as results when searching by the key in the `Dict(k,v)` dictionary with `Optional<T>` type values. Using this type of result data, you can distinguish between a `NULL` value in the dictionary and a situation when the key is missing. -### Example +#### Example ```yql $dict = {"a":1, "b":null}; @@ -32,7 +32,7 @@ null The `NULL` literal has a separate singular `Null` type and can be implicitly converted to any optional type (for example, the nested type `Optional<Optional<...Optional<T>...>>`). In ANSI SQL, `NULL` means "an unknown value", that's why logical and arithmetic operations involving `NULL` or empty `Optional` have certain specifics. -### Examples +#### Examples ```yql SELECT diff --git a/yql/essentials/docs/en/udf/list/datetime.md b/yql/essentials/docs/en/udf/list/datetime.md index c18380d4082..dbd6f137350 100644 --- a/yql/essentials/docs/en/udf/list/datetime.md +++ b/yql/essentials/docs/en/udf/list/datetime.md @@ -21,7 +21,7 @@ If the timezone is not GMT, the components store the local time for the relevant Conversion from a primitive type to an internal representation. It's always successful on a non-empty input. -### List of functions +#### List of functions * `DateTime::Split(Date{Flags:AutoMap}) -> Resource<TM>` * `DateTime::Split(Datetime{Flags:AutoMap}) -> Resource<TM>` @@ -36,7 +36,7 @@ Functions that accept `Resource<TM>` as input, can be called directly from the p Making a primitive type from an internal representation. It's always successful on a non-empty input. -### List of functions +#### List of functions * `DateTime::MakeDate(Resource<TM>{Flags:AutoMap}) -> Date` * `DateTime::MakeDatetime(Resource<TM>{Flags:AutoMap}) -> Datetime` @@ -45,7 +45,7 @@ Making a primitive type from an internal representation. It's always successful * `DateTime::MakeTzDatetime(Resource<TM>{Flags:AutoMap}) -> TzDatetime` * `DateTime::MakeTzTimestamp(Resource<TM>{Flags:AutoMap}) -> TzTimestamp` -### Examples +#### Examples ```yql SELECT @@ -63,7 +63,7 @@ SELECT Extracting a component from an internal representation. -### List of functions +#### List of functions * `DateTime::GetYear(Resource<TM>{Flags:AutoMap}) -> Uint16` * `DateTime::GetDayOfYear(Resource<TM>{Flags:AutoMap}) -> Uint16` @@ -82,7 +82,7 @@ Extracting a component from an internal representation. * `DateTime::GetTimezoneId(Resource<TM>{Flags:AutoMap}) -> Uint16` * `DateTime::GetTimezoneName(Resource<TM>{Flags:AutoMap}) -> String` -### Examples +#### Examples ```yql $tm = DateTime::Split(TzDatetime("2019-01-09T00:00:00,Europe/Moscow")); @@ -99,13 +99,13 @@ SELECT Updating one or more components in the internal representation. Returns either an updated copy or NULL, if an update produces an invalid date or other inconsistencies. -### List of functions +#### List of functions ```yql DateTime::Update( Resource<TM>{Flags:AutoMap}, [ Year:Uint16?, Month:Uint8?, Day:Uint8?, Hour:Uint8?, Minute:Uint8?, Second:Uint8?, Microsecond:Uint32?, Timezone:String? ]) -> Resource<TM>? ``` -### Examples +#### Examples ```yql $tm = DateTime::Split(Timestamp("2019-01-01T01:02:03.456789Z")); @@ -125,7 +125,7 @@ SELECT Getting a Timestamp from the number of seconds/milliseconds/microseconds since the UTC epoch. When the Timestamp limits are exceeded, NULL is returned. -### List of functions +#### List of functions * `DateTime::FromSeconds(Uint32{Flags:AutoMap}) -> Timestamp` * `DateTime::FromMilliseconds(Uint64{Flags:AutoMap}) -> Timestamp` @@ -135,13 +135,13 @@ Getting a Timestamp from the number of seconds/milliseconds/microseconds since t Getting a number of seconds/milliseconds/microseconds since the UTC Epoch from a primitive type. -### List of functions +#### List of functions * `DateTime::ToSeconds(Date/DateTime/Timestamp/TzDate/TzDatetime/TzTimestamp{Flags:AutoMap}) -> Uint32` * `DateTime::ToMilliseconds(Date/DateTime/Timestamp/TzDate/TzDatetime/TzTimestamp{Flags:AutoMap}) -> Uint64` * `DateTime::ToMicroseconds(Date/DateTime/Timestamp/TzDate/TzDatetime/TzTimestamp{Flags:AutoMap}) -> Uint64` -### Examples +#### Examples ```yql SELECT @@ -153,7 +153,7 @@ SELECT Conversions between `Interval` and various time units. -### List of functions +#### List of functions * `DateTime::ToDays(Interval{Flags:AutoMap}) -> Int16` * `DateTime::ToHours(Interval{Flags:AutoMap}) -> Int32` @@ -172,7 +172,7 @@ AddTimezone doesn't affect the output of ToSeconds() in any way, because ToSecon You can also create an Interval from a string literal in the format [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601%23Durations). -### Examples +#### Examples ```yql SELECT @@ -185,7 +185,7 @@ SELECT Get the start (end) of the period including the date/time. If the result is invalid, NULL is returned. If the timezone is different from GMT, then the period start (end) is in the specified time zone. -### List of functions +#### List of functions * `DateTime::StartOfYear(Resource<TM>{Flags:AutoMap}) -> Resource<TM>?` * `DateTime::EndOfYear(Resource<TM>{Flags:AutoMap}) -> Resource<TM>?` @@ -208,7 +208,7 @@ The functions treat periods longer than one day in a different manner than the s * `DateTime::TimeOfDay(Resource<TM>{Flags:AutoMap}) -> Interval` -### Examples +#### Examples ```yql SELECT @@ -241,7 +241,7 @@ SELECT Add/subtract the specified number of units to/from the component in the internal representation and update the other fields. Returns either an updated copy or NULL, if an update produces an invalid date or other inconsistencies. -### List of functions +#### List of functions * `DateTime::ShiftYears(Resource<TM>{Flags:AutoMap}, Int32) -> Resource<TM>?` * `DateTime::ShiftQuarters(Resource<TM>{Flags:AutoMap}, Int32) -> Resource<TM>?` @@ -249,7 +249,7 @@ Returns either an updated copy or NULL, if an update produces an invalid date or If the resulting number of the day in the month exceeds the maximum allowed, then the `Day` field will accept the last day of the month without changing the time (see examples). -### Examples +#### Examples ```yql $tm1 = DateTime::Split(DateTime("2019-01-31T01:01:01Z")); @@ -268,7 +268,7 @@ SELECT Get a string representation of a time using an arbitrary formatting string. -### List of functions +#### List of functions * `DateTime::Format(String, alwaysWriteFractionalSeconds:Bool?) -> (Resource<TM>{Flags:AutoMap}) -> String` @@ -288,7 +288,7 @@ A set of specifiers is implemented for the formatting string: All other characters in the format string are passed on without changes. -### Examples +#### Examples ```yql $format = DateTime::Format("%Y-%m-%d %H:%M:%S %Z"); @@ -302,7 +302,7 @@ SELECT Parse a string into an internal representation using an arbitrary formatting string. Default values are used for empty fields. If errors are raised, NULL is returned. -### List of functions +#### List of functions * `DateTime::Parse(String) -> (String{Flags:AutoMap}) -> Resource<TM>?` @@ -319,7 +319,7 @@ Implemented specifiers: * `%b`: A short three-letter case-insensitive English name of the month (Jan). * `%B`: A full case-insensitive English name of the month (January). -### Examples +#### Examples ```yql $parse1 = DateTime::Parse("%H:%M:%S"); @@ -338,14 +338,14 @@ For the common formats, wrappers around the corresponding util methods are suppo ## Parse specific formats -### List of functions +#### List of functions * `DateTime::ParseRfc822(String{Flags:AutoMap}) -> Resource<TM>?` * `DateTime::ParseIso8601(String{Flags:AutoMap}) -> Resource<TM>?` * `DateTime::ParseHttp(String{Flags:AutoMap}) -> Resource<TM>?` * `DateTime::ParseX509(String{Flags:AutoMap}) -> Resource<TM>?` -### Examples +#### Examples ```yql SELECT diff --git a/yql/essentials/docs/en/udf/list/digest.md b/yql/essentials/docs/en/udf/list/digest.md index 2acd4de863a..3d4dbaf0e84 100644 --- a/yql/essentials/docs/en/udf/list/digest.md +++ b/yql/essentials/docs/en/udf/list/digest.md @@ -34,7 +34,7 @@ A set of commonly used hash functions. * `Digest::XXH3(String{Flags:AutoMap}) -> Uint64` * `Digest::XXH3_128(String{Flags:AutoMap}) -> Tuple<Uint64,Uint64>` -### Examples +#### Examples ```yql SELECT Digest::Md5Hex("YQL"); -- "1a0c1b56e9d617688ee345da4030da3c" diff --git a/yql/essentials/docs/en/udf/list/hyperscan.md b/yql/essentials/docs/en/udf/list/hyperscan.md index 9bb32a078d7..ac3b98f4e05 100644 --- a/yql/essentials/docs/en/udf/list/hyperscan.md +++ b/yql/essentials/docs/en/udf/list/hyperscan.md @@ -56,7 +56,7 @@ However, if you want to match a string against any of the listed expressions (th When you call `MultiGrep`/`MultiMatch`, regular expressions are passed one per line using [multiline string literals](../../syntax/expressions.md#named-nodes): -### Example +#### Example ```yql $multi_match = Hyperscan::MultiMatch(@@a.* diff --git a/yql/essentials/docs/en/udf/list/math.md b/yql/essentials/docs/en/udf/list/math.md index dd129399d84..2b0b8ac75ca 100644 --- a/yql/essentials/docs/en/udf/list/math.md +++ b/yql/essentials/docs/en/udf/list/math.md @@ -4,13 +4,13 @@ A set of wrappers around the functions from the libm library and the Yandex util ## Constants {#constants} -### List of functions +#### List of functions * `Math::Pi() -> Double` * `Math::E() -> Double` * `Math::Eps() -> Double` -### Examples +#### Examples ```yql SELECT Math::Pi(); -- 3.141592654 @@ -20,13 +20,13 @@ SELECT Math::Eps(); -- 2.220446049250313e-16 ## (Double) -> Bool {#double-bool} -### List of functions +#### List of functions * `Math::IsInf(Double{Flags:AutoMap}) -> Bool` * `Math::IsNaN(Double{Flags:AutoMap}) -> Bool` * `Math::IsFinite(Double{Flags:AutoMap}) -> Bool` -### Examples +#### Examples ```yql SELECT Math::IsNaN(0.0/0.0); -- true @@ -35,7 +35,7 @@ SELECT Math::IsFinite(1.0/0.0); -- false ## (Double) -> Double {#double-double} -### List of functions +#### List of functions * `Math::Abs(Double{Flags:AutoMap}) -> Double` * `Math::Acos(Double{Flags:AutoMap}) -> Double` @@ -67,7 +67,7 @@ SELECT Math::IsFinite(1.0/0.0); -- false * `Math::Log2(Double{Flags:AutoMap}) -> Double` * `Math::Log10(Double{Flags:AutoMap}) -> Double` -### Examples +#### Examples ```yql SELECT Math::Sqrt(256); -- 16 @@ -76,7 +76,7 @@ SELECT Math::Trunc(1.2345); -- 1 ## (Double, Double) -> Double {#doubledouble-double} -### List of functions +#### List of functions * `Math::Atan2(Double{Flags:AutoMap}, Double{Flags:AutoMap}) -> Double` * `Math::Fmod(Double{Flags:AutoMap}, Double{Flags:AutoMap}) -> Double` @@ -84,7 +84,7 @@ SELECT Math::Trunc(1.2345); -- 1 * `Math::Pow(Double{Flags:AutoMap}, Double{Flags:AutoMap}) -> Double` * `Math::Remainder(Double{Flags:AutoMap}, Double{Flags:AutoMap}) -> Double` -### Examples +#### Examples ```yql SELECT Math::Atan2(1, 0); -- 1.570796327 @@ -93,12 +93,12 @@ SELECT Math::Remainder(2.1, 2); -- 0.1 ## (Double, Int32) -> Double {#doubleint32-double} -### List of functions +#### List of functions * `Math::Ldexp(Double{Flags:AutoMap}, Int32{Flags:AutoMap}) -> Double` * `Math::Round(Double{Flags:AutoMap}, [Int32?]) -> Double`: The second argument indicates the power of 10 to which we round (it's negative for decimal digits and positive for rounding to tens, thousands, or millions); the default value is 0 -### Examples +#### Examples ```yql SELECT Math::Pow(2, 10); -- 1024 @@ -107,11 +107,11 @@ SELECT Math::Round(1.2345, -2); -- 1.23 ## (Double, Double, \[Double?\]) -> Bool {#doubledouble-bool} -### List of functions +#### List of functions * `Math::FuzzyEquals(Double{Flags:AutoMap}, Double{Flags:AutoMap}, [Double?]) -> Bool`: Compares two Doubles for being inside the neighborhood specified by the third argument; the default value is 1.0e-13 -### Examples +#### Examples ```yql SELECT Math::FuzzyEquals(1.01, 1.0, 0.05); -- true @@ -119,7 +119,7 @@ SELECT Math::FuzzyEquals(1.01, 1.0, 0.05); -- true ## Functions for computing remainders -### List of functions +#### List of functions * `Math::Mod(Int64{Flags:AutoMap}, Int64) -> Int64?` * `Math::Rem(Int64{Flags:AutoMap}, Int64) -> Int64?` @@ -131,7 +131,7 @@ These functions behave similarly to the built-in % operator in the case of non-n Functions return null if the divisor is zero. -### Examples +#### Examples ```yql SELECT Math::Mod(-1, 7); -- 6 diff --git a/yql/essentials/docs/en/udf/list/pire.md b/yql/essentials/docs/en/udf/list/pire.md index 3776e74c04a..ebdfd4c06fa 100644 --- a/yql/essentials/docs/en/udf/list/pire.md +++ b/yql/essentials/docs/en/udf/list/pire.md @@ -37,7 +37,7 @@ When escaping special characters in a regular expression, be sure to use the sec You can enable the case-insensitive mode by specifying, at the beginning of the regular expression, the flag `(?i)`. -### Examples +#### Examples ```yql $value = "xaaxaaxaa"; @@ -82,7 +82,7 @@ Use the MultiGrep/MultiMatch functions to optimize the query execution speed. Be When you call MultiGrep/MultiMatch, regular expressions are passed one per line using [multiline string literals](../../syntax/expressions.md#multiline-string-literals): -### Examples +#### Examples ```yql $multi_match = Pire::MultiMatch(@@a.* diff --git a/yql/essentials/docs/en/udf/list/url.md b/yql/essentials/docs/en/udf/list/url.md index 0dbe3d5b48d..680a5a2742e 100644 --- a/yql/essentials/docs/en/udf/list/url.md +++ b/yql/essentials/docs/en/udf/list/url.md @@ -12,7 +12,7 @@ Returned value: * Normalized URL. * `NULL`, if the passed string argument can't be parsed as a URL. -### Examples +#### Examples ```yql SELECT Url::Normalize("hTTp://wWw.yDb.TECH/"); -- "http://www.ydb.tech/" @@ -30,7 +30,7 @@ Returned value: * Normalized URL. * Source URL, if the normalization has failed. -### Examples +#### Examples ```yql SELECT Url::NormalizeWithDefaultHttpScheme("wWw.yDb.TECH"); -- "http://www.ydb.tech/" @@ -41,12 +41,12 @@ SELECT Url::NormalizeWithDefaultHttpScheme("http://ydb.tech#foo"); -- "http://yd Encode a UTF-8 string to the urlencoded format (`Url::Encode`) and back (`Url::Decode`). -### List of functions +#### List of functions * `Url::Encode(String?) -> String?` * `Url::Decode(String?) -> String?` -### Examples +#### Examples ```yql SELECT Url::Decode("http://ydb.tech/%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0"); @@ -63,7 +63,7 @@ Parses the URL into parts. Url::Parse(Parse{Flags:AutoMap}) -> Struct< Frag: String?, Host: String?, ParseError: String?, Pass: String?, Path: String?, Port: String?, Query: String?, Scheme: String?, User: String? > ``` -### Examples +#### Examples ```yql SELECT Url::Parse( @@ -87,7 +87,7 @@ SELECT Url::Parse( Get a component of the URL. -### List of functions +#### List of functions * `Url::GetScheme(String{Flags:AutoMap}) -> String` * `Url::GetHost(String?) -> String?` @@ -112,7 +112,7 @@ Get a component of the URL. Returns the domain that's most likely owned by an individual or organization. Unlike `Url::GetSignificantDomain`, it uses a special whitelist. Besides the `***.co.uk` domains, it can return a third-level domain used by free hosting sites and blogs (for example: something.livejournal.com) -### Examples +#### Examples ```yql SELECT Url::GetScheme("https://ydb.tech"); -- "https://" @@ -137,7 +137,7 @@ SELECT Url::GetDomain("http://www.ydb.tech", 2); -- "ydb.tech" Returns a copy of the passed URL, stripping out all the CGI parameters and fragments ("?foo=bar" and/or "#baz"). -### Examples +#### Examples ```yql SELECT Url::CutScheme("http://www.ydb.tech"); -- "www.ydb.tech" @@ -148,7 +148,7 @@ SELECT Url::CutWWW("www.ydb.tech"); -- "ydb.tech" [Punycode](https://en.wikipedia.org/wiki/Punycode) transformations. -### List of functions +#### List of functions * `Url::HostNameToPunycode(String{Flag:AutoMap}) -> String?` * `Url::ForceHostNameToPunycode(String{Flag:AutoMap}) -> String` @@ -156,7 +156,7 @@ SELECT Url::CutWWW("www.ydb.tech"); -- "ydb.tech" * `Url::ForcePunycodeToHostName(String{Flag:AutoMap}) -> String` * `Url::CanBePunycodeHostName(String{Flag:AutoMap}) -> Bool` -### Examples +#### Examples ```yql SELECT Url::PunycodeToHostName("xn--80aniges7g.xn--j1aef"); -- "example.com" @@ -166,7 +166,7 @@ SELECT Url::PunycodeToHostName("xn--80aniges7g.xn--j1aef"); -- "example.com" [Query](https://docs.python.org/3/library/urllib.parse.html) transformations. -### List of functions +#### List of functions ```yql Url::QueryStringToList(String{Flag:AutoMap}, [ @@ -192,7 +192,7 @@ Url::BuildQueryString(List<Tuple<String, String?>>{Flag:AutoMap}, [ ]) -> String ``` -### Examples +#### Examples ```yql SELECT Url::QueryStringToList("a=1&b=2&a=3"); -- [("a", "1"), ("b", "2"), ("a", "3")] diff --git a/yql/essentials/docs/en/udf/list/yson.md b/yql/essentials/docs/en/udf/list/yson.md index 5a398dda9ff..3d4dd2d7cba 100644 --- a/yql/essentials/docs/en/udf/list/yson.md +++ b/yql/essentials/docs/en/udf/list/yson.md @@ -98,7 +98,7 @@ Yson::From(T) -> Resource<'Yson2.Node'> `Yson::From` is a polymorphic function that converts most primitive data types and containers (lists, dictionaries, tuples, structures, and so on) into a Yson resource. The source object type must be Yson-compatible. For example, in dictionary keys, you can only use the `String` or `Utf8` data types, but not `String?` or `Utf8?` . -### Example +#### Example ```yql SELECT Yson::Serialize(Yson::From(TableRow())) FROM table1; @@ -182,7 +182,7 @@ These functions do not do implicit type casting by default, that is, the value i `Yson::ConvertTo` is a polymorphic function that converts the data type that is specified in the second argument and supports containers (lists, dictionaries, tuples, structures, and so on) into a Yson resource. -### Example +#### Example ```yql $data = Yson(@@{ @@ -284,7 +284,7 @@ It's passed in the last optional argument (omitted for brevity) to the methods ` * **AutoConvert**: If the value passed to Yson doesn't match the result data type exactly, the value is converted where possible. For example, `Yson::ConvertToInt64` in this mode will convert even Double numbers to Int64. * **Strict**: By default, all functions from the Yson library return an error in case of issues during query execution (for example, an attempt to parse a string that is not Yson/Json, or an attempt to search by a key in a scalar type, or when a conversion to an incompatible data type has been requested, and so on). If you disable the strict mode, `NULL` is returned instead of an error in most cases. When converting to a dictionary or list (`ConvertTo<Type>Dict` or `ConvertTo<Type>List`), improper items are excluded from the resulting collection. -### Example +#### Example ```yql $yson = @@{y = true; x = 5.5}@@y; |