Skip to content

Commit 7edcfa9

Browse files
committed
Merge branch 'master' into slxu-kill-query-at-aborted-downloading
2 parents 1b16f80 + d07616a commit 7edcfa9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+386
-518
lines changed

.dictionary

+1
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ valmeida
2727
metadata
2828
aggregator
2929
aggregators
30+
accessor

.settings/org.eclipse.jdt.ui.prefs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ org.eclipse.jdt.ui.exception.name=e
5959
org.eclipse.jdt.ui.gettersetter.use.is=true
6060
org.eclipse.jdt.ui.ignorelowercasenames=true
6161
org.eclipse.jdt.ui.importorder=java;javax;org;com;
62-
org.eclipse.jdt.ui.javadoc=false
62+
org.eclipse.jdt.ui.javadoc=true
6363
org.eclipse.jdt.ui.keywordthis=false
6464
org.eclipse.jdt.ui.ondemandthreshold=99
6565
org.eclipse.jdt.ui.overrideannotation=true
6666
org.eclipse.jdt.ui.staticondemandthreshold=99
67-
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
67+
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n *\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/** */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
6868
sp_cleanup.add_default_serial_version_id=true
6969
sp_cleanup.add_generated_serial_version_id=false
7070
sp_cleanup.add_missing_annotations=true

speedtest/edu/washington/escience/myria/mrbenchmarks/GlobalAvg.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected TupleBatch fetchNextReady() throws DbException {
4242
final Operator child = getChild();
4343
TupleBatch tb = child.nextReady();
4444
if (tb != null) {
45-
ImmutableList<Column<?>> inputColumns = tb.getDataColumns();
45+
ImmutableList<? extends Column<?>> inputColumns = tb.getDataColumns();
4646
DoubleColumnBuilder rc = new DoubleColumnBuilder();
4747
rc.expandAll();
4848
for (int idx = 0; idx < tb.numTuples(); ++idx) {

speedtest/edu/washington/escience/myria/mrbenchmarks/SubStr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected TupleBatch fetchNextReady() throws DbException {
4343
if (tb != null) {
4444
StringColumnBuilder builder = new StringColumnBuilder();
4545
builder.expandAll();
46-
ImmutableList<Column<?>> source = tb.getDataColumns();
46+
ImmutableList<? extends Column<?>> source = tb.getDataColumns();
4747
for (int idx = 0; idx < tb.numTuples(); ++idx) {
4848
String subStr = source.get(substrColumnIdx).getString(idx).substring(fromCharIdx, endCharIdx);
4949
builder.replaceString(subStr, idx);

src/edu/washington/escience/myria/MyriaConstants.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
/**
66
* This class holds the constants for the Myria execution.
7-
*
8-
*
7+
*
98
*/
109
public final class MyriaConstants {
1110
/**
@@ -268,13 +267,13 @@ public final class MyriaConstants {
268267
* The maximum number of subqueries we will allow a query to execute before killing it. This is a safeguard against an
269268
* infinite loop.
270269
*/
271-
public static final int MAXIMUM_NUM_SUBQUERIES = 100;
270+
public static final int MAXIMUM_NUM_SUBQUERIES = 1000;
272271

273272
/**
274273
* Default imports for janino. Modules imported here can be used in expressions.
275274
*/
276275
public static final String[] DEFAULT_JANINO_IMPORTS =
277-
{ "com.google.common.hash.Hashing", "java.nio.charset.Charset" };
276+
{ "com.google.common.hash.Hashing", "java.nio.charset.Charset" };
278277

279278
/** Private constructor to disallow building utility class. */
280279
private MyriaConstants() {

src/edu/washington/escience/myria/accessmethod/JdbcAccessMethod.java

+38-12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.sql.ResultSet;
1212
import java.sql.SQLException;
1313
import java.sql.Statement;
14+
import java.sql.Timestamp;
1415
import java.util.ArrayList;
1516
import java.util.Iterator;
1617
import java.util.List;
@@ -40,8 +41,8 @@
4041

4142
/**
4243
* Access method for a JDBC database. Exposes data as TupleBatches.
43-
*
44-
*
44+
*
45+
*
4546
*/
4647
public final class JdbcAccessMethod extends AccessMethod {
4748

@@ -54,7 +55,7 @@ public final class JdbcAccessMethod extends AccessMethod {
5455

5556
/**
5657
* The constructor. Creates an object and connects with the database
57-
*
58+
*
5859
* @param jdbcInfo connection information
5960
* @param readOnly whether read-only connection or not
6061
* @throws DbException if there is an error making the connection.
@@ -106,7 +107,7 @@ public void setReadOnly(final Boolean readOnly) throws DbException {
106107

107108
/**
108109
* Helper function to copy data into PostgreSQL using the COPY command.
109-
*
110+
*
110111
* @param relationKey the destination relation
111112
* @param schema the schema of the relation
112113
* @param tupleBatch the tuples to be inserted.
@@ -168,9 +169,34 @@ public void tupleBatchInsert(final RelationKey relationKey, final Schema schema,
168169
/* Set up and execute the query */
169170
final PreparedStatement statement =
170171
jdbcConnection.prepareStatement(insertStatementFromSchema(schema, relationKey));
171-
tupleBatch.getIntoJdbc(statement);
172-
// TODO make it also independent. should be getIntoJdbc(statement,
173-
// tupleBatch)
172+
for (int row = 0; row < tupleBatch.numTuples(); ++row) {
173+
for (int col = 0; col < tupleBatch.numColumns(); ++col) {
174+
switch (schema.getColumnType(col)) {
175+
case BOOLEAN_TYPE:
176+
statement.setBoolean(col + 1, tupleBatch.getBoolean(col, row));
177+
break;
178+
case DATETIME_TYPE:
179+
statement.setTimestamp(col + 1, new Timestamp(tupleBatch.getDateTime(col, row).getMillis()));
180+
break;
181+
case DOUBLE_TYPE:
182+
statement.setDouble(col + 1, tupleBatch.getDouble(col, row));
183+
break;
184+
case FLOAT_TYPE:
185+
statement.setFloat(col + 1, tupleBatch.getFloat(col, row));
186+
break;
187+
case INT_TYPE:
188+
statement.setInt(col + 1, tupleBatch.getInt(col, row));
189+
break;
190+
case LONG_TYPE:
191+
statement.setLong(col + 1, tupleBatch.getLong(col, row));
192+
break;
193+
case STRING_TYPE:
194+
statement.setString(col + 1, tupleBatch.getString(col, row));
195+
break;
196+
}
197+
}
198+
statement.addBatch();
199+
}
174200
statement.executeBatch();
175201
statement.close();
176202
} catch (final SQLException e) {
@@ -253,7 +279,7 @@ public void createTableIfNotExists(final RelationKey relationKey, final Schema s
253279

254280
/**
255281
* Create an unlogged table.
256-
*
282+
*
257283
* @param relationKey the relation name
258284
* @param schema the relation schema
259285
* @throws DbException if anything goes wrong
@@ -333,7 +359,7 @@ private String createIfNotExistsStatementFromSchema(final Schema schema, final R
333359

334360
/**
335361
* Helper utility for creating JDBC CREATE TABLE statements.
336-
*
362+
*
337363
* @param type a Myria column type.
338364
* @param dbms the description of the DBMS, e.g., "mysql".
339365
* @return the name of the DBMS type that matches the given Myria type.
@@ -494,7 +520,7 @@ public void createIndexIfNotExists(final RelationKey relationKey, final Schema s
494520

495521
/**
496522
* Create an index in postgres if no index with the same name already exists.
497-
*
523+
*
498524
* @param relationKey the table on which the indexes will be created.
499525
* @param schema the Schema of the data in the table.
500526
* @param index the index to be created; each entry is a list of column indices.
@@ -519,7 +545,7 @@ public void createIndexIfNotExistPostgres(final RelationKey relationKey, final S
519545

520546
/**
521547
* Wraps a JDBC ResultSet in a Iterator<TupleBatch>.
522-
*
548+
*
523549
* Implementation based on org.apache.commons.dbutils.ResultSetIterator. Requires ResultSet.isLast() to be implemented.
524550
*/
525551
class JdbcTupleBatchIterator implements Iterator<TupleBatch> {
@@ -534,7 +560,7 @@ class JdbcTupleBatchIterator implements Iterator<TupleBatch> {
534560

535561
/**
536562
* Constructs a JdbcTupleBatchIterator from the given ResultSet and Schema objects.
537-
*
563+
*
538564
* @param resultSet the JDBC ResultSet containing the results.
539565
* @param schema the Schema of the generated TupleBatch objects.
540566
*/

src/edu/washington/escience/myria/accessmethod/SQLiteAccessMethod.java

+34-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,40 @@ protected Object job(final SQLiteConnection sqliteConnection) throws DbException
132132
sqliteConnection.exec("BEGIN TRANSACTION");
133133
/* Set up and execute the query */
134134
statement = sqliteConnection.prepare(insertStatementFromSchema(schema, relationKey));
135-
tupleBatch.getIntoSQLite(statement);
135+
for (int row = 0; row < tupleBatch.numTuples(); ++row) {
136+
for (int col = 0; col < tupleBatch.numColumns(); ++col) {
137+
switch (schema.getColumnType(col)) {
138+
case BOOLEAN_TYPE:
139+
/* In SQLite, booleans are integers represented as 0 (false) or 1 (true). */
140+
int colVal = 0;
141+
if (tupleBatch.getBoolean(col, row)) {
142+
colVal = 1;
143+
}
144+
statement.bind(col + 1, colVal);
145+
break;
146+
case DATETIME_TYPE:
147+
statement.bind(col + 1, tupleBatch.getDateTime(col, row).getMillis()); // SQLite long
148+
break;
149+
case DOUBLE_TYPE:
150+
statement.bind(col + 1, tupleBatch.getDouble(col, row));
151+
break;
152+
case FLOAT_TYPE:
153+
statement.bind(col + 1, tupleBatch.getFloat(col, row));
154+
break;
155+
case INT_TYPE:
156+
statement.bind(col + 1, tupleBatch.getInt(col, row));
157+
break;
158+
case LONG_TYPE:
159+
statement.bind(col + 1, tupleBatch.getLong(col, row));
160+
break;
161+
case STRING_TYPE:
162+
statement.bind(col + 1, tupleBatch.getString(col, row));
163+
break;
164+
}
165+
}
166+
statement.step();
167+
statement.reset();
168+
}
136169
/* COMMIT TRANSACTION */
137170
sqliteConnection.exec("COMMIT TRANSACTION");
138171
} catch (final SQLiteException e) {

0 commit comments

Comments
 (0)