Checkpoint 1 page is updated with the build instructions

This commit is contained in:
Gokhan Kul 2018-02-20 22:45:26 -05:00
parent aba881a375
commit 058d21f24f

View file

@ -34,7 +34,7 @@ Your task is to answer these queries as they arrive.
<h2>Volcano-Style Computation (Iterators)</h2>
Let's take a look at the script we've used as an example in class.
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">with <span style="color:#5b2a96;">open</span>(<span style="color:#f4181b;">'data.csv'</span>, <span style="color:#f4181b;">'r'</span>) <span style="color:#a71790;"><strong>as</strong></span> f:<br />
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">with <span style="color:#5b2a96;">open</span>(<span style="color:#f4181b;">'data.dat'</span>, <span style="color:#f4181b;">'r'</span>) <span style="color:#a71790;"><strong>as</strong></span> f:<br />
&nbsp;&nbsp;<span style="color:#a71790;"><strong>for</strong></span> line <span style="color:#a71790;"><strong>in</strong></span> f:<br />
&nbsp;&nbsp;&nbsp;&nbsp;fields = split(<span style="color:#f4181b;">&quot;,&quot;</span>, line)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#a71790;"><strong>if</strong></span>(fields[<span style="color:#0000ff;">2</span>] != <span style="color:#f4181b;">&quot;Ensign&quot;</span> <span style="color:#a71790;"><strong>and</strong></span> <span style="color:#5b2a96;">int</span>(fields[<span style="color:#0000ff;">3</span>]) &gt; <span style="color:#0000ff;">25</span>):<br />
@ -42,7 +42,7 @@ Let's take a look at the script we've used as an example in class.
</div>
<p>This script is basically a form of pattern 3 above
<pre><code class="sql">SELECT fields[1] FROM 'data.csv'
<pre><code class="sql">SELECT fields[1] FROM 'data.dat'
WHERE fields[2] != "Ensign" AND CAST(fields[3] AS int) > 25
</code></pre>
</p>
@ -58,11 +58,11 @@ WHERE fields[2] != "Ensign" AND CAST(fields[3] AS int) > 25
</div>
<p>This is nice and simple, but the code is very specific to pattern 3. That's something that will lead us into trouble. To see a simple example of the sort of problems we're going to run into, let's come up with an example of pattern 5:</p>
<pre><code class="sql">SELECT height + weight FROM 'data.csv' WHERE rank != 'Ensign'</code></pre>
<pre><code class="sql">SELECT height + weight FROM 'data.dat' WHERE rank != 'Ensign'</code></pre>
That is, we're asking for the sum of height and weight of each non-ensign in our example table. An equivalent script would be...</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">total = <span style="color:#0000ff;">0</span><br />
<br />
with <span style="color:#5b2a96;">open</span>(<span style="color:#f4181b;">'data.csv'</span>, <span style="color:#f4181b;">'r'</span>) <span style="color:#a71790;"><strong>as</strong></span> f:<br />
with <span style="color:#5b2a96;">open</span>(<span style="color:#f4181b;">'data.dat'</span>, <span style="color:#f4181b;">'r'</span>) <span style="color:#a71790;"><strong>as</strong></span> f:<br />
&nbsp;&nbsp;<span style="color:#a71790;"><strong>for</strong></span> line <span style="color:#a71790;"><strong>in</strong></span> f:<br />
&nbsp;&nbsp;&nbsp;&nbsp;fields = split(<span style="color:#f4181b;">&quot;,&quot;</span>, line)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#a71790;"><strong>if</strong></span> fields[<span style="color:#0000ff;">2</span>] != <span style="color:#f4181b;">'Ensign'</span>:<br />
@ -207,7 +207,7 @@ Eval eval = new Eval(){
</tbody>
</table>
<p>In addition to the schema, you will find a corresponding <tt>[tablename].csv</tt> file in the <tt>data</tt> directory. The name of the table corresponds to the table names given in the <tt>CREATE TABLE</tt> statements your code receives. For example, let's say that you see the following statement in your query file:</p>
<p>In addition to the schema, you will find a corresponding <tt>[tablename].dat</tt> file in the <tt>data</tt> directory. The name of the table corresponds to the table names given in the <tt>CREATE TABLE</tt> statements your code receives. For example, let's say that you see the following statement in your query file:</p>
<pre>CREATE TABLE R(A int, B int, C int);</pre>
<p>That means that the data directory contains a data file called 'R.dat' that might look like this:</p>
<pre>1|1|5
@ -216,18 +216,20 @@ Eval eval = new Eval(){
<p>Each line of text (see <a href="http://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html">BufferedReader.readLine()</a>) corresponds to one row of data. Each record is delimited by a vertical pipe '|' character.  Integers and floats are stored in a form recognized by Javas Long.parseLong() and Double.parseDouble() methods. Dates are stored in YYYY-MM-DD form, where YYYY is the 4-digit year, MM is the 2-digit month number, and DD is the 2-digit date. Strings are stored unescaped and unquoted and are guaranteed to contain no vertical pipe characters.</p>
<h4>Grading Workflow</h4>
<p>All .java files in the src directory at the root of your repository will be compiled (and linked against JSQLParser). As before, the class <tt>edu.buffalo.www.cse4562.Main</tt> will be invoked with no arguments, and a stream of <b>semicolon-delimited</b> queries will be printed to System.in (after you print out a prompt)</p>
<p>All .java files in the src directory at the root of your repository will be compiled (and linked against JSQLParser). A main file that you can take as an example is given <a href="https://www.cse.buffalo.edu/~gokhanku/Main.java">here</a>. As before, the class <tt>edu.buffalo.www.cse4562.Main</tt> will be invoked with no arguments, and a stream of <b>semicolon-delimited</b> queries will be printed to System.in (after you print out a prompt)</p>
<p>For example (<span style="color: red">red</span> text is entered by the user/grader):</p>
<pre>bash&gt; <span style="color: red">ls data</span>
R.csv
S.csv
T.csv
bash&gt; <span style="color: red">cat data/R.csv</span>
R.dat
S.dat
T.dat
bash&gt; <span style="color: red">cat data/R.dat</span>
1|1|5
1|2|6
2|3|7
bash&gt; <span style="color: red">java -cp build:jsqlparser.jar edu.buffalo.www.cse4562.Main -</span>
bash&gt; <span style="color: red">find {code root directory} -name \*.java -print > compile.list</span>
bash&gt; <span style="color: red">javac -cp {libs location}/commons-csv-1.5.jar:{libs location}/evallib-1.0.jar:{libs location}/jsqlparser-1.0.0.jar -d {compiled directory name} @compile.list</span>
bash&gt; <span style="color: red">java -cp {compiled directory name}/src/:{libs location}/commons-csv-1.5.jar:{libs location}/evallib-1.0.jar:{libs location}/jsqlparser-1.0.0.jar edu.buffalo.www.cse4562.Main --data data/</span>
$> <span style="color: red">CREATE TABLE R(A int, B int, C int);</span>
$> <span style="color: red">SELECT B, C FROM R WHERE A = 1;</span>
1|5
@ -238,7 +240,7 @@ $> <span style="color: red">SELECT A + B AS Q FROM R;</span>
5
</pre>
<p>For this project, we will issue 5 queries to your program excluding <tt>CREATE TABLE</tt> queries. 3 of these queries will NOT be timed, and they will evaluated based on the correctness of the query results. Answering each query successfully will bring you 1 point each. An example file you will read the data from is given <a href="https://www.cse.buffalo.edu/~gokhanku/R.csv">here</a>. This file is the same size and has the same structure with what we will use to evaluate these three queries. The remaining two queries will be timed, and they will run on a file that has 4000 tuples (~200 KB). You will get 2 point for each query if you can return correct results. You will receive additional 1.5 points for each query for matching or beating the reference implementation timewise. Also keep in mind that for ALL queries, the grader will time out and exit after 5 minutes.
<p>For this project, we will issue 5 queries to your program excluding <tt>CREATE TABLE</tt> queries. 3 of these queries will NOT be timed, and they will evaluated based on the correctness of the query results. Answering each query successfully will bring you 1 point each. An example file you will read the data from is given <a href="https://www.cse.buffalo.edu/~gokhanku/R.dat">here</a>. This file is the same size and has the same structure with what we will use to evaluate these three queries. The remaining two queries will be timed, and they will run on a file that has 4000 tuples (~200 KB). You will get 2 point for each query if you can return correct results. You will receive additional 1.5 points for each query for matching or beating the reference implementation timewise. Also keep in mind that for ALL queries, the grader will time out and exit after 5 minutes.
</p>
<style type="text/css">
@ -289,3 +291,6 @@ $> <span style="color: red">SELECT A + B AS Q FROM R;</span>
</tr>
</table>
<p>Updated on 02/20/2018: As explained the post on piazza, build commands are updated. Example Main.java file added. Also, you should find 'R.dat' (not R.csv) in your data folder when a query accesses table R.
</p>