use of org.voltdb.types.TimestampType in project voltdb by VoltDB.
the class TestCSVLoader method testNoQuotesSpecialSeparator.
@Test
public void testNoQuotesSpecialSeparator() throws Exception {
// Identical to previous test, except separator is Ctrl-A, not '|'.
// Don't know how to make Ctrl-A visible in eclipse.
String[] myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=", "--noquotechar", "--escape=\\", "--skip=1", "--limitrows=100", "BlAh" };
String currentTime = new TimestampType().toString();
String[] myData = { "1 1111111111first1.101.11" + currentTime + "POINT(1 1)POLYGON((0 0, 1 0, 0 1, 0 0))", "222222222second3.30NULL" + currentTime + "POINT(2 2)POLYGON((0 0, 2 0, 0 2, 0 0))", //unclosed quote below should work
"1 1111111111fir\"st1.101.11" + currentTime + "POINT(1 1)POLYGON((0 0, 1 0, 0 1, 0 0))" };
int invalidLineCnt = 0;
int validLineCnt = 2;
test_Interface(myOptions, myData, invalidLineCnt, validLineCnt);
}
use of org.voltdb.types.TimestampType in project voltdb by VoltDB.
the class TestCSVLoader method testHeaderColumnWhitespace1.
@Test
public void testHeaderColumnWhitespace1() throws Exception {
// ENG-12324: csvloader --header doesn't work if header has spaces. This is essentially the same test as testHeaderColumnNumNotSame, but with some
// strategically placed whitespace in the header.
String[] myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--limitrows=100", "--header", "BlAh" };
String currentTime = new TimestampType().toString();
String[] myData = { " clm_integer, clm_tinyint,clm_smallint, clm_bigint ,clm_string,clm_decimal,clm_float , clm_timestamp,clm_point ,clm_geography", "1 ,1,1,11111111,first,1.10,1.11," + currentTime + ",POINT(1 1),\"POLYGON((0 0, 1 0, 0 1, 0 0))\"", "2,2,2,222222,second,3.30,NULL," + currentTime + ",POINT(2 2),\"POLYGON((0 0, 2 0, 0 2, 0 0))\"", "3,3,3,333333, third ,NULL, 3.33," + currentTime + ",POINT(3 3),\"POLYGON((0 0, 3 0, 0 3, 0 0))\"", "4,4,4,444444, NULL ,4.40 ,4.44," + currentTime + ",POINT(4 4),\"POLYGON((0 0, 4 0, 0 4, 0 0))\"", "5,5,5,5555555, \"abcde\"g, 5.50, 5.55," + currentTime + ",POINT(5 5),\"POLYGON((0 0, 5 0, 0 5, 0 0))\"", "6,6,NULL,666666, sixth, 6.60, 6.66," + currentTime + ",POINT(6 6),\"POLYGON((0 0, 6 0, 0 6, 0 0))\"", "7,NULL,7,7777777, seventh, 7.70, 7.77," + currentTime + ",POINT(7 7),\"POLYGON((0 0, 7 0, 0 7, 0 0))\"", "11, 1,1,\"1,000\",first,1.10,1.11," + currentTime + ",POINT(1 1),\"POLYGON((0 0, 8 0, 0 8, 0 0))\"" };
int invalidLineCnt = 0;
int validLineCnt = 8;
test_Interface(myOptions, myData, invalidLineCnt, validLineCnt);
}
use of org.voltdb.types.TimestampType in project voltdb by VoltDB.
the class TestCSVLoader method testSkipOverFlow.
@Test
public void testSkipOverFlow() throws Exception {
String[] myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", //Skip the whole file
"--skip=10000", "BlAh" };
String currentTime = new TimestampType().toString();
String[] myData = { "1,1,1,11111111,first,1.10,1.11," + currentTime + ",POINT(1 1),\"POLYGON((0 0, 1 0, 0 1, 0 0))\"", "2,2,2,222222,second,3.30,NULL," + currentTime + ",POINT(2 2),\"POLYGON((0 0, 2 0, 0 2, 0 0))\"", "3,3,3,333333, third ,NULL, 3.33," + currentTime + ",POINT(3 3),\"POLYGON((0 0, 3 0, 0 3, 0 0))\"", "4,4,4,444444, NULL ,4.40 ,4.44," + currentTime + ",POINT(4 4),\"POLYGON((0 0, 4 0, 0 4, 0 0))\"", "5,5,5,5555555, \"abcde\"g, 5.50, 5.55," + currentTime + ",POINT(5 5),\"POLYGON((0 0, 5 0, 0 5, 0 0))\"", "6,6,NULL,666666, sixth, 6.60, 6.66," + currentTime + ",POINT(6 6),\"POLYGON((0 0, 6 0, 0 6, 0 0))\"", "7,NULL,7,7777777, seventh, 7.70, 7.77," + currentTime + ",POINT(7 7),\"POLYGON((0 0, 7 0, 0 7, 0 0))\"", "11, 1,1,\"1,000\",first,1.10,1.11," + currentTime + ",POINT(11 11),\"POLYGON((0 0, 11 0, 0 11, 0 0))\"", //empty line
"", //invalid lines below
"8, 8", "10,10,10,10 101 010,second,2.20,2.22" + currentTime + ",POINT(10 10),\"POLYGON((0 0, 10 0, 0 10, 0 0))\"", "12,n ull,12,12121212,twelveth,12.12,12.12" };
int invalidLineCnt = 0;
int validLineCnt = 0;
test_Interface(myOptions, myData, invalidLineCnt, validLineCnt);
}
use of org.voltdb.types.TimestampType in project voltdb by VoltDB.
the class TestCSVLoader method testProcedureOption.
//Test -p option where we use just one processor and one line at a time processing of callProcedure.
@Test
public void testProcedureOption() throws Exception {
String[] myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--skip=1", "--limitrows=100", "--procedure=BLAH.insert" };
String currentTime = new TimestampType().toString();
String[] myData = { "1 ,1,1,11111111,first,1.10,1.11," + currentTime + ",POINT(1 1),\"POLYGON((0 0, 1 0, 0 1, 0 0))\"", "2,2,2,222222,second,3.30,NULL," + currentTime + ",POINT(2 2),\"POLYGON((0 0, 2 0, 0 2, 0 0))\"", "3,3,3,333333, third ,NULL, 3.33," + currentTime + ",POINT(3 3),\"POLYGON((0 0, 3 0, 0 3, 0 0))\"", "4,4,4,444444, NULL ,4.40 ,4.44," + currentTime + ",POINT(4 4),\"POLYGON((0 0, 4 0, 0 4, 0 0))\"", "5,5,5,5555555, \"abcde\"g, 5.50, 5.55," + currentTime + ",POINT(5 5),\"POLYGON((0 0, 5 0, 0 5, 0 0))\"", "6,6,NULL,666666, sixth, 6.60, 6.66," + currentTime + ",POINT(6 6),\"POLYGON((0 0, 6 0, 0 6, 0 0))\"", "7,NULL,7,7777777, seventh, 7.70, 7.77," + currentTime + ",POINT(7 7),\"POLYGON((0 0, 7 0, 0 7, 0 0))\"", "11, 1,1,\"1,000\",first,1.10,1.11," + currentTime + ",POINT(11 11),\"POLYGON((0 0, 11 0, 0 11, 0 0))\"", //empty line
"", //invalid lines below
"8, 8", "9, NLL,9,\"1,000\",nine,1.10,1.11," + currentTime + ",POINT(9 9),\"POLYGON((0 0, 9 0, 0 9, 0 0))\"", "10,10,10,10 101 010,second,2.20,2.22" + currentTime + ",POINT(10 10),\"POLYGON((0 0, 10 0, 0 10, 0 0))\"", "12,n ull,12,12121212,twelveth,12.12,12.12" };
int invalidLineCnt = 4;
int validLineCnt = 7;
test_Interface(myOptions, myData, invalidLineCnt, validLineCnt);
}
use of org.voltdb.types.TimestampType in project voltdb by VoltDB.
the class InsertT method run.
public VoltTable[] run(String T_PK1, String T_PK2, String V1, String V2, String S_PK, String V3, String V4, String V5, String V6, String V7, String V8, String V9, String V10, String V11, String V12, String V13, String V14, String V15, String TS1, String V16, String TS2, String V17, String V18, String V19, String V20, String V21, String V22, String V23, String V24, String BIGINT1, String T_PK3, String TS3, String V25, String TS4, String DECIMAL1, String V26, String bigint2, String bigint3, String bigint4, String bigint5, String bigint6, String bigint7, String V27, String BIGINT8, String TS5, String V28, String V29, String V30, String V31, String V32, String INT1) throws VoltAbortException {
VoltTable[] retval = null;
try {
SimpleDateFormat sdf = new SimpleDateFormat("MMddyyyy");
Long emptylong = new Long(0);
Long s_pk = emptylong;
if ((S_PK != null) && (!"".equals(S_PK))) {
s_pk = Long.parseLong(S_PK);
}
Long bigint1 = emptylong;
if ((BIGINT1 != null) && (!"".equals(BIGINT1.trim()))) {
bigint1 = Long.parseLong(BIGINT1);
}
BigDecimal decimal1 = null;
if ((DECIMAL1 != null) && (!"".equals(DECIMAL1))) {
decimal1 = new BigDecimal(DECIMAL1);
}
TimestampType ts1 = null;
TimestampType ts2 = null;
if ((TS1 != null) && (!"".equals(TS1))) {
Date tempdate = null;
try {
tempdate = sdf.parse(TS1);
ts1 = new TimestampType(tempdate.getTime() * 1000);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if ((TS2 != null) && (!"".equals(TS2))) {
Date tempdate = null;
try {
tempdate = sdf.parse(TS2);
ts2 = new TimestampType(tempdate.getTime() * 1000);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
TimestampType ts3 = null;
if ((TS3 != null) && (!"".equals(TS3))) {
Date tempdate = null;
try {
tempdate = sdf.parse(TS3);
ts3 = new TimestampType(tempdate.getTime() * 1000);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
TimestampType ts5 = null;
if ((TS5 != null) && (!"".equals(TS5))) {
Date tempdate = null;
try {
tempdate = sdf.parse(TS5);
ts5 = new TimestampType(tempdate.getTime() * 1000);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
TimestampType ts4 = null;
if ((TS4 != null) && (!"".equals(TS4))) {
Date tempdate = null;
try {
tempdate = sdf.parse(TS4);
ts4 = new TimestampType(tempdate.getTime() * 1000);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Integer bigint8 = null;
if ((BIGINT8 != null) && (!"".equals(BIGINT8))) {
bigint8 = Integer.parseInt(BIGINT8);
}
Integer int1 = null;
if ((INT1 != null) && (!"".equals(INT1))) {
int1 = Integer.parseInt(INT1);
}
voltQueueSQL(sql, T_PK1, T_PK2, V1, V2, s_pk, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, ts1, V16, ts2, V17, V18, V19, V20, V21, V22, V23, V24, bigint1, T_PK3, ts3, V25, ts4, decimal1, V26, V27, bigint8, ts5, V28, V29, V30, V31, V32, int1);
retval = voltExecuteSQL();
} catch (Exception exp) {
System.out.println("Problem in run method of InsertT procedure");
System.out.println("T_PK1 is " + T_PK1 + " T_PK2 is " + T_PK2);
}
return retval;
}
Aggregations