merged asterix_stabilization_temp_missing_tests branches back to stabilization
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@1342 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-algebra/pom.xml b/asterix-algebra/pom.xml
index b81e77f..a03bae7 100644
--- a/asterix-algebra/pom.xml
+++ b/asterix-algebra/pom.xml
@@ -17,6 +17,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
<plugin>
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java
index 4af1424..c5b7c41 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java
@@ -22,6 +22,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DieOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DistinctOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DistributeResultOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.EmptyTupleSourceOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ExchangeOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ExtensionOperator;
@@ -396,6 +397,11 @@
}
@Override
+ public ILogicalOperator visitDistributeResultOperator(DistributeResultOperator op, ILogicalOperator arg) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public ILogicalOperator visitWriteResultOperator(WriteResultOperator op, ILogicalOperator arg) {
throw new UnsupportedOperationException();
}
diff --git a/asterix-app/pom.xml b/asterix-app/pom.xml
index 7d6e64a..9476178 100644
--- a/asterix-app/pom.xml
+++ b/asterix-app/pom.xml
@@ -19,6 +19,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
<plugin>
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
index 3c43736..9df5e7c 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -44,6 +44,7 @@
ncConfig1.ccPort = DEFAULT_HYRACKS_CC_CLUSTER_PORT;
ncConfig1.clusterNetIPAddress = "127.0.0.1";
ncConfig1.dataIPAddress = "127.0.0.1";
+ ncConfig1.datasetIPAddress = "127.0.0.1";
ncConfig1.nodeId = NC1_ID;
nc1 = new NodeControllerService(ncConfig1);
nc1.start();
@@ -53,6 +54,7 @@
ncConfig2.ccPort = DEFAULT_HYRACKS_CC_CLUSTER_PORT;
ncConfig2.clusterNetIPAddress = "127.0.0.1";
ncConfig2.dataIPAddress = "127.0.0.1";
+ ncConfig2.datasetIPAddress = "127.0.0.1";
ncConfig2.nodeId = NC2_ID;
nc2 = new NodeControllerService(ncConfig2);
nc2.start();
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
index 5d3ab0a..075ddd3 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
@@ -174,6 +174,17 @@
throw new AsterixException("Could not find dataset " + datasetName + " in datavetse " + dataverseName);
}
ARecordType itemType = (ARecordType) metadata.findType(dataverseName, dataset.getItemTypeName());
+ for (String keyField : DatasetUtils.getPartitioningKeys(dataset)) {
+ try {
+ if (!itemType.isClosedField(keyField)) {
+ throw new AsterixException("Cannot partition dataset \"" + dataset.getDatasetName()
+ + "\" by key \"" + keyField + "\" since it is not a valid field of \""
+ + itemType.getTypeName() + "\"");
+ }
+ } catch (IOException e) {
+ throw new AsterixException(e);
+ }
+ }
JobSpecification spec = new JobSpecification();
IBinaryComparatorFactory[] comparatorFactories = DatasetUtils.computeKeysBinaryComparatorFactories(dataset,
itemType, format.getBinaryComparatorFactoryProvider());
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
index 43c6c0c..10cba14 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
@@ -23,6 +23,8 @@
import edu.uci.ics.asterix.api.java.AsterixJavaClient;
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.external.dataset.adapter.FileSystemBasedAdapter;
+import edu.uci.ics.asterix.external.util.IdentitiyResolverFactory;
import edu.uci.ics.asterix.test.base.AsterixTestHelper;
import edu.uci.ics.asterix.test.common.TestHelper;
@@ -56,6 +58,10 @@
File outdir = new File(PATH_ACTUAL);
outdir.mkdirs();
AsterixHyracksIntegrationUtil.init();
+ // Set the node resolver to be the identity resolver that expects node names
+ // to be node controller ids; a valid assumption in test environment.
+ System.setProperty(FileSystemBasedAdapter.NODE_RESOLVER_FACTORY_PROPERTY,
+ IdentitiyResolverFactory.class.getName());
}
@AfterClass
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
index 8eafd02..c705ea6 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
@@ -17,6 +17,8 @@
import edu.uci.ics.asterix.api.common.AsterixHyracksIntegrationUtil;
import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.external.dataset.adapter.FileSystemBasedAdapter;
+import edu.uci.ics.asterix.external.util.IdentitiyResolverFactory;
import edu.uci.ics.asterix.test.aql.TestsUtils;
import edu.uci.ics.asterix.testframework.context.TestCaseContext;
import edu.uci.ics.asterix.testframework.xml.TestCase.CompilationUnit;
@@ -51,8 +53,14 @@
AsterixHyracksIntegrationUtil.init();
- // TODO: Uncomment when hadoop version is upgraded and adapters are ported
+ // TODO: Uncomment when hadoop version is upgraded and adapters are
+ // ported.
HDFSCluster.getInstance().setup();
+
+ // Set the node resolver to be the identity resolver that expects node names
+ // to be node controller ids; a valid assumption in test environment.
+ System.setProperty(FileSystemBasedAdapter.NODE_RESOLVER_FACTORY_PROPERTY,
+ IdentitiyResolverFactory.class.getName());
}
@AfterClass
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv20.aql b/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv20.aql
new file mode 100644
index 0000000..beebca4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv20.aql
@@ -0,0 +1,50 @@
+/*
+ * Description : Test various syntax for dataset access
+ * : Using parentheses for dataset access is now optional
+ * : New syntax can use fully qualified names to access datasets.
+ * Expected Res : Success
+ * Date : 6th March 2013
+ */
+
+drop dataverse student if exists;
+drop dataverse teacher if exists;
+
+create dataverse student;
+create dataverse teacher;
+
+write output to nc1:"rttest/cross-dataverse_cross-dv20.adm";
+
+create type student.stdType as open {
+id : int32,
+name : string,
+age : int32,
+sex : string,
+dept : string
+}
+
+create type teacher.tchrType as open {
+id : int32,
+name : string,
+age : int32,
+sex : string,
+dept : string
+}
+
+create dataset student.ugdstd(stdType) primary key id;
+create dataset student.gdstd(stdType) primary key id;
+create dataset teacher.prof(tchrType) primary key id;
+create dataset teacher.pstdoc(tchrType) primary key id;
+
+insert into dataset student.ugdstd({"id":457,"name":"John Doe","age":22,"sex":"M","dept":"Dance"});
+
+insert into dataset student.gdstd({"id":418,"name":"John Smith","age":26,"sex":"M","dept":"Economics"});
+
+insert into dataset teacher.prof({"id":152,"name":"John Meyer","age":42,"sex":"M","dept":"History"});
+
+insert into dataset teacher.pstdoc({"id":259,"name":"Sophia Reece","age":36,"sex":"F","dept":"Anthropology"});
+
+for $s in dataset student.ugdstd
+for $p in dataset('teacher.prof')
+for $a in dataset("student.gdstd")
+for $b in dataset teacher.pstdoc
+return {"ug-student":$s,"prof":$p,"grd-student":$a,"postdoc":$b}
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change.aql b/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change.aql
new file mode 100644
index 0000000..fb9682d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change.aql
@@ -0,0 +1,43 @@
+/*
+ * Description : Test variant syntax for delete
+ * : Ending semi-colon is optional for delete
+ * Expected Res : Success
+ * Date : 6th March 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+ l_orderkey: int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: int32,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string
+}
+
+create dataset LineItem(LineItemType)
+ primary key l_orderkey, l_linenumber;
+
+load dataset LineItem
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+delete $l from dataset LineItem where $l.l_orderkey>=10
+
+write output to nc1:"rttest/dml_delete-syntax-change.adm";
+for $c in dataset('LineItem')
+order by $c.l_orderkey, $c.l_linenumber
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/insert-syntax.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert-syntax.aql
new file mode 100644
index 0000000..58177d3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert-syntax.aql
@@ -0,0 +1,35 @@
+/*
+ * Test case Name : insert-syntax-change.aql
+ * Description : verify various AQL syntax for insert
+ * Expected Result : Success
+ * Date : 6th March 2013
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype as open {
+ id: int32,
+ name: string
+}
+
+create dataset testds(testtype) primary key id;
+
+ insert into dataset testds (
+ { "id": 1, "name": "Person One", "hobbies": {{"Rock", "Metal"}}}
+ );
+
+ insert into dataset testds (
+ { "id": 2, "name": "Person Two", "hobbies": {{"Rock", "Jazz"}}}
+ )
+
+ insert into dataset testds { "id": 3, "name": "Person Three", "hobbies": {{"Blues"}}};
+
+ insert into dataset testds { "id": 4, "name": "Person Four", "hobbies": {{"Metal", "Jazz"}}}
+
+write output to nc1:"rttest/dml_insert-syntax.adm";
+
+for $d in dataset("testds")
+order by $d.id
+return $d
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/misc/partition-by-nonexistent-field.aql b/asterix-app/src/test/resources/runtimets/queries/misc/partition-by-nonexistent-field.aql
new file mode 100644
index 0000000..10dbfc1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/misc/partition-by-nonexistent-field.aql
@@ -0,0 +1,20 @@
+/*
+ * Description : Tries to partition a dataset by a non-existent field
+ * Expected Result: An error reporting that this is not allowed
+ * Author: zheilbron
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open{
+name1:string
+}
+
+create dataset testds(TestType) primary key id;
+
+insert into dataset testds({"name1":"John","name2":"Smith"});
+
+for $l in dataset('testds')
+return $l
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02.aql b/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02.aql
new file mode 100644
index 0000000..7f01c3e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02.aql
@@ -0,0 +1,48 @@
+/*
+ * Description : Test variant syntax for dataset access (scan)
+ * : using parentheses and quotes is optional
+ * Expected Res : Success
+ * Date : 6th March 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+create type AllType as open {
+ id: int32,
+ name: string,
+ age: float,
+ salary: double,
+ married: boolean,
+ interests: {{string}},
+ children: [string],
+ address: AddressType,
+ dob: date,
+ time: time,
+ datetime: datetime,
+ duration: duration,
+ location2d: point,
+ location3d: point3d,
+ line: line,
+ polygon: polygon,
+ circle: circle
+
+ // binary
+ // union
+}
+
+create external dataset All(AllType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/allData.json"),("format"="adm"));
+
+write output to nc1:"rttest/scan_alltypes_02.adm";
+
+for $a in dataset All
+return $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/scan/invalid-scan-syntax.aql b/asterix-app/src/test/resources/runtimets/queries/scan/invalid-scan-syntax.aql
new file mode 100644
index 0000000..254ecc4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/scan/invalid-scan-syntax.aql
@@ -0,0 +1,22 @@
+/*
+ * Description : Tests syntax error for the changed dataset access syntax
+ * Expected Result: Syntax Error from parser
+ * Date: March 6th 2013
+ */
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Employee as closed {
+id: int32,
+name: string,
+salary: int32
+}
+
+create dataset Office(Employee)
+primary key id;
+
+insert into dataset Office({"id": 1, "name": "clerk#1", "salary":120000});
+
+for $t in dataset 'test.Office'
+return $t
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/cross-dv20.adm b/asterix-app/src/test/resources/runtimets/results/cross-dataverse/cross-dv20.adm
new file mode 100644
index 0000000..83de609
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/cross-dataverse/cross-dv20.adm
@@ -0,0 +1 @@
+{ "ug-student": { "id": 457, "name": "John Doe", "age": 22, "sex": "M", "dept": "Dance" }, "prof": { "id": 152, "name": "John Meyer", "age": 42, "sex": "M", "dept": "History" }, "grd-student": { "id": 418, "name": "John Smith", "age": 26, "sex": "M", "dept": "Economics" }, "postdoc": { "id": 259, "name": "Sophia Reece", "age": 36, "sex": "F", "dept": "Anthropology" } }
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/delete-syntax-change.adm b/asterix-app/src/test/resources/runtimets/results/dml/delete-syntax-change.adm
new file mode 100644
index 0000000..7039cfe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/delete-syntax-change.adm
@@ -0,0 +1,25 @@
+{ "l_orderkey": 1, "l_partkey": 156, "l_suppkey": 4, "l_linenumber": 1, "l_quantity": 17, "l_extendedprice": 17954.55d, "l_discount": 0.04d, "l_tax": 0.02d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-03-13", "l_commitdate": "1996-02-12", "l_receiptdate": "1996-03-22", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "TRUCK", "l_comment": "egular courts above the" }
+{ "l_orderkey": 1, "l_partkey": 68, "l_suppkey": 9, "l_linenumber": 2, "l_quantity": 36, "l_extendedprice": 34850.16d, "l_discount": 0.09d, "l_tax": 0.06d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-04-12", "l_commitdate": "1996-02-28", "l_receiptdate": "1996-04-20", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "MAIL", "l_comment": "ly final dependencies: slyly bold " }
+{ "l_orderkey": 1, "l_partkey": 64, "l_suppkey": 5, "l_linenumber": 3, "l_quantity": 8, "l_extendedprice": 7712.48d, "l_discount": 0.1d, "l_tax": 0.02d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-01-29", "l_commitdate": "1996-03-05", "l_receiptdate": "1996-01-31", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "REG AIR", "l_comment": "riously. regular, express dep" }
+{ "l_orderkey": 1, "l_partkey": 3, "l_suppkey": 6, "l_linenumber": 4, "l_quantity": 28, "l_extendedprice": 25284.0d, "l_discount": 0.09d, "l_tax": 0.06d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-04-21", "l_commitdate": "1996-03-30", "l_receiptdate": "1996-05-16", "l_shipinstruct": "NONE", "l_shipmode": "AIR", "l_comment": "lites. fluffily even de" }
+{ "l_orderkey": 1, "l_partkey": 25, "l_suppkey": 8, "l_linenumber": 5, "l_quantity": 24, "l_extendedprice": 22200.48d, "l_discount": 0.1d, "l_tax": 0.04d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-03-30", "l_commitdate": "1996-03-14", "l_receiptdate": "1996-04-01", "l_shipinstruct": "NONE", "l_shipmode": "FOB", "l_comment": " pending foxes. slyly re" }
+{ "l_orderkey": 1, "l_partkey": 16, "l_suppkey": 3, "l_linenumber": 6, "l_quantity": 32, "l_extendedprice": 29312.32d, "l_discount": 0.07d, "l_tax": 0.02d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-01-30", "l_commitdate": "1996-02-07", "l_receiptdate": "1996-02-03", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "MAIL", "l_comment": "arefully slyly ex" }
+{ "l_orderkey": 2, "l_partkey": 107, "l_suppkey": 2, "l_linenumber": 1, "l_quantity": 38, "l_extendedprice": 38269.8d, "l_discount": 0.0d, "l_tax": 0.05d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1997-01-28", "l_commitdate": "1997-01-14", "l_receiptdate": "1997-02-02", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "RAIL", "l_comment": "ven requests. deposits breach a" }
+{ "l_orderkey": 3, "l_partkey": 5, "l_suppkey": 2, "l_linenumber": 1, "l_quantity": 45, "l_extendedprice": 40725.0d, "l_discount": 0.06d, "l_tax": 0.0d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1994-02-02", "l_commitdate": "1994-01-04", "l_receiptdate": "1994-02-23", "l_shipinstruct": "NONE", "l_shipmode": "AIR", "l_comment": "ongside of the furiously brave acco" }
+{ "l_orderkey": 3, "l_partkey": 20, "l_suppkey": 10, "l_linenumber": 2, "l_quantity": 49, "l_extendedprice": 45080.98d, "l_discount": 0.1d, "l_tax": 0.0d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1993-11-09", "l_commitdate": "1993-12-20", "l_receiptdate": "1993-11-24", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "RAIL", "l_comment": " unusual accounts. eve" }
+{ "l_orderkey": 3, "l_partkey": 129, "l_suppkey": 8, "l_linenumber": 3, "l_quantity": 27, "l_extendedprice": 27786.24d, "l_discount": 0.06d, "l_tax": 0.07d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1994-01-16", "l_commitdate": "1993-11-22", "l_receiptdate": "1994-01-23", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "SHIP", "l_comment": "nal foxes wake. " }
+{ "l_orderkey": 3, "l_partkey": 30, "l_suppkey": 5, "l_linenumber": 4, "l_quantity": 2, "l_extendedprice": 1860.06d, "l_discount": 0.01d, "l_tax": 0.06d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1993-12-04", "l_commitdate": "1994-01-07", "l_receiptdate": "1994-01-01", "l_shipinstruct": "NONE", "l_shipmode": "TRUCK", "l_comment": "y. fluffily pending d" }
+{ "l_orderkey": 3, "l_partkey": 184, "l_suppkey": 5, "l_linenumber": 5, "l_quantity": 28, "l_extendedprice": 30357.04d, "l_discount": 0.04d, "l_tax": 0.0d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1993-12-14", "l_commitdate": "1994-01-10", "l_receiptdate": "1994-01-01", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "FOB", "l_comment": "ages nag slyly pending" }
+{ "l_orderkey": 3, "l_partkey": 63, "l_suppkey": 8, "l_linenumber": 6, "l_quantity": 26, "l_extendedprice": 25039.56d, "l_discount": 0.1d, "l_tax": 0.02d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1993-10-29", "l_commitdate": "1993-12-18", "l_receiptdate": "1993-11-04", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "RAIL", "l_comment": "ges sleep after the caref" }
+{ "l_orderkey": 4, "l_partkey": 89, "l_suppkey": 10, "l_linenumber": 1, "l_quantity": 30, "l_extendedprice": 29672.4d, "l_discount": 0.03d, "l_tax": 0.08d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-01-10", "l_commitdate": "1995-12-14", "l_receiptdate": "1996-01-18", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "REG AIR", "l_comment": "- quickly regular packages sleep. idly" }
+{ "l_orderkey": 5, "l_partkey": 109, "l_suppkey": 10, "l_linenumber": 1, "l_quantity": 15, "l_extendedprice": 15136.5d, "l_discount": 0.02d, "l_tax": 0.04d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1994-10-31", "l_commitdate": "1994-08-31", "l_receiptdate": "1994-11-20", "l_shipinstruct": "NONE", "l_shipmode": "AIR", "l_comment": "ts wake furiously " }
+{ "l_orderkey": 5, "l_partkey": 124, "l_suppkey": 5, "l_linenumber": 2, "l_quantity": 26, "l_extendedprice": 26627.12d, "l_discount": 0.07d, "l_tax": 0.08d, "l_returnflag": "R", "l_linestatus": "F", "l_shipdate": "1994-10-16", "l_commitdate": "1994-09-25", "l_receiptdate": "1994-10-19", "l_shipinstruct": "NONE", "l_shipmode": "FOB", "l_comment": "sts use slyly quickly special instruc" }
+{ "l_orderkey": 5, "l_partkey": 38, "l_suppkey": 4, "l_linenumber": 3, "l_quantity": 50, "l_extendedprice": 46901.5d, "l_discount": 0.08d, "l_tax": 0.03d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1994-08-08", "l_commitdate": "1994-10-13", "l_receiptdate": "1994-08-26", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "AIR", "l_comment": "eodolites. fluffily unusual" }
+{ "l_orderkey": 6, "l_partkey": 140, "l_suppkey": 6, "l_linenumber": 1, "l_quantity": 37, "l_extendedprice": 38485.18d, "l_discount": 0.08d, "l_tax": 0.03d, "l_returnflag": "A", "l_linestatus": "F", "l_shipdate": "1992-04-27", "l_commitdate": "1992-05-15", "l_receiptdate": "1992-05-02", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "TRUCK", "l_comment": "p furiously special foxes" }
+{ "l_orderkey": 7, "l_partkey": 183, "l_suppkey": 4, "l_linenumber": 1, "l_quantity": 12, "l_extendedprice": 12998.16d, "l_discount": 0.07d, "l_tax": 0.03d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-05-07", "l_commitdate": "1996-03-13", "l_receiptdate": "1996-06-03", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "FOB", "l_comment": "ss pinto beans wake against th" }
+{ "l_orderkey": 7, "l_partkey": 146, "l_suppkey": 3, "l_linenumber": 2, "l_quantity": 9, "l_extendedprice": 9415.26d, "l_discount": 0.08d, "l_tax": 0.08d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-02-01", "l_commitdate": "1996-03-02", "l_receiptdate": "1996-02-19", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "SHIP", "l_comment": "es. instructions" }
+{ "l_orderkey": 7, "l_partkey": 95, "l_suppkey": 8, "l_linenumber": 3, "l_quantity": 46, "l_extendedprice": 45774.14d, "l_discount": 0.1d, "l_tax": 0.07d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-01-15", "l_commitdate": "1996-03-27", "l_receiptdate": "1996-02-03", "l_shipinstruct": "COLLECT COD", "l_shipmode": "MAIL", "l_comment": " unusual reques" }
+{ "l_orderkey": 7, "l_partkey": 164, "l_suppkey": 5, "l_linenumber": 4, "l_quantity": 28, "l_extendedprice": 29796.48d, "l_discount": 0.03d, "l_tax": 0.04d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-03-21", "l_commitdate": "1996-04-08", "l_receiptdate": "1996-04-20", "l_shipinstruct": "NONE", "l_shipmode": "FOB", "l_comment": ". slyly special requests haggl" }
+{ "l_orderkey": 7, "l_partkey": 152, "l_suppkey": 4, "l_linenumber": 5, "l_quantity": 38, "l_extendedprice": 39981.7d, "l_discount": 0.08d, "l_tax": 0.01d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-02-11", "l_commitdate": "1996-02-24", "l_receiptdate": "1996-02-18", "l_shipinstruct": "DELIVER IN PERSON", "l_shipmode": "TRUCK", "l_comment": "ns haggle carefully ironic deposits. bl" }
+{ "l_orderkey": 7, "l_partkey": 80, "l_suppkey": 10, "l_linenumber": 6, "l_quantity": 35, "l_extendedprice": 34302.8d, "l_discount": 0.06d, "l_tax": 0.03d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-01-16", "l_commitdate": "1996-02-23", "l_receiptdate": "1996-01-22", "l_shipinstruct": "TAKE BACK RETURN", "l_shipmode": "FOB", "l_comment": "jole. excuses wake carefully alongside of " }
+{ "l_orderkey": 7, "l_partkey": 158, "l_suppkey": 3, "l_linenumber": 7, "l_quantity": 5, "l_extendedprice": 5290.75d, "l_discount": 0.04d, "l_tax": 0.02d, "l_returnflag": "N", "l_linestatus": "O", "l_shipdate": "1996-02-10", "l_commitdate": "1996-03-26", "l_receiptdate": "1996-02-13", "l_shipinstruct": "NONE", "l_shipmode": "FOB", "l_comment": "ithely regula" }
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/insert-syntax.adm b/asterix-app/src/test/resources/runtimets/results/dml/insert-syntax.adm
new file mode 100644
index 0000000..9407868
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/insert-syntax.adm
@@ -0,0 +1,4 @@
+{ "id": 1, "name": "Person One", "hobbies": {{ "Rock", "Metal" }} }
+{ "id": 2, "name": "Person Two", "hobbies": {{ "Rock", "Jazz" }} }
+{ "id": 3, "name": "Person Three", "hobbies": {{ "Blues" }} }
+{ "id": 4, "name": "Person Four", "hobbies": {{ "Metal", "Jazz" }} }
diff --git a/asterix-app/src/test/resources/runtimets/results/scan/alltypes_02.adm b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_02.adm
new file mode 100644
index 0000000..64aee7c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_02.adm
@@ -0,0 +1 @@
+{ "id": 10, "name": "Nancy", "age": 32.5f, "salary": 12.0d, "married": true, "interests": {{ "reading", "writing" }}, "children": [ "Brad", "Scott" ], "address": { "number": 8389, "street": "Hill St.", "city": "Mountain View" }, "dob": date("-2011-01-27"), "time": time("12:20:30.000Z"), "datetime": datetime("-1951-12-27T12:20:30.000Z"), "duration": duration("P10Y11M12DT10H50M30S"), "location2d": point("41.0,44.0"), "location3d": point3d("44.0,13.0,41.0"), "line": line("10.1,11.1 10.2,11.2"), "polygon": polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"), "circle": circle("10.1,11.1 10.2") }
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 1157c4a..02eb1ee 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -754,6 +754,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="dml">
+ <compilation-unit name="delete-syntax-change">
+ <output-file compare="Text">delete-syntax-change.adm</output-file>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
<compilation-unit name="drop-empty-secondary-indexes">
<output-file compare="Text">drop-empty-secondary-indexes.adm</output-file>
</compilation-unit>
@@ -784,8 +789,13 @@
</compilation-unit>
</test-case>
<test-case FilePath="dml">
- <compilation-unit name="insert-into-empty-dataset">
- <output-file compare="Text">insert-into-empty-dataset.adm</output-file>
+ <compilation-unit name="insert-into-empty-dataset-with-index">
+ <output-file compare="Text">insert-into-empty-dataset-with-index.adm</output-file>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
+ <compilation-unit name="insert-syntax">
+ <output-file compare="Text">insert-syntax.adm</output-file>
</compilation-unit>
</test-case>
<test-case FilePath="dml">
@@ -2673,6 +2683,12 @@
</compilation-unit>
</test-case>
<test-case FilePath="scan">
+ <compilation-unit name="invalid-scan-syntax">
+ <output-file compare="Text">invalid-scan-syntax.adm</output-file>
+ <expected-error>SyntaxError</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="scan">
<compilation-unit name="30">
<output-file compare="Text">30.adm</output-file>
</compilation-unit>
@@ -2683,6 +2699,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="scan">
+ <compilation-unit name="alltypes_02">
+ <output-file compare="Text">alltypes_02.adm</output-file>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="scan">
<compilation-unit name="numeric_types_01">
<output-file compare="Text">numeric_types_01.adm</output-file>
</compilation-unit>
@@ -3704,6 +3725,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="cross-dataverse">
+ <compilation-unit name="cross-dv20">
+ <output-file compare="Text">cross-dv20.adm</output-file>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="cross-dataverse">
<compilation-unit name="insert_across_dataverses">
<output-file compare="Text">insert_across_dataverses.adm</output-file>
</compilation-unit>
diff --git a/asterix-aql/pom.xml b/asterix-aql/pom.xml
index 7617582..50a0f99 100644
--- a/asterix-aql/pom.xml
+++ b/asterix-aql/pom.xml
@@ -16,6 +16,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
<plugin>
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index e296266..dca639b 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -260,7 +260,7 @@
datasetName = nameComponents.second;
}
- <LEFTPAREN> query = Query() <RIGHTPAREN> ";"
+ (<LEFTPAREN>)? query = Query() (<RIGHTPAREN>)? (";")?
{return new InsertStatement(dataverseName, datasetName, query, getVarCounter());}
}
@@ -280,7 +280,7 @@
{
nameComponents = getDotSeparatedPair();
}
- ("where" condition = Expression())? (dieClause = DieClause())? ";"
+ ("where" condition = Expression())? (dieClause = DieClause())? (";")?
{return new DeleteStatement(var, nameComponents.first, nameComponents.second, condition, dieClause, getVarCounter()); }
}
@@ -1818,10 +1818,11 @@
Expression expr = null;
}
{
- //Literal | VariableRef | ListConstructor | RecordConstructor | FunctionCallExpr | ParenthesizedExpression
+ //Literal | VariableRef | ListConstructor | RecordConstructor | FunctionCallExpr | DatasetAccessExpression | ParenthesizedExpression
(
expr =Literal()
| expr = FunctionCallExpr()
+ | expr = DatasetAccessExpression()
| expr =VariableRef()
{
@@ -2046,7 +2047,8 @@
String id2=null;
}
{
- ( <IDENTIFIER> { dataverse = defaultDataverse; funcName = token.image;} ("." <IDENTIFIER> { dataverse = funcName; funcName = token.image;})? | <DATASET> {dataverse = MetadataConstants.METADATA_DATAVERSE_NAME; funcName = getToken(0).toString();})
+
+ <IDENTIFIER> { dataverse = defaultDataverse; funcName = token.image;} ("." <IDENTIFIER> { dataverse = funcName; funcName = token.image;})?
{
hint = getHint(token);
}
@@ -2070,7 +2072,34 @@
}
}
-
+Expression DatasetAccessExpression() throws ParseException:
+{
+ CallExpr callExpr;
+ List<Expression> argList = new ArrayList<Expression>();
+ String funcName;
+ String dataverse;
+ LiteralExpr ds;
+ LiteralExpr dvds;
+ Expression nameArg;
+ int arity = 0;
+}
+{
+ <DATASET> {dataverse = MetadataConstants.METADATA_DATAVERSE_NAME; funcName = getToken(0).toString();}
+ (
+ (<IDENTIFIER> {ds = new LiteralExpr(); ds.setValue( new StringLiteral(token.image) ); argList.add(ds); arity ++;} ("." <IDENTIFIER> { dvds = new LiteralExpr(); dvds.setValue(new StringLiteral(ds.getValue()+"."+token.image)); argList.remove(0); argList.add(dvds);})? ) |
+ (<LEFTPAREN> nameArg = Expression() {argList.add(nameArg); arity ++;} ("," nameArg = Expression() { argList.add(nameArg); arity++; })* <RIGHTPAREN>)
+ )
+
+ {
+ FunctionSignature signature = lookupFunctionSignature(dataverse, funcName.toString(), arity);
+ if(signature == null)
+ {
+ signature = new FunctionSignature(dataverse, funcName.toString(), arity);
+ }
+ callExpr = new CallExpr(signature,argList);
+ return callExpr;
+ }
+}
Expression ParenthesizedExpression() throws ParseException:
{
diff --git a/asterix-common/pom.xml b/asterix-common/pom.xml
index 0994109..87a36ab 100644
--- a/asterix-common/pom.xml
+++ b/asterix-common/pom.xml
@@ -18,6 +18,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
</plugins>
diff --git a/asterix-external-data/pom.xml b/asterix-external-data/pom.xml
index 337da7f..f54f1c2 100644
--- a/asterix-external-data/pom.xml
+++ b/asterix-external-data/pom.xml
@@ -17,6 +17,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
<plugin>
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/data/operator/FeedIntakeOperatorNodePushable.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/data/operator/FeedIntakeOperatorNodePushable.java
index 29fe72a..d0dbb98 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/data/operator/FeedIntakeOperatorNodePushable.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/data/operator/FeedIntakeOperatorNodePushable.java
@@ -81,7 +81,7 @@
@Override
public void close() throws HyracksDataException {
- writer.close();
+
}
@Override
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/FileSystemBasedAdapter.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/FileSystemBasedAdapter.java
index e46705d..9f8cedc 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/FileSystemBasedAdapter.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/FileSystemBasedAdapter.java
@@ -17,8 +17,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.external.util.DNSResolverFactory;
+import edu.uci.ics.asterix.external.util.INodeResolver;
+import edu.uci.ics.asterix.external.util.INodeResolverFactory;
import edu.uci.ics.asterix.om.types.ARecordType;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.IAType;
@@ -36,12 +41,17 @@
private static final long serialVersionUID = 1L;
- protected ITupleParserFactory parserFactory;
- protected ITupleParser parser;
-
+ public static final String NODE_RESOLVER_FACTORY_PROPERTY = "node.Resolver";
public static final String KEY_DELIMITER = "delimiter";
public static final String KEY_PATH = "path";
+ protected ITupleParserFactory parserFactory;
+ protected ITupleParser parser;
+ protected static INodeResolver nodeResolver;
+
+ private static final INodeResolver DEFAULT_NODE_RESOLVER = new DNSResolverFactory().createNodeResolver();
+ private static final Logger LOGGER = Logger.getLogger(FileSystemBasedAdapter.class.getName());
+
public abstract InputStream getInputStream(int partition) throws IOException;
public FileSystemBasedAdapter(IAType atype) {
@@ -118,4 +128,32 @@
}
}
+
+ protected INodeResolver getNodeResolver() {
+ if (nodeResolver == null) {
+ nodeResolver = initNodeResolver();
+ }
+ return nodeResolver;
+ }
+
+ private static INodeResolver initNodeResolver() {
+ INodeResolver nodeResolver = null;
+ String configuredNodeResolverFactory = System.getProperty(NODE_RESOLVER_FACTORY_PROPERTY);
+ if (configuredNodeResolverFactory != null) {
+ try {
+ nodeResolver = ((INodeResolverFactory) (Class.forName(configuredNodeResolverFactory).newInstance()))
+ .createNodeResolver();
+
+ } catch (Exception e) {
+ if (LOGGER.isLoggable(Level.WARNING)) {
+ LOGGER.log(Level.WARNING, "Unable to create node resolver from the configured classname "
+ + configuredNodeResolverFactory + "\n" + e.getMessage());
+ }
+ nodeResolver = DEFAULT_NODE_RESOLVER;
+ }
+ } else {
+ nodeResolver = DEFAULT_NODE_RESOLVER;
+ }
+ return nodeResolver;
+ }
}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/NCFileSystemAdapter.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/NCFileSystemAdapter.java
index bcc90c8..ae9b412 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/NCFileSystemAdapter.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/dataset/adapter/NCFileSystemAdapter.java
@@ -21,6 +21,7 @@
import java.io.InputStream;
import java.util.Map;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
@@ -60,7 +61,7 @@
return AdapterType.READ;
}
- private void configureFileSplits(String[] splits) {
+ private void configureFileSplits(String[] splits) {
if (fileSplits == null) {
fileSplits = new FileSplit[splits.length];
String nodeName;
@@ -77,10 +78,12 @@
}
}
- private void configurePartitionConstraint() {
+ private void configurePartitionConstraint() throws AsterixException {
String[] locs = new String[fileSplits.length];
+ String location;
for (int i = 0; i < fileSplits.length; i++) {
- locs[i] = fileSplits[i].getNodeName();
+ location = getNodeResolver().resolveNode(fileSplits[i].getNodeName());
+ locs[i] = location;
}
partitionConstraint = new AlgebricksAbsolutePartitionConstraint(locs);
}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/feed/lifecycle/FeedManager.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/feed/lifecycle/FeedManager.java
index 29e4486..8314267 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/feed/lifecycle/FeedManager.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/feed/lifecycle/FeedManager.java
@@ -43,9 +43,7 @@
for (LinkedBlockingQueue<IFeedMessage> queue : operatorQueues) {
queue.put(feedMessage);
}
- } else {
- throw new AsterixException("Unable to deliver message. Unknown feed :" + feedId);
- }
+ }
} catch (Exception e) {
throw new AsterixException(e);
}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/DNSResolver.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/DNSResolver.java
new file mode 100644
index 0000000..ff6bbdf
--- /dev/null
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/DNSResolver.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.external.util;
+
+import java.util.Random;
+import java.util.Set;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.util.AsterixRuntimeUtil;
+
+/**
+ * Resolves a value (DNS/IP Address) to the id of a Node Controller running at the location.
+ */
+public class DNSResolver implements INodeResolver {
+
+ private static Random random = new Random();
+
+ @Override
+ public String resolveNode(String value) throws AsterixException {
+ try {
+ String ipAddress = AsterixRuntimeUtil.getIPAddress(value);
+ Set<String> nodeControllers = AsterixRuntimeUtil.getNodeControllersOnIP(ipAddress);
+ if (nodeControllers == null || nodeControllers.isEmpty()) {
+ throw new AsterixException(" No node controllers found at the address: " + value);
+ }
+ String chosenNCId = nodeControllers.toArray(new String[]{})[random
+ .nextInt(nodeControllers.size())];
+ return chosenNCId;
+ } catch (AsterixException ae) {
+ throw ae;
+ } catch (Exception e) {
+ throw new AsterixException(e);
+ }
+ }
+}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/DNSResolverFactory.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/DNSResolverFactory.java
new file mode 100644
index 0000000..6b56601
--- /dev/null
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/DNSResolverFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.external.util;
+
+/**
+ * Factory for creating instance of {@link DNSResolver}
+ */
+public class DNSResolverFactory implements INodeResolverFactory {
+
+ private static final INodeResolver INSTANCE = new DNSResolver();
+
+ @Override
+ public INodeResolver createNodeResolver() {
+ return INSTANCE;
+ }
+
+}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/INodeResolver.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/INodeResolver.java
new file mode 100644
index 0000000..d0e8a64
--- /dev/null
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/INodeResolver.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.external.util;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+
+/**
+ * A policy for resolving a name to a node controller id.
+ *
+ */
+public interface INodeResolver {
+
+ /**
+ * Resolve a passed-in value to a node controller id.
+ *
+ * @param value
+ * string to be resolved
+ * @return resolved result (a node controller id)
+ * @throws AsterixException
+ */
+ public String resolveNode(String value) throws AsterixException;
+}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/INodeResolverFactory.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/INodeResolverFactory.java
new file mode 100644
index 0000000..2abde9c
--- /dev/null
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/INodeResolverFactory.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.external.util;
+
+/**
+ * Factory for creating an instance of INodeResolver
+ *
+ * @see INodeResolver
+ */
+public interface INodeResolverFactory {
+
+ /**
+ * Create an instance of {@link INodeResolver}
+ *
+ * @return an instance of INodeResolver
+ */
+ public INodeResolver createNodeResolver();
+}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/IdentitiyResolverFactory.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/IdentitiyResolverFactory.java
new file mode 100644
index 0000000..5161203
--- /dev/null
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/IdentitiyResolverFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.external.util;
+
+/**
+ * Factory for creating an instance of @see {IdentityResolver}.
+ * Identity resolver simply resolves a value to itself and is useful when value being resolved
+ * is a node controller id.
+ */
+public class IdentitiyResolverFactory implements INodeResolverFactory {
+
+ private static INodeResolver INSTANCE = new IdentityResolver();
+
+ @Override
+ public INodeResolver createNodeResolver() {
+ return INSTANCE;
+ }
+
+}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/IdentityResolver.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/IdentityResolver.java
new file mode 100644
index 0000000..7ff1f9b
--- /dev/null
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/util/IdentityResolver.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.external.util;
+
+/**
+ * Identity resolver simply resolves a value to itself and is useful when value being resolved
+ * is a node controller id.
+ */
+public class IdentityResolver implements INodeResolver {
+
+ @Override
+ public String resolveNode(String value) {
+ return value;
+ }
+
+}
diff --git a/asterix-hyracks-glue/pom.xml b/asterix-hyracks-glue/pom.xml
index 1a18d1c..e28b2af 100644
--- a/asterix-hyracks-glue/pom.xml
+++ b/asterix-hyracks-glue/pom.xml
@@ -19,6 +19,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
</plugins>
diff --git a/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml b/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml
index 524727f..dc5e207 100644
--- a/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml
+++ b/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml
@@ -13,8 +13,9 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
</plugins>
diff --git a/asterix-metadata/pom.xml b/asterix-metadata/pom.xml
index 3e8e0f9..ae90e4e 100644
--- a/asterix-metadata/pom.xml
+++ b/asterix-metadata/pom.xml
@@ -17,6 +17,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
</plugins>
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
index 321a73c..f49703a 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
@@ -542,6 +542,14 @@
}
@Override
+ public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getResultHandleRuntime(IDataSink sink,
+ int[] printColumns, IPrinterFactory[] printerFactories, RecordDescriptor inputDesc, boolean ordered,
+ JobSpecification spec) throws AlgebricksException {
+ // TODO(madhusudancs): Stub implementation of the method
+ return null;
+ }
+
+ @Override
public IDataSourceIndex<String, AqlSourceId> findDataSourceIndex(String indexId, AqlSourceId dataSourceId)
throws AlgebricksException {
AqlDataSource ads = findDataSource(dataSourceId);
diff --git a/asterix-om/pom.xml b/asterix-om/pom.xml
index 8ff3f84..a74d233 100644
--- a/asterix-om/pom.xml
+++ b/asterix-om/pom.xml
@@ -17,6 +17,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
</plugins>
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
index ac1facc..82320e4 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
@@ -204,8 +204,34 @@
return findFieldPosition(baaos.getByteArray(), 0, baaos.getByteArray().length);
}
+ /**
+ * Returns the field type of the field name if it exists, otherwise null.
+ *
+ * @param fieldName
+ * the fieldName whose type is sought
+ * @return the field type of the field name if it exists, otherwise null
+ * @throws IOException
+ * if an error occurs while serializing the field name
+ */
public IAType getFieldType(String fieldName) throws IOException {
- return fieldTypes[findFieldPosition(fieldName)];
+ int fieldPos = findFieldPosition(fieldName);
+ if (fieldPos < 0 || fieldPos >= fieldTypes.length) {
+ return null;
+ }
+ return fieldTypes[fieldPos];
+ }
+
+ /**
+ * Returns true or false indicating whether or not a field is closed.
+ *
+ * @param fieldName
+ * the name of the field to check
+ * @return true if fieldName is a closed field, otherwise false
+ * @throws IOException
+ * if an error occurs while serializing fieldName
+ */
+ public boolean isClosedField(String fieldName) throws IOException {
+ return findFieldPosition(fieldName) != -1;
}
@Override
diff --git a/asterix-runtime/pom.xml b/asterix-runtime/pom.xml
index be64661..245f577 100644
--- a/asterix-runtime/pom.xml
+++ b/asterix-runtime/pom.xml
@@ -18,6 +18,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
<plugin>
diff --git a/asterix-test-framework/pom.xml b/asterix-test-framework/pom.xml
index 9462b5d..4042066 100755
--- a/asterix-test-framework/pom.xml
+++ b/asterix-test-framework/pom.xml
@@ -16,6 +16,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
<plugin>
diff --git a/asterix-tools/pom.xml b/asterix-tools/pom.xml
index 0440618..f6868c5 100644
--- a/asterix-tools/pom.xml
+++ b/asterix-tools/pom.xml
@@ -17,6 +17,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
<plugin>
diff --git a/asterix-transactions/pom.xml b/asterix-transactions/pom.xml
index a402077..bc008cd 100644
--- a/asterix-transactions/pom.xml
+++ b/asterix-transactions/pom.xml
@@ -19,6 +19,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <fork>true</fork>
</configuration>
</plugin>
</plugins>