File: column_create.rst

package info (click to toggle)
groonga 15.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 163,080 kB
  • sloc: ansic: 770,564; cpp: 48,925; ruby: 40,447; javascript: 10,250; yacc: 7,045; sh: 5,602; python: 2,821; makefile: 1,672
file content (1918 lines) | stat: -rw-r--r-- 66,952 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
.. -*- rst -*-

.. groonga-command
.. database: commands_column_create

``column_create``
=================

Summary
-------

``column_create`` creates a new column in a table.

You need to create one or more columns to store multiple data in one
record.

Groonga provides an index as a column. It's different from other
systems. An index is just an index in other systems. Implementing an
index as a column provides flexibility. For example, you can add
metadata to each token.

See :doc:`/reference/column` for column details.

Syntax
------

This command takes many parameters.

Most parameters are required::

  column_create table
                name
                flags
                type
                [source=null]
		[path=null]
		[generator=null]

Usage
-----

This section describes about the followings:

* :ref:`column-create-scalar`
* :ref:`column-create-vector`
* :ref:`column-create-vector-weight`
* :ref:`column-create-reference`
* :ref:`column-create-index`
* :ref:`column-create-index-full-text-search`
* :ref:`column-create-index-multiple-columns`
* :ref:`column-create-index-small`
* :ref:`column-create-index-medium`
* :ref:`column-create-index-large`
* :ref:`column-create-missing-mode`
* :ref:`column-create-invalid-mode`
* :ref:`column-create-generated-column`

Here is the ``People`` table definition. The ``People`` table is used
in examples:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_table.log
.. table_create \
..   --name People \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText

.. _column-create-scalar:

Create a scalar column
^^^^^^^^^^^^^^^^^^^^^^

Groonga provides scalar column to store one value. For example, scalar
column should be used for storing age into a person record. Because a
person record must have only one age.

If you want to store multiple values into a record, scalar column
isn't suitable. Use :ref:`column-create-vector` instead.

You must specify ``COLUMN_SCALAR`` to the ``flags`` parameter to
create a scalar column.

Here is an example to create the ``age`` column to the ``People``
table. ``age`` column is a scalar column. It can store one ``UInt8``
(``0-255``) value as its value:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_scalar_create.log
.. column_create \
..   --table People \
..   --name age \
..   --flags COLUMN_SCALAR \
..   --type UInt8

You can store one value (``7``) by the following :doc:`load` command:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_scalar_load.log
.. load --table People
.. [
.. {"_key": "alice", "age": 7}
.. ]

You can confirm the stored one value (``7``) by the following
:doc:`select` command:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_scalar_select.log
.. select --table People

.. _column-create-vector:

Create a vector column
^^^^^^^^^^^^^^^^^^^^^^

Groonga provides vector column to store multiple values. For example,
vector column may be used for storing roles into a person
record. Because a person record may have multiple roles.

If you want to store only one value into a record, vector column isn't
suitable. Use :ref:`column-create-scalar` instead.

You must specify ``COLUMN_VECTOR`` to the ``flags`` parameter to
create a vector column.

Here is an example to create the ``roles`` column to the ``People``
table. ``roles`` column is a vector column. It can store zero or more
``ShortText`` values as its value:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_vector_create.log
.. column_create \
..   --table People \
..   --name roles \
..   --flags COLUMN_VECTOR \
..   --type ShortText

You can store multiple values (``["adventurer", "younger-sister"]``)
by the following :doc:`load` command:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_vector_load.log
.. load --table People
.. [
.. {"_key": "alice", "roles": ["adventurer", "younger-sister"]}
.. ]

You can confirm the stored multiple values (``["adventurer",
"younger-sister"]``) by the following :doc:`select` command:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_vector_select.log
.. select --table People

.. _column-create-vector-weight:

Create a weight vector column
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TODO: See also :ref:`weight-vector-column` and :ref:`select-adjuster`.

.. _column-create-reference:

Create a column that refers a table's record
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Both scalar column and vector column can store reference to record of
an existing table as column value. It's useful to store relationship
between records.

For example, using a column that refers a person record is better for
storing a character into a book record. Because one person may be
appeared in some books.

You must specify table name to be referenced to the ``type`` parameter
to create a column that refers a table's record.

Here is an example to create the ``character`` column to the ``Books``
table. The ``character`` column refers the ``People`` table. It can
store one ``People`` table's record.

Here is the ``Books`` table definition:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_reference_create_table.log
.. table_create \
..   --name Books \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText

Here is the ``character`` column definition in the ``Books``
table. ``--type People`` is important:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_reference_create_column.log
.. column_create \
..   --table Books \
..   --name character \
..   --flags COLUMN_SCALAR \
..   --type People

You can store one reference (``"alice"``) by the following :doc:`load`
command. You can use key value (``People._key`` value) for referring a
record:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_reference_load.log
.. load --table Books
.. [
.. {"_key": "Alice's Adventure in Wonderland", "character": "alice"}
.. ]

You can confirm the stored reference (``"alice"`` record) by the
following :doc:`select` command. It retrieves the ``age`` column and
the ``roles`` column values:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_reference_select.log
.. select \
..  --table Books \
..  --output_columns _key,character._key,character.age,character.roles

.. _column-create-index:

Create an index column
^^^^^^^^^^^^^^^^^^^^^^

Groonga provides index column for fast search. It doesn't store your
data. It stores data for fast search.

You don't need to update index column by yourself. Index column is
updated automatically when you store data into a data column (scalar
column or vector column) that is marked as index target column. You
can set multiple columns as index target columns to one index column.

If you make a new index, it is invisible until finishing of index build.

If Groonga has an index column for the ``age`` column of the
``People`` table, Groonga can do fast equal search, fast comparison
search and fast range search against ``age`` column values.

You must specify the following parameters to create an index column:

  * The ``flags`` parameter: ``COLUMN_INDEX``

  * The ``type`` parameter: The table name of index target column such
    as ``People``

  * The ``source`` parameter: The index target column name such as
    ``age``

You don't need additional flags to the ``flags`` parameter for equal
search, comparison search and range search index column. You need
additional flags to the ``flags`` parameter for full text search index
column or multiple column index column. See
:ref:`column-create-index-full-text-search` and
:ref:`column-create-index-multiple-columns` for details.

Here is an example to create an index column for the ``age`` column of
the ``People`` table.

First, you need to create a table for range index column. See
:ref:`table-create-range-index-table` for details. This example
creates the ``Ages`` table as :ref:`table-pat-key`:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_index_create_table.log
.. table_create \
..   --name Ages \
..   --flags TABLE_PAT_KEY \
..   --key_type UInt8

Now, you can create an index column for the ``age`` column of the
``People`` table. ``COLUMN_INDEX`` in the ``flags`` parameter,
``People`` in the ``type`` parameter and ``age`` in the ``source``
parameter are important:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_index_create_column.log
.. column_create \
..   --table Ages \
..   --name people_age_index \
..   --flags COLUMN_INDEX \
..   --type People \
..   --source age

You can confirm that ``age > 5`` is evaluated by the
``Ages.people_age_index`` newly created index column from log. Groonga
reports used index columns in ``info`` log level. You can change log
level dynamically by :doc:`log_level` command.

.. groonga-command
.. log: true
.. include:: ../../example/reference/commands/column_create/usage_index_select.log
.. log_level --level info
.. select \
..   --table People \
..   --filter 'age > 5'
.. log_level --level notice
.. log: false

