The next week of lectures

This commit is contained in:
Oliver Kennedy 2019-02-03 21:42:33 -05:00
parent 23319f1a75
commit 3892f9a877
16 changed files with 2373 additions and 192 deletions

View file

@ -219,7 +219,7 @@ For each week:
<section>
<h3>Relational Algebra</h3>
<img src="graphics/2019 -02-04-RA-Tree.svg" />
<img src="graphics/2019-02-04-RA-Tree.svg" />
$$\pi_{R.A}(\sigma_{S.C=10}(\bowtie_{R.B = S.B}(\textbf{R}, \textbf{S})))$$
</section>
@ -325,7 +325,7 @@ For each week:
<h3>Selection ($\sigma_{c}$)</h3>
<p>Delete rows that fail the condition $c$.</p>
<div class="fragment">
$$\sigma_{(BORONAME = \texttt{'Brooklyn'})} \textbf{Trees}$$
$$\sigma_{(\textbf{BORONAME} = \texttt{'Brooklyn'})} \textbf{Trees}$$
<table style="font-size: small; margin-top: 30px;">
<tr><th>TREE_ID</th><th>SPC_COMMON</th><th>BORONAME</th><th>...</th></tr>
<tr><td>204026</td><td>'honeylocust'</td><td>'Brooklyn'</td><td>...</td></tr>
@ -336,6 +336,11 @@ For each week:
<tr><td style="font-weight: bold;" colspan="4">... and 177287 more</td></tr>
</table>
</div>
<div class="fragment">
<pre><code class="sql">
SELECT * FROM Trees [[ WHERE BORONAME = 'Brooklyn' ]]
</code></pre>
</div>
</section>
<section>
@ -343,7 +348,7 @@ For each week:
<p>Delete attributes not in the projection list $A$.</p>
<div class="fragment">
$$\pi_{BORONAME}(Trees)$$
$$\pi_{\textbf{BORONAME}}(Trees)$$
<table style="font-size: small; margin-top: 30px;">
<tr><th>BORONAME</th></tr>
<tr><td>Queens</td></tr>
@ -356,14 +361,19 @@ For each week:
<p class="fragment">Only 5 results... not 683788?</p>
<p class="fragment">Set and Bag Projection are different</p>
<div class="fragment">
<pre><code class="sql">
SELECT [[ DISTINCT BORONAME ]] FROM Trees;
</code></pre>
</div>
</section>
<section>
<h3>Reminder: Queries are Relations</h3>
<p>What are these queries schemas?</p>
<div class="fragment" style="margin-top: 50px;">$$\pi_{TREEID, SPC\_COMMON, BORONAME} \textbf{Trees}$$</div>
<div class="fragment" style="margin-top: 50px;">$$\sigma_{(BORONAME = \texttt{'Brooklyn'})} \textbf{Trees}$$</div>
<div class="fragment" style="margin-top: 50px;">$$\sigma_{(BORONAME = \texttt{'Brooklyn'})}(\pi_{TREEID, SPC\_COMMON, BORONAME} \textbf{Trees})$$</div>
<div class="fragment" style="margin-top: 50px;">$$\pi_{\textit{TREEID},\ \textit{SPC_COMMON},\ \textit{BORONAME}} \textbf{Trees}$$</div>
<div class="fragment" style="margin-top: 50px;">$$\sigma_{(\textit{BORONAME} = \texttt{'Brooklyn'})} \textbf{Trees}$$</div>
<div class="fragment" style="margin-top: 50px;">$$\sigma_{(\textit{BORONAME} = \texttt{'Brooklyn'})}(\pi_{\textit{TREEID},\ \textit{SPC_COMMON},\ \textit{BORONAME}} \textbf{Trees})$$</div>
</section>
<section>
@ -491,7 +501,7 @@ For each week:
<p style="font-size: 60%">(Which operators behave differently in Set- and Bag-RA?)</p>
<table>
<tr ><th>Operator </th><th>Symbol </th><th >Duplicates?</th></tr>
<tr ><th>Operator </th><th>Symbol </th><th >Creates Duplicates?</th></tr>
<tr ><td>Selection </td><td>$\sigma$ </td><td class="fragment" style="color: darkred;">No</td></tr>
<tr class="fragment"><td>Projection </td><td>$\pi$ </td><td class="fragment" style="color: darkgreen;">Yes</td></tr>
<tr class="fragment"><td>Cross-product </td><td>$\times$ </td><td class="fragment" style="color: darkred;">No</td></tr>
@ -532,47 +542,71 @@ For each week:
</section>
<section>
<h3>Division ($/$)</h3>
<section>
<h3>Division ($/$)</h3>
<p>Not typically supported as a primitive operator,<br/>but useful for expressing queries like:</p>
<p style="font-size: 70%; font-weight: bold">Find species that appear in all boroughs</p>
<div style="font-size: 70%">
$$\pi_{BORONAME,\ SPC\_COMMON}(\textbf{Trees}) \;\;/\;\;\pi_{SPC\_COMMON}(\textbf{Trees})$$
(using set relational algebra)
</div>
<p>
$$R / S \equiv \{\; \left<\vec t\right> \;|\; \forall \left<\vec s\right> \in S, \left< \vec t \vec s \right> \in R \;\}$$
</p>
<p>Not typically supported as a primitive operator,<br/>but useful for expressing queries like:</p>
<p style="font-size: 70%; font-weight: bold">Find species that appear in all boroughs</p>
<div style="font-size: 70%">
$$\pi_{BORONAME,\ SPC\_COMMON}(\textbf{Trees}) \;\;/\;\;\pi_{SPC\_COMMON}(\textbf{Trees})$$
(using set relational algebra)
</div>
<p>
$$R / S \equiv \{\; \left<\vec t\right> \;|\; \forall \left<\vec s\right> \in S, \left< \vec t \vec s \right> \in R \;\}$$
</p>
</section>
<section>
<h3>Division ($/$)</h3>
<table style="font-size: 60%; margin-top: 30px; display: inline-block; vertical-align: middle;">
<tr><th>BORO</th> <th>SPC_COMMON</th></tr>
<tr class="fragment highlight-blue" data-fragment-index="1"><td>Brooklyn</td> <td>honeylocust</td></tr>
<tr class="fragment highlight-red" data-fragment-index="3"><td>Brooklyn</td> <td>American linden</td></tr>
<tr><td>Brooklyn</td> <td>London planetree</td></tr>
<tr class="fragment highlight-blue" data-fragment-index="1"><td>Manhattan</td> <td>honeylocust</td></tr>
<tr class="fragment highlight-red" data-fragment-index="3"><td>Manhattan</td> <td>American linden</td></tr>
<tr class="fragment highlight-green" data-fragment-index="5"><td>Manhattan</td> <td>pin oak</td></tr>
<tr class="fragment highlight-blue" data-fragment-index="1"><td>Queens</td> <td>honeylocust</td></tr>
<tr class="fragment highlight-red" data-fragment-index="3"><td>Queens</td> <td>American linden</td></tr>
<tr class="fragment highlight-blue" data-fragment-index="1"><td>Bronx</td> <td>honeylocust</td></tr>
</table>
<table style="font-size: 40%; margin-left: 30px; display: inline-block; vertical-align: middle;">
<tr class="fragment" data-fragment-index="1"><td>
<span style="font-size: 200%">/</span>
<table style="display: inline-block; vertical-align: middle; margin-left: 10px; border: 1px solid black;"><tr><th>SPC_COMMON</th></tr><tr><td class="fragment highlight-current-blue" data-fragment-index="1">honeylocust</td></tr></table>
<span class="fragment" data-fragment-index="2">
<span style="font-size: 200%; margin-left: 10px;">=</span>
<table style="display: inline-block; vertical-align: middle; margin-left: 10px; border: 1px solid black;"><tr><th>BORO</th></tr><tr><td>Brooklyn</td></tr><tr><td>Manhattan</td></tr><tr><td>Queens</td></tr><tr><td>Bronx</td></tr></table>
</span>
</td></tr>
<tr class="fragment" data-fragment-index="3"><td>
<span style="font-size: 200%">/</span>
<table style="display: inline-block; vertical-align: middle; margin-left: 10px; border: 1px solid black;"><tr><th>SPC_COMMON</th></tr><tr><td class="fragment highlight-current-blue" data-fragment-index="3">honeylocust</td></tr><tr><td class="fragment highlight-current-red" data-fragment-index="3">American linden</td></tr></table>
<span class="fragment" data-fragment-index="4">
<span style="font-size: 200%; margin-left: 10px;">=</span>
<table style="display: inline-block; vertical-align: middle; margin-left: 10px; border: 1px solid black;"><tr><th>BORO</th></tr><tr><td>Brooklyn</td></tr><tr><td>Manhattan</td></tr><tr><td>Queens</td></tr></table>
</span>
</td></tr>
<tr class="fragment" data-fragment-index="5"><td>
<span style="font-size: 200%">/</span>
<table style="display: inline-block; vertical-align: middle; margin-left: 10px; border: 1px solid black;"><tr><th>SPC_COMMON</th></tr><tr><td class="fragment highlight-current-blue" data-fragment-index="5">honeylocust</td></tr><tr><td class="fragment highlight-current-red" data-fragment-index="5">American linden</td></tr><tr><td class="fragment highlight-current-green" data-fragment-index="5">pin oak</td></tr></table>
<span class="fragment" data-fragment-index="6">
<span style="font-size: 200%; margin-left: 10px;">=</span>
<table style="display: inline-block; vertical-align: middle; margin-left: 10px; border: 1px solid black;"><tr><th>BORO</th></tr><tr><td>Manhattan</td></tr></table>
</span>
</td></tr>
</table>
</section>
<section>
<h3>Group Work</h3>
<p>If time permits: Implement division using other operators.</p>
</section>
</section>
<section>
<table style="font-size: small; margin-top: 30px; display: inline-block; vertical-align: middle;">
<tr><th>BORO</th> <th>SPC_COMMON</th></tr>
<tr><td>Brooklyn</td> <td>honeylocust</td></tr>
<tr><td>Brooklyn</td> <td>American linden</td></tr>
<tr><td>Brooklyn</td> <td>London planetree</td></tr>
<tr><td>Manhattan</td> <td>honeylocust</td></tr>
<tr><td>Manhattan</td> <td>American linden</td></tr>
<tr><td>Manhattan</td> <td>pin oak</td></tr>
<tr><td>Queens</td> <td>honeylocust</td></tr>
<tr><td>Queens</td> <td>American linden</td></tr>
<tr><td>Bronx</td> <td>honeylocust</td></tr>
</table>
<table style="font-size: 40%; margin-left: 30px; display: inline-block; vertical-align: middle;">
<tr class="fragment"><td style="text-align: left; padding-bottom: 30px;">/ { honeylocust }</td> <td style="text-align: left;">= Brooklyn, Manhattan, Queens, Bronx</td></tr>
<tr class="fragment"><td style="text-align: left; padding-bottom: 30px;">/ { honeylocust, American linden }</td> <td style="text-align: left;">= Brooklyn, Manhattan, Queens</td></tr>
<tr class="fragment"><td style="text-align: left; padding-bottom: 30px;">/ { honeylocust, American linden, pin oak }</td><td style="text-align: left;">= Manhattan</td></tr>
</table>
</section>
<section>
<h3>Group Work</h3>
<p>If time permits: Implement division using other operators.</p>
</section>
</section>
<section>
<section>
<h3>Relational Algebra</h3>
<p>
@ -586,6 +620,7 @@ For each week:
</p>
</section>
</div></div>
<script src="../reveal.js-3.6.0/js/reveal.js"></script>

View file

@ -0,0 +1,464 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSE 4/562</title>
<meta name="description" content="CSE 4/562">
<meta name="author" content="Oliver Kennedy">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="../reveal.js-3.6.0/css/reveal.css">
<link rel="stylesheet" href="ubodin.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="../reveal.js-3.6.0/lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? '../reveal.js-3.6.0/css/print/pdf.css' : '../reveal.js-3.6.0/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<script src="../reveal.js-3.6.0/lib/js/head.min.js"></script>
<!--[if lt IE 9]>
<script src="../reveal.js-3.6.0/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="header">
<!-- Any Talk-Specific Header Content Goes Here -->
CSE 4/562 - Database Systems
</div>
<div class="slides">
<section>
<h2>Relational Algebra Equivalences</h2>
<h3>CSE 4/562 Database Systems</h3>
<h5>February 6, 2019</h5>
<h5><b>Textbook</b>: Ch. 16.2</h5>
</section>
<section>
<section>
<h3>The running theme</h3>
<p>
<span class="fragment highlight-grey" data-fragment-index="1">If X and Y are </span><u>equivalent</u><span class="fragment highlight-grey" data-fragment-index="1"> and Y is <u>better</u>,<br/>
then replace all Xs with Ys</span>
</p>
<p class="fragment" data-fragment-index="1" style="font-size: 70%;"><b>Today's focus</b>: Provable Equivalence for RA Expressions</p>
</section>
<section>
<h3>Equivalence</h3>
$$Q_1 = \pi_{A}\left( \sigma_{c}( R ) \right)$$
$$Q_2 = \sigma_{c}\left( \pi_{A}( R ) \right)$$
<div class="fragment">
$$Q_1 \stackrel{?}{\equiv} Q_2$$
</div>
</section>
<section>
<h3>Ground Rules</h3>
<dl>
<dt class="fragment" data-fragment-index="1">Only Relational Values Matter</dt>
<dd class="fragment" data-fragment-index="1">Obviously $Q_1 \neq Q_2$. What we care about is whether $Q_1(R) = Q_2(R)$...</dd>
<dt class="fragment" data-fragment-index="2">Data Independent</dt>
<dd class="fragment" data-fragment-index="2">... for <i>all</i> valid input data $R$.</dd>
<dd class="fragment" data-fragment-index="3" style="font-size: 70%">However, it's fair to talk about equivalence when we know the data has some properties. (more on this later)</dd>
<dt class="fragment" data-fragment-index="4">Data-Model Dependent</dt>
<dd class="fragment" data-fragment-index="4">It's important to be clear whether we're talking about sets, <span class="fragment highlight-blue">bags</span>, or lists.</dd>
</dl>
</section>
<section>
<h3>In summary...</h3>
<p style="font-size: 80%;">
We say that $Q_1 \equiv Q_2$ if and only if<br/>
we can guarantee that the <i>bag</i> of tuples produced by $Q_1(R, S, T, \ldots)$ <br/>
is the same as the <i>bag</i> of tuples produced by $Q_2(R, S, T, \ldots)$ <br/>
for any combination of valid inputs $R, S, T, \ldots$.
</p>
<p style="font-size: 70%;" class="fragment">
... that satisfy any necessary properties.
</p>
</section>
<section>
<h3>Starting Rules</h3>
<table style="font-size: 80%">
<tr><th colspan="2" style="padding-top: 20px;">Selection</th></tr>
<tr>
<td>$\sigma_{c_1 \wedge c_2}(R) \equiv \sigma_{c_1}(\sigma_{c_2}(R))$</td>
<td>(Decomposability)</td>
</tr>
<tr><th colspan="2" style="padding-top: 20px;">Projection</th></tr>
<tr>
<td>$\pi_{A}(R) \equiv \pi_{A}(\pi_{A \cup B}(R))$</td>
<td>(Idempotence)</td>
</tr>
<tr><th colspan="2" style="padding-top: 20px;">Cross Product</th></tr>
<tr>
<td>$R \times (S \times T) \equiv (R \times S) \times T$</td>
<td>(Associativity)</td>
</tr>
<tr>
<td>$R \times S \equiv S \times R$</td>
<td>(Commutativity)</td>
</tr>
<tr><th colspan="2" style="padding-top: 20px;">Union</th></tr>
<tr>
<td>$R \cup (S \cup T) \equiv (R \cup S) \cup T$</td>
<td>(Associativity)</td>
</tr>
<tr>
<td>$R \cup S \equiv S \cup R$</td>
<td>(Commutativity)</td>
</tr>
</table>
</section>
<section>
<h3>Try it!</h3>
<p class="fragment highlight-grey" data-fragment-index="1">
Show that
$$R \times (S \times T) \equiv T \times (S \times R)$$
</p>
<div class="fragment highlight-grey" data-fragment-index="2">
<p class="fragment" data-fragment-index="1">
Show that
$$\sigma_{c_1}(\sigma_{c_2}(R)) \equiv \sigma_{c_2}(\sigma_{c_1}(R))$$
</p>
</div>
<div class="fragment highlight-grey" data-fragment-index="3">
<p class="fragment" data-fragment-index="2">
Show that
$$R \bowtie_{c} S \equiv S \bowtie_{c} R$$
</p>
</div>
<p class="fragment" data-fragment-index="3">
Show that
$$\sigma_{R.B = S.B \wedge R.A > 3}(R \times S) \equiv \sigma_{R.A > 3}(R \bowtie_{B} S)$$
</p>
</section>
</section>
<section>
<section>
<h3>Rules for Multiple Operators</h3>
</section>
<section>
<table style="font-size: 90%; margin-bottom: 50px;">
<tr><th colspan="2" style="padding-top: 20px;">Selection + Projection</th></tr>
<tr>
<td>$\pi_{A}(\sigma_{c}(R)) \equiv \sigma_{c}(\pi_{A}(R))$</td>
<td>(Commutativity)</td>
</tr>
</table>
<p style="font-size: 80%;" class="fragment">... but only if $A$ and $c$ are <u>compatible</u></p>
<p style="font-size: 80%;" class="fragment">$A$ must include all columns referenced by $c$ ($cols(c)$)</p>
<div class="fragment" style="margin-top: 50px;">
<h3>Try it!</h3>
<p>
Show that
$$\pi_A(\sigma_c(R)) \equiv \pi_A(\sigma_c(\pi_{(A \cup cols(c))}(R)))$$
</p>
</div>
</section>
<section>
<table style="font-size: 90%; margin-bottom: 50px;">
<tr><th colspan="2" style="padding-top: 20px;">Selection + Cross Product</th></tr>
<tr>
<td>$\sigma_c(R \times S) \equiv (\sigma_{c}(R)) \times S$</td>
<td>(Commutativity)</td>
</tr>
</table>
<p style="font-size: 80%;" class="fragment">... but only if $c$ references only columns of $R$</p>
<p style="font-size: 60%;" class="fragment">$cols(c) \subseteq cols(R)$</p>
<div class="fragment" style="margin-top: 50px;">
<h3>Try it!</h3>
<p>
Show that
$$\sigma_{R.B = S.B \wedge R.A > 3}(R \times S) \equiv (\sigma_{R.A > 3}(R)) \bowtie_{B} S$$
<div style="font-size: 70%;" class="fragment">When is this rewrite a good idea?</div>
</p>
</div>
</section>
<section>
<table style="font-size: 90%; margin-bottom: 50px;">
<tr><th colspan="2" style="padding-top: 20px;">Projection + Cross Product</th></tr>
<tr>
<td>$\pi_A(R \times S) \equiv (\pi_{A_R}(R)) \times (\pi_{A_S}(S))$</td>
<td>(Commutativity)</td>
</tr>
</table>
<p style="font-size: 80%;">... where $A_R$ and $A_S$ are the columns of $A$ from $R$ and $S$ respectively.</p>
<p style="font-size: 60%;">$A_R = A \cap cols(R)$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$A_S = A \cap cols(S)$</p>
<div class="fragment" style="margin-top: 50px;">
<h3>Try it!</h3>
<p>
Show that
$$\pi_{A}(R \bowtie_c S) \equiv (\pi_{A_R}(R)) \bowtie_c (\pi_{A_S}(S))$$
<div style="font-size: 70%;" class="fragment">When does this condition hold?</div>
</p>
</div>
</section>
<section>
<table style="font-size: 80%; margin-bottom: 50px;">
<tr><th colspan="2" style="padding-top: 20px;">Intersection</th></tr>
<tr>
<td>$R \cap (S \cap T) \equiv (R \cap S) \cap T$</td>
<td>(Associativity)</td>
</tr>
<tr>
<td>$R \cap S \equiv S \cap R$</td>
<td>(Commutativity)</td>
</tr>
<tr><th colspan="2" style="padding-top: 20px;">Selection + <u>&nbsp;&nbsp;&nbsp;&nbsp;</u></th></tr>
<tr>
<td>$\sigma_c(R \cup S) \equiv (\sigma_c(R)) \cup (\sigma_c(R))$</td>
<td>(Commutativity)</td>
</tr>
<tr>
<td>$\sigma_c(R \cap S) \equiv (\sigma_c(R)) \cap (\sigma_c(R))$</td>
<td>(Commutativity)</td>
</tr>
<tr><th colspan="2" style="padding-top: 20px;">Projection + <u>&nbsp;&nbsp;&nbsp;&nbsp;</u></th></tr>
<tr>
<td>$\pi_A(R \cup S) \equiv (\pi_A(R)) \cup (\pi_A(R))$</td>
<td>(Commutativity)</td>
</tr>
<tr>
<td>$\pi_A(R \cap S) \equiv (\pi_A(R)) \cap (\pi_A(R))$</td>
<td>(Commutativity)</td>
</tr>
<tr><th colspan="2" style="padding-top: 20px;">Cross Product + Union</th></tr>
<tr>
<td>$R \times (S \cup T) \equiv (R \times S) \cup (R \times T)$</td>
<td>(Distributivity)</td>
</tr>
</table>
</section>
</section>
<section>
<section>
<h3>Example</h3>
<pre style="display: inline-block; width: 300px; vertical-align: middle;"><code class="sql">
SELECT R.A, T.E
FROM R, S, T
WHERE R.B = S.B
AND S.C < 5
AND S.D = T.D
</code></pre>
<span style="vertical-align: middle; margin: 50px; font-size: 300%"></span>
<img src="graphics/2019-02-06-RA-Opt-1.svg" style="vertical-align: middle;"/>
</section>
<section>
<img src="graphics/2019-02-06-RA-Opt-1.svg" style="vertical-align: middle;" />
<span style="vertical-align: middle; margin: 50px; font-size: 300%"></span>
<img src="graphics/2019-02-06-RA-Opt-2.svg" style="vertical-align: middle;"/>
</section>
<section>
<img src="graphics/2019-02-06-RA-Opt-2.svg" style="vertical-align: middle;" />
<span style="vertical-align: middle; margin: 50px; font-size: 300%"></span>
<img src="graphics/2019-02-06-RA-Opt-3.svg" style="vertical-align: middle;" />
</section>
<section>
<img src="graphics/2019-02-06-RA-Opt-3.svg" style="vertical-align: middle;" />
<span style="vertical-align: middle; margin: 50px; font-size: 300%"></span>
<img src="graphics/2019-02-06-RA-Opt-4.svg" style="vertical-align: middle;" />
</section>
<section>
<img src="graphics/2019-02-06-RA-Opt-4.svg" style="vertical-align: middle;" />
<span style="vertical-align: middle; margin: 50px; font-size: 300%"></span>
<img src="graphics/2019-02-06-RA-Opt-5.svg" style="vertical-align: middle;" />
</section>
<section>
<img src="graphics/2019-02-06-RA-Opt-5.svg" style="vertical-align: middle;" />
<span style="vertical-align: middle; margin: 50px; font-size: 300%"></span>
<img src="graphics/2019-02-06-RA-Opt-6.svg" style="vertical-align: middle;" />
</section>
<section>
<img src="graphics/2019-02-06-RA-Opt-6.svg" style="vertical-align: middle;" />
<span style="vertical-align: middle; margin: 50px; font-size: 300%"></span>
<img src="graphics/2019-02-06-RA-Opt-7.svg" style="vertical-align: middle;" />
</section>
</section>
<section>
<section>
<h3>General Query Optimizers</h3>
<p><b>Input:</b> Dumb translation of SQL to RA</p>
<p>⬇︎</p>
<p>Apply rewrites</p>
<p>⬇︎</p>
<p><b>Output:</b> Better, but equivalent query</p>
</section>
<section>
<p>Which rewrite rules should we apply?</p>
</section>
<section>
<dl style="font-size: 75%">
<dt class="fragment highlight-grey" data-fragment-index="2">Selection Pushdown</dt>
<dd class="fragment highlight-grey" data-fragment-index="2"><b>Always</b> commute Selections as close to the leaves as possible.</dd>
<dt class="fragment highlight-grey" data-fragment-index="2">Join Construction</dt>
<dd class="fragment highlight-grey" data-fragment-index="2">Joins are <b>always</b> better than cross-products. <span class="fragment" data-fragment-index="1">(if there's a good join algorithm)</span></dd>
<dt class="fragment highlight-grey" data-fragment-index="2">(Optional) Projection Pushdown</dt>
<dd class="fragment highlight-grey" data-fragment-index="2">Commuting Projections down to the leaves removes redundant columns, and <b>may</b> be beneficial for some systems.</dd>
<dt>Join Algorithm Selection</dt>
<dd>Joins can be implemented differently, depending on the join predicate.</dd>
<dt>Join/Union Ordering</dt>
<dd>The order in which joins are evaluated <b>may</b> affect query runtimes.</dd>
<dt>Access Paths</dt>
<dd>$(\sigma_c(R))$ and $(Q(\ldots) \bowtie_c R)$ are special cases that we can make fast!</dd>
</dl>
<p class="fragment" data-fragment-index="2" style="font-size: 60%">Some rewrites are situational... we need more information to decide when to apply them.</p>
</section>
<section>
<h3>General Query Optimizers</h3>
<ol style="font-size: 60%">
<li class="fragment" data-fragment-index="1">Apply blind heuristics (e.g., push down selections)</li>
<li class="fragment" data-fragment-index="2">Enumerate all possible <i>execution plans</i> by varying <span class="fragment" data-fragment-index="3" style="font-size: 80%;">(or for a reasonable subset)</span>
<ul>
<li>Join/Union Evaluation Order (commutativity, associativity, distributivity)</li>
<li class="fragment" data-fragment-index="4">Algorithms for Joins, Aggregates, Sort, Distinct, and others</span></li>
<li class="fragment" data-fragment-index="4">Data Access Paths</li>
</ul>
</li>
<li class="fragment" data-fragment-index="5">Estimate the cost of each execution plan</li>
<li class="fragment" data-fragment-index="6">Pick the execution plan with the lowest cost</li>
</ol>
</section>
<section>
<b>Next Class:</b> Extended Relational Algebra and Basic Join Algorithms
</section>
</section>
</div></div>
<script src="../reveal.js-3.6.0/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/../reveal.js#configuration
Reveal.initialize({
controls: false,
progress: true,
history: true,
center: true,
slideNumber: true,
transition: 'fade', // none/fade/slide/convex/concave/zoom
chart: {
defaults: {
global: {
title: { fontColor: "#333", fontSize: 24 },
legend: {
labels: { fontColor: "#333", fontSize: 20 },
},
responsiveness: true
},
scale: {
scaleLabel: { fontColor: "#333", fontSize: 20 },
gridLines: { color: "#333", zeroLineColor: "#333" },
ticks: { fontColor: "#333", fontSize: 16 },
}
},
line: { borderColor: [ "rgba(20,220,220,.8)" , "rgba(220,120,120,.8)", "rgba(20,120,220,.8)" ], "borderDash": [ [5,10], [0,0] ]},
bar: { backgroundColor: [
"rgba(220,220,220,0.8)",
"rgba(151,187,205,0.8)",
"rgba(205,151,187,0.8)",
"rgba(187,205,151,0.8)"
]
},
pie: { backgroundColor: [ ["rgba(0,0,0,.8)" , "rgba(220,20,20,.8)", "rgba(20,220,20,.8)", "rgba(220,220,20,.8)", "rgba(20,20,220,.8)"] ]},
radar: { borderColor: [ "rgba(20,220,220,.8)" , "rgba(220,120,120,.8)", "rgba(20,120,220,.8)" ]},
},
// Optional ../reveal.js plugins
dependencies: [
{ src: '../reveal.js-3.6.0/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '../reveal.js-3.6.0/plugin/math/math.js',
condition: function() { return true; },
mathjax: '../reveal.js-3.6.0/js/MathJax.js'
},
{ src: '../reveal.js-3.6.0/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../reveal.js-3.6.0/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../reveal.js-3.6.0/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../reveal.js-3.6.0/plugin/zoom-js/zoom.js', async: true },
{ src: '../reveal.js-3.6.0/plugin/notes/notes.js', async: true },
// Chart.min.js
{ src: '../reveal.js-3.6.0/plugin/chart/Chart.min.js'},
// the plugin
{ src: '../reveal.js-3.6.0/plugin/chart/csv2chart.js'},
{ src: '../reveal.js-3.6.0/plugin/svginline/es6-promise.auto.js', async: false },
{ src: '../reveal.js-3.6.0/plugin/svginline/data-src-svg.js', async: false }
]
});
</script>
</body>
</html>

View file

@ -55,156 +55,449 @@
<section>
<section>
<h1>Intro</h1>
<h2>Checkpoint 1</h2>
<h3>CSE 4/562 Database Systems</h3>
<h5>February 01, 2019</h5>
<h5>February 8, 2019</h5>
<h5><b>Textbook</b>: Ch. 16.1</h5>
</section>
<section>
<ul>
<li>Using CCJSQLParser</li>
<li>Using SQL ASTs</li>
<li>Select Statements</li>
<li>Create Table Statements</li>
</ul>
<ul>
<li>Requirements Overview</li>
<li><tt>CREATE TABLE</tt></li>
<li>Volcano Evaluation</li>
<li>EvalLib</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Using CCJSqlParser</h2>
<section>
<h2>Checkpoint 1</h2>
<pre><code class="java">
// StringReaders create a reader from a string
Reader input = new StringReader("SELECT * FROM R")
<svg width="900px" height="300px">
<image x="0" y="0" xlink:href="graphics/Clipart/Window.png" width="900px" height="24px" />
<rect x="0" y="24" fill="black" width="900px" height="276px" />
<g transform="translate(0,44)">
<text x="5" y="0" font-size="12pt" font-family="Courier" fill="#00ff00">sif$</text>
<g class="fragment">
<text x="50" y="0" font-size="12pt" font-family="Courier" fill="#00ff00">javac -cp build:jsqlparser.jar:evallib.jar -D build {all .java files}</text>
<text x="5" y="20" font-size="12pt" font-family="Courier" fill="#00ff00" class="fragment">sif$</text>
</g>
</g>
<g transform="translate(0,64)" class="fragment">
<text x="50" y="0" font-size="12pt" font-family="Courier" fill="#00ff00">ls data/</text>
<text x="5" y="20" font-size="12pt" font-family="Courier" fill="#00ff00">R.csv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S.csv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T.csv</text>
<text x="5" y="40" font-size="12pt" font-family="Courier" fill="#00ff00">sif$</text>
</g>
<g transform="translate(0,104)" class="fragment">
<text x="50" y="0" font-size="12pt" font-family="Courier" fill="#00ff00">head -n 2 data/R.csv</text>
<text x="5" y="20" font-size="12pt" font-family="Courier" fill="#00ff00">1|3|5</text>
<text x="5" y="40" font-size="12pt" font-family="Courier" fill="#00ff00">2|9|1</text>
<text x="5" y="60" font-size="12pt" font-family="Courier" fill="#00ff00">sif$</text>
</g>
<g transform="translate(0,164)" class="fragment">
<text x="50" y="0" font-size="12pt" font-family="Courier" fill="#00ff00">java -cp build:jsqlparser.jar:evallib.jar dubstep.Main -</text>
<text x="5" y="20" font-size="12pt" font-family="Courier" fill="#00ff00">$&gt;</text>
</g>
<g transform="translate(0, 184)" class="fragment">
<text x="30" y="0" font-size="12pt" font-family="Courier" fill="#00ff00">CREATE TABLE R(A int, B int, C int);</text>
<text x="5" y="20" font-size="12pt" font-family="Courier" fill="#00ff00">$&gt;</text>
</g>
<g transform="translate(0, 204)" class="fragment">
<text x="30" y="0" font-size="12pt" font-family="Courier" fill="#00ff00">SELECT A, C FROM R WHERE B &lt; 5;</text>
<text x="5" y="20" font-size="12pt" font-family="Courier" fill="#00ff00">1|5</text>
<text x="5" y="40" font-size="12pt" font-family="Courier" fill="#00ff00">...</text>
<text x="5" y="60" font-size="12pt" font-family="Courier" fill="#00ff00">$&gt;</text>
</g>
</svg>
</section>
<section>
<h2>Checkpoint 1</h2>
<ul>
<li>Your code compiled just the same as in Checkpoint 0.</li>
<li>Print a prompt '$&gt;' at the start and after each command.</li>
<li><tt>CREATE TABLE</tt> statements tell you the schema of each table.</li>
<li>Data lives in a '|'-separated file in 'data/[tablename].csv'</li>
<li>Print query results '|'-separated</li>
</ul>
</section>
</section>
<section>
<section>
<svg width="800" height="100">
<g transform="translate(0,20)">
<image x="0" y="0" xlink:href="graphics/Clipart/Server.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">→ SQL</text>
</g>
</svg>
<pre><code class="sql">CREATE TABLE PLAYERS(
ID string,
FIRSTNAME string,
LASTNAME string,
FIRSTSEASON int,
LASTSEASON int,
WEIGHT int,
BIRTHDATE date
);
// CCJSqlParser takes a Reader or InputStream
CCJSqlParser parser = new CCJSqlParser(input)
SELECT FIRSTNAME, LASTNAME,
WEIGHT, BIRTHDATE
FROM PLAYERS
WHERE WEIGHT>200;</code></pre>
</section>
<section>
<svg width="800" height="100">
<g transform="translate(0,20)">
<image x="0" y="0" xlink:href="graphics/Clipart/Server.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">→ SQL</text>
<g transform="translate(115,0)">
<text font-size="18pt" transform="translate(-15,25)rotate(-45)"></text>
<text x="0" y="0" font-size="14pt" font-family="Courier">CREATE TABLE</text>
</g>
<g transform="translate(115,75)" fill="grey">
<text font-size="18pt" transform="translate(-27,-25)rotate(45)"></text>
<text x="0" y="0" font-size="14pt" font-family="Courier">SELECT</text>
</g>
</g>
</svg>
<pre><code class="sql">CREATE TABLE PLAYERS(
ID string,
FIRSTNAME string,
LASTNAME string,
FIRSTSEASON int,
LASTSEASON int,
WEIGHT int,
BIRTHDATE date
);</code></pre>
<p style="font-size: 20pt" class="fragment">There is a table named "PLAYERS"...
<ul style="font-size: 18pt">
<li class="fragment" style="margin: 10px;">... with 7 attributes</li>
<li class="fragment" style="margin: 10px;">... who's attributes have the given types</li>
<li class="fragment" style="margin: 10px;">... with data in the file "data/PLAYERS.csv"</li>
</ul>
</p>
</section>
<section>
<svg width="800" height="100">
<g transform="translate(0,20)">
<image x="0" y="0" xlink:href="graphics/Clipart/Server.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">→ SQL</text>
<g transform="translate(115,-20)">
<text font-size="18pt" transform="translate(-15,45)rotate(-45)"></text>
<text x="0" y="20" font-size="14pt" font-family="Courier">CREATE TABLE</text>
<g transform="translate(170,0)">
<text font-size="18pt" transform="translate(-27,23)"></text>
<image x="0" y="0" xlink:href="graphics/Clipart/DB.png" width="48px" height="50px" />
<rect x="-18" y="25" width="80" height="20" fill="white" opacity="0.7" />
<text font-size="12pt" transform="translate(-28,40)">Saved Schema</text>
</g>
<g transform="translate(400, 0)" class="fragment">
<image x="0" y="0" xlink:href="graphics/Clipart/File.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">.csv</text>
</g>
</g>
<g transform="translate(115,75)" fill="grey">
<text font-size="18pt" transform="translate(-27,-25)rotate(45)"></text>
<text x="0" y="0" font-size="14pt" font-family="Courier">SELECT</text>
</g>
</g>
</svg>
<pre class="fragment">
ABDELAL01|Alaa|Abdelnaby|1990|1994|240|1968-06-24
ABDULKA01|Kareem|Abdul-jabbar|1969|1988|225|1947-04-16
ABDULMA01|Mahmo|Abdul-rauf|1990|2000|162|1969-03-09
ABDULTA01|Tariq|Abdul-wahad|1997|2002|223|1974-11-03
ABDURSH01|Shareef|Abdur-rahim|1996|2007|225|1976-12-11
ABERNTO01|Tom|Abernethy|1976|1980|220|1954-05-06
ABRAMJO01|John|Abramovic|1946|1947|195|1919-02-09
ACKERAL01|Alex|Acker|2005|2008|185|1983-01-21
ACKERDO01|Donald|Ackerman|1953|1953|183|1930-09-04
ACRESMA01|Mark|Acres|1987|1992|220|1962-11-15
ACTONCH01|Charles|Acton|1967|1967|210|1942-01-11
... </pre>
</section>
<section>
<svg width="800" height="100">
<g transform="translate(0,20)">
<image x="0" y="0" xlink:href="graphics/Clipart/Server.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">→ SQL</text>
<g transform="translate(115,-20)" fill="grey">
<text font-size="18pt" transform="translate(-15,45)rotate(-45)"></text>
<text x="0" y="20" font-size="14pt" font-family="Courier">CREATE TABLE</text>
<g transform="translate(170,0)">
<text font-size="18pt" transform="translate(-27,23)"></text>
<image x="0" y="0" xlink:href="graphics/Clipart/DB.png" width="48px" height="50px" />
<rect x="-18" y="25" width="80" height="20" fill="white" opacity="0.7" />
<text font-size="12pt" transform="translate(-28,40)">Saved Schema</text>
</g>
<g transform="translate(400, 0)" fill="black">
<image x="0" y="0" xlink:href="graphics/Clipart/File.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">.csv</text>
<g transform="translate(30,50)">
<polyline points="0,0 0,40" stroke="black" stroke-width="1.5"/>
</g>
</g>
</g>
<g transform="translate(115,75)">
<text font-size="18pt" transform="translate(-27,-25)rotate(45)"></text>
<text x="0" y="0" font-size="14pt" font-family="Courier">SELECT</text>
<g transform="translate(70,-6)">
<polyline points="0,0 450,0" stroke="black" stroke-width="1.5"/>
<g transform="translate(440,0)">
<polyline points="0,0 10,0 0,3 0,-3 10,0" stroke="black" stroke-width="1.5"/>
</g>
<g transform="translate(455,0)">
<text x="0" y="6" font-size="14pt">Results</text>
</g>
</g>
</g>
</g>
</svg>
<h3>Example Queries</h3>
<ol>
<li style="font-size: 20pt">SELECT A, B, ... FROM R <b>(Project)</b></li>
<li style="font-size: 20pt">SELECT A, B, ... FROM R WHERE ... <b>(Project+Filter)</b></li>
<li style="font-size: 20pt">SELECT A+B AS C, ... FROM R <b>(Map)</b></li>
<li style="font-size: 20pt">SELECT A+B AS C, ... FROM R WHERE ... <b>(Map+Filter)</b></li>
<li class="fragment highlight-grey" data-fragment-index="1" style="font-size: 20pt">SELECT SUM(A+B) AS C, ... FROM R <b>(Aggregate)</b></li>
<li class="fragment highlight-grey" data-fragment-index="1" style="font-size: 20pt">SELECT SUM(A+B) AS C, ... FROM R WHERE ... <b>(Aggregate+Filter)</b></li>
</ol>
</section>
<section>
<svg width="800" height="100">
<g transform="translate(0,20)">
<image x="0" y="0" xlink:href="graphics/Clipart/Server.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">→ SQL</text>
<g transform="translate(115,-20)" fill="grey">
<text font-size="18pt" transform="translate(-15,45)rotate(-45)"></text>
<text x="0" y="20" font-size="14pt" font-family="Courier">CREATE TABLE</text>
<g transform="translate(170,0)">
<text font-size="18pt" transform="translate(-27,23)"></text>
<image x="0" y="0" xlink:href="graphics/Clipart/DB.png" width="48px" height="50px" />
<rect x="-18" y="25" width="80" height="20" fill="white" opacity="0.7" />
<text font-size="12pt" transform="translate(-28,40)">Saved Schema</text>
</g>
<g transform="translate(400, 0)" fill="black">
<image x="0" y="0" xlink:href="graphics/Clipart/File.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">.csv</text>
<g transform="translate(30,50)">
<polyline points="0,0 0,40" stroke="black" stroke-width="1.5"/>
</g>
</g>
</g>
<g transform="translate(115,75)">
<text font-size="18pt" transform="translate(-27,-25)rotate(45)"></text>
<text x="0" y="0" font-size="14pt" font-family="Courier">SELECT</text>
<g transform="translate(70,-6)">
<polyline points="0,0 450,0" stroke="black" stroke-width="1.5"/>
<g transform="translate(440,0)">
<polyline points="0,0 10,0 0,3 0,-3 10,0" stroke="black" stroke-width="1.5"/>
</g>
<g transform="translate(455,0)">
<text x="0" y="6" font-size="14pt">Results</text>
</g>
</g>
</g>
</g>
</svg>
<pre><code class="java"> if(stmt instanceof Select){
SelectBody bodyBase = ((Select)stmt).getSelectBody();
if(bodyBase instanceof PlainSelect){
PlainSelect body = (PlainSelect)bodyBase;
...
body.getFromItem()
body.getWhere()
body.getSelectItems()
...
}
}</code></pre>
</section>
<section>
<svg width="800" height="100">
<g transform="translate(0,20)">
<image x="0" y="0" xlink:href="graphics/Clipart/Server.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">→ SQL</text>
<g transform="translate(115,-20)" fill="grey">
<text font-size="18pt" transform="translate(-15,45)rotate(-45)"></text>
<text x="0" y="20" font-size="14pt" font-family="Courier">CREATE TABLE</text>
<g transform="translate(170,0)">
<text font-size="18pt" transform="translate(-27,23)"></text>
<image x="0" y="0" xlink:href="graphics/Clipart/DB.png" width="48px" height="50px" />
<rect x="-18" y="25" width="80" height="20" fill="white" opacity="0.7" />
<text font-size="12pt" transform="translate(-28,40)">Saved Schema</text>
</g>
<g transform="translate(400, 0)" fill="black">
<image x="0" y="0" xlink:href="graphics/Clipart/File.png" width="50px" height="50px" />
<text x="45" y="38" font-size="12pt">.csv</text>
<g transform="translate(30,50)">
<polyline points="0,0 0,25" stroke="black" stroke-width="1.5"/>
<g transform="translate(0,15) rotate(90)">
<polyline points="0,0 10,0 0,3 0,-3 10,0" stroke="black" stroke-width="1.5"/>
</g>
</g>
</g>
</g>
<g transform="translate(115,75)">
<text font-size="18pt" transform="translate(-27,-25)rotate(45)"></text>
<text x="0" y="0" font-size="14pt" font-family="Courier">SELECT</text>
<g transform="translate(70,-6)">
<polyline points="0,0 320,0" stroke="black" stroke-width="1.5"/>
<g transform="translate(310,0)">
<polyline points="0,0 10,0 0,3 0,-3 10,0" stroke="black" stroke-width="1.5"/>
</g>
<g transform="translate(325,0)">
<text x="0" y="6" font-size="14pt" fill="red">Iterators</text>
<g transform="translate(75,0)">
<polyline points="0,0 50,0" stroke="black" stroke-width="1.5"/>
<g transform="translate(40,0)">
<polyline points="0,0 10,0 0,3 0,-3 10,0" stroke="black" stroke-width="1.5"/>
</g>
<g transform="translate(55,0)">
<text x="0" y="6" font-size="14pt">Results</text>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
</section>
</section>
// CCJSqlParser.Statement() returns the next
// complete Statement object from the reader or
// input stream (or null if the stream is empty).
Statement statement = parser.Statement()
</code></pre>
</section>
<section>
<h2>Using CCJSqlParser</h2>
<pre><code class="java">
// System.in is an InputStream
CCJSqlParser parser = new CCJSqlParser(System.in)
Statement statement = parser.Statement();
// loop until you hit the last statement
while(statement != null){
//
// Do something with statement
//
// ... then read the next statement
statement = parser.Statement();
}
</code></pre>
</section>
</section>
<section>
<section>
<h2>Abstract Syntax Trees</h2>
<ul>
<li><b>Statement</b>: Select, CreateTable</li>
<li class="fragment" data-fragment-index="1"><b>SelectBody</b>: PlainSelect, Union</li>
<li class="fragment" data-fragment-index="1"><b>FromItem</b>: Table, Join, SubSelect</li>
<li class="fragment" data-fragment-index="1"><b>SelectItem</b>: AllColumns, AllTableColumns, SelectExpressionItem</li>
<li class="fragment" data-fragment-index="1"><b>Expression</b>: LongValue, AddExpression, GreaterThan</li>
</ul>
</section>
<section>
<pre><code class="java">
while(statement != null){
if(statement instanceof Select){
Select select = (Select)statement;
// Do something with `select`
} else if(statement instanceof CreateTable){
CreateTable create = (CreateTable)statement;
// Do something with `create`
} else {
throw new SqlException("Can't handle: "+statement);
<section>
<section>
<h2>Iterators</h2>
<p>There are a number of data transformations that appear in more than one pattern. For example:
<ol>
<li>Loading the CSV file in as data</li>
<li>Filtering rows out of data</li>
<li>Transforming (mapping) data into a new structure</li>
<li>Summarizing (aggregating) data</li>
<li>Printing output data</li>
</ol>
</p>
<p class="fragment"><b>Suggestion:</b> Abstract these steps out</p>
</section>
<section>
<h2>Idea: Functions</h2>
<ol>
<li>loadCSV(...) returns a table</li>
<li>filter(condition, table) returns a table</li>
<li>map(expressions, table) returns a table</li>
<li>aggregate(aggregates, table) returns a row</li>
<li>print(table)</li>
</ol>
</p>
<p class="fragment"><b>Problem:</b> A "table" can get very very big.</p>
</section>
<section>
<h2>Better Idea: Iterators</h2>
<dl>
<dt>hasNext()</dt>
<dd>Returns true if there are more rows to return</dd>
<dt>next()</dt>
<dd>Returns the next row</dd>
</dl>
<p>All "functions" can be implemented as iterators that use constant space</p>
</section>
<section>
<h3>Example: SelectOperator</h3>
<pre><code class="java">
class SelectOperator implements RAOperator
{
RAOperator child;
Expression condition;
public ProjectOperator(RAOperator child, Expression condition) {
this.child = child; this.condition = condition;
}
statement = parser.Statement()
}
</code></pre>
</section>
public boolean hasNext(){ /* ...? */ }
public /* ...? */ next(){ /* ...? */ }
}
</code></pre>
</section>
<section>
<h3>'|'-separated Value File Suggestions</h3>
<ul>
<li>Use BufferedReader's readline() method</li>
<li>Precompile your '|' splitter using <code>java.util.regexp.Pattern.compile()</code></li>
<li>Parse everything upfront</li>
<li>Keep each row as an Array of PrimitiveValues</li>
<li>For Codd's sake, don't store entire tables in memory</li>
</ul>
</section>
<section>
<table>
<tr><th>SQL Type</th><th>PrimitiveValue</th></tr>
<tr><td>string</td><td>StringValue</td></tr>
<tr><td>varchar</td><td>StringValue</td></tr>
<tr><td>char</td><td>StringValue</td></tr>
<tr><td>int</td><td>LongValue</td></tr>
<tr><td>decimal</td><td>DoubleValue</td></tr>
<tr><td>date</td><td>DateValue</td></tr>
</table>
</section>
</section>
<section>
<pre><code class="java">
Select select = (Select)statement;
SelectBody body = select.getSelectBody();
if(body instanceof /* ... */){
// ...
<section>
<section>
<h2>EvalLib</h2>
<p>How do you evaluate the <code class="sql">A > 5</code> in<br/> <code class="sql">SELECT B FROM R WHERE A > 5</code>?</p>
<p class="fragment">More generally, how do you evaluate a JSqlParser <code>Expression</code>?</p>
</section>
<section>
<pre><code class="java">
Eval eval = new Eval(){ /* we'll get what goes here shortly */ }
</code></pre>
<pre class="fragment"><code class="java">
// Evaluate "1 + 2.0"
PrimitiveValue result;
result =
eval.eval(
new Addition(
new LongPrimitive(1),
new DoublePrimitive(2.0)
)
);
System.out.println("Result: "+result); // "Result: 3.0"
</code></pre>
</section>
<section>
<pre><code class="java">
// Evaluate "R.A >= 5"
result =
eval.eval(
new GreaterThanEquals(
new Column(new Table(null, "R"), "A"), // `R.A`
new LongPrimitive(5)
)
);
</code></pre>
<p class="fragment"><b>Problem: </b> What value should EvalLib give to <code>R.A</code>?</p>
</section>
<section>
<p>Your code needs to tell it...</p>
<pre><code class="java">
Eval eval = new Eval(){
public PrimitiveValue eval(Column c){
String colName = c.getColumnName();
String tableName = c.getTable().getName();
PrimitiveValue ret = /* look up colName.tableName */
return ret;
}
}
</code></pre>
<ul class="fragment">
<li><b>PlainSelect</b>: <tt>(SELECT * FROM ...)</tt></li>
<li><b>Union</b>: <tt>(SELECT * FROM ...) UNION ALL (SELECT ...)</tt></li>
</ul>
</section>
</code></pre>
</section>
</section>
<section>
<pre><code class="java">
Select select = (Select)statement;
SelectBody body = select.getSelectBody();
if(body instanceof PlainSelect){
PlainSelect plain = (PlainSelect)body;
// Do something with `plain`
}
</code></pre>
</section>
</section>
<section>
<h1>Questions?</h1>
</section>
<section>
<section>
<h2>PlainSelect</h2>
<pre><code class="sql">
SELECT [distinct] [selectItems]
FROM [fromItem], [joins, ...]
WHERE [where]
GROUP BY [groupByColumnReferences]
HAVING [having]
ORDER BY [orderByElements]
LIMIT [limit]
</code></pre>
Everything in [brackets] has a method in <a href="http://doc.odin.cse.buffalo.edu/jsqlparser/net/sf/jsqlparser/statement/select/PlainSelect.html">PlainSelect</a>
</section>
<section>
<h2>SelectItems</h2>
<dl>
<dt>AllColumns</dt>
<dd>SELECT *</dd>
<dt>AllTableColumns</dt>
<dd>SELECT R.*</dd>
<dt>SelectExpressionItem</dt>
<dd>SELECT R.A or SELECT R.A AS Q</dd>
</dl>
</section>
<section>
<h2>Expressions</h2>
<ul>
<li>WHERE</li>
<li>HAVING</li>
<li>SelectExpressionItem</li>
<li>ORDER BY</li>
</ul>
(To be discussed next week)
</section>
</section>
</div></div>

View file

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="92.70742mm"
height="101.07824mm"
viewBox="0 0 92.70742 101.07824"
version="1.1"
id="svg118"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="2018-02-07-RA-Opt-1.svg">
<defs
id="defs112" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.78309972"
inkscape:cx="23.270924"
inkscape:cy="-79.24054"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="-6"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata115">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-48.822655,-39.646066)">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="53.031429"
y="69.168358"
id="text12"><tspan
sodipodi:role="line"
x="53.031429"
y="69.168358"
style="stroke-width:0.26458332"
id="tspan16">σ<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan22">(R.B=S.B)∧(S.C &lt; 5)∧(S.D=T.D)</tspan></tspan></text>
<text
id="text28"
y="45.418324"
x="83.855835"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan26"
style="stroke-width:0.26458332"
y="45.418324"
x="83.855835"
sodipodi:role="line">π<tspan
id="tspan24"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888903px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;baseline-shift:sub;text-anchor:start;stroke-width:0.26458332">R.A, T.E</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="93.566727"
y="95.211891"
id="text34"><tspan
sodipodi:role="line"
x="93.566727"
y="95.211891"
style="stroke-width:0.26458332"
id="tspan39">⨉</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="116.46198"
y="118.95098"
id="text52"><tspan
sodipodi:role="line"
id="tspan50"
x="116.46198"
y="118.95098"
style="stroke-width:0.26458332">T</tspan></text>
<g
id="g957"
transform="translate(-0.34844655,-21.487778)">
<path
inkscape:connector-curvature="0"
id="path60"
d="M 74.578941,131.02562 95.425965,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 120.50635,131.02562 99.659303,118.46395"
id="path62"
inkscape:connector-curvature="0" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 97.194195,88.423556 v -14.9671"
id="path64"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.194195,63.032949 V 49.134934"
id="path66"
inkscape:connector-curvature="0" />
<text
id="text79"
y="116.83536"
x="70.591789"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan77"
style="stroke-width:0.26458332"
y="116.83536"
x="70.591789"
sodipodi:role="line">⨉</tspan></text>
<text
id="text83"
y="140.57962"
x="47.783958"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="140.57962"
x="47.783958"
id="tspan81"
sodipodi:role="line">R</tspan></text>
<text
id="text87"
y="140.57445"
x="93.487053"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="140.57445"
x="93.487053"
id="tspan85"
sodipodi:role="line">S</tspan></text>
<g
transform="translate(-23.323383,0.13569193)"
id="g93">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.578941,131.02562 95.425965,118.46395"
id="path89"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path91"
d="M 120.50635,131.02562 99.659303,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="78.316673mm"
height="125.06678mm"
viewBox="0 0 78.316673 125.06678"
version="1.1"
id="svg118"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="2018-02-07-RA-Opt-2.svg">
<defs
id="defs112" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.78309972"
inkscape:cx="251.84973"
inkscape:cy="11.424806"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="-4"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata115">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-48.822655,-39.646066)">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="81.750099"
y="69.168358"
id="text12"><tspan
sodipodi:role="line"
x="81.750099"
y="69.168358"
style="stroke-width:0.26458332"
id="tspan16">σ<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan22">(S.D=T.D)</tspan></tspan></text>
<text
id="text28"
y="45.418324"
x="83.855835"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan26"
style="stroke-width:0.26458332"
y="45.418324"
x="83.855835"
sodipodi:role="line">π<tspan
id="tspan24"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888903px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;baseline-shift:sub;text-anchor:start;stroke-width:0.26458332">R.A, T.E</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="93.566727"
y="119.20042"
id="text34"><tspan
sodipodi:role="line"
x="93.566727"
y="119.20042"
style="stroke-width:0.26458332"
id="tspan39">⨉</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="116.46198"
y="142.93953"
id="text52"><tspan
sodipodi:role="line"
id="tspan50"
x="116.46198"
y="142.93953"
style="stroke-width:0.26458332">T</tspan></text>
<g
id="g957"
transform="translate(-0.34844655,2.5007589)">
<path
inkscape:connector-curvature="0"
id="path60"
d="M 74.578941,131.02562 95.425965,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 120.50635,131.02562 99.659303,118.46395"
id="path62"
inkscape:connector-curvature="0" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 97.194195,88.423556 v -14.9671"
id="path64"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.194195,63.032949 V 49.134934"
id="path66"
inkscape:connector-curvature="0" />
<text
id="text79"
y="140.8239"
x="70.591789"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan77"
style="stroke-width:0.26458332"
y="140.8239"
x="70.591789"
sodipodi:role="line">⨉</tspan></text>
<text
id="text83"
y="164.56816"
x="47.783958"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="164.56816"
x="47.783958"
id="tspan81"
sodipodi:role="line">R</tspan></text>
<text
id="text87"
y="164.56299"
x="93.487053"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="164.56299"
x="93.487053"
id="tspan85"
sodipodi:role="line">S</tspan></text>
<g
transform="translate(-23.323383,24.124229)"
id="g93">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.578941,131.02562 95.425965,118.46395"
id="path89"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path91"
d="M 120.50635,131.02562 99.659303,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<text
id="text118"
y="93.156891"
x="68.235428"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan116"
style="stroke-width:0.26458332"
y="93.156891"
x="68.235428"
sodipodi:role="line">σ<tspan
id="tspan114"
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332">(R.B=S.B)∧(S.C &lt; 5)</tspan></tspan></text>
<path
inkscape:connector-curvature="0"
id="path120"
d="M 97.194195,112.41209 V 97.444993"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8 KiB

View file

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="77.149452mm"
height="125.06678mm"
viewBox="0 0 77.149452 125.06678"
version="1.1"
id="svg118"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="2018-02-07-RA-Opt-3.svg">
<defs
id="defs112" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.78309972"
inkscape:cx="263.24272"
inkscape:cy="11.42482"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="-4"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata115">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-45.808261,-39.646066)">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="81.750099"
y="69.168358"
id="text12"><tspan
sodipodi:role="line"
x="81.750099"
y="69.168358"
style="stroke-width:0.26458332"
id="tspan16">σ<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan22">(S.D=T.D)</tspan></tspan></text>
<text
id="text28"
y="45.418324"
x="83.855835"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan26"
style="stroke-width:0.26458332"
y="45.418324"
x="83.855835"
sodipodi:role="line">π<tspan
id="tspan24"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888903px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;baseline-shift:sub;text-anchor:start;stroke-width:0.26458332">R.A, T.E</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="93.566727"
y="95.549744"
id="text34"><tspan
sodipodi:role="line"
x="93.566727"
y="95.549744"
style="stroke-width:0.26458332"
id="tspan39">⨉</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="116.46198"
y="119.28886"
id="text52"><tspan
sodipodi:role="line"
id="tspan50"
x="116.46198"
y="119.28886"
style="stroke-width:0.26458332">T</tspan></text>
<g
id="g957"
transform="translate(-0.34844655,-21.149911)">
<path
inkscape:connector-curvature="0"
id="path60"
d="M 74.578941,131.02562 95.425965,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 120.50635,131.02562 99.659303,118.46395"
id="path62"
inkscape:connector-curvature="0" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 97.194195,88.423556 v -14.9671"
id="path64"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.194195,63.032949 V 49.134934"
id="path66"
inkscape:connector-curvature="0" />
<text
id="text79"
y="140.8239"
x="70.591789"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan77"
style="stroke-width:0.26458332"
y="140.8239"
x="70.591789"
sodipodi:role="line">⨉</tspan></text>
<text
id="text83"
y="164.56816"
x="47.783958"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="164.56816"
x="47.783958"
id="tspan81"
sodipodi:role="line">R</tspan></text>
<text
id="text87"
y="164.56299"
x="93.487053"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="164.56299"
x="93.487053"
id="tspan85"
sodipodi:role="line">S</tspan></text>
<g
transform="translate(-23.323383,24.124229)"
id="g93">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.578941,131.02562 95.425965,118.46395"
id="path89"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path91"
d="M 120.50635,131.02562 99.659303,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<text
id="text118"
y="114.4425"
x="45.26049"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan116"
style="stroke-width:0.26458332"
y="114.4425"
x="45.26049"
sodipodi:role="line">σ<tspan
id="tspan114"
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332">(R.B=S.B)∧(S.C &lt; 5)</tspan></tspan></text>
<path
inkscape:connector-curvature="0"
id="path120"
d="M 74.219258,133.69769 V 118.7306"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8 KiB

View file

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="77.149452mm"
height="100.06464mm"
viewBox="0 0 77.149452 100.06464"
version="1.1"
id="svg118"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="2018-02-07-RA-Opt-4.svg">
<defs
id="defs112" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.78309972"
inkscape:cx="263.24272"
inkscape:cy="-83.071429"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="-4"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata115">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-45.808261,-39.646066)">
<text
id="text28"
y="45.418324"
x="83.855835"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan26"
style="stroke-width:0.26458332"
y="45.418324"
x="83.855835"
sodipodi:role="line">π<tspan
id="tspan24"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888903px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;baseline-shift:sub;text-anchor:start;stroke-width:0.26458332">R.A, T.E</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="116.46198"
y="94.28672"
id="text52"><tspan
sodipodi:role="line"
id="tspan50"
x="116.46198"
y="94.28672"
style="stroke-width:0.26458332">T</tspan></text>
<g
id="g957"
transform="translate(-0.34844655,-46.152048)">
<path
inkscape:connector-curvature="0"
id="path60"
d="M 74.578941,131.02562 95.425965,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 120.50635,131.02562 99.659303,118.46395"
id="path62"
inkscape:connector-curvature="0" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.194195,63.032949 V 49.134934"
id="path66"
inkscape:connector-curvature="0" />
<text
id="text79"
y="115.82176"
x="70.591789"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan77"
style="stroke-width:0.26458332"
y="115.82176"
x="70.591789"
sodipodi:role="line">⨉</tspan></text>
<text
id="text83"
y="139.56602"
x="47.783958"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="139.56602"
x="47.783958"
id="tspan81"
sodipodi:role="line">R</tspan></text>
<text
id="text87"
y="139.56085"
x="93.487053"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="139.56085"
x="93.487053"
id="tspan85"
sodipodi:role="line">S</tspan></text>
<g
transform="translate(-23.323383,-0.87790809)"
id="g93">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.578941,131.02562 95.425965,118.46395"
id="path89"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path91"
d="M 120.50635,131.02562 99.659303,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<text
id="text118"
y="89.440361"
x="45.26049"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan116"
style="stroke-width:0.26458332"
y="89.440361"
x="45.26049"
sodipodi:role="line">σ<tspan
id="tspan114"
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332">(R.B=S.B)∧(S.C &lt; 5)</tspan></tspan></text>
<path
inkscape:connector-curvature="0"
id="path120"
d="M 74.219258,108.69555 V 93.728463"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="84.297577"
y="69.024971"
id="text34-7"><tspan
sodipodi:role="line"
x="84.297577"
y="69.024971"
style="stroke-width:0.26458332"
id="tspan39-9">⋈<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan30">S.D=T.D</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="99.310852"
y="97.314034"
id="text182"><tspan
sodipodi:role="line"
id="tspan180"
x="99.310852"
y="106.6778"
style="stroke-width:0.26458332"></tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="74.135056mm"
height="123.71531mm"
viewBox="0 0 74.135055 123.71531"
version="1.1"
id="svg118"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="2018-02-07-RA-Opt-5.svg">
<defs
id="defs112" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.78309972"
inkscape:cx="32.209768"
inkscape:cy="6.3169553"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="-4"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata115">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-48.822655,-39.646066)">
<text
id="text28"
y="45.418324"
x="83.855835"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan26"
style="stroke-width:0.26458332"
y="45.418324"
x="83.855835"
sodipodi:role="line">π<tspan
id="tspan24"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888903px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;baseline-shift:sub;text-anchor:start;stroke-width:0.26458332">R.A, T.E</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="116.46198"
y="94.28672"
id="text52"><tspan
sodipodi:role="line"
id="tspan50"
x="116.46198"
y="94.28672"
style="stroke-width:0.26458332">T</tspan></text>
<g
id="g957"
transform="translate(-0.34844655,-46.152048)">
<path
inkscape:connector-curvature="0"
id="path60"
d="M 74.578941,131.02562 95.425965,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 120.50635,131.02562 99.659303,118.46395"
id="path62"
inkscape:connector-curvature="0" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.194195,63.032949 V 49.134934"
id="path66"
inkscape:connector-curvature="0" />
<text
id="text79"
y="139.47243"
x="70.591789"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan77"
style="stroke-width:0.26458332"
y="139.47243"
x="70.591789"
sodipodi:role="line">⨉</tspan></text>
<text
id="text83"
y="163.21669"
x="47.783958"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="163.21669"
x="47.783958"
id="tspan81"
sodipodi:role="line">R</tspan></text>
<text
id="text87"
y="163.21152"
x="93.487053"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="163.21152"
x="93.487053"
id="tspan85"
sodipodi:role="line">S</tspan></text>
<g
transform="translate(-23.323383,22.772762)"
id="g93">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.578941,131.02562 95.425965,118.46395"
id="path89"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path91"
d="M 120.50635,131.02562 99.659303,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<text
id="text118"
y="89.440361"
x="58.437294"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan116"
style="stroke-width:0.26458332"
y="89.440361"
x="58.437294"
sodipodi:role="line">σ<tspan
id="tspan114"
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332">(R.B=S.B)</tspan></tspan></text>
<path
inkscape:connector-curvature="0"
id="path120"
d="M 74.219258,108.69555 V 93.728463"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="84.297577"
y="69.024971"
id="text34-7"><tspan
sodipodi:role="line"
x="84.297577"
y="69.024971"
style="stroke-width:0.26458332"
id="tspan39-9">⋈<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan30">S.D=T.D</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="99.310852"
y="97.314034"
id="text182"><tspan
sodipodi:role="line"
id="tspan180"
x="99.310852"
y="106.6778"
style="stroke-width:0.26458332"></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="58.437294"
y="113.091"
id="text207"><tspan
sodipodi:role="line"
x="58.437294"
y="113.091"
style="stroke-width:0.26458332"
id="tspan205">σ<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan203">(S.C &lt; 5)</tspan></tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.219258,132.34622 V 117.37913"
id="path209"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="74.135056mm"
height="123.71531mm"
viewBox="0 0 74.135055 123.71531"
version="1.1"
id="svg118"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="2018-02-07-RA-Opt-6.svg">
<defs
id="defs112" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.78309972"
inkscape:cx="32.209768"
inkscape:cy="6.3169553"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="-4"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata115">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-48.822655,-39.646066)">
<text
id="text28"
y="45.418324"
x="83.855835"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan26"
style="stroke-width:0.26458332"
y="45.418324"
x="83.855835"
sodipodi:role="line">π<tspan
id="tspan24"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888903px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;baseline-shift:sub;text-anchor:start;stroke-width:0.26458332">R.A, T.E</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="116.46198"
y="94.28672"
id="text52"><tspan
sodipodi:role="line"
id="tspan50"
x="116.46198"
y="94.28672"
style="stroke-width:0.26458332">T</tspan></text>
<g
id="g957"
transform="translate(-0.34844655,-46.152048)">
<path
inkscape:connector-curvature="0"
id="path60"
d="M 74.578941,131.02562 95.425965,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 120.50635,131.02562 99.659303,118.46395"
id="path62"
inkscape:connector-curvature="0" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.194195,63.032949 V 49.134934"
id="path66"
inkscape:connector-curvature="0" />
<text
id="text79"
y="115.14603"
x="70.591789"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan77"
style="stroke-width:0.26458332"
y="115.14603"
x="70.591789"
sodipodi:role="line">⨉</tspan></text>
<text
id="text83"
y="138.89029"
x="47.783958"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="138.89029"
x="47.783958"
id="tspan81"
sodipodi:role="line">R</tspan></text>
<text
id="text87"
y="163.21152"
x="93.487053"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="163.21152"
x="93.487053"
id="tspan85"
sodipodi:role="line">S</tspan></text>
<g
transform="translate(-23.323383,-1.5536417)"
id="g93">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.578941,131.02562 95.425965,118.46395"
id="path89"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path91"
d="M 120.50635,131.02562 99.659303,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<text
id="text118"
y="89.440361"
x="58.437294"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan116"
style="stroke-width:0.26458332"
y="89.440361"
x="58.437294"
sodipodi:role="line">σ<tspan
id="tspan114"
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332">(R.B=S.B)</tspan></tspan></text>
<path
inkscape:connector-curvature="0"
id="path120"
d="M 74.219258,108.69555 V 93.728463"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="84.297577"
y="69.024971"
id="text34-7"><tspan
sodipodi:role="line"
x="84.297577"
y="69.024971"
style="stroke-width:0.26458332"
id="tspan39-9">⋈<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan30">S.D=T.D</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="99.310852"
y="97.314034"
id="text182"><tspan
sodipodi:role="line"
id="tspan180"
x="99.310852"
y="106.6778"
style="stroke-width:0.26458332"></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="81.074364"
y="134.71448"
id="text207"><tspan
sodipodi:role="line"
x="81.074364"
y="134.71448"
style="stroke-width:0.26458332"
id="tspan205">σ<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan203">(S.C &lt; 5)</tspan></tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 96.856328,153.96969 V 139.0026"
id="path209"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="74.135056mm"
height="99.152901mm"
viewBox="0 0 74.135055 99.152901"
version="1.1"
id="svg118"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="2018-02-07-RA-Opt-7.svg">
<defs
id="defs112" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.78309972"
inkscape:cx="32.20977"
inkscape:cy="-86.51733"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="-4"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata115">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-48.822655,-39.646066)">
<text
id="text28"
y="45.418324"
x="83.855835"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan26"
style="stroke-width:0.26458332"
y="45.418324"
x="83.855835"
sodipodi:role="line">π<tspan
id="tspan24"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888903px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;baseline-shift:sub;text-anchor:start;stroke-width:0.26458332">R.A, T.E</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="116.46198"
y="94.28672"
id="text52"><tspan
sodipodi:role="line"
id="tspan50"
x="116.46198"
y="94.28672"
style="stroke-width:0.26458332">T</tspan></text>
<g
id="g957"
transform="translate(-0.34844655,-46.152048)">
<path
inkscape:connector-curvature="0"
id="path60"
d="M 74.578941,131.02562 95.425965,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 120.50635,131.02562 99.659303,118.46395"
id="path62"
inkscape:connector-curvature="0" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.194195,63.032949 V 49.134934"
id="path66"
inkscape:connector-curvature="0" />
<text
id="text83"
y="114.32784"
x="47.783958"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="114.32784"
x="47.783958"
id="tspan81"
sodipodi:role="line">R</tspan></text>
<text
id="text87"
y="138.64911"
x="93.487053"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="stroke-width:0.26458332"
y="138.64911"
x="93.487053"
id="tspan85"
sodipodi:role="line">S</tspan></text>
<g
transform="translate(-23.323383,-26.116079)"
id="g93">
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 74.578941,131.02562 95.425965,118.46395"
id="path89"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path91"
d="M 120.50635,131.02562 99.659303,118.46395"
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="84.297577"
y="69.024971"
id="text34-7"><tspan
sodipodi:role="line"
x="84.297577"
y="69.024971"
style="stroke-width:0.26458332"
id="tspan39-9">⋈<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan30">S.D=T.D</tspan></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="99.310852"
y="97.314034"
id="text182"><tspan
sodipodi:role="line"
id="tspan180"
x="99.310852"
y="106.6778"
style="stroke-width:0.26458332"></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="81.074364"
y="110.15205"
id="text207"><tspan
sodipodi:role="line"
x="81.074364"
y="110.15205"
style="stroke-width:0.26458332"
id="tspan205">σ<tspan
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332"
id="tspan203">(S.C &lt; 5)</tspan></tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 96.856328,129.40724 V 114.44015"
id="path209"
inkscape:connector-curvature="0" />
<text
id="text253"
y="89.296974"
x="61.322639"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
id="tspan251"
style="stroke-width:0.26458332"
y="89.296974"
x="61.322639"
sodipodi:role="line">⋈<tspan
id="tspan249"
style="font-size:4.93888903px;baseline-shift:sub;stroke-width:0.26458332">R.B=S.B</tspan></tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View file

@ -19,18 +19,21 @@ schedule:
materials:
slides: "https://odin.cse.buffalo.edu/slides/cse4562sp2019/2019-02-04-RA-Basics.html"
- date: "Feb 6"
due: "Homework 1"
topic: "Relational Algebra Equivalences"
textbook: "16.2"
materials:
slides: "https://odin.cse.buffalo.edu/slides/cse4562sp2019/2019-02-06-RA-Equivs.html"
- date: "Feb 8"
due: "Checkpoint 0"
topic: "Checkpoint 1"
textbook: "Ch. 15.1-15.3, 16.3"
materials:
slides: "https://odin.cse.buffalo.edu/slides/cse4562sp2019/2019-02-08-Checkpoint1.html"
- date: "Feb 11"
topic: "Evaluating Relational Algebra"
topic: "Basic Algorithms"
textbook: "Ch. 15.1-15.5, 16.7"
- date: "Feb 13"
due: "Homework 2"
due: "Homework 1"
topic: "Extended Relational Algebra"
textbook: "Ch. 5.2, 15.4"
- date: "Feb 15"
@ -41,7 +44,7 @@ schedule:
topic: "Indexing (Intro + Tree Indexes)"
textbook: "Ch. 8.3-8.4, 14.1-14.2, 14.4"
- date: "Feb 20"
due: "Homework 3"
due: "Homework 2"
topic: "Indexing (Hash Indexes + Modern Indexes)"
note: Learned indexes, LSM Trees
textbook: "Ch. 14.3"
@ -57,7 +60,7 @@ schedule:
topic: "Checkpoint 2"
textbook: "Ch. 15.1-15.5, 16.2-16.3, 16.7"
- date: "Feb 27"
due: "Homework 4"
due: "Homework 3"
topic: "External (2-Pass) Algorithms (contd.)"
textbook: "Ch. 15.4-15.5, 15.8"
textbook:
@ -69,7 +72,7 @@ schedule:
topic: "Database Statistics 1/2"
textbook: "Ch. 16.4-16.5"
- date: "Mar 6"
due: "Homework 5"
due: "Homework 4"
topic: "Database Statistics 2/2"
textbook: "Ch. 16.4-16.5"
- date: "Mar 8"
@ -93,7 +96,7 @@ schedule:
topic: "Materialized Views"
textbook: "Ch. 8.5"
- date: "Mar 27"
due: "Homework 6"
due: "Homework 5"
topic: "SQL DDL and Constraints"
textbook: "Ch. 7.1-7.4"
- date: "Mar 29"
@ -106,7 +109,7 @@ schedule:
- date: "Apr 3"
topic: "Pessimistic Transaction Control"
textbook: "Ch. 18.3-18.7, 19.2"
due: "Homework 7"
due: "Homework 6"
- date: "Apr 5"
topic: "Pessimistic Transaction Control (contd.)"
textbook: "Ch. 18.3-18.7, 19.2"
@ -115,7 +118,7 @@ schedule:
topic: "Checkpoint 4"
textbook: "Ch. 15.7, 16.4-16.6"
- date: "Apr 10"
due: "Homework 8"
due: "Homework 7"
topic: "Optimistic Transaction Control"
textbook: "Ch. 18.8-18.9"
- date: "Apr 12"
@ -125,7 +128,7 @@ schedule:
topic: "Logging + ARIES Recovery (contd.)"
textbook: "Ch. 17.1-17.5"
- date: "Apr 17"
due: "Homework 9"
due: "Homework 8"
topic: "Distributed Algorithms"
textbook: "Ch. 20.1-20.4"
- date: "Apr 19"
@ -135,7 +138,7 @@ schedule:
topic: "Distributed Updates"
textbook: "Ch. 20.5-20.6"
- date: "Apr 24"
due: "Homework 10"
due: "Homework 9"
topic: "Distributed Updates (contd.)"
textbook: "Ch. 20.5-20.6"
- date: "Apr 26"
@ -145,12 +148,12 @@ schedule:
topic: "Approximate Query Processing"
textbook: "Ch. 23.5"
- date: "May 1"
due: "Homework 11"
due: "Homework 10"
topic: "Provenance Queries"
- date: "May 3"
topic: "Provenance for Uncertainty"
- date: "May 6"
due: "Homework 12"
due: "Homework 11"
topic: "Buffer Day"
- date: "May 8"
topic: "Final Exam Review 1"