Skip to content

DOCS-163: Docs for the Interval data type and the INTERVAL operator. - #7452

Merged
BayoNet merged 46 commits into
ClickHouse:masterfrom
BayoNet:en-docs/CLICKHOUSEDOCS-163-interval
Nov 6, 2019
Merged

BayoNet merged 46 commits into
ClickHouse:masterfrom
BayoNet:en-docs/CLICKHOUSEDOCS-163-interval

Conversation

@BayoNet

@BayoNet BayoNet commented Oct 23, 2019

Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Category (leave one):

  • Documentation

BayoNet added 30 commits August 16, 2019 17:58
@BayoNet BayoNet added comp-documentation Documentation (docs, examples, READMEs). pr-doc-fix labels Oct 23, 2019
@BayoNet
BayoNet requested a review from a team as a code owner October 23, 2019 12:23
@@ -0,0 +1,74 @@
# Interval {#data-type-interval}

Represents time and date intervals. The resulting type of the `INTERVAL` operator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link?

- QUARTER
- YEAR

For each interval type, there is the separated data type. For example, the DAY interval is expressed as the `IntervalDay` data type:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd better explicitly explain that this as a set of similarly behaving data types from the very beginning


Structure:

- Unsigned integer value of interval.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • value -> length?
  • from this explanation it's not obvious that each interval value means "this integer multiplied by the unit from interval time"

└─────────────────────┴───────────────────────────────┘
```

Intervals of different types can't be combined in one `INTERVAL` operator. You can't use the expressions like `INTERVAL 4 DAY 1 HOUR`, so you need to express intervals in the minimal units. For example, `1 day and an hour` interval should be expressed as `INTERVAL 25 HOUR`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • this is important and should be explained earlier, probably in !!! block, but not in terms of INTERVAL operator, but in terms of Interval values
  • minimal units = SECOND, it's more like "smallest unit it consists of"

### INTERVAL {#operator-interval}

Creates an [Interval](../data_types/special_data_types/interval.md)-type value that should be used in arithmetical operations with [Date](../data_types/date.md) and [DateTime](../data_types/datetime.md)-type values.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it has pretty non-trivial syntax that needs explanation
some details from Interval type article also are worth repeating here

@BayoNet
BayoNet merged commit 6ae3998 into ClickHouse:master Nov 6, 2019
@BayoNet
BayoNet deleted the en-docs/CLICKHOUSEDOCS-163-interval branch November 6, 2019 12:15
BayoNet added a commit that referenced this pull request Dec 6, 2019
* Update operators.md (#70)

* Update operators.md (#71)

* CLICKHOUSEDOCS-163: EN review, RU translation.

* CLICKHOUSEDOCS-163: Fix

* Update docs/ru/data_types/special_data_types/interval.md

Co-Authored-By: Ivan Blinkov <[email protected]>

* Update docs/ru/query_language/operators.md

Co-Authored-By: Ivan Blinkov <[email protected]>

* Update docs/ru/data_types/special_data_types/interval.md

Co-Authored-By: Ivan Blinkov <[email protected]>

* CLICKHOUSEDOCS-163: Clarification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-documentation Documentation (docs, examples, READMEs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants