7.4. Data types#

7.4.1. Name#

Groonga data types

7.4.2. Description#

Groonga identifies data types to store.

A primary key of table and column value belong to some kind of data types in Groonga database. And normally, column values become in common with all records in one table.

A primary key type and column type can be specified Groonga defined types, user defined types or user defined table.

If you specify other table to primary key type, this table becomes subset of the table of primary key type.

If you specify other table to column type, this column becomes reference key of the table of column type.

7.4.3. Builtin types#

The following types are defined as builtin types.

7.4.3.1. Bool#

Boolean type. The possible values are true and false. (default: false)

To store a value by load command, becomes false if you specify false, 0 or empty string, becomes true if you specify others.

7.4.3.2. Int8#

Signed 8bit integer. It’s -128 or more and 127 or less. (default: 0)

7.4.3.3. UInt8#

Unsigned 8bit integer. Is’t 0 or more and 255 or less. (default: 0)

7.4.3.4. Int16#

Signed 16bit integer. It’s -32,768 or more and 32,767 or less. (default: 0)

7.4.3.5. UInt16#

Unsigned 16bit integer. It’s 0 or more and 65,535 or less. (default: 0)

7.4.3.6. Int32#

Signed 32bit integer. It’s -2,147,483,648 or more and 2,147,483,647 or less. (default: 0)

7.4.3.7. UInt32#

Unsigned 32bit integer. It’s 0 or more and 4,294,967,295 or less. (default: 0)

7.4.3.8. Int64#

Signed 64bit integer. It’s -9,223,372,036,854,775,808 or more and 9,223,372,036,854,775,807 or less. (default: 0)

7.4.3.9. UInt64#

Unsigned 64bit integer. It’s 0 or more and 18,446,744,073,709,551,615 or less. (default: 0)

7.4.3.10. Float32#

New in version 10.0.2.

Single-precision floating-point number of IEEE 754 as a real number. (default: 0.0)

See IEEE floating point - Wikipedia, the free encyclopedia or IEEE 754: Standard for Binary Floating-Point for details of IEEE 754 format.

7.4.3.11. Float#

Double-precision floating-point number of IEEE 754 as a real number. (default: 0.0)

See IEEE floating point - Wikipedia, the free encyclopedia or IEEE 754: Standard for Binary Floating-Point for details of IEEE 754 format.

7.4.3.12. Time#

Date and Time, the number of seconds that have elapsed since 1970-01-01 00:00:00 by 64 bit signed integer. (default: 0)

To store a value by load command, specifies the number of elapsed seconds since 1970-01-01 00:00:00. To specify the detailed date and time than seconds, use the decimal.

7.4.3.13. ShortText#

String of 4,095 or less bytes. (default: “”)

7.4.3.14. Text#

String of 65,535 or less bytes. (default: “”)

7.4.3.15. LongText#

String of 2,147,483,647 or less bytes. (default: “”)

7.4.3.16. TokyoGeoPoint#

旧日本測地系による経緯度であり、経度と緯度をミリ秒単位で表現した整数の組により表現します。(デフォルト値: 0x0)

度分秒形式でx度y分z秒となる経度・緯度は、(((x * 60) + y) * 60 + z) * 1000という計算式でミリ秒単位へと変換されます。

load コマンドで値を格納するときは、”ミリ秒単位の経度xミリ秒単位の緯度” もしくは “経度の小数表記x緯度の小数表記” という文字列表現を使って指定します。経度と緯度の区切りとしては、’x’ のほかに ‘,’ を使うことができます。

測地系の詳細については、 測地系 - Wikipedia を参照してください。

7.4.3.17. WGS84GeoPoint#

世界測地系(World Geodetic System, WGS 84)による経緯度であり、経度と緯度をミリ秒単位で表現した整数の組により表現します。(デフォルト値: 0x0)

度分秒形式からミリ秒形式への変換方法や load コマンドにおける指定方法はTokyoGeoPointと同じです。

7.4.4. Limitations about types#

7.4.4.1. Types that can’t be specified in primary key of table#

Text and LongText can’t be specified in primary key of table.

7.4.4.2. ベクターとして格納できない型#

Groongaのカラムは、ある型のベクターを保存することができます。しかし、ShortText, Text, LongTextの3つの型についてはベクターとして保存したり出力したりすることはできますが、検索条件やドリルダウン条件に指定することができません。

テーブル型は、ベクターとして格納することができます。よって、ShortTextのベクターを検索条件やドリルダウン条件に使用したい場合には、主キーがShortText型のテーブルを別途作成し、そのテーブルを型として利用します。