Repository: trafodion Updated Branches: refs/heads/master 802e4fe71 -> 23a7be106
[TRAFODION-3130] Add Descriptions for *Data Type Mapping from Hive to Trafodion* in *Trafodion SQL Reference Manual* Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/466446cd Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/466446cd Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/466446cd Branch: refs/heads/master Commit: 466446cd73157945b371fb229c4e49c971b0e32d Parents: 7ee5b25 Author: liu.yu <[email protected]> Authored: Thu Jul 5 14:57:33 2018 +0800 Committer: liu.yu <[email protected]> Committed: Thu Jul 5 14:57:33 2018 +0800 ---------------------------------------------------------------------- .../src/asciidoc/_chapters/introduction.adoc | 104 +++++++++++++++---- 1 file changed, 86 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/466446cd/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc ---------------------------------------------------------------------- diff --git a/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc b/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc index 4434227..63e9310 100644 --- a/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc +++ b/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc @@ -260,35 +260,103 @@ select * from hive.hive.t; -- explicit table name <<< -[[type_mapping_from_hive_to_trafodion_sql]] -=== Type Mapping From Hive to {project-name} SQL +[[data_type_mapping_from_hive_to_trafodion_sql]] +=== Data Type Mapping From Hive to {project-name} SQL -{project-name} performs the following data-type mappings: +{project-name} performs the following data-type mappings. -[cols="2*",options="header"] +[[numeric_data_type_mapping_from_hive_to_trafodion]] +==== Numeric Data Type Mapping From Hive to Trafodion + +[cols="6*^.^",options="header"] +|=== +6+| +++<u>Numeric</u>+++ Data Type Mapping From Hive to Trafodion +3+| *Hive ^1^* 3+| *Trafodion* +| Data Type | Range | Byte(s) | Data Type | Range | Byte(s) +| tinyint + +(signed) | -128 ~ +127 | 1 | tinyint + +(signed) | -128 ~ +127 | 1 +| smallint + +(signed) | -32,768 ~ +32,767 | 2 | smallint + +(signed) | -32,768 ~ +32,767 | 2 +| int + +(signed) | -2,147,483,648 ~ +2,147,483,647 | 4 | int + +(signed) | -2,147,483,648 ~ +2,147,483,647 | 4 +| bigint + +(signed) | -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807 | 8 | largeint + +(signed) | -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807 | 8 +|=== + +1. Hive supports *only signed numeric data types*. + +For more information about numeric data type for Hive and Trafodion, see the table below. + +[cols="6*^.^",options="header"] +|=== +6+| Comparison of Numeric Data Type between Hive and Trafodion +3+| *Hive* 3+| *Trafodion* +| Data Type | Range | Byte(s) | Data Type | Range | Byte(s) +| tinyint + +(signed) | -128 ~ +127 | 1 | tinyint + +(signed) | -128 ~ +127 .2+| 1 +.2+| smallint + +(signed) .2+| -32,768 ~ +32,767 .2+| 2 | tinyint + +(unsigned) | 0 ~ 255 | smallint + +(signed) | -32,768 ~ +32,767 .2+| 2 +.2+| int + +(signed) .2+| -2,147,483,648 ~ +2,147,483,647 .2+| 4 | smallint + +(unsigned) | 0 ~ 65,535 | int + +(signed) | -2,147,483,648 ~ +2,147,483,647 .2+| 4 +.2+| bigint + +(signed) .2+| -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807 .2+| 8 | int + +(unsigned) | 0 ~ 4,294,967,295 | largeint + +(signed) | -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807 .2+| 8 +| / | / | / | largeint + +(unsigned) | 0 ~ 18,446,744,073,709,551,615 |=== -| Hive Type | {project-name} SQL Type -| `tinyint` | `tinyint` -| `tinyint` | `smallint` -| `smallint` | `smallint` -| `int` | `int` -| `bigint` | `largeint` + +[[character_string_data_type_mapping_from_hive_to_trafodion]] +==== Character String Data Type Mapping From Hive to Trafodion + +[cols="2*^.^",options="header"] +|=== +2+| +++<u>Character String</u>+++ Data Type Mapping From Hive to Trafodion +| *Hive* | *Trafodion* | `string` | `varchar(_n_ bytes) character set utf8`^1^ | `varchar` | `varchar` | `char` | `char` +|=== + +1. The value `_n_` is determined by `CQD HIVE_MAX_STRING_LENGTH`. See the +{docs-url}/cqd_reference/index.hmtl[{project-name} Control Query Default (CQD) Reference Guide]. + +[[numeric_data_type_mapping_from_hive_to_trafodion]] +==== Numeric Data Type Mapping From Hive to Trafodion + +[cols="2*^.^",options="header"] +|=== +2+| +++<u>Numeric</u>+++ Data Type Mapping From Hive to Trafodion +| *Hive* | *Trafodion* | `float` | `real` -| `decimal (precision, scale)` | `decimal (precision, scale)`^2^ + -`numeric (precision, scale)`^3^ +| `decimal (precision, scale)` | `decimal (precision, scale)`^1^ + +`numeric (precision, scale)`^2^ | `double` | `float(54)` -| `timestamp` | `timestamp(6)`^4^ +|=== + +1. If p is less than or equal to 18, decimal (precision, scale) is mapped to decimal (precision, scale). +2. If p is greater than 18, decimal (precision, scale) is mapped to numeric (precision, scale). + +[[datetime_data_type_mapping_from_hive_to_trafodion]] +==== Datetime Data Type Mapping From Hive to Trafodion + +[cols="2*^.^",options="header"] +|=== +2+| +++<u>Datetime</u>+++ Data Type Mapping From Hive to Trafodion +| *Hive* | *Trafodion* +| `timestamp` | `timestamp(6)`^1^ | `date` | `date` |=== -1. The value `_n_` is determined by `CQD HIVE_MAX_STRING_LENGTH`. See the -{docs-url}/cqd_reference/index.hmtl[{project-name} Control Query Default (CQD) Reference Guide]. -2. If p is less than or equal to 18, decimal (precision, scale) is mapped to decimal (precision, scale). -3. If p is greater than 18, decimal (precision, scale) is mapped to numeric (precision, scale). -4. Hive supports timestamps with nanosecond resolution (precision of 9). {project-name} SQL supports only microsecond resolution (precision 6). +1. Hive supports timestamps with nanosecond resolution (precision of 9). {project-name} SQL supports only microsecond resolution (precision 6). [[supported_sql_statements_with_hive_tables]] === Supported SQL Statements With Hive Tables
