-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathlanguage-directed-acyclic-flow-graphs-3.yaml
More file actions
47 lines (43 loc) · 1.75 KB
/
language-directed-acyclic-flow-graphs-3.yaml
File metadata and controls
47 lines (43 loc) · 1.75 KB
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
# ============================================================================
# NOTE: This is a test to protect an example shown in the SuperPipe language
# docs. If you need to make changes to the SuperPipe below to make the tests pass
# again after a change, the docs likely need to be updated as well.
#
# See https://github.com/brimdata/super/pull/2901 for details
# ============================================================================
# The SuperPipe being tested below has been modified from the way it appears in
# docs/language/README.md:
#
# from ... |> switch color (
# case "red" => op1 |> op2 |> ...
# case "blue" => op1 |> op2 |> ...
# default => op1 |> op2 |> ...
# ) |> ...
#
# Specifically, the "op1", "op2", and "..." have been filled in with real
# operations.
script: |
export SUPER_DB_LAKE=test
super db init -q
super db create -q -orderby name fruit
super db load -q -use fruit fruit.jsup
super db query -z -I switch.spq
inputs:
- name: fruit.jsup
data: |
{name:"apple",color:"red",price:1.5}
{name:"banana",color:"yellow",price:2.1}
{name:"blueberry",color:"blue",price:0.1}
- name: switch.spq
data: |
from fruit |> switch color (
case "red" => put price:=price+0.5 |> put bigcolor:=upper(color) |> put tag:="expensive"
case "blue" => put price:=price+0.1 |> put colorlen:=len(color) |> put tag:="cheaper"
default => put price:=price-0.1 |> put promo:="discounted" |> put tag:="promoted"
) |> sort name
outputs:
- name: stdout
data: |
{name:"apple",color:"red",price:2.,bigcolor:"RED",tag:"expensive"}
{name:"banana",color:"yellow",price:2.,promo:"discounted",tag:"promoted"}
{name:"blueberry",color:"blue",price:0.2,colorlen:4,tag:"cheaper"}