You can confirm that the ``Ages.people_age_index`` is used from the
following log::

  [table][select][index][range] <Ages.people_age_index>

The log says ``Ages.people_age_index`` index column is used for range
search.

.. _column-create-index-full-text-search:

Create an index column for full text search
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There is a difference between for non full text search (equal search,
comparison search or range search) index column and for full text
search index column. You need to add ``WITH_POSITION`` to the
``flags`` parameter. It means that you need to specify
``COLUMN_INDEX|WITH_POSITION`` to the ``flags`` parameter. It's the
difference.

Here is an example to create a full text search index column for the
key of the ``People`` table.

First, you need to create a table for full text search index
column. See :ref:`table-create-lexicon` for details. This example
creates the ``Terms`` table as :ref:`table-pat-key` with
:ref:`token-bigram` tokenizer and :ref:`normalizer-auto` normalizer:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_full_text_search_index_create_table.log
.. table_create \
..   --name Terms \
..   --flags TABLE_PAT_KEY \
..   --key_type ShortText \
..   --default_tokenizer TokenBigram \
..   --normalizer NormalizerAuto

Now, you can create a full text search index column for the key of the
``People`` table. ``COLUMN_INDEX|WITH_POSITION`` in the ``flags``
parameter, ``People`` in the ``type`` parameter and ``_key`` in the
``source`` parameter are important:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_full_text_search_index_create_column.log
.. column_create \
..   --table Terms \
..   --name people_key_index \
..   --flags COLUMN_INDEX|WITH_POSITION \
..   --type People \
..   --source _key

You can confirm that ``--match_columns _key`` and ``--query Alice``
are evaluated by the ``Terms.people_key_index`` newly created full
text search index column from log. Groonga reports used index columns
in ``info`` log level. You can change log level dynamically by
:doc:`log_level` command.

.. groonga-command
.. log: true
.. include:: ../../example/reference/commands/column_create/usage_full_text_search_index_select.log
.. log_level --level info
.. select \
..   --table People \
..   --match_columns _key \
..   --query Alice
.. log_level --level notice
.. log: false

You can confirm that the ``Terms.people_key_index`` is used from the
following log::

  [object][search][index][key][exact] <Terms.people_key_index>

The log says ``Terms.people_key_index`` index column is used for full
text search. (To be precise, the index column is used for exact term
search by inverted index.)

.. _column-create-index-multiple-columns:

Create a multiple columns index column
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You can create an index column for multiple columns. It means that you
can do fast search for multiple columns with one index
column. Multiple columns index column has better space efficiency than
single column index column only when multiple columns have many same
tokens. Multiple columns index column may be slower than single column
index column. Because multiple columns index column will be a bigger
index column.

You can't use multiples columns in different tables as index target
columns in the same multiple columns index column. You must specify
columns in the same tables as index target columns to one multiple
columns index column. For example, you can't create a multiple columns
index for ``People._key`` and ``Books._key`` because they are columns
of different tables. You can create a multiple columns index column
for ``People._key`` and ``People.roles`` because they are columns of
the same table.

There is a difference between for single column index column and for
multiple columns index column. You need to add ``WITH_SECTION`` to the
``flags`` parameter. It means that you need to specify
``COLUMN_INDEX|WITH_SECTION`` to the ``flags`` parameter. It's the
difference.

If you want to create a multiple columns index column for full text
search, you need to specify
``COLUMN_INDEX|WITH_POSITION|WITH_SECTION`` to the ``flags``
parameter. See :ref:`column-create-index-full-text-search` for full
text search index column details.

Here is an example to create a multiple columns index column for the
key of the ``People`` table and the ``roles`` column of the ``People``
table.

There is no difference between index table for single column index
column and multiple columns index column.

In this example, ``Names`` table is created for equal search and
prefix search. It uses ``TABLE_PAT_KEY`` because ``TABLE_PAT_KEY``
supports prefix search. See :doc:`../tables` for details.

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_multiple_columns_index_create_table.log
.. table_create \
..   --name Names \
..   --flags TABLE_PAT_KEY \
..   --key_type ShortText \
..   --normalizer NormalizerAuto

You can create a multiple columns index column for the key of the
``People`` table and ``roles`` column of the ``People``
table. ``COLUMN_INDEX|WITH_SECTION`` in the ``flags`` parameter,
``People`` in the ``type`` parameter and ``_key,roles`` in the
``source`` parameter are important:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_multiple_columns_index_create_column.log
.. column_create \
..   --table Names \
..   --name people_key_roles_index \
..   --flags COLUMN_INDEX|WITH_SECTION \
..   --type People \
..   --source _key,roles

You can confirm that ``--filter 'roles @^ "Younger"`` is evaluated by
the ``Names.people_key_roles_index`` newly created multiple columns
index column from log. Groonga reports used index columns in ``info``
log level. You can change log level dynamically by :doc:`log_level`
command.

.. groonga-command
.. log: true
.. include:: ../../example/reference/commands/column_create/usage_multiple_columns_index_select.log
.. log_level --level info
.. select \
..   --table People \
..   --filter 'roles @^ "Younger"'
.. log_level --level notice
.. log: false

You can confirm that the ``Names.people_key_roles_index`` is used from
the following log::

  [table][select][index][prefix] <Names.people_key_roles_index>

The log says ``Names.people_key_roles_index`` index column is used for
prefix search.

.. _column-create-index-small:

Create a small index column
^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you know index target data are small, you can reduce memory usage
for the index column. Memory usage is ``1/256`` of the default index
column.

How many data are small? It depends on data. Small index column can't
handle 1 billion records at least. If index target is only one
scalar column with no text family type (``ShortText``, ``Text`` or
``LongText``), the maximum handleable records are depends of the
number of kinds of index target data. If index target column has
``1``, ``1``, ``2`` and ``3``, the number of kinds of them are ``3``
(``1`` and ``2`` and ``3``). The following table shows the
relationship between the number of kinds of index target data and the
number of handleable records:

.. list-table:: The number of kinds of index target data and the number of handleable records in a small index column
   :header-rows: 1

   * - The number of kinds of index target data
     - The number of hanleable records
   * - 1
     - 16779234
   * - 2
     - 4648070
   * - 4
     - 7238996
   * - 8
     - 8308622
   * - 16
     - 11068624
   * - 32
     - 12670817
   * - 64
     - 18524211
   * - 128
     - 38095511
   * - 256
     - 51265384

You need to add ``INDEX_SMALL`` to the ``flags`` parameter such as
``COLUMN_INDEX|INDEX_SMALL`` to create a small index column.

If the ``People`` table has only 1 million records, you can use a
small index column for the ``age`` column:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_small_index_create_column.log
.. column_create \
..   --table Ages \
..   --name people_age_small_index \
..   --flags COLUMN_INDEX|INDEX_SMALL \
..   --type People \
..   --source age

.. _column-create-index-medium:

Create a medium index column
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you know index target data are medium, you can reduce memory usage
for the index column. Memory usage is ``5/24`` of the default index
column.

How many data are medium? It depends on data.

If index target is only one scalar column, a medium index column
can handle all records.

A medium index column may not handle all records at the following
cases:

  * Index target is one text family (``ShortText``, ``Text`` or
    ``LongText``) scalar column
  * Index target is one vector column
  * Index targets are multiple columns
  * Index table has tokenizer

You need to add ``INDEX_MEDIUM`` to the ``flags`` parameter such as
``COLUMN_INDEX|INDEX_MEDIUM`` to create a medium index column.

You can use a medium index column for an index column of the ``age``
column of the ``People`` table safely. Because it's one scalar column
with ``UInt8`` type.

Here is an example to create a medium index column:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_medium_index_create_column.log
.. column_create \
..   --table Ages \
..   --name people_age_medium_index \
..   --flags COLUMN_INDEX|INDEX_MEDIUM \
..   --type People \
..   --source age

.. _column-create-index-large:

Create a large index column
^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you know index target data are large, you need to use large index
column. It uses increases memory usage for the index column but it can
accept more data. Memory usage is 2 times larger than the default
index column.

How many data are large? It depends on data.

If index target is only one scalar column, it's not large data.

Large data must have many records (normally at least 10 millions
records) and at least one of the following features:

  * Index targets are multiple columns
  * Index table has tokenizer

You need to add ``INDEX_LARGE`` to the ``flags`` parameter such as
``COLUMN_INDEX|INDEX_LARGE`` to create a large index column.

You can use a large index column for an index column of the ``_key``
of the ``People`` table and the ``role`` column of the ``People``
table.

Here is an example to create a large index column:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/usage_large_index_create_column.log
.. column_create \
..   --table Terms \
..   --name people_roles_large_index \
..   --flags COLUMN_INDEX|WITH_POSITION|WITH_SECTION|INDEX_LARGE \
..   --type People \
..   --source roles

.. _column-create-missing-mode:

Missing mode
^^^^^^^^^^^^

.. versionadded:: 12.0.2

You can control how to process a nonexistent key in the specified new
value of a reference column by a ``MISSING_*`` flag. Here are
available ``MISSING_*`` flags:

* ``MISSING_ADD`` (default)
* ``MISSING_IGNORE``
* ``MISSING_NIL``

You can't specify multiple ``MISSING_*`` flags for a column.

``MISSING_*`` flags are meaningful only for a reference column.

The following table describes the differences between ``MISSING_*``
flags when a nonexistent key is specified to a reference scalar
column:

.. list-table::
   :header-rows: 1

   * - Flag
     - Description
     - An example given value
     - An example set value

   * - ``MISSING_ADD``
     - The given nonexistent key is added to the referred table
       automatically and the ID of the newly added record is set.

       This is the default.
     - ``"nonexistent"``
     - The record ID of the newly added record whose key is
       ``"nonexistent"``.
   * - ``MISSING_IGNORE``
     - The given nonexistent key is ignored and ``0`` is set.

       There is no difference between ``MISSING_IGNORE`` and
       ``MISSING_NIL`` for a reference scalar column.
     - ``"nonexistent"``
     - ``0``
   * - ``MISSING_NIL``
     - The given nonexistent key is ignored and ``0`` is set.

       There is no difference between ``MISSING_IGNORE`` and
       ``MISSING_NIL`` for a reference scalar column.
     - ``"nonexistent"``
     - ``0``

Here is an example to show differences between ``MISSING_*`` flags for
a reference scalar column.

First this example defines columns for all ``MISSING_*`` flags:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/missing_mode_scalar_schema.log
.. table_create \
..   --name MissingModeScalarReferred \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText
.. table_create \
..   --name MissingModeScalar \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText
.. column_create \
..   --table MissingModeScalar \
..   --name missing_add \
..   --flags COLUMN_SCALAR|MISSING_ADD \
..   --type MissingModeScalarReferred
.. column_create \
..   --table MissingModeScalar \
..   --name missing_ignore \
..   --flags COLUMN_SCALAR|MISSING_IGNORE \
..   --type MissingModeScalarReferred
.. column_create \
..   --table MissingModeScalar \
..   --name missing_nil \
..   --flags COLUMN_SCALAR|MISSING_NIL \
..   --type MissingModeScalarReferred

Then this example loads nonexistent keys to all columns. The specified
nonexistent key for ``MISSING_ADD`` is only added to
``MissingModeScalarReferred`` automatically and the specified
nonexistent keys for ``MISSING_IGNORE`` and ``MISSING_NIL`` aren't
added to ``MissingModeScalarReferred``. ``missing_ignore``'s value and
``missing_nil``'s value are showed as ``""`` because they refer a
record whose ID is ``0`` and record whose ID is ``0`` never exist:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/missing_mode_scalar_load.log
.. load --table MissingModeScalar
.. [
.. {"_key": "key", "missing_add":    "nonexistent1"}
.. ]
.. load --table MissingModeScalar
.. [
.. {"_key": "key", "missing_ignore": "nonexistent2"}
.. ]
.. load --table MissingModeScalar
.. [
.. {"_key": "key", "missing_nil":    "nonexistent3"}
.. ]
.. select --table MissingModeScalar
.. select --table MissingModeScalarReferred

The following table describes the differences between ``MISSING_*``
flags when a vector value that has a nonexistent key element is
specified to a reference vector column:

.. list-table::
   :header-rows: 1

   * - Flag
     - Description
     - An example given value
     - An example set value

   * - ``MISSING_ADD``
     - The given nonexistent key is added to the referred table
       automatically and the ID of the newly added record is used for
       the element.

       This is the default.
     - ``["existent1", "nonexistent", "existent2"]``
     - The record IDs of ``"existent1"``, ``"nonexistent"`` and
       ``"existent2"``.
   * - ``MISSING_IGNORE``
     - The given nonexistent key element is ignored.
     - ``["existent1", "nonexistent", "existent2"]``
     - The record IDs of ``"existent1"`` and ``"existent2"``.
   * - ``MISSING_NIL``
     - The given nonexistent key element is ignored.

       If ``INVALID_WARN`` or ``INVALID_IGNORE`` are also specified,
       the element is replaced with ``0``. If ``INVALID_ERROR`` is
       specified or no ``INVALID_*`` are specified, the element is
       ignored.

       See also :ref:`column-create-invalid-mode`.
     - ``["existent1", "nonexistent", "existent2"]``
     - The record ID of ``"existent1"`` and ``0`` and the record ID of
       ``"existent2"`` for ``INVALID_WARN`` and ``INVALID_IGNORE``.

       The record IDs of ``"existent1"`` and ``"existent2"`` for
       ``INVALID_ERROR`` and no ``INVALID_*``.

Here is an example to show differences between ``MISSING_*`` flags for
a reference vector column.

First this example defines columns for all ``MISSING_*`` flags:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/missing_mode_vector_schema.log
.. table_create \
..   --name MissingModeVectorReferred \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText
.. table_create \
..   --name MissingModeVector \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText
.. column_create \
..   --table MissingModeVector \
..   --name missing_add \
..   --flags COLUMN_VECTOR|MISSING_ADD \
..   --type MissingModeVectorReferred
.. column_create \
..   --table MissingModeVector \
..   --name missing_ignore \
..   --flags COLUMN_VECTOR|MISSING_IGNORE|INVALID_IGNORE \
..   --type MissingModeVectorReferred
.. column_create \
..   --table MissingModeVector \
..   --name missing_nil \
..   --flags COLUMN_VECTOR|MISSING_NIL|INVALID_IGNORE \
..   --type MissingModeVectorReferred

