File: columns.test

package info (click to toggle)
groonga 11.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 121,576 kB
  • sloc: ansic: 801,209; javascript: 62,121; ruby: 46,206; cpp: 33,790; xml: 24,951; yacc: 13,333; sh: 7,776; python: 3,266; makefile: 2,315; perl: 133
file content (39 lines) | stat: -rw-r--r-- 1,082 bytes parent folder | download | duplicates (4)
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
table_create Items TABLE_HASH_KEY ShortText
column_create Items price COLUMN_SCALAR UInt32

load --table Items
[
{"_key": "Book",  "price": 1000},
{"_key": "Note",  "price": 1000},
{"_key": "Box",   "price":  520},
{"_key": "Pen",   "price":  510},
{"_key": "Food",  "price":  500},
{"_key": "Drink", "price":  300}
]

# To use cache
#@sleep 1

#@collect-query-log true
select Items \
  --columns[price_with_tax].stage initial \
  --columns[price_with_tax].type UInt32 \
  --columns[price_with_tax].flags COLUMN_SCALAR \
  --columns[price_with_tax].value 'price * 1.08'

#@sleep 1

select Items \
  --columns[price_with_tax].stage initial \
  --columns[price_with_tax].type UInt32 \
  --columns[price_with_tax].flags COLUMN_SCALAR \
  --columns[price_with_tax].value 'price * 1.08'

# There are more spaces around '*' in --columns[price_with_tax].value
select Items \
  --columns[price_with_tax].stage initial \
  --columns[price_with_tax].type UInt32 \
  --columns[price_with_tax].flags COLUMN_SCALAR \
  --columns[price_with_tax].value 'price  *  1.08'

#@collect-query-log false