package edu.umich.verdict.redshift;

import edu.umich.verdict.VerdictConf;
import edu.umich.verdict.VerdictContext;
import edu.umich.verdict.VerdictJDBCContext;
import edu.umich.verdict.exceptions.VerdictException;

public class RedshiftThroughVerdictTest {

    public static void main(String[] args) throws VerdictException {

        VerdictConf conf = new VerdictConf();
        conf.setDbms("redshift");
        conf.setHost("salat2-verdict.ctkb4oe4rzfm.us-east-1.redshift.amazonaws.com");
        conf.setPort("5439");		
        conf.setDbmsSchema("dev");
        conf.setUser("junhao");
        conf.setPassword("BTzyc1xG");
        conf.set("loglevel", "debug");
        
        VerdictContext vc = VerdictJDBCContext.from(conf);
        
//        vc.executeJdbcQuery("set bypass=true");
//        vc.executeJdbcQuery("set search_path = tpch1g,tpch1g_verdict");
//        vc.executeJdbcQuery("set bypass=false");
//        vc.executeJdbcQuery("select count(*) from tpch1g.orders");
        
        vc.executeJdbcQuery("set bypass=true");
        vc.executeJdbcQuery("set search_path = tpch1g,tpch1g_verdict");
        vc.executeJdbcQuery("set bypass=false");
        vc.executeJdbcQuery("show tables in tpch1g");
        vc.executeJdbcQuery("show tables in tpch1g_verdict");
        vc.executeJdbcQuery("create sample of tpch1g.lineitem");
//        vc.executeJdbcQuery("create sample of tpch1g.lineitem");
//        vc.executeJdbcQuery("delete sample of tpch1g.orders");
//        vc.executeJdbcQuery("delete sample of tpch1g.lineitem");

        vc.destroy();
    }

}

@@ -787,18 +787,17 @@
 ass=
-tru
+fals
 e%22);%0A
-//
     
@@ -911,24 +911,33 @@
 ss=false%22);%0A
+        %0A
 //        vc
@@ -938,204 +938,205 @@
     
-vc.executeJdbcQuery(%22select count(*) from tpch1g.orders%22);%0A        %0A        vc.executeJdbcQuery(%22set bypass=true%22);%0A        vc.executeJdbcQuery(%22set search_path = tpch1g,tpch1g_verdict%22
+long startTime = System.currentTimeMillis();                %0A        vc.executeJdbcQuery(%22create sample of tpch1g.orders%22);        %0A//        long endTime   = System.currentTimeMillis(
 );%0A
+//
         
 vc.e
@@ -1135,165 +1135,186 @@
     
-vc.executeJdbcQuery(%22set bypass=false%22);%0A        vc.executeJdbcQuery(%22show tables in tpch1g%22);%0A        vc.executeJdbcQuery(%22show tables in tpch1g_verdict%22);%0A
+long totalTime = endTime - startTime;%0A//        System.out.println(totalTime);%0A//%0A//        vc.executeJdbcQuery(%22create stratified sample of tpch1g.lineitem on l_suppkey%22);%0A//%0A//
     
@@ -1337,32 +1337,41 @@
 bcQuery(%22create 
+universe 
 sample of tpch1g
@@ -1360,39 +1360,32 @@
 e sample of 
-tpch1g.
 lineitem
 %22);%0A//      
@@ -1364,35 +1364,52 @@
 mple of lineitem
-%22);
+ on l_orderkey%22);%0A//
 %0A//        vc.ex
@@ -1423,32 +1423,41 @@
 bcQuery(%22create 
+universe 
 sample of tpch1g
@@ -1446,39 +1446,32 @@
 e sample of 
-tpch1g.
 lineitem
 %22);%0A//      
@@ -1458,19 +1458,35 @@
 lineitem
-%22);
+ on l_partkey%22);%0A//
 %0A//     
@@ -1501,38 +1501,46 @@
 ecuteJdbcQuery(%22
-delete
+create uniform
  sample of tpch1
@@ -1526,39 +1526,32 @@
 iform sample of 
-tpch1g.
 orders%22);%0A//    
@@ -1540,24 +1540,27 @@
 f orders%22);%0A
+//%0A
 //        vc
@@ -1582,40 +1582,44 @@
 ry(%22
-delete sample of tpch1g.lineitem
+create universe sample of o_orderkey
 %22);%0A

add new queries for sampling