Then this example loads a vector that includes a nonexistent key to
all columns. The specified nonexistent key for ``MISSING_ADD`` is only
added to ``MissingModeVectorReferred`` automatically and the specified
nonexistent keys for ``MISSING_IGNORE`` and ``MISSING_NIL`` aren't
added to ``MissingModeVectorReferred``. The specified nonexistent key
element is removed from ``missing_ignore``'s value. The specified
nonexistent key element is replaced with ``0`` in ``missing_nil``'s
value because ``INVALID_IGNORE`` is also specified. And the element
replaced with ``0`` is showed as ``""`` because it refers a record
whose ID is ``0`` and record whose ID is ``0`` never exist:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/missing_mode_vector_load.log
.. load --table MissingModeVectorReferred
.. [
.. {"_key": "existent1"},
.. {"_key": "existent2"}
.. ]
.. load --table MissingModeVector
.. [
.. {"_key": "key", "missing_add":    ["existent1", "nonexistent1", "existent2"]}
.. ]
.. load --table MissingModeVector
.. [
.. {"_key": "key", "missing_ignore": ["existent1", "nonexistent2", "existent2"]}
.. ]
.. load --table MissingModeVector
.. [
.. {"_key": "key", "missing_nil":    ["existent1", "nonexistent3", "existent2"]}
.. ]
.. select --table MissingModeVector
.. select --table MissingModeVectorReferred

.. _column-create-invalid-mode:

Invalid mode
^^^^^^^^^^^^

.. versionadded:: 12.0.2

You can control how to process an invalid value in the specified new
value of a data column by a ``INVALID_*`` flag. Here are available
``INVALID_*`` flags:

* ``INVALID_ERROR`` (default)
* ``INVALID_WARN``
* ``INVALID_IGNORE``

You can't specify multiple ``INVALID_*`` flags for a column.

``INVALID_*`` flags are meaningful only for a ``COLUMN_SCALAR`` column
and a ``COLUMN_VECTOR`` column.

If the target column is a reference column, an invalid value depends
on :ref:`column-create-missing-mode`. If you specify
``MISSING_IGNORE`` or ``MISSING_NIL``, a nonexistent key is an invalid
value. Note that an empty string key and string keys that are empty
strings by normalization aren't an invalid value with all
``MISSING_*`` flags. They are special.

If the target column isn't a reference column, an invalid value
depends on column's value type. For example, ``"invalid"`` is an
invalid value for an ``Int32`` scalar column.

The following table describes the differences between ``INVALID_*``
flags when an invalid value is specified to an ``Int32`` scalar column:

.. list-table::
   :header-rows: 1

   * - Flag
     - Description
     - An example given value
     - An example set value

   * - ``INVALID_ERROR``
     - The given invalid value is reported as an error in
       :ref:`process-log` and by :doc:`load`.

       The given invalid value isn't set.

       This is the default.
     - ``"invalid"``
     - The column isn't updated.
   * - ``INVALID_WARN``
     - The given invalid value is reported as a warning in
       :ref:`process-log`.

       The given invalid value is replaced with the default value of
       the target scalar column. For example, ``0`` is the default
       value for an ``Int32`` scalar column.
     - ``"nonexistent"``
     - ``0``
   * - ``INVALID_IGNORE``
     - The given invalid value is ignored.

       The given invalid value is replaced with the default value of
       the target scalar column. For example, ``0`` is the default
       value for an ``Int32`` scalar column.
     - ``"invalid"``
     - ``0``

Here is an example to show differences between ``INVALID_*`` flags for
an ``Int32`` scalar column.

First this example defines columns for all ``INVALID_*`` flags:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/invalid_mode_scalar_schema.log
.. table_create \
..   --name InvalidModeScalar \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText
.. column_create \
..   --table InvalidModeScalar \
..   --name invalid_error \
..   --flags COLUMN_SCALAR|INVALID_ERROR \
..   --type Int32
.. column_create \
..   --table InvalidModeScalar \
..   --name invalid_warn \
..   --flags COLUMN_SCALAR|INVALID_WARN \
..   --type Int32
.. column_create \
..   --table InvalidModeScalar \
..   --name invalid_ignore \
..   --flags COLUMN_SCALAR|INVALID_IGNORE \
..   --type Int32

Then this example loads ``29`` as initial values for all columns to
show differences between them on update:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/invalid_mode_scalar_load_initial.log
.. load --table InvalidModeScalar
.. [
..   {
..     "_key": "key",
..     "invalid_error":  29,
..     "invalid_warn":   29,
..     "invalid_ignore": 29
..   }
.. ]
.. select \
..   --table InvalidModeScalar \
..   --output_columns invalid_error,invalid_warn,invalid_ignore

Then this example update existing column values with invalid values.
The specified invalid value is reported as an error by :doc:`load`
only with ``INVALID_ERROR``. And the existing value isn't updated only
with ``INVALID_ERROR``. The existing value is updated with ``0`` with
``INVALID_WARN`` and ``INVALID_IGNORE``. You can't see differences
between ``INVALID_WARN`` and ``INVALID_IGNORE`` with this example but
a warning message is logged in :ref:`process-log` only with
``INVALID_WARN``:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/invalid_mode_scalar_load_update.log
.. load --table InvalidModeScalar
.. [
.. {"_key": "key", "invalid_error":  "invalid"},
.. ]
.. load --table InvalidModeScalar
.. [
.. {"_key": "key", "invalid_warn":   "invalid"},
.. ]
.. load --table InvalidModeScalar
.. [
.. {"_key": "key", "invalid_ignore": "invalid"},
.. ]
.. select \
..   --table InvalidModeScalar \
..   --output_columns invalid_error,invalid_warn,invalid_ignore

The following table describes the differences between ``INVALID_*``
flags when a vector value that has an invalid element is specified to
an ``Int32`` vector column:

.. list-table::
   :header-rows: 1

   * - Flag
     - Description
     - An example given value
     - An example set value

   * - ``INVALID_ERROR``
     - The given invalid element is reported as an error in
       :ref:`process-log` but :doc:`load` doesn't report an error.

       If the target column is a reference vector column and
       ``MISSING_NIL`` flag is specified, invalid elements are
       replaced with ``0``. Invalid elements are ignored otherwise.

     - ``[1, "invalid", 3]``
     - ``[1, 3]``
   * - ``INVALID_WARN``
     - The given invalid element is reported as a warning in
       :ref:`process-log`.

       If the target column is a reference vector column and
       ``MISSING_NIL`` flag is specified, invalid elements are
       replaced with ``0``. Invalid elements are ignored otherwise.

     - ``[1, "invalid", 3]``
     - ``[1, 3]``
   * - ``INVALID_IGNORE``
     - The given invalid element is ignored.

       If the target column is a reference vector column and
       ``MISSING_NIL`` flag is specified, invalid elements are
       replaced with ``0``. Invalid elements are ignored otherwise.

     - ``[1, "invalid", 3]``
     - ``[1, 3]``

Here is an example to show differences between ``INVALID_*`` flags for
a reference vector column.

First this example defines columns for all ``INVALID_*`` flags:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/invalid_mode_vector_schema.log
.. table_create \
..   --name InvalidModeVector \
..   --flags TABLE_HASH_KEY \
..   --key_type ShortText
.. column_create \
..   --table InvalidModeVector \
..   --name invalid_error \
..   --flags COLUMN_VECTOR|INVALID_ERROR \
..   --type Int32
.. column_create \
..   --table InvalidModeVector \
..   --name invalid_warn \
..   --flags COLUMN_VECTOR|INVALID_WARN \
..   --type Int32
.. column_create \
..   --table InvalidModeVector \
..   --name invalid_ignore \
..   --flags COLUMN_VECTOR|INVALID_IGNORE \
..   --type Int32

