Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: [Docs] Add an ES-SQL column for data types #37529

Merged
merged 2 commits into from
Jan 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 31 additions & 28 deletions docs/reference/sql/language/data-types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,44 @@

beta[]

Most of {es} <<mapping-types, data types>> are available in {es-sql}, as indicated below:
Most of {es} <<mapping-types, data types>> are available in {es-sql}, as indicated below.
As one can see, all of {es} <<mapping-types, data types>> are mapped to the data type with the same
name in {es-sql}, with the exception of **date** data type which is mapped to **datetime** in {es-sql}:

[cols="^,^m,^"]
[cols="^,^m,^,^"]

|===
s|{es} type
s|{es-sql} type
s|SQL type
s|SQL precision

3+h| Core types

| <<null-value, `null`>> | null | 0
| <<boolean, `boolean`>> | boolean | 1
| <<number, `byte`>> | tinyint | 3
| <<number, `short`>> | smallint | 5
| <<number, `integer`>> | integer | 10
| <<number, `long`>> | bigint | 19
| <<number, `double`>> | double | 15
| <<number, `float`>> | real | 7
| <<number, `half_float`>> | float | 16
| <<number, `scaled_float`>> | float | 19
| <<keyword, `keyword`>> | varchar | based on <<ignore-above>>
| <<text, `text`>> | varchar | 2,147,483,647
| <<binary, `binary`>> | varbinary | 2,147,483,647
| <<date, `date`>> | timestamp | 24
| <<ip, `ip`>> | varchar | 39
3+h| Complex types
| <<object, `object`>> | struct | 0
| <<nested, `nested`>> | struct | 0

3+h| Unsupported types

| _types not mentioned above_ | unsupported | 0
4+h| Core types

| <<null-value, `null`>> | null | NULL | 0
| <<boolean, `boolean`>> | boolean | BOOLEAN | 1
| <<number, `byte`>> | byte | TINYINT | 3
| <<number, `short`>> | short | SMALLINT | 5
| <<number, `integer`>> | integer | INTEGER | 10
| <<number, `long`>> | long | BIGINT | 19
| <<number, `double`>> | double | DOUBLE | 15
| <<number, `float`>> | float | REAL | 7
| <<number, `half_float`>> | half_float | FLOAT | 16
| <<number, `scaled_float`>> | scaled_float | FLOAT | 19
| <<keyword, `keyword`>> | keyword | VARCHAR | based on <<ignore-above>>
| <<text, `text`>> | text | VARCHAR | 2,147,483,647
| <<binary, `binary`>> | binary | VARBINARY | 2,147,483,647
| <<date, `date`>> | datetime | TIMESTAMP | 24
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the generated HTML, it looks fine, but I'm wondering if we shouldn't make it more clear (in a short sentence before the table) what is the actual difference, because the user will see two columns that look almost the same and only towards the end one notices (if it does notice) date in ES has a datetime correspondent in ES-SQL.

What I'm suggesting is to change the phrase before the table from Most of Elasticsearch data types are available in Elasticsearch SQL, as indicated below:

to something like

Most of Elasticsearch data types are available in Elasticsearch SQL, as indicated below. As one can see, all of Elasticsearch data types are mapped to the data type with the same name in Elasticsearch SQL, with the exception of datedata type which is calleddatetime in Elasticsearch SQL:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the clarification, as I think it's better to have it standing out there apart from the table where the eye can skip it as everything else is the same.

Copy link
Member

Choose a reason for hiding this comment

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

Potentially add an explanation as why there's datetime : in order to not confuse it with the ANSI SQL date (date only) type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, planning to do it with the introduction of date.

| <<ip, `ip`>> | ip | VARCHAR | 39

4+h| Complex types

| <<object, `object`>> | object | STRUCT | 0
| <<nested, `nested`>> | nested | STRUCT | 0

4+h| Unsupported types

| _types not mentioned above_ | unsupported | OTHER | 0

|===

Expand Down