Files
secondo/Tools/Generators/TPC-D/tpcgen.sec
2026-01-23 17:03:45 +08:00

129 lines
3.1 KiB
Plaintext

# July 2008, M. Spiekermann
#
# This Secondo command script imports CSV-data as generated by the tpc data
# generation tool dbgen.
#
# To avoid problems with indexes the attribute's prefixes are formed by a
# single lowercase letter without using the underscore
# 1: relations
let LINEITEM = [ const rel(tuple([
LORDERKEY: int,
LPARTKEY: int,
LSUPPKEY: int,
LLINENUMBER: int,
LQUANTITY: real,
LEXTENDEDPRICE: real,
LDISCOUNT: real,
LTAX: real,
LRETURNFLAG: string,
LLINESTATUS: string,
LSHIPDATE: instant,
LCOMMITDATE: instant,
LRECEIPTDATE: instant,
LSHIPINSTRUCT: string,
LSHIPMODE: string,
LCOMMENT: string] )) value ()
]
csvimport['lineitem.tbl', 0, "", "|"] consume;
let SUPPLIER = [ const rel(tuple([
SSUPPKEY: int,
SNAME: string,
SADDRESS: string,
SNATIONKEY: int,
SPHONE: string,
SACCTBAL: real,
SCOMMENT: text] )) value ()
]
csvimport['supplier.tbl', 0, "", "|"] consume;
let ORDERS = [ const rel(tuple([
OORDERKEY: int,
OCUSTKEY: int,
OORDERSTATUS: string,
OTOTALPRICE: real,
OORDERDATE: instant,
OORDERPRIORITY: string,
OCLERK: string,
OSHIPPRIORITY: int,
OCOMMENT: text] )) value ()
]
csvimport['order.tbl', 0, "", "|"] consume;
let CUSTOMER = [ const rel(tuple([
CCUSTKEY: int,
CNAME: string,
CADDRESS: string,
CNATIONKEY: int,
CPHONE: string,
CACCTBAL: real,
CMKTSEGMENT: string,
CCOMMENT: text] )) value ()
]
csvimport['customer.tbl', 0, "", "|"] consume;
let PART = [ const rel(tuple([
PPARTKEY: int,
PNAME: text,
PMFGR: string,
PBRAND: string,
PTYPE: string,
PSIZE: int,
PCONTAINER: string,
PRETAILPRICE: real,
PCOMMENT: string] )) value ()
]
csvimport['part.tbl', 0, "", "|"] consume;
let PARTSUPP = [ const rel(tuple([
PsPARTKEY: int,
PsSUPPKEY: int,
PsAVAILQTY: int,
PsSUPPLYCOST: real,
PsCOMMENT: text] )) value ()
]
csvimport['partsupp.tbl', 0, "", "|"] consume;
let NATION = [ const rel(tuple([
NNATIONKEY: int,
NNAME: string,
NREGIONKEY: int,
NCOMMENT: text] )) value ()
]
csvimport['nation.tbl', 0, "", "|"] consume;
let REGION = [ const rel(tuple([
RREGIONKEY: int,
RNAME: string,
RCOMMENT: text] )) value ()
]
csvimport['region.tbl', 0, "", "|"] consume;
# 2: constants
#constant used in query 1
let cmpdate1 = [const instant value "1998-12-01"] - [const duration value (90 0)];
#constants used in query 5
let cmpdate5_1 = [const instant value "1994-01-01"];
let cmpdate5_2 = [const instant value "1995-01-01"];
#constants used in query 10
let cmpdate10_1 = [const instant value "1993-10-01"];
let cmpdate10_2 = [const instant value "1994-01-01"];