diff --git a/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java b/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java
index cefb997..2eafd76 100644
--- a/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java
+++ b/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java
@@ -89,16 +89,16 @@
 
         CSVFileScanOperatorDescriptor ordScanner = new CSVFileScanOperatorDescriptor(spec, ordersSplits, ordersDesc,
                 '|', "'\"");
-        ordScanner.setPartitionConstraint(createRRPartitionConstraint(10));
+        ordScanner.setPartitionConstraint(createRRPartitionConstraint(2));
 
         CSVFileScanOperatorDescriptor custScanner = new CSVFileScanOperatorDescriptor(spec, custSplits, custDesc, '|',
                 "'\"");
-        custScanner.setPartitionConstraint(createRRPartitionConstraint(10));
+        custScanner.setPartitionConstraint(createRRPartitionConstraint(2));
 
         InMemoryHashJoinOperatorDescriptor join = new InMemoryHashJoinOperatorDescriptor(spec, new int[] { 0 },
                 new int[] { 1 }, new IBinaryHashFunctionFactory[] { StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc, 6000000);
-        join.setPartitionConstraint(new PartitionCountConstraint(40));
+        join.setPartitionConstraint(new PartitionCountConstraint(4));
 
         RecordDescriptor groupResultDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
@@ -108,10 +108,10 @@
                         new IBinaryHashFunctionFactory[] { StringBinaryHashFunctionFactory.INSTANCE }),
                 new IBinaryComparatorFactory[] { StringBinaryComparatorFactory.INSTANCE },
                 new CountAccumulatingAggregatorFactory(), groupResultDesc, 16);
-        gby.setPartitionConstraint(new PartitionCountConstraint(40));
+        gby.setPartitionConstraint(new PartitionCountConstraint(4));
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        printer.setPartitionConstraint(new PartitionCountConstraint(40));
+        printer.setPartitionConstraint(new PartitionCountConstraint(4));
 
         IConnectorDescriptor ordJoinConn = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 1 },
@@ -136,32 +136,26 @@
     }
 
     private static FileSplit[] createOrdersFileSplits() {
-        FileSplit fss[] = new FileSplit[40];
+        FileSplit fss[] = new FileSplit[2];
         for (int i = 0; i < fss.length; ++i) {
-            fss[i] = new FileSplit("foo", new File("/home/ubuntu/vinayakb/data/tpch.40.splits/disk" + (i % 4)
-                    + "/orders" + i + ".dat"));
+            fss[i] = new FileSplit("foo", new File("data/tpch0.001/orders-part" + (i + 1) + ".tbl"));
         }
         return fss;
     }
 
     private static FileSplit[] createCustomerFileSplits() {
-        FileSplit fss[] = new FileSplit[40];
+        FileSplit fss[] = new FileSplit[2];
         for (int i = 0; i < fss.length; ++i) {
-            fss[i] = new FileSplit("foo", new File("/home/ubuntu/vinayakb/data/tpch.40.splits/disk" + (i % 4)
-                    + "/customer" + i + ".dat"));
+            fss[i] = new FileSplit("foo", new File("data/tpch0.001/customer-part" + (i + 1) + ".tbl"));
         }
         return fss;
     }
 
-    private static final LocationConstraint[] LCS = { new AbsoluteLocationConstraint("asterix-001"),
-            new AbsoluteLocationConstraint("asterix-002"), new AbsoluteLocationConstraint("asterix-003"),
-            new AbsoluteLocationConstraint("asterix-004"), new AbsoluteLocationConstraint("asterix-005"),
-            new AbsoluteLocationConstraint("asterix-006"), new AbsoluteLocationConstraint("asterix-007"),
-            new AbsoluteLocationConstraint("asterix-008"), new AbsoluteLocationConstraint("asterix-009"),
-            new AbsoluteLocationConstraint("asterix-010"), };
+    private static final LocationConstraint[] LCS = { new AbsoluteLocationConstraint("NC1"),
+            new AbsoluteLocationConstraint("NC2") };
 
     private static PartitionConstraint createRRPartitionConstraint(int k) {
-        LocationConstraint[] lcs = new LocationConstraint[40];
+        LocationConstraint[] lcs = new LocationConstraint[2];
         for (int i = 0; i < lcs.length; ++i) {
             lcs[i] = createRRSteppedChoiceConstraint(i, k);
         }
