driftx commented on code in PR #1887: URL: https://github.com/apache/cassandra/pull/1887#discussion_r981245224
########## doc/cql3/CQL.textile: ########## @@ -2154,6 +2154,16 @@ A number of functions are provided to "convert" a @timeuuid@, a @timestamp@ or a |@dateOf@ |@timeuuid@ |Similar to @toTimestamp(timeuuid)@ (DEPRECATED)| |@unixTimestampOf@ |@timeuuid@ |Similar to @toUnixTimestamp(timeuuid)@ (DEPRECATED)| +h4(#floorFun). Floor function + +Rounds date and time to the nearest value. + +|_. type |_. function |_. | +|@timestamp@ | floor(timestamp, duration [, start_timestamp]) | If the start_timestamp is not used, then the start timestamp is January 1, 1970 00:00:00.000 GMT | +|@timeuuid@ | floor(timeuuid, duration [, start_timestamp]) | If the start_timestamp is not used, then the start timestamp is January 1, 1970 00:00:00.000 GMT | +|@date@ | floor(date, duration [, start_date]) | If the start_date is not used, then the start date is January 1, 1970 GMT | +|@time@ | floor(time, duration [, start_time]) | ==If the start_time is not used, then the start time is 00:00:00[000000000]== | + Review Comment: Formatting ########## doc/cql3/CQL.textile: ########## @@ -1822,6 +1824,44 @@ They can also be input as string literals in any of the following formats: * @08:12:54.123456@ * @08:12:54.123456789@ +h3(#usingdurations). Working with durations + +Values of the @duration@ type are encoded as 3 signed integer of variable lengths. The first integer represents the Review Comment: integer -> integers ########## doc/cql3/CQL.textile: ########## @@ -1,4 +1,4 @@ -<!-- +!-- Review Comment: Need this :) ########## doc/cql3/CQL.textile: ########## @@ -1749,6 +1750,7 @@ p. The following table gives additional informations on the native data types, a |@date@ | integers, strings |A date (with no corresponding time value). See "Working with dates":#usingdates below for more information.| |@decimal@ | integers, floats |Variable-precision decimal| |@double@ | integers |64-bit IEEE-754 floating point| +|@duration@ | duration | A duration with nanosecond precision. See "Working with durations":#usingdurations below for details.| Review Comment: missing a space ########## doc/cql3/CQL.textile: ########## @@ -2111,7 +2113,25 @@ will select all rows where the @timeuuid@ column @t@ is strictly older than '201 _Warning_: We called the values generated by @minTimeuuid@ and @maxTimeuuid@ _fake_ UUID because they do no respect the Time-Based UUID generation process specified by the "RFC 4122":http://www.ietf.org/rfc/rfc4122.txt. In particular, the value returned by these 2 methods will not be unique. This means you should only use those methods for querying (as in the example above). Inserting the result of those methods is almost certainly _a bad idea_. -h3(#timeFun). Time conversion functions + +h3(#datetimeFun). Datetime functions + +h4(#curentDateTime). Retrieving the current date/time + +The following functions can be used to retrieve the date/time at the time where the function is invoked: + +|_. function name |_. output type | +| @currentTimestamp@ | @timestamp@ | Review Comment: Formatting ########## doc/cql3/CQL.textile: ########## @@ -1998,7 +2039,7 @@ The following table describes the conversions supported by the @cast@ function. |_. from |_. to | |@ascii@ |@text@, @varchar@ | -|@bigint@ |@tinyint@, @smallint@, @int@, @float@, @double@, @decimal@, @varint@, @text@, @varchar@ | +|@bigint@ |@tinyint@, @smallint@, @int@, @float@, @double@, @@decimal@@, @varint@, @text@, @varchar@ | Review Comment: spacing ########## doc/cql3/CQL.textile: ########## @@ -1985,6 +1985,47 @@ UPDATE plays SET scores = scores - [ 12, 21 ] WHERE id = '123-afde'; // removes As with "maps":#map, TTLs if used only apply to the newly inserted/updated _values_. +h2(#arithmeticOperators). Arithmetic Operators + +h3(#numberArithmetic). Number Arithmetic + +CQL supports the following operators: + +|_. Operator |_. Description | +| @-@ (unary) | Negates operand | +| @+@ | Addition | +| @-@ | Substraction | +| @*@ | Multiplication | +| @/@ | Division | +| @%@ | Returns the remainder of a division | + +Arithmetic operations are only supported on numeric types or counters. + +The return type of the operation will be based on the operand types: + + +|_. left/right |_. @tinyint@ |_. @smallint@ |_. @int@ |_. @bigint@ |_. @counter@ |_. @float@ |_. @double@ |_. @varint@ |_. @decimal@ | Review Comment: Spacing -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