Then this example loads a vector that includes an invalid element to
all columns. The all specified invalid elements are ignored regardless
of ``INVALID_*`` flags. Messages in :ref:`process-log` are different
by ``INVALID_*`` flags. If ``INVALID_ERROR`` is specified, an error
message is logged in :ref:`process-log`. If ``INVALID_WARN`` is
specified, a warning message is logged in
:ref:`process-log`. ``INVALID_IGNORE`` is specified, no message is
logged in :ref:`process-log`:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/invalid_mode_vector_load.log
.. load --table InvalidModeVector
.. [
.. {"_key": "key", "invalid_error":  [1, "invalid", 3]}
.. ]
.. load --table InvalidModeVector
.. [
.. {"_key": "key", "invalid_warn":   [1, "invalid", 3]}
.. ]
.. load --table InvalidModeVector
.. [
.. {"_key": "key", "invalid_ignore": [1, "invalid", 3]}
.. ]
.. select \
..   --table InvalidModeVector \
..   --output_columns invalid_error,invalid_warn,invalid_ignore

.. _column-create-generated-column:

Create a generated column
^^^^^^^^^^^^^^^^^^^^^^^^^

.. versionadded:: 14.1.0

You can generate a column value from other column value
automatically. You can use an expression in
:doc:`../grn_expr/script_syntax` how to generate a column value.

Here is an example how to define a generated column:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/generated_column_schema.log
.. table_create \
..   --name Posts \
..   --flags TABLE_NO_KEY
.. column_create \
..   --table Posts \
..   --name title_html \
..   --flags COLUMN_SCALAR \
..   --type ShortText
.. column_create \
..   --table Posts \
..   --name title_text \
..   --flags COLUMN_SCALAR \
..   --type ShortText \
..   --source title_html \
..   --generator 'html_untag(title_html)'

``Posts.title_text`` is a generated column. Its value is generated
from a value of ``Posts.title_html``. ``--source title_html`` and
``--generator 'html_untag(title_html)'`` are the important parts.

``--source title_html`` means that ``Posts.title_text`` uses
``Posts.title_html`` as source.

``--generator 'html_untag(title_html)'`` means that
``Posts.title_text`` value is generated by evaluating
``html_untag(title_html)``. :doc:`../functions/html_untag` is a
function that removes HTML tags from HTML text. ``html_untag("Hello
<em>Groonga</em>")`` returns ``"Hello Groonga"``.

Let's load a value to ``Posts.title_html`` and see ``Posts.title_text``:

.. groonga-command
.. include:: ../../example/reference/commands/column_create/generated_column_load.log
.. load --table Posts
.. [
.. {"title_html", "Hello <em>Groonga</em>"}
.. ]
.. select --table Posts

You can see ``Posts.title_text`` has ``"Hello Groonga"``
automatically.

Parameters
----------

This section describes all parameters.

Required parameters
^^^^^^^^^^^^^^^^^^^

There are some required parameters.

.. _column-create-table:

``table``
"""""""""

Specifies an existing table name for the new column.

.. _column-create-name:

``name``
""""""""

Specifies the column name to be created.

The column name must be unique in the same table.

Here are available characters:

* ``0`` .. ``9`` (digit)
* ``a`` .. ``z`` (alphabet, lower case)
* ``A`` .. ``Z`` (alphabet, upper case)
* ``#`` (hash)
* ``@`` (at mark)
* ``-`` (hyphen)
* ``_`` (underscore) (NOTE: Underscore can't be used as the first
  character.)

You need to create a name with one or more the above characters. Note
that you can't use ``_`` as the first character such as ``_name``.


.. _column-create-flags:

``flags``
"""""""""

Specifies the column type and column customize options.

Here are available flags:

.. list-table::
   :header-rows: 1

   * - Flag
     - Description

   * - ``COLUMN_SCALAR``
     - Scalar column. It can store one value. See also
       :doc:`/reference/columns/scalar` or
       :ref:`column-create-scalar`.

   * - ``COLUMN_VECTOR``
     - Vector column. It can store multiple values. See also
       :doc:`/reference/columns/vector` or
       :ref:`column-create-vector`.

   * - ``COLUMN_INDEX``
     - Index column. It stores data for fast search. See also
       :doc:`/reference/columns/index` or
       :ref:`column-create-index`.

   * - ``COMPRESS_ZLIB``
     - It enables column value compression by zlib. You need Groonga
       that enables zlib support.

       Compression by zlib is higher space efficiency than compression
       by LZ4. But compression by zlib is slower than compression by
       LZ4.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``COMPRESS_LZ4``
     - It enables column value compression by LZ4. You need Groonga
       that enables LZ4 support.

       Compression by LZ4 is faster than compression by zlib. But
       compression by LZ4 is lower space efficiency than compression
       by zlib.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``COMPRESS_ZSTD``
     - It enables column value compression by Zstandard. You need
       Groonga that enables Zstandard support.

       Compression by Zstandard is faster than compression by zlib and
       the same space efficiency as zlib.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``COMPRESS_FILTER_SHUFFLE``
     - .. versionadded:: 13.0.8

       .. include:: compress_filter.rst

       Here are a list of suitable data type for this filter.

       This flag reorganize data based on a element of Nth byte.

       First, 0th byte data of each element within the vector column
       would be gathered and be continuously placed. Then, 1st byte
       data would be handled as same as 0th byte data and all byte
       data would be as so repeatedly.

       There are tendency for those compression algorithms such as
       ``COMPRESS_ZLIB``, ``COMPRESS_LZ4`` and ``COMPRESS_ZSTD`` to
       have the higher compression rate when the data has same values
       in continuance. The point for this flag is to produce data
       having same values in continuance by reorganizing data for
       every N byte.

       In particular, it would work as below.

       For example, there is the vector column ``[1, 1051, 515]`` in
       ``UInt16``. It would be as below representing in the little
       endien byte column.

       .. code-block::

          | Byte 0 | Byte 1 |  | Byte 0 | Byte 1 |  | Byte 0 | Byte 1 |
          |--------|--------|  |--------|--------|  |--------|--------|
          | 0x01   | 0x00   |, | 0x1b   | 0x04   |, | 0x03   | 0x02   |

       This flag is to produce the data as following by gathering
       values of ``Byte 0``, then of ``Byte 1`` from the above data.
       The action to gather values with every N Byte would be called
       shuffle from now on. Shuffling the above data would be as
       below.

       .. code-block::

          | Byte 0 | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 | Byte 1 |
          |--------|--------|--------|  |--------|--------|--------|
          | 0x01   | 0x1b   | 0x03   |, | 0x00   | 0x04   | 0x02   |

       The point is whether there would be same values in continuance
       or not. Looking at the above example data, it is appeared to
       have no same values in continuance after shuffling. Those data
       are not suitable for this flag because it is not contributed to
       increase the compression rate even shuffling.

       On the other hand, the vector column ``[1, 2, 3]`` in
       ``UInt16`` would be as following after shuffling. First for
       the explanation, ``[1, 2, 3]`` in ``UInt16`` would be
       represented as below in the little endien byte column.

       .. code-block::

          | Byte 0 | Byte 1 |  | Byte 0 | Byte 1 |  | Byte 0 | Byte 1 |
          |--------|--------|  |--------|--------|  |--------|--------|
          | 0x01   | 0x00   |, | 0x02   | 0x00   |, | 0x03   | 0x00   |


       And, after shuffling ``[1, 2, 3]`` in ``UInt16``, the data
       would be as below.

       .. code-block::

          | Byte 0 | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 | Byte 1 |
          |--------|--------|--------|  |--------|--------|--------|
          | 0x01   | 0x02   | 0x03   |, | 0x00   | 0x00   | 0x00   |

       After shuffling ``[1, 2, 3]`` in ``UInt16``, the date in ``Byte
       1`` would be all ``0x00``. It means there are same values in
       continuance.  Thus, this data pattern is suitable for this flag
       because it would contribute to increase the compression rate.

       In case of a floating-point number, the data having same the
       code part and the exponent part would be corresponded. In case
       of the IEEE 754 type single-precision floating-point format,
       code part would be placed at 31st bit, and exponent part would
       be placed at 32nd bit. There would be same values in
       continuance after shuffling the data if the code part and the
       upper 7 bit of exponent bit become same because the highest
       byte would be structured with the code part and the upper 7 bit
       of exponent bit.

       For example, the data, ``[0.5, 0.6]`` in ``Float32``, would
       have same code bit and exponent part by representing in
       Single-precision floating-point format in IEEE 754 type as
       below.

       .. code-block::

          | fraction (23bit)             | exponent (8bit) | sign (1bit) |
          |------------------------------|-----------------|-------------|
          | 0000 0000 0000 0000 0000 000 | 0111 1110       | 0           |
          | 0101 1001 1001 1001 1001 100 | 0111 1110       | 0           |

       Shuffling the given data would have same values in continuance
       for ``Byte 3`` as below.

       .. code-block::

          | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 |  | Byte 2 | Byte 2 |  | Byte 3 | Byte 3 | 
          |--------|--------|  |--------|--------|  |--------|--------|  |--------|--------| 
          | 0x00   | 0x9a   |, | 0x00   | 0x99   |, | 0x00   | 0x19   |, | 0x3f   | 0x3f   | 

       In case of the ``Float`` / ``Float32`` type data, please refer
       to explanations for
       ``COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE`` and
       ``COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTES`` since it is also
       possible to combine
       ``COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE`` or
       ``COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTES``.

   * - ``COMPRESS_FILTER_BYTE_DELTA``
     - .. versionadded:: 13.0.8

       .. include:: compress_filter.rst

       Here is what kind of the data being effective for this flag.

       This flag is to calculate the difference between bytes of
       values to be compression targeted. As sample case of the
       vector column ``[1, 2, 3, 4, 5]`` in ``UInt8``, applying this
       flag would produce data would become ``[1, (2-1), (3-2), (4-3),
       (5-4)] = [1, 1, 1, 1, 1]``.

       As noted above, it is trying to increase the compression rate
       by calculating increments and producing same values in
       continuance. The point is there would be same values in
       continuance after calculating the increments between each
       elements.

       Thus, the data is not suitable to use for this flag if there
       would not be same values in continuance after calculating the
       increments. Here is the list of data pattern to have same
       values in continuance after calculating increments.

       First pattern would be the data increased with constant
       interval such as ``[1, 2, 3, 4, 5]`` in ``UInt8``. The
       constant interval could be every ``10`` for ``[1, 11, 21, 31,
       41]`` in ``UInt8`` as long as the interval is same.

       Next pattern would be the data having same values in
       continuance such as ``[5, 5, 5, 5, 5]`` in ``UInt8``. There
       would be ``0`` in continuance after calculating the increments
       of this data. In opposite, ``[1, 255, 2, 200, 1]`` in
       ``UInt8`` is not suitable for this flag because the data would
       not have same value in continuance after calculating the
       increments.

       There would be a case to be able to increase the compression
       rate by combining ``COMPRESS_FILTER_SHUFFLE`` even though
       calculating increments would not have same value in
       continuance, or increments are too large.

       For exapmle, ``[4526677, 4592401, 4658217, 4723879]`` in
       ``UInt32`` would be ``[4526677, 65724, 65816, 65662]`` after
       only being applied ``COMPRESS_FILTER_BYTE_DELTA``. This data
       would not have values in continuance, and increments are large.

       But applying ``COMPRESS_FILTER_SHUFFLE`` to this data would be
       different. And it will be explained in following. First for
       the explanation, ``[4526677, 4592401, 4658217, 4723879]`` in
       ``UInt32`` would be represent the byte column in the little
       endien as below.

       .. code-block::

          | Byte 0 | Byte 1 | Byte 2 | Byte 3 |  | Byte 0 | Byte 1 | Byte 2 | Byte 3 |  | Byte 0 | Byte 1 | Byte 2 | Byte 3 |  | Byte 0 | Byte 1 | Byte 2 | Byte 3 | 
          |--------|--------|--------|--------|  |--------|--------|--------|--------|  |--------|--------|--------|--------|  |--------|--------|--------|--------| 
          | 0x55   | 0x12   | 0x45   | 0x00   |, | 0x11   | 0x13   | 0x46   | 0x00   |, | 0x29   | 0x14   | 0x47   | 0x00   |, | 0xA7   | 0x14   | 0x48   | 0x00   | 

       Applying ``COMPRESS_FILTER_SHUFFLE`` to this data would be
       following byte columns.

       .. code-block::

          | Byte 0 | Byte 0 | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 | Byte 1 | Byte 1 |  | Byte 2 | Byte 2 | Byte 2 | Byte 2 |  | Byte 3 | Byte 3 | Byte 3 | Byte 3 |
          |--------|--------|--------|--------|  |--------|--------|--------|--------|  |--------|--------|--------|--------|  |--------|--------|--------|--------|
          | 0x55   | 0x11   | 0x29   | 0xA7   |, | 0x12   | 0x13   | 0x14   | 0x14   |, | 0x45   | 0x46   | 0x47   | 0x48   |, | 0x00   | 0x00   | 0x00   | 0x00   | 

       Pay attention to the data of ``Byte 1``, ``Byte 2``, and ``Byte
       3`` after the shuffling. The data increments of ``Byte 1`` are
       ``[0x12, 0x01, 0x01, 0x00]``. The data increments of ``Byte 2``
       are ``[0x45, 0x01, 0x01, 0x01]``.  The data increments of
       ``Byte 3`` are ``[0x00, 0x00, 0x00, 0x00]``. From those
       numbers, you can see the data increments have small values and
       have same values in continuance.

       As you see these, the compression rate could be increase by
       combining ``COMPRESS_FILTER_SHUFFLE`` even if applying
       ``COMPRESS_FILTER_BYTE_DELTA`` did not change the rate.

       Please note that ``COMPRESS_FILTER_SHUFFLE`` would not be
       effective for the 1 byte data because it is to gather the same
       byte from the data. (The 1 byte data would have same data
       column whether being shuffled or not.) Thus, in case of
       combining ``COMPRESS_FILTER_BYTE_DELTA`` and
       ``COMPRESS_FILTER_SHUFFLE``, please do not use data in ``Int8``
       / ``UInt8``. Only use for other type.

   * - ``COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE``
     - .. versionadded:: 13.0.8

       .. include:: compress_filter.rst

       This flag can be used only for ``Float`` / ``Float32``. And it
       is expected to be combined with ``COMPRESS_FILTER_SHUFFLE`` .

       Here is what kind of the data being effective for this flag.

       This flag would drop the 1 byte of fraction from each vector
       column elements of ``Float`` / ``Float32`` type. Dropping the
       fraction means making all of the lower 1 byte of the
       floating-point number ``0``.

       For example, ``[1.25, 3.67, 4.55]`` in ``Float32`` would be
       presented as following in the IEEE 754 format single-precision
       floating-point.

       .. code-block::

          | fraction (23bit)             | exponent (8bit) | sign (1bit) |
          |------------------------------|-----------------|-------------|
          | 0000 0000 0000 0000 0000 010 | 1111 1110       | 0           |
          | 0001 0010 1000 0111 0101 011 | 0000 0001       | 0           |
          | 0101 1001 1001 1001 1000 100 | 1000 0001       | 0           |

       Applying this flag make all lower 1 byte ``0``. And the data
       would be as below. Pay attention to all ``0`` for lower 1byte
       of fixed-point part.

       .. code-block::

          | fraction (23bit)             | exponent (8bit) | sign (1bit) |
          |------------------------------|-----------------|-------------|
          | 0000 0000 0000 0000 0000 010 | 1111 1110       | 0           |
          | 0000 0000 1000 0111 0101 011 | 0000 0001       | 0           |
          | 0000 0000 1001 1001 1000 100 | 1000 0001       | 0           |

       These actions are what would be done for single flag usage. As
       noted, this flag is expected to be combined with
       ``COLUMN_FILTER_SHUFFLE`` . Thus, by shuffling the data it is
       to expected increasing the compression rate after using the
       flag.

       Applying ``COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE`` then
       shuffling would produce data as below.

       .. code-block::

          | Byte 0 | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 | Byte 1 |  | Byte 2 | Byte 2 | Byte 2 |  | Byte 3 | Byte 3 | Byte 3 | 
          |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------| 
          | 0x00   | 0x00   | 0x00   |, | 0x00   | 0xe1   | 0x99   |, | 0xa0   | 0x6a   | 0x91   |, | 0x3f   | 0x40   | 0x40   | 

       Pay attention to the ``Byte 0``. You can find the value ``0``
       in continuance for ``Byte 0``. If
       ``COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE`` was not applied
       and shuffled, the data would be as following table, there would
       be no same value in continuance for any bytes.

       .. code-block::

          | Byte 0 | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 | Byte 1 |  | Byte 2 | Byte 2 | Byte 2 |  | Byte 3 | Byte 3 | Byte 3 | 
          |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------| 
          | 0x00   | 0x48   | 0x9a   |, | 0x00   | 0xe1   | 0x99   |, | 0xa0   | 0x6a   | 0x91   |, | 0x3f   | 0x40   | 0x40   | 

       Applying ``COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE`` to those
       data can be expected to increase the compression rate even if
       those data cannot increase the compression rate only with
       shuffling. However, note the data may be inaccurate since the
       fraction of the floating-point number is dropped for 1 byte.

   * - ``COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTES``
     - .. versionadded:: 13.0.8

       .. include:: compress_filter.rst

       This flag can be used only for ``Float`` / ``Float32``. And it
       is expected to be combined with ``COMPRESS_FILTER_SHUFFLE``.

       Here is what kind of the data being effective for this flag.

       This flag would drop the 2 bytes of fraction from each vector
       column elements of ``Float`` / ``Float32`` type. Dropping the
       fraction means making all of the lower 2 bytes of the
       floating-point number ``0``.

       For example, ``[1.25, 3.67, 4.55]`` in ``Float32`` would be
       presented as following in the IEEE 754 format single-precision
       floating-point.

       .. code-block::

          | fraction (23bit)             | exponent (8bit) | sign (1bit) |
          |------------------------------|-----------------|-------------|
          | 0000 0000 0000 0000 0000 010 | 1111 1110       | 0           |
          | 0001 0010 1000 0111 0101 011 | 0000 0001       | 0           |
          | 0101 1001 1001 1001 1000 100 | 1000 0001       | 0           |

       Applying this flag make all lower 2 bytes ``0``. And the data
       would be as below. Pay attention to all ``0`` for lower 2
       bytes of fixed-point part.

       .. code-block::

          | fraction (23bit)             | exponent (8bit) | sign (1bit) |
          |------------------------------|-----------------|-------------|
          | 0000 0000 0000 0000 0000 010 | 1111 1110       | 0           |
          | 0000 0000 0000 0000 0101 011 | 0000 0001       | 0           |
          | 0000 0000 0000 0000 1000 100 | 1000 0001       | 0           |

       These actions are what would be done for single flag usage. As
       noted, this flag is expected to be combined with
       ``COLUMN_FILTER_SHUFFLE`` . Thus, by shuffling the data it is
       to expected increasing the compression rate after using the
       flag.

       Applying ``COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTE`` then
       shuffling would produce data as below.

       .. code-block::

          | Byte 0 | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 | Byte 1 |  | Byte 2 | Byte 2 | Byte 2 |  | Byte 3 | Byte 3 | Byte 3 | 
          |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------| 
          | 0x00   | 0x00   | 0x00   |, | 0x00   | 0x00   | 0x00   |, | 0xa0   | 0x6a   | 0x91   |, | 0x3f   | 0x40   | 0x40   | 

       Pay attention to the ``Byte 0`` and ``Byte 1``. You can find
       the value ``0`` in continuance for ``Byte 0`` and ``Byte1``.

       If ``COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTE`` was not applied
       and shuffled, the data would be as following table, there would
       be no same value in continuance for any bytes.

       .. code-block::

          | Byte 0 | Byte 0 | Byte 0 |  | Byte 1 | Byte 1 | Byte 1 |  | Byte 2 | Byte 2 | Byte 2 |  | Byte 3 | Byte 3 | Byte 3 | 
          |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------|  |--------|--------|--------| 
          | 0x00   | 0x48   | 0x9a   |, | 0x00   | 0xe1   | 0x99   |, | 0xa0   | 0x6a   | 0x91   |, | 0x3f   | 0x40   | 0x40   | 

       Applying ``COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTE`` to those
       data can be expected to increase the compression rate even if
       those data cannot increase the compression rate only with
       shuffling.

       However, note the data may be inaccurate since the fraction of
       the floating-point number is dropped for 2 bytes.

   * - ``WITH_SECTION``
     - It enables section support to index column.

       If section support is enabled, you can support multiple
       documents in the same index column.

       You must specify this flag to create a multiple columns index
       column. See also :ref:`column-create-index-multiple-columns` for
       details.

       Section support requires additional spaces. If you don't need
       section support, you should not enable section support.

       This flag is available only for ``COLUMN_INDEX``.

   * - ``WITH_WEIGHT``
     - It enables weight support to vector column or index column.

       If weight support is enabled for vector column, you can add
       weight for each element. If weight support is enabled for index
       column, you can add weight for each posting. They are useful to
       compute suitable search score.

       You must specify this flag to use :ref:`select-adjuster`. See
       also :ref:`column-create-vector-weight` for details.

       Weight support requires additional spaces. If you don't need
       weight support, you should not enable weight support.

       This flag is available only for ``COLUMN_VECTOR`` or
       ``COLUMN_INDEX``.

   * - ``WEIGHT_FLOAT32``
     - .. versionadded:: 10.0.3

       You can use 32bit floating point instead of 32bit unsigned
       integer for weight value.

       You also need to specify ``WITH_WEIGHT``.

       This flag is available only for ``COLUMN_VECTOR`` or
       ``COLUMN_INDEX``.

   * - ``WITH_POSITION``
     - It enables position support to index column. It means that the
       index column is full inverted index. (Index column is
       implemented as inverted index.)

       If position support is enabled, you can add position in the
       document for each posting. It's required for phrase search. It
       means that index column for full text search must enable
       position support because most full text search uses phrase
       search.

       You must specify this flag to create a full text search index
       column. See also :ref:`column-create-index-full-text-search` for
       details.

       Position support requires additional spaces. If you don't need
       position support, you should not enable position support.

       This flag is available only for ``COLUMN_INDEX``.

   * - ``INDEX_SMALL``
     - .. versionadded:: 6.0.8

       It requires to create a small index column.

       If index target data are small, small index column is enough.
       Small index column uses fewer memory than a normal index column
       or a medium index column. See also
       :ref:`column-create-index-small` for knowing what are "small
       data" and how to use this flag.

       This flag is available only for ``COLUMN_INDEX``.

   * - ``INDEX_MEDIUM``
     - .. versionadded:: 6.0.8

       It requires to create a medium index column.

       If index target data are medium, medium index column is enough.
       Medium index column uses fewer memory than a normal index
       column. See also :ref:`column-create-index-medium` for knowing
       what are "medium data" and how to use this flag.

       This flag is available only for ``COLUMN_INDEX``.

   * - ``INDEX_LARGE``
     - .. versionadded:: 9.0.2

       It requires to create a large index column.

       If index target data are large, you need to use large index
       column. Large index column uses more memory than a normal index
       column but accepts more data than a normal index column. See
       also :ref:`column-create-index-large` for knowing what are
       "large data" and how to use this flag.

       This flag is available only for ``COLUMN_INDEX``.

   * - ``MISSING_ADD``
     - .. versionadded:: 12.0.2

       You can't specify multiple ``MISSING_*`` flags. They are
       exclusive.

       This is meaningful only for reference scalar and vector
       columns.

       If this flag is specified and nonexistent key in the referred
       table is specified to the column's value, a new record is
       created in the referred table automatically.

       If you don't specify any ``MISSING_*`` flag, ``MISSING_ADD`` is
       used as the default.

       See also :ref:`column-create-missing-mode`.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``MISSING_IGNORE``
     - .. versionadded:: 12.0.2

       You can't specify multiple ``MISSING_*`` flags. They are
       exclusive.

       This is meaningful only for reference scalar and vector
       columns.

       If this flag is specified and nonexistent key in the referred
       table is specified to the column's value, the value is just
       ignored. If the column is a scalar column, ``GRN_ID_NIL``
       (``0``) is stored because Groonga doesn't support the NULL
       value. If the column is a vector column, the element is just
       removed from the value. For example, ``["existent1",
       "nonexistent", "existent2"]`` is set to the vector column and
       ``"nonexistent"`` record doesn't exist in the referred table,
       ``["existent1", "existent2"]`` are set to the vector column.

       See also :ref:`column-create-missing-mode`.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``MISSING_NIL``
     - .. versionadded:: 12.0.2

       You can't specify multiple ``MISSING_*`` flags. They are
       exclusive.

       This is meaningful only for reference scalar and vector
       columns.

       If this flag is specified and nonexistent key in the referred
       table is specified to the column's value, the value is replaced
       with ``GRN_ID_NIL`` (``0``).

       See also :ref:`column-create-missing-mode`.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``INVALID_ERROR``
     - .. versionadded:: 12.0.2

       You can't specify multiple ``INVALID_*`` flags. They are
       exclusive.

       If this flag is specified and an invalid value is specified, an
       error is reported to :ref:`process-log`.

       For example, ``"STRING"`` for ``Int32`` column is an invalid
       value.

       If the column is a scalar column, :doc:`load` also reports an
       error.

       If the column is a vector column, :doc:`load` doesn't reports
       an error but invalid values in a vector value are removed or
       replaced with ``GRN_ID_NIL`` (``0``) depending on ``MISSING_*``
       flag of the column.

       .. note::

          This is an incompatible change at 12.0.2. :doc:`load`
          also reports an error for a vector column before 12.0.2.

       If you don't specify any ``INVALID_*`` flag, ``INVALID_ERROR`` is
       used as the default.

       See also :ref:`column-create-invalid-mode`.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``INVALID_WARN``
     - .. versionadded:: 12.0.2

       You can't specify multiple ``INVALID_*`` flags. They are
       exclusive.

       If this flag is specified and an invalid value is specified, a
       warning is reported to :ref:`process-log` but no error is
       reported.

       For example, ``"STRING"`` for ``Int32`` column is an invalid
       value.

       If the column is a vector column, invalid values in a vector
       value are removed or replaced with ``GRN_ID_NIL`` (``0``)
       depending on ``MISSING_*`` flag of the column.

       See also :ref:`column-create-invalid-mode`.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

   * - ``INVALID_IGNORE``
     - .. versionadded:: 12.0.2

       You can't specify multiple ``INVALID_*`` flags. They are
       exclusive.

       If this flag is specified and an invalid value is specified,
       it's just ignored.

       For example, ``"STRING"`` for ``Int32`` column is an invalid
       value.

       If the column is a vector column, invalid values in a vector
       value are removed or replaced with ``GRN_ID_NIL`` (``0``)
       depending on ``MISSING_*`` flag of the column.

       See also :ref:`column-create-invalid-mode`.

       This flag is available only for ``COLUMN_SCALAR`` and
       ``COLUMN_VECTOR``.

You must specify one of ``COLUMN_${TYPE}`` flags. You can't specify
two or more ``COLUMN_${TYPE}`` flags. For example,
``COLUMN_SCALAR|COLUMN_VECTOR`` is invalid.

You can combine flags with ``|`` (vertical bar) such as
``COLUMN_INDEX|WITH_SECTION|WITH_POSITION``.

.. _column-create-type:

``type``
""""""""

Specifies type of the column value.

If the column is scalar column or vector column, here are available
types:

* Builtin types described in :doc:`/reference/types`
* Tables defined by users

If the column is index column, here are available types:

* Tables defined by users

See also the followings:

* :ref:`column-create-scalar`
* :ref:`column-create-vector`
* :ref:`column-create-reference`
* :ref:`column-create-index`

Optional parameters
^^^^^^^^^^^^^^^^^^^

There is an optional parameter.

.. _column-create-source:

``source``
""""""""""

Specifies index target columns. You can specify one or more columns to
the ``source`` parameter.

This parameter is only available for index column.

You can only specify columns of the table specified as
:ref:`column-create-type`. You can also use the ``_key`` pseudo column
for specifying the table key as index target.

If you specify multiple columns to the ``source`` parameter, separate
columns with ``,`` (comma) such as ``_key,roles``.

``path``
""""""""

.. versionadded:: 10.0.7

Specifies a path for storing a column.

This option is useful if you want to store a column that
you often use to fast storage (e.g. SSD) and store it that you don't often
use to slow storage (e.g. HDD).

You can use a relative path or an absolute path in this option.
If you specify a relative path, it is resolved from the current directory for the ``groonga`` process.

The default value is none.

.. _column-create-generator:

``generator``
"""""""""""""

.. versionadded:: 14.1.0

Specifies a generator expression in :doc:`../grn_expr/script_syntax`
that is used to generate column value automatically.

This option is useful if you want to generate a column value from
other column value automatically.

The default value is none.

.. seealso:: :ref:`column-create-generated-column`

Return value
------------

``column_create`` returns ``true`` as body on success such as::

  [HEADER, true]

If ``column_create`` fails, ``column_create`` returns ``false`` as
body::

  [HEADER, false]

Error details are in ``HEADER``.

See :doc:`/reference/command/output_format` for ``HEADER``.

See also
--------

  * :doc:`/reference/column`
  * :doc:`/reference/commands/table_create`
  * :doc:`/reference/command/output_format`