Added test to cover issue 162
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@621 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/data/names.adm b/asterix-app/data/names.adm
new file mode 100644
index 0000000..35c137e
--- /dev/null
+++ b/asterix-app/data/names.adm
@@ -0,0 +1,120 @@
+711|Hugh|Lema|25|HR
+721|Schwan|Phil|34|Payroll
+732|Noemi|Eacret|56|HR
+741|Julio|Mattocks|38|Sales
+751|Lance|Kottke|34|IT
+761|Kurt|Liz|32|HR
+771|Neva|Barbeau|45|Sales
+781|Karina|Tuthill|46|Payroll
+791|Maricela|Cambron|36|IT
+110|Allan|Piland|29|HR
+101|Javier|Makuch|28|IT
+112|Pearlie|Aumann|31|Payroll
+113|Chandra|Hase|34|Sales
+114|Christian|Convery|28|HR
+115|Panther|Ritch|26|IT
+116|Ted|Elsea|26|IT
+117|Tabatha|Bladen|25|HR
+118|Clayton|Oltman|42|Sales
+119|Sharron|Darwin|32|Payroll
+210|Clayton|Durgin|52|HR
+299|Julio|Iorio|37|IT
+212|Emilia|Chenail|26|Sales
+213|Kenya|Almquist|43|Payroll
+214|Alejandra|Lacefield|41|HR
+215|Karina|Michelsen|46|IT
+216|Katy|Delillo|36|IT
+217|Benita|Kleist|37|HR
+218|Earlene|Paluch|31|IT
+219|Kurt|Petermann|27|Payroll
+915|Starner|Stuart|25|Sales
+925|Sofia|Cuff|30|HR
+935|Milagros|Murguia|31|IT
+945|Margery|Haldeman|32|IT
+955|Max|Mell|33|HR
+965|Micco|Mercy|31|Payroll
+975|Clare|Vangieson|34|IT
+985|Elnora|Dimauro|35|Sales
+995|Pearlie|Kocian|38|HR
+809|Clayton|Delany|23|IT
+811|Kubik|Kuhn|27|HR
+821|Allan|Tomes|29|Payroll
+831|Lonnie|Aller|33|Sales
+841|Neil|Hurrell|26|IT
+851|Clayton|Engles|41|HR
+861|Javier|Gabrielson|39|Payroll
+871|Allan|Alejandre|48|IT
+881|Julio|Isa|38|Sales
+891|Roslyn|Simmerman|31|IT
+601|Neil|Deforge|26|HR
+611|Earlene|Marcy|32|IT
+621|Erik|Lechuga|42|Payroll
+631|Tyrone|Holtzclaw|34|Sales
+641|Lance|Hankey|35|Sales
+651|Mallory|Gladding|31|HR
+661|Tia|Braaten|40|IT
+671|Julio|Vanpatten|30|Payroll
+681|Max|Teachout|34|IT
+691|Karina|Wingerter|31|IT
+8301|Earlene|Wallick|26|HR
+8338|Julio|Bosket|28|Payroll
+5438|Lakisha|Quashie|29|HR
+538|Milagros|Forkey|34|Sales
+504|Erik|Dobek|29|IT
+584|Dollie|Dattilo|32|Payroll
+524|Benita|Maltos|33|IT
+534|Kurt|Biscoe|36|HR
+544|Loraine|Housel|30|Sales
+554|Jamie|Rachal|30|IT
+564|Liza|Fredenburg|37|IT
+574|Ericka|Feldmann|29|Sales
+589|Lorrie|Sharon|27|IT
+594|Roxie|Houghtaling|40|Payroll
+514|Julio|Ruben|41|IT
+414|Mathew|Fuschetto|34|HR
+424|Allyson|Remus|32|IT
+434|Earlene|Linebarger|26|Payroll
+444|Clinton|Sick|29|IT
+454|Ted|Caba|28|HR|Sales
+464|Fernando|Engelke|39|IT
+474|Mathew|Courchesne|31|IT
+484|Cody|Vinyard|36|Payroll
+494|Benita|Fravel|33|Sales
+404|Emilia|Square|32|IT
+1263|Tania|Loffredo|25|IT
+363|Cody|Rodreguez|26|IT
+463|Marcie|States|28|IT
+3563|Hazeltine|Susan|29|Sales
+7663|Annabelle|Nimmo|30|Payroll
+9763|Ted|Saini|31|IT
+1863|Darren|Thorington|32|Sales
+2963|Neil|Gunnerson|34|IT
+1410|Clinton|Fredricks|34|IT
+1411|Lance|Farquhar|32|HR
+1412|Tabatha|Crisler|33|IT
+1413|Max|Durney|29|IT
+1414|Carmella|Strauser|30|Payroll
+1415|Kelly|Carrales|40|IT
+1416|Guy|Merten|29|Sales
+1417|Noreen|Ruhland|29|IT
+1418|Julio|Damore|27|Sales
+1419|Selena|Truby|25|HR
+1420|Alejandra|Commons|30|Sales
+1421|Allyson|Balk|30|IT
+1422|Nelson|Byun|40|Sales
+1423|Christian|Reidhead|40|IT
+1424|Pearlie|Hopkin|48|Payroll
+1425|Nelson|Wohlers|41|HR
+1426|Marcie|Rasnake|42|Sales
+1427|Hugh|Marshburn|43|Payroll
+1428|Mathew|Marasco|45|Sales
+1429|Kurt|Veres|32|IT
+1430|Julio|Barkett|39|Sales
+4727|Michael|Carey|50|Payroll
+2333|Chen|Li|42|HR
+7444|Sharad|Mehrotra|42|Sales
+9555|Tony|Givargis|40|Sales
+3666|Young Seok|Kim|35|Payroll
+9941|Khurram Faraaz|Mohammed|30|HR
+1007|Yingyi|Bu|27|IT
+1999|Susan|Malaika|42|HR
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key.aql
new file mode 100644
index 0000000..dadb884
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key.aql
@@ -0,0 +1,35 @@
+/*
+ * Description : Test that BTree index is used in query plan
+ * : define the BTree index on a composite key (fname,lanme)
+ * : predicate => where $l.fname="Julio" and $l.lname="Isa"
+ * Expected Result : Success
+ * Issue : Issue 162
+ * Date : 7th August 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as closed {
+id:int32,
+fname:string,
+lname:string,
+age:int32,
+dept:string
+}
+
+create dataset employee(Emp) partitioned by key id;
+
+load dataset employee
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/names.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+create index idx_employee_f_l_name on employee(fname,lname);
+
+write output to nc1:"rttest/index-selection_btree-index-composite-key.adm";
+
+for $l in dataset('employee')
+where $l.fname="Julio" and $l.lname="Isa"
+return $l
+
diff --git a/asterix-app/src/test/resources/runtimets/results/index-selection/btree-index-composite-key.adm b/asterix-app/src/test/resources/runtimets/results/index-selection/btree-index-composite-key.adm
new file mode 100644
index 0000000..cebf05b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/index-selection/btree-index-composite-key.adm
@@ -0,0 +1 @@
+{ "id": 881, "fname": "Julio", "lname": "Isa", "age": 38, "dept": "Sales" }