Kouhei Sutou
null+****@clear*****
Sun Aug 30 23:08:11 JST 2015
Kouhei Sutou 2015-08-30 23:08:11 +0900 (Sun, 30 Aug 2015) New Revision: 653a85ac3db2113f75778c76c3d197a6ce093944 https://github.com/groonga/groonga/commit/653a85ac3db2113f75778c76c3d197a6ce093944 Message: doc: document column_copy Added files: doc/source/example/reference/commands/column_copy/change_column_type.log doc/source/example/reference/commands/column_copy/change_column_type_setup.log doc/source/example/reference/commands/column_copy/change_column_value_type.log doc/source/example/reference/commands/column_copy/change_column_value_type_setup.log doc/source/example/reference/commands/column_copy/change_table_key_type.log doc/source/example/reference/commands/column_copy/change_table_key_type_setup.log doc/source/example/reference/commands/column_copy/change_table_type.log doc/source/example/reference/commands/column_copy/change_table_type_setup.log doc/source/example/reference/commands/column_copy/from_table.log doc/source/example/reference/commands/column_copy/from_table_setup.log doc/source/example/reference/commands/column_copy/move_column.log doc/source/example/reference/commands/column_copy/move_column_setup.log doc/source/example/reference/commands/column_copy/to_table.log doc/source/example/reference/commands/column_copy/to_table_setup.log doc/source/reference/commands/column_copy.rst Modified files: doc/locale/ja/LC_MESSAGES/reference.po Modified: doc/locale/ja/LC_MESSAGES/reference.po (+373 -42) =================================================================== --- doc/locale/ja/LC_MESSAGES/reference.po 2015-08-30 19:43:30 +0900 (4704d8f) +++ doc/locale/ja/LC_MESSAGES/reference.po 2015-08-30 23:08:11 +0900 (d29cc8a) @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.2.1\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2015-08-30 13:44+0900\n" +"PO-Revision-Date: 2015-08-30 23:07+0900\n" "Last-Translator: Masafumi Yokoyama <yokoyama �� clear-code.com>\n" "Language-Team: Japanese\n" "Language: ja\n" @@ -3790,6 +3790,366 @@ msgstr "" msgid ":doc:`load`" msgstr "" +msgid "``column_copy``" +msgstr "" + +msgid "``column_copy`` copies all column values to other column." +msgstr "``column_copy`` はカラムのすべての値を他のカラムにコピーします。" + +msgid "You can implement the following features with this command:" +msgstr "このコマンドを使うと、次のような機能を実装できます。" + +msgid "Changing column configuration" +msgstr "カラムの設定を変更" + +msgid "Changing table configuration" +msgstr "テーブルの設定を変更" + +# 1e3c30ee4f62480c94f728efe9801121 +msgid "You can change column configuration by the following steps:" +msgstr "次のステップでカラムの設定を変更できます。" + +msgid "Create a new column with new configuration" +msgstr "新しい設定で新しいカラムを作る" + +msgid "Copy all values from the current column to the new column" +msgstr "現在のカラムから新しいカラムへすべての値をコピーする" + +msgid "Remove the current column" +msgstr "現在のカラムを削除する" + +msgid "Rename the new column to the current column" +msgstr "新しいカラムを現在のカラムにリネームする" + +# 1e3c30ee4f62480c94f728efe9801121 +msgid "You can change table configuration by the following steps:" +msgstr "次のステップでテーブルの設定を変更できます。" + +msgid "Create a new table with new configuration" +msgstr "新しい設定で新しいテーブルを作る" + +msgid "Create all same columns to the new table" +msgstr "すべてのカラムを同じ設定で新しいテーブルに作る" + +msgid "Copy all column values from the current table to the new table" +msgstr "現在のテーブルから新しいテーブルへすべてのカラムの値をコピーする" + +msgid "Remove the current table" +msgstr "現在のテーブルを削除する" + +msgid "Rename the new table to the current table" +msgstr "新しいテーブルを現在のテーブルにリネームする" + +msgid "Concrete examples are showed later." +msgstr "具体例は後で示します。" + +msgid "" +"You can't copy column values from a ``TABLE_NO_KEY`` table to anothertable. " +"And you can't copy column values to a ``TABLE_NO_KEY`` tablefrom another " +"table. Because Groonga can't map records without recordkey." +msgstr "" +"``TABLE_NO_KEY`` テーブルから他のテーブルにカラムの値をコピーすることはできま" +"せん。また、他のテーブルから ``TABLE_NO_KEY`` テーブルにカラムの値をコピーす" +"ることもできません。これは、レコードのキーがないとどのレコードとどのレコード" +"を対応させればよいか決められないからです。" + +msgid "" +"You can copy column values from a ``TABLE_NO_KEY`` table to the same " +"``TABLE_NO_KEY`` table." +msgstr "" +"``TABLE_NO_KEY`` テーブルから同じ ``TABLE_NO_KEY`` テーブルにカラムの値をコ" +"ピーすることはできます。" + +msgid "" +"You can copy column values from a ``TABLE_HASH_KEY`` / ``TABLE_PAT_KEY`` / " +"``TABLE_DAT_KEY`` table to the same or another ``TABLE_HASH_KEY`` / " +"``TABLE_PAT_KEY`` / ``TABLE_DAT_KEY`` table." +msgstr "" +"``TABLE_HASH_KEY`` / ``TABLE_PAT_KEY`` / ``TABLE_DAT_KEY`` テーブルから他の " +"``TABLE_HASH_KEY`` / ``TABLE_PAT_KEY`` / ``TABLE_DAT_KEY`` テーブルにカラムの" +"値をコピーすることができます。同じテーブルに対してもできます。" + +msgid "This command takes four parameters." +msgstr "このコマンドには4つの引数があります。" + +msgid "All parameters are required::" +msgstr "すべての引数は必須です::" + +msgid "Here are use cases of this command:" +msgstr "このコマンドのユースケースは次の通りです。" + +msgid "How to change column configuration" +msgstr "カラムの設定の変更方法" + +msgid "" +"You can change column value type. For example, you can change ``UInt32`` " +"column value to ``ShortText`` column value." +msgstr "" +"カラムの値の型を変えることができます。たとえば、カラムの型を ``UInt32`` から " +"``ShortText`` に変えることができます。" + +msgid "" +"You can change column type. For example, you can change ``COLUMN_SCALAR`` " +"column to ``COLUMN_VECTOR`` column." +msgstr "" +"カラムの種類を変えることができます。たとえば、 ``COLUMN_SCALAR`` カラムを " +"``COLUMN_VECTOR`` カラムに変えることができます。" + +msgid "" +"You can move a column to other table. For example, you can move " +"``high_score`` column to ``Users`` table from ``Players`` table." +msgstr "" +"カラムを他のテーブルに移動することができます。たとえば、 ``high_score`` カラ" +"ムを ``Players`` テーブルから ``Users`` テーブルに移動できます。" + +msgid "Here are basic steps to change column configuration:" +msgstr "カラムの設定を変更する基本的なステップは次の通りです。" + +msgid "" +"Here is an example to change column value type to ``Int32`` from " +"``ShortText``." +msgstr "カラムの値の型を ``ShortText`` から ``Int32`` に変更する例です。" + +msgid "Here are schema and data:" +msgstr "スキーマ定義とサンプルデータは以下の通りです。" + +msgid "" +"The following commands change ``Logs.serial`` column value type to " +"``ShortText`` from ``Int32``:" +msgstr "" +"次のコマンドは ``Logs.serial`` カラムの値の型を ``Int32`` から ``ShortText`` " +"に変えています。" + +msgid "" +"You can find ``Logs.serial`` stores ``ShortText`` value from the response of " +"``select``." +msgstr "" +"``select`` のレスポンスを見ると ``Logs.serial`` が ``ShortText`` の値を保存し" +"ていることがわかります。" + +msgid "" +"Here is an example to change column type to ``COLUMN_VECTOR`` from " +"``COLUMN_SCALAR``." +msgstr "" +"カラムの種類を ``COLUMN_SCALAR`` から ``COLUMN_VECTOR`` に変更する例です。" + +msgid "" +"The following commands change ``Entries.tag`` column to ``COLUMN_VECTOR`` " +"from ``COLUMN_SCALAR``:" +msgstr "" +"次のコマンドは ``Entries.tag`` を ``COLUMN_SCALAR`` から ``COLUMN_VECTOR`` へ" +"変更します。" + +msgid "" +"You can find ``Entries.tag`` stores ``COLUMN_VECTOR`` value from the " +"response of ``select``." +msgstr "" +"``select`` のレスポンスを見ると、 ``Entries.tag`` が ``COLUMN_VECTOR`` の値を" +"保存していることがわかります。" + +msgid "" +"Here is an example to move ``high_score`` column to ``Users`` table from " +"``Players`` table." +msgstr "" +"``high_score`` カラムを ``Players`` テーブルから ``Users`` テーブルに移動する" +"例です。" + +msgid "" +"The following commands move ``high_score`` column to ``Users`` table from " +"``Players`` table:" +msgstr "" +"次のコマンドは ``high_score`` カラムを ``Players`` テーブルから ``Users`` " +"テーブルに移動します。" + +msgid "" +"You can find ``Users.high_score`` is moved from ``Players.high_score`` from " +"the response of ``select``." +msgstr "" +"``select`` の結果を見ると、 ``Players.high_score`` を ``Users.high_score`` に" +"移動できていることがわかります。" + +msgid "How to change table configuration" +msgstr "テーブルの設定の変更方法" + +msgid "" +"You can change table key type. For example, you can change key type to " +"``ShortText`` from ``Int32``." +msgstr "" +"テーブルのキーの型を変更できます。たとえば、キーの型を ``Int32`` から " +"``ShortText`` に変更できます。" + +msgid "" +"You can change table type. For example, you can change ``TABLE_HASH_KEY`` " +"table to ``TABLE_PAT_KEY`` table." +msgstr "" +"テーブルの種類を変更できます。たとえば、 ``TABLE_HASH_KEY`` テーブルを " +"``TABLE_PAT_KEY`` テーブルに変更できます。" + +msgid "" +"You can also change other options such as default tokenizer and normalizer. " +"For example, you can change default tokenizer to " +"``TokenBigramSplitSymbolAlphaDigit`` from ``TokenBigrm``." +msgstr "" +"デフォルトトークナイザーやノーマライザーなど他のオプションも変更できます。た" +"とえば、デフォルトトークナイザーを ``TokenBigrm`` から " +"``TokenBigramSplitSymbolAlphaDigit`` に変更できます。" + +msgid "" +"You can't change ``TABLE_NO_KEY`` table. Because ``TABLE_NO_KEY`` doesn't " +"have record key. Groonga can't identify copy destination record without " +"record key." +msgstr "" +"``TABLE_NO_KEY`` テーブルは変更できません。なぜなら、 ``TABLE_NO_KEY`` レコー" +"ドのキーがないからです。レコードのキーがないとコピー先のレコードを特定するこ" +"とができません。" + +msgid "Here are basic steps to change table configuration:" +msgstr "テーブルの設定を変更する基本的なステップは次の通りです。" + +msgid "" +"Here is an example to change table key type to ``ShortText`` from ``Int32``." +msgstr "テーブルのキーの型を ``Int32`` から ``ShortText`` に変更する例です。" + +msgid "" +"The following commands change ``IDs`` table key type to ``ShortText`` from " +"``Int32``:" +msgstr "" +"次のコマンドは ``IDs`` テーブルのキーの型を ``Int32`` から ``ShortText`` に変" +"更します。" + +msgid "" +"You can find ``IDs`` stores ``ShortText`` key from the response of " +"``select``." +msgstr "" +"``select`` のレスポンスを見ると、 ``IDs`` は ``ShortText`` のキーを保存してい" +"ることがわかります。" + +msgid "" +"Here is an example to change table type to ``TABLE_PAT_KEY`` from " +"``TABLE_HASH_KEY``." +msgstr "" +"テーブルの種類を ``TABLE_HASH_KEY`` から ``TABLE_PAT_KEY`` に変更する例です。" + +msgid "" +"The following commands change ``Names`` table to ``TABLE_PAT_KEY`` from " +"``TABLE_HASH_KEY``:" +msgstr "" +"次のコマンドは ``Names`` テーブルを ``TABLE_HASH_KEY`` から " +"``TABLE_PAT_KEY`` に変更します。" + +msgid "" +"You can find ``Names`` is a ``TABLE_PAT_KEY`` because ``select`` can use :" +"ref:`script-syntax-prefix-search-operator`. You can't use :ref:`script-" +"syntax-prefix-search-operator` with ``TABLE_HASH_KEY``." +msgstr "" +"``select`` で :ref:`script-syntax-prefix-search-operator` を使えているので、 " +"``Names`` が ``TABLE_PAT_KEY`` に変わったことがわかります。" +"``TABLE_HASH_KEY`` では :ref:`script-syntax-prefix-search-operator` を使えま" +"せん。" + +msgid "This section describes parameters." +msgstr "このセクションでは引数について説明します。" + +msgid "Required parameters" +msgstr "必須引数" + +msgid "All parameters are required." +msgstr "すべての引数は必須です。" + +msgid "``from_table``" +msgstr "" + +msgid "Specifies the table name of source column." +msgstr "ソースカラムのテーブル名を指定します。" + +msgid "You can specify any table including ``TABLE_NO_KEY`` table." +msgstr "``TABLE_NO_KEY`` テーブルを含むすべてのテーブルを指定できます。" + +msgid "" +"If you specify ``TABLE_NO_KEY`` table, :ref:`column-copy-to-table` must be " +"the same table." +msgstr "" +"``TABLE_NO_KEY`` テーブルを指定するときは、 :ref:`column-copy-to-table` には" +"同じテーブルを指定しなければいけません。" + +msgid "Here is an example to use ``from_table``." +msgstr "``from_table`` の使用例です。" + +msgid "You can copy all values to ``to_column`` from ``from_column``:" +msgstr "すべての値を ``from_column`` から ``to_column`` にコピーできます。" + +msgid "``from_name``" +msgstr "" + +msgid "Specifies the column name to be copied values." +msgstr "値をコピーするカラムの名前を指定します。" + +# d383cb1889334034b283ca5b0328c4da +msgid "See :ref:`column-copy-from-table` for example." +msgstr "具体例は :ref:`column-copy-from-table` を見てください。" + +msgid "``to_table``" +msgstr "" + +msgid "Specifies the table name of destination column." +msgstr "コピー先のカラムのテーブル名を指定します。" + +msgid "" +"You can specify the same table name as :ref:`column-copy-from-table` when " +"you want to copy column values in the same table." +msgstr "" +"同じテーブル内でカラムの値をコピーしたいときは、 :ref:`column-copy-from-" +"table` に指定した名前と同じ名前を指定します。" + +msgid "" +"You can't specify ``TABLE_NO_KEY`` table to ``to_table`` because Groonga " +"can't identify destination records without record key." +msgstr "" +"``to_table`` に ``TABLE_NO_KEY`` テーブルを指定することはできません。なぜな" +"ら、レコードのキーがないとGroongaはコピー先のレコードを特定できないからです。" + +msgid "" +"There is one exception. If you specify the same name as ``from_table`` to " +"``to_table``, you can use ``TABLE_NO_KEY`` table as ``to_table``. Because " +"Groonga can identify destination records when source table and destination " +"table is the same table." +msgstr "" +"例外が1つあります。 ``from_table`` と ``to_table`` に同じテーブル名を指定した" +"場合は、 ``to_table`` に ``TABLE_NO_KEY`` テーブルを指定できます。なぜなら、" +"コピー元テーブルとコピー先テーブルが同じテーブルならGroongaはコピー先のレコー" +"ドを得適できるからです。" + +msgid "Here is an example to use ``to_table``." +msgstr "``to_table`` を使った例です。" + +msgid "You can copy all values to ``ToTable.to_column`` from ``Table.column``:" +msgstr "" +"``Table.column`` から ``ToTable.to_column`` にすべての値をコピーできます。" + +msgid "``to_name``" +msgstr "" + +msgid "Specifies the destination column name." +msgstr "コピー先のカラム名を指定します。" + +# d383cb1889334034b283ca5b0328c4da +msgid "See :ref:`column-copy-to-table` for example." +msgstr "具体例は :ref:`column-copy-to-table` を見てください。" + +msgid "Optional parameters" +msgstr "省略可能引数" + +msgid "The command returns ``true`` as body on success such as::" +msgstr "このコマンドが成功したときは以下のようにボディは ``true`` になります::" + +msgid "If the command fails, error details are in ``HEADER``." +msgstr "このコマンドが失敗すると、 ``HEADER`` にエラーの詳細が含まれます。" + +msgid "See :doc:`/reference/command/output_format` for ``HEADER``." +msgstr "" +"``HEADER`` については :doc:`/reference/command/output_format` を参照してくだ" +"さい。" + msgid "``column_create``" msgstr "" @@ -3950,12 +4310,6 @@ msgstr "以下は ``column_list`` コマンドの簡単な使用例です。" msgid "This section describes parameters of ``column_list``." msgstr "このセクションでは ``column_list`` の引数について説明します。" -msgid "Required parameters" -msgstr "必須引数" - -msgid "All parameters are required." -msgstr "すべての引数は必須です。" - msgid "Specifies the name of table to be listed columns." msgstr "カラムの一覧を取得するテーブルの名前を指定します。" @@ -4260,9 +4614,6 @@ msgstr "" msgid "This command takes three parameters." msgstr "このコマンドの引数は3つです。" -msgid "All parameters are required::" -msgstr "すべての引数は必須です::" - msgid "Here is a simple example of ``column_rename`` command." msgstr "以下は ``column_rename`` コマンドの簡単な使用例です。" @@ -4341,23 +4692,9 @@ msgstr "" msgid "There is no required parameters." msgstr "必須の引数はありません。" -msgid "Optional parameters" -msgstr "省略可能引数" - msgid "There is no optional parameters." msgstr "省略可能な引数はありません。" -msgid "The command returns ``true`` as body on success such as::" -msgstr "このコマンドが成功したときは以下のようにボディは ``true`` になります::" - -msgid "If the command fails, error details are in ``HEADER``." -msgstr "このコマンドが失敗すると、 ``HEADER`` にエラーの詳細が含まれます。" - -msgid "See :doc:`/reference/command/output_format` for ``HEADER``." -msgstr "" -"``HEADER`` については :doc:`/reference/command/output_format` を参照してくだ" -"さい。" - msgid "``define_selector``" msgstr "" @@ -5485,9 +5822,6 @@ msgstr "" "``logical_parameters`` は、新しい値を設定するときは、新しい値を設定する前の値" "を返します。" -msgid "This section describes parameters of ``logical_parameters``." -msgstr "このセクションでは ``logical_parameters`` の引数について説明します。" - msgid "There is one optional parameter." msgstr "省略可能な引数が1つあります。" @@ -5640,6 +5974,18 @@ msgid "It doesn't control whether existing cached result is used or not." msgstr "" "これは既存のキャッシュされた結果を使うかどうかを指定するものではありません。" +msgid "``no``" +msgstr "" + +msgid "Don't cache the output of this query." +msgstr "このクエリーの出力をキャッシュしない。" + +msgid "``yes``" +msgstr "" + +msgid "Cache the output of this query. It's the default value." +msgstr "このクエリーの出力をキャッシュする。デフォルト値。" + # 26f6896f991341569e381e95aebf1f73 msgid "``logical_select``" msgstr "" @@ -6338,9 +6684,6 @@ msgstr "" "論理テーブル名として ``Logs`` を指定すると昇順ですべてのシャード名を取得でき" "ます。" -msgid "This section describes parameters." -msgstr "このセクションでは引数について説明します。" - msgid "There is one required parameter." msgstr "必須の引数が1つあります。" @@ -8893,18 +9236,6 @@ msgid ":ref:`select-drilldown-label-keys` uses the following output format::" msgstr "" ":ref:`select-drilldown-label-keys` の出力フォーマットは以下の通りです::" -msgid "``no``" -msgstr "" - -msgid "Don't cache the output of this query." -msgstr "このクエリーの出力をキャッシュしない。" - -msgid "``yes``" -msgstr "" - -msgid "Cache the output of this query. It's the default value." -msgstr "このクエリーの出力をキャッシュする。デフォルト値。" - msgid "Here is an example to disable caching the result of this query:" msgstr "このクエリーの結果をキャッシュしないようにする例です。" Added: doc/source/example/reference/commands/column_copy/change_column_type.log (+46 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_column_type.log 2015-08-30 23:08:11 +0900 (2332f7f) @@ -0,0 +1,46 @@ +Execution example:: + + column_create Entries new_tag COLUMN_VECTOR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_copy Entries tag Entries new_tag + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_remove Entries tag + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_rename Entries new_tag tag + # [[0, 1337566253.89858, 0.000355720520019531], true] + select Entries + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_id", + # "UInt32" + # ], + # [ + # "_key", + # "ShortText" + # ], + # [ + # "tag", + # "ShortText" + # ] + # ], + # [ + # 1, + # "entry1", + # [ + # "Groonga" + # ] + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/change_column_type_setup.log (+11 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_column_type_setup.log 2015-08-30 23:08:11 +0900 (e34a7fe) @@ -0,0 +1,11 @@ +Execution example:: + + table_create Entries TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Entries tag COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table Entries + [ + {"_key": "entry1", "tag": "Groonga"} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 1] Added: doc/source/example/reference/commands/column_copy/change_column_value_type.log (+44 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_column_value_type.log 2015-08-30 23:08:11 +0900 (7defb37) @@ -0,0 +1,44 @@ +Execution example:: + + column_create Logs new_serial COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_copy Logs serial Logs new_serial + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_remove Logs serial + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_rename Logs new_serial serial + # [[0, 1337566253.89858, 0.000355720520019531], true] + select Logs + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_id", + # "UInt32" + # ], + # [ + # "_key", + # "ShortText" + # ], + # [ + # "serial", + # "ShortText" + # ] + # ], + # [ + # 1, + # "log1", + # "1" + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/change_column_value_type_setup.log (+11 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_column_value_type_setup.log 2015-08-30 23:08:11 +0900 (80e4077) @@ -0,0 +1,11 @@ +Execution example:: + + table_create Logs TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs serial COLUMN_SCALAR Int32 + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table Logs + [ + {"_key": "log1", "serial": 1} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 1] Added: doc/source/example/reference/commands/column_copy/change_table_key_type.log (+55 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_table_key_type.log 2015-08-30 23:08:11 +0900 (8851cc6) @@ -0,0 +1,55 @@ +Execution example:: + + table_create NewIDs TABLE_HASH_KEY Int32 + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create NewIDs label COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create NewIDs used COLUMN_SCALAR Bool + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_copy IDs label NewIDs label + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_copy IDs used NewIDs used + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_remove IDs + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_rename NewIDs IDs + # [[0, 1337566253.89858, 0.000355720520019531], true] + select IDs + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_id", + # "UInt32" + # ], + # [ + # "_key", + # "Int32" + # ], + # [ + # "label", + # "ShortText" + # ], + # [ + # "used", + # "Bool" + # ] + # ], + # [ + # 1, + # 100, + # "ID 100", + # true + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/change_table_key_type_setup.log (+13 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_table_key_type_setup.log 2015-08-30 23:08:11 +0900 (2b0246f) @@ -0,0 +1,13 @@ +Execution example:: + + table_create IDs TABLE_HASH_KEY Int32 + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create IDs label COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create IDs used COLUMN_SCALAR Bool + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table IDs + [ + {"_key": 100, "label": "ID 100", used: true} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 1] Added: doc/source/example/reference/commands/column_copy/change_table_type.log (+41 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_table_type.log 2015-08-30 23:08:11 +0900 (4384186) @@ -0,0 +1,41 @@ +Execution example:: + + table_create NewNames TABLE_PAT_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create NewNames used COLUMN_SCALAR Bool + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_copy Names used NewNames used + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_remove Names + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_rename NewNames Names + # [[0, 1337566253.89858, 0.000355720520019531], true] + select Names --filter '_key @^ "ali"' + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 0 + # ], + # [ + # [ + # "_id", + # "UInt32" + # ], + # [ + # "_key", + # "ShortText" + # ], + # [ + # "used", + # "Bool" + # ] + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/change_table_type_setup.log (+11 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/change_table_type_setup.log 2015-08-30 23:08:11 +0900 (8d58329) @@ -0,0 +1,11 @@ +Execution example:: + + table_create Names TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Names used COLUMN_SCALAR Bool + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table Entries + [ + {"_key": "alice", "used": false} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 1] Added: doc/source/example/reference/commands/column_copy/from_table.log (+38 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/from_table.log 2015-08-30 23:08:11 +0900 (c5b5a7f) @@ -0,0 +1,38 @@ +Execution example:: + + column_copy FromTable from_column FromTable to_column + # [[0, 1337566253.89858, 0.000355720520019531], true] + select FromTable --output_columns _key,from_column,to_column + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ], + # [ + # "from_column", + # "ShortText" + # ], + # [ + # "to_column", + # "ShortText" + # ] + # ], + # [ + # "key1", + # "value1", + # "value1" + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/from_table_setup.log (+47 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/from_table_setup.log 2015-08-30 23:08:11 +0900 (3c0d2dd) @@ -0,0 +1,47 @@ +Execution example:: + + table_create FromTable TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create FromTable from_column COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create FromTable to_column COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table FromTable + [ + {"_key": "key1", "from_column": "value1"} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 1] + select FromTable --output_columns _key,from_column,to_column + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ], + # [ + # "from_column", + # "ShortText" + # ], + # [ + # "to_column", + # "ShortText" + # ] + # ], + # [ + # "key1", + # "value1", + # "" + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/move_column.log (+44 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/move_column.log 2015-08-30 23:08:11 +0900 (5e5af8b) @@ -0,0 +1,44 @@ +Execution example:: + + table_create Users TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Users high_score COLUMN_SCALAR Int32 + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_copy Players high_score Users high_score + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_remove Players high_score + # [[0, 1337566253.89858, 0.000355720520019531], true] + select Users + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_id", + # "UInt32" + # ], + # [ + # "_key", + # "ShortText" + # ], + # [ + # "high_score", + # "Int32" + # ] + # ], + # [ + # 1, + # "player1", + # 100 + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/move_column_setup.log (+11 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/move_column_setup.log 2015-08-30 23:08:11 +0900 (e9c2b43) @@ -0,0 +1,11 @@ +Execution example:: + + table_create Players TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Players high_score COLUMN_SCALAR Int32 + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table Players + [ + {"_key": "player1", "high_score": 100} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 1] Added: doc/source/example/reference/commands/column_copy/to_table.log (+33 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/to_table.log 2015-08-30 23:08:11 +0900 (22d34d6) @@ -0,0 +1,33 @@ +Execution example:: + + column_copy Table column ToTable to_column + # [[0, 1337566253.89858, 0.000355720520019531], true] + select ToTable --output_columns _key,to_column + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ], + # [ + # "to_column", + # "ShortText" + # ] + # ], + # [ + # "key1", + # "value1" + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/column_copy/to_table_setup.log (+15 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/column_copy/to_table_setup.log 2015-08-30 23:08:11 +0900 (d15bf5f) @@ -0,0 +1,15 @@ +Execution example:: + + table_create Table TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Table column COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create ToTable TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create ToTable to_column COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table Table + [ + {"_key": "key1", "column": "value1"} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 1] Added: doc/source/reference/commands/column_copy.rst (+381 -0) 100644 =================================================================== --- /dev/null +++ doc/source/reference/commands/column_copy.rst 2015-08-30 23:08:11 +0900 (f8a70fe) @@ -0,0 +1,381 @@ +.. -*- rst -*- + +.. highlightlang:: none + +.. groonga-command +.. database: commands_select + +``column_copy`` +=============== + +Summary +------- + +.. versionadded:: 5.0.7 + +``column_copy`` copies all column values to other column. + +You can implement the following features with this command: + + * Changing column configuration + * Changing table configuration + +You can change column configuration by the following steps: + + 1. Create a new column with new configuration + 2. Copy all values from the current column to the new column + 3. Remove the current column + 4. Rename the new column to the current column + +You can change table configuration by the following steps: + + 1. Create a new table with new configuration + 2. Create all same columns to the new table + 3. Copy all column values from the current table to the new table + 4. Remove the current table + 5. Rename the new table to the current table + +Concrete examples are showed later. + +You can't copy column values from a ``TABLE_NO_KEY`` table to another +table. And you can't copy column values to a ``TABLE_NO_KEY`` table +from another table. Because Groonga can't map records without record +key. + +You can copy column values from a ``TABLE_NO_KEY`` table to the same +``TABLE_NO_KEY`` table. + +You can copy column values from a ``TABLE_HASH_KEY`` / +``TABLE_PAT_KEY`` / ``TABLE_DAT_KEY`` table to the same or another +``TABLE_HASH_KEY`` / ``TABLE_PAT_KEY`` / ``TABLE_DAT_KEY`` table. + +Syntax +------ + +This command takes four parameters. + +All parameters are required:: + + column_copy from_table + from_name + to_table + to_name + +Usage +----- + +Here are use cases of this command: + + * Changing column configuration + * Changing table configuration + +How to change column configuration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can change column value type. For example, you can change +``UInt32`` column value to ``ShortText`` column value. + +You can change column type. For example, you can change +``COLUMN_SCALAR`` column to ``COLUMN_VECTOR`` column. + +You can move a column to other table. For example, you can move +``high_score`` column to ``Users`` table from ``Players`` table. + +Here are basic steps to change column configuration: + + 1. Create a new column with new configuration + 2. Copy all values from the current column to the new column + 3. Remove the current column + 4. Rename the new column to the current column + +Here is an example to change column value type to ``Int32`` from +``ShortText``. + +Here are schema and data: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_column_value_type_setup.log +.. table_create Logs TABLE_HASH_KEY ShortText +.. column_create Logs serial COLUMN_SCALAR Int32 +.. load --table Logs +.. [ +.. {"_key": "log1", "serial": 1} +.. ] + +The following commands change ``Logs.serial`` column value type to +``ShortText`` from ``Int32``: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_column_value_type.log +.. column_create Logs new_serial COLUMN_SCALAR ShortText +.. column_copy Logs serial Logs new_serial +.. column_remove Logs serial +.. column_rename Logs new_serial serial +.. select Logs + +You can find ``Logs.serial`` stores ``ShortText`` value from the +response of ``select``. + +Here is an example to change column type to ``COLUMN_VECTOR`` from +``COLUMN_SCALAR``. + +Here are schema and data: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_column_type_setup.log +.. table_create Entries TABLE_HASH_KEY ShortText +.. column_create Entries tag COLUMN_SCALAR ShortText +.. load --table Entries +.. [ +.. {"_key": "entry1", "tag": "Groonga"} +.. ] + +The following commands change ``Entries.tag`` column to +``COLUMN_VECTOR`` from ``COLUMN_SCALAR``: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_column_type.log +.. column_create Entries new_tag COLUMN_VECTOR ShortText +.. column_copy Entries tag Entries new_tag +.. column_remove Entries tag +.. column_rename Entries new_tag tag +.. select Entries + +You can find ``Entries.tag`` stores ``COLUMN_VECTOR`` value from the +response of ``select``. + +Here is an example to move ``high_score`` column to ``Users`` table +from ``Players`` table. + +Here are schema and data: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/move_column_setup.log +.. table_create Players TABLE_HASH_KEY ShortText +.. column_create Players high_score COLUMN_SCALAR Int32 +.. load --table Players +.. [ +.. {"_key": "player1", "high_score": 100} +.. ] + +The following commands move ``high_score`` column to ``Users`` table +from ``Players`` table: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/move_column.log +.. table_create Users TABLE_HASH_KEY ShortText +.. column_create Users high_score COLUMN_SCALAR Int32 +.. column_copy Players high_score Users high_score +.. column_remove Players high_score +.. select Users + +You can find ``Users.high_score`` is moved from ``Players.high_score`` +from the response of ``select``. + +How to change table configuration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can change table key type. For example, you can change +key type to ``ShortText`` from ``Int32``. + +You can change table type. For example, you can change +``TABLE_HASH_KEY`` table to ``TABLE_PAT_KEY`` table. + +You can also change other options such as default tokenizer and +normalizer. For example, you can change default tokenizer to +``TokenBigramSplitSymbolAlphaDigit`` from ``TokenBigrm``. + +.. note:: + + You can't change ``TABLE_NO_KEY`` table. Because ``TABLE_NO_KEY`` + doesn't have record key. Groonga can't identify copy destination + record without record key. + +Here are basic steps to change table configuration: + + 1. Create a new table with new configuration + 2. Create all same columns to the new table + 3. Copy all column values from the current table to the new table + 4. Remove the current table + 5. Rename the new table to the current table + +Here is an example to change table key type to ``ShortText`` from +``Int32``. + +Here are schema and data: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_table_key_type_setup.log +.. table_create IDs TABLE_HASH_KEY Int32 +.. column_create IDs label COLUMN_SCALAR ShortText +.. column_create IDs used COLUMN_SCALAR Bool +.. load --table IDs +.. [ +.. {"_key": 100, "label": "ID 100", used: true} +.. ] + +The following commands change ``IDs`` table key type to ``ShortText`` +from ``Int32``: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_table_key_type.log +.. table_create NewIDs TABLE_HASH_KEY Int32 +.. column_create NewIDs label COLUMN_SCALAR ShortText +.. column_create NewIDs used COLUMN_SCALAR Bool +.. column_copy IDs label NewIDs label +.. column_copy IDs used NewIDs used +.. table_remove IDs +.. table_rename NewIDs IDs +.. select IDs + +You can find ``IDs`` stores ``ShortText`` key from the response of +``select``. + +Here is an example to change table type to ``TABLE_PAT_KEY`` from +``TABLE_HASH_KEY``. + +Here are schema and data: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_table_type_setup.log +.. table_create Names TABLE_HASH_KEY ShortText +.. column_create Names used COLUMN_SCALAR Bool +.. load --table Entries +.. [ +.. {"_key": "alice", "used": false} +.. ] + +The following commands change ``Names`` table to ``TABLE_PAT_KEY`` +from ``TABLE_HASH_KEY``: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/change_table_type.log +.. table_create NewNames TABLE_PAT_KEY ShortText +.. column_create NewNames used COLUMN_SCALAR Bool +.. column_copy Names used NewNames used +.. table_remove Names +.. table_rename NewNames Names +.. select Names --filter '_key @^ "ali"' + +You can find ``Names`` is a ``TABLE_PAT_KEY`` because ``select`` can +use :ref:`script-syntax-prefix-search-operator`. You can't use +:ref:`script-syntax-prefix-search-operator` with ``TABLE_HASH_KEY``. + +Parameters +---------- + +This section describes parameters. + +Required parameters +^^^^^^^^^^^^^^^^^^^ + +All parameters are required. + +.. _column-copy-from-table: + +``from_table`` +"""""""""""""" + +Specifies the table name of source column. + +You can specify any table including ``TABLE_NO_KEY`` table. + +If you specify ``TABLE_NO_KEY`` table, :ref:`column-copy-to-table` +must be the same table. + +Here is an example to use ``from_table``. + +Here are schema and data: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/from_table_setup.log +.. table_create FromTable TABLE_HASH_KEY ShortText +.. column_create FromTable from_column COLUMN_SCALAR ShortText +.. column_create FromTable to_column COLUMN_SCALAR ShortText +.. load --table FromTable +.. [ +.. {"_key": "key1", "from_column": "value1"} +.. ] +.. select FromTable --output_columns _key,from_column,to_column + +You can copy all values to ``to_column`` from ``from_column``: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/from_table.log +.. column_copy FromTable from_column FromTable to_column +.. select FromTable --output_columns _key,from_column,to_column + +.. _column-copy-from-name: + +``from_name`` +""""""""""""" + +Specifies the column name to be copied values. + +See :ref:`column-copy-from-table` for example. + +.. _column-copy-to-table: + +``to_table`` +"""""""""""" + +Specifies the table name of destination column. + +You can specify the same table name as :ref:`column-copy-from-table` +when you want to copy column values in the same table. + +You can't specify ``TABLE_NO_KEY`` table to ``to_table`` because +Groonga can't identify destination records without record key. + +There is one exception. If you specify the same name as ``from_table`` +to ``to_table``, you can use ``TABLE_NO_KEY`` table as +``to_table``. Because Groonga can identify destination records when +source table and destination table is the same table. + +Here is an example to use ``to_table``. + +Here are schema and data: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/to_table_setup.log +.. table_create Table TABLE_HASH_KEY ShortText +.. column_create Table column COLUMN_SCALAR ShortText +.. table_create ToTable TABLE_HASH_KEY ShortText +.. column_create ToTable to_column COLUMN_SCALAR ShortText +.. load --table Table +.. [ +.. {"_key": "key1", "column": "value1"} +.. ] + +You can copy all values to ``ToTable.to_column`` from +``Table.column``: + +.. groonga-command +.. include:: ../../example/reference/commands/column_copy/to_table.log +.. column_copy Table column ToTable to_column +.. select ToTable --output_columns _key,to_column + +.. _column-copy-to-name: + +``to_name`` +""""""""""" + +Specifies the destination column name. + +See :ref:`column-copy-to-table` for example. + +Optional parameters +^^^^^^^^^^^^^^^^^^^ + +There is no optional parameters. + +Return value +------------ + +The command returns ``true`` as body on success such as:: + + [HEADER, true] + +If the command fails, error details are in ``HEADER``. + +See :doc:`/reference/command/output_format` for ``HEADER``. -------------- next part -------------- HTML����������������������������... Download