forked from itrummer/CodexDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompt_collection
158 lines (133 loc) · 5.23 KB
/
prompt_collection
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
"""
This Python program answers the query "What is the average age of customers?" on the following tables:
- Table customers, columns customer_id, name, age, zip, stored in 'customer.csv'.
The program performs the followings steps:
1. Import libraries for efficient data processing.
2. Load data for all tables.
3. Process the query.
4. Enable display for all rows and columns, strings of infinite length.
5. Print out the query result.
"""
--- Start of Python program ---
---
"""
File "customer.csv" stores table customer with columns customer_ID, age, name, zip.
Write a Python program for data format transformation:
1. Load libraries for efficient data formats.
2. Read "customer.csv" from disk.
3. Change into more efficient format.
4. Write changed file to hard disk.
5. Print only the name of the new file.
6. --- End of Python program ---
"""
--- Begin of Python program ---
---
Write a script for executing a C program, stored in file "testProgram", on Linux (no prompts):
--- Script starts here ---
---
Write a script for executing a Python program, stored in file "helloWorld", with Linux (no prompts):
--- Script starts here ---
---
"""
This Python program answers the query "What is the average age of customers?" on the following tables:
- Table customers, columns customer_id, name, age, zip, stored in 'customer.csv'.
The program performs the followings steps:
1. Import libraries for efficient data processing.
2. Load data for all tables.
3. Process the query.
4. Print out the query result.
"""
---
# Answer the query "What is the average age of customers?" on the following tables:
# - Table customers, columns customer_id, name, age, zip, stored in 'customer.csv'.
#!/bin/bash
---
"""
Write Python program to transform 'customer.csv' into a more efficient file format.
1. Read data from 'customer.csv'.
2. Transform into efficient format for large-scale processing.
3. Write transformed file to hard disk.
4. Print out name of new file only.
"""
---
///// Translate query from SQL to C++.
/// SQL query:
// Table lineorder, columns lo_extendedprice (numeric), lo_discount (numeric), lo_quantity (integer)
// Table date, columns d_year (integer)
select sum(lo_extendedprice*lo_discount) as revenue
from lineorder, date
where lo_orderdate = d_datekey
and d_year = 1993
and lo_discount between 2 - 1
and 2 + 1 and lo_quantity < 24;
/// C++ query:
// 1. Create index.
// 2. Print query result.
std::vector<s_lineorder> lineorder;
std::vector<s_date> date;
// 1. Create index.
std::vector<s_lineorder>::iterator lo_it;
std::vector<s_date>::iterator d_it;
for (lo_it = lineorder.begin(); lo_it != lineorder.end(); ++lo_it) {
for (d_it = date.begin(); d_it != date.end(); ++d_it) {
if (lo_it->lo_orderdate == d_it->d_datekey) {
lo_it->d_it = d_it;
}
}
}
// 2. Print query result.
double revenue = 0;
for (lo_it = lineorder.begin(); lo_it != lineorder.end(); ++lo_it) {
if (lo_it->d_it->d_year == 1993) {
if (lo_it->lo_discount >= 2 - 1 && lo_it->lo_discount <= 2 + 1) {
if (lo_it->lo_quantity < 24) {
revenue += lo_it->lo_extendedprice * lo_it->lo_discount;
}
}
}
}
std::cout << "revenue = " << revenue << std::endl;
---
Programming and scripting languages supported by Codex:
1.
---
# Create an index on the following table:
# Table customer, columns name, customer_id, age, zip, stored in 'customer.csv'.
# Execute the following steps:
# 1. Read customer.csv from disk.
# 2. Create a B+ tree index on the data.
# 3. Write index to file on hard disk.
# 4. Print out name of index file only.
---
# This Python program indexes the file customer.csv. The program has no input arguments.
# Table customer, columns name, customer_id, age, zip, stored in 'customer.csv'.
# Execute the following steps:
# 1. Read customer.csv from disk.
# 2. Create a B+ tree index on the data.
# 3. Write index to file on hard disk.
# 4. Print out name of index file only.
---
# This Python program indexes the file customer.csv. The program has no input arguments.
# Table customer, columns name, customer_id, age, zip, stored in customer.csv.
# Execute the following steps:
# 1. Read customer.csv from disk.
# 2. Create a B+ tree index on the data.
# 3. Write index to file on hard disk.
# 4. Print out name of index file only.
---
"""
This Python program answers the query "What is the total number of singers?" on the following tables:
Table stadium with columns Stadium_ID, Location, Name, Capacity, Highest, Lowest, Average, stored in stadium.csv.
Table singer with columns Singer_ID, Name, Country, Song_Name, Song_release_year, Age, Is_male, stored in singer.csv.
Table concert with columns concert_ID, concert_Name, Theme, Stadium_ID, Year, stored in concert.csv.
Table singer_in_concert with columns concert_ID, Singer_ID, stored in singer_in_concert.csv.
1. Load data for all relevant tables.
2. Calculate the answer to the query.
3. Write query results to file 'result.csv'.
Generate code to reduce main memory footprint as much as possible.
"""
---
1. Import library for processing tabular data in parallel.
1. Import library for processing tabular data on GPU.
1. Import library for processing tabular data on TPU.
(with temperature 0.2 - no start/end tags, 400 tokens)