Search in sources :

Example 76 with TimestampType

use of org.voltdb.types.TimestampType in project voltdb by VoltDB.

the class TestVoltBulkLoader method testMultipleTablesWithMultipleClientsMP.

//Test multiple tables with no errors (MultiPartition).
public void testMultipleTablesWithMultipleClientsMP() throws Exception {
    String mySchema = "create table BLAH (" + "clm_integer integer not null, " + // column that is partitioned on
    "clm_tinyint tinyint default 0, " + "clm_smallint smallint default 0, " + "clm_bigint bigint default 0, " + "clm_string varchar(20) default null, " + "clm_decimal decimal default null, " + "clm_float float default null, " + "clm_timestamp timestamp default null, " + "PRIMARY KEY(clm_integer) " + "); " + "create table BLAH2 (" + "clm_integer integer not null, " + // column that is partitioned on
    "clm_string varchar(20) default null, " + "clm_decimal decimal default null, " + "clm_float float default null, " + "clm_timestamp timestamp default null, " + "PRIMARY KEY(clm_integer) " + "); ";
    TimestampType currentTime = new TimestampType();
    Object[][] myData1 = { { 1, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 2, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 3, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 4, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 5, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 6, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 7, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 8, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 9, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 10, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 11, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 12, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 13, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 14, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 15, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 16, 1, 1, 11111111, "first", 1.10, 1.11, currentTime }, { 17, 1, 1, 11111111, "first", 1.10, 1.11, currentTime } };
    int myBatchSize1 = 200;
    Integer[] failures1 = {};
    ArrayList<Integer> expectedFailures1 = new ArrayList<Integer>(Arrays.asList(failures1));
    Object[][] myData2 = { { 1, "first", 1.10, 1.11, currentTime }, { 2, "first", 1.10, 1.11, currentTime }, { 3, "first", 1.10, 1.11, currentTime }, { 4, "first", 1.10, 1.11, currentTime }, { 5, "first", 1.10, 1.11, currentTime }, { 6, "first", 1.10, 1.11, currentTime }, { 7, "first", 1.10, 1.11, currentTime }, { 8, "first", 1.10, 1.11, currentTime }, { 9, "first", 1.10, 1.11, currentTime }, { 10, "first", 1.10, 1.11, currentTime }, { 11, "first", 1.10, 1.11, currentTime }, { 12, "first", 1.10, 1.11, currentTime }, { 13, "first", 1.10, 1.11, currentTime }, { 14, "first", 1.10, 1.11, currentTime }, { 15, "first", 1.10, 1.11, currentTime } };
    int myBatchSize2 = 200;
    Integer[] failures2 = {};
    ArrayList<Integer> expectedFailures2 = new ArrayList<Integer>(Arrays.asList(failures2));
    test_multiplexing(mySchema, true, true, true, "BLAH", myData1, myBatchSize1, expectedFailures1, false, "BLAH2", myData2, myBatchSize2, expectedFailures2, false);
}
Also used : ArrayList(java.util.ArrayList) TimestampType(org.voltdb.types.TimestampType)

Example 77 with TimestampType

use of org.voltdb.types.TimestampType in project voltdb by VoltDB.

the class TestJDBCLoader method testColumnSizeFailure.

@Test
public void testColumnSizeFailure() throws Exception {
    String[] myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--skip=1", "BlAh" };
    String[] jdbcOptions = { "--jdbcdriver=" + driver_class, "--jdbcurl=" + jdbc_url, "--jdbctable=" + "BlAh", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "JBlAh" };
    String currentTime = new TimestampType().toString();
    String[] myData = { "1,2,2,222222,second,3.30,NULL," + currentTime, "2,3,3,333333, third ,NULL, 3.33," + currentTime, "3,4,4,444444, NULL ,4.40 ,4.44," + currentTime, "4,5,5,5555555,  \"abcde\"g, 5.50, 5.55," + currentTime, "5,6,NULL,666666, sixth, 6.60, 6.66," + currentTime, // the next one the string is too big
    "6,6,NULL,666666, longerthansixteencha, 6.60, 6.66," + currentTime };
    int invalidLineCnt = 1;
    int validLineCnt = 4;
    test_Interface(myOptions, jdbcOptions, myData, invalidLineCnt, validLineCnt);
}
Also used : TimestampType(org.voltdb.types.TimestampType) Test(org.junit.Test)

Example 78 with TimestampType

use of org.voltdb.types.TimestampType in project voltdb by VoltDB.

the class TestJDBCLoader method testCommon.

@Test
public void testCommon() throws Exception {
    String[] myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--skip=1", "BlAh" };
    String[] jdbcOptions = { "--jdbcdriver=" + driver_class, "--jdbcurl=" + jdbc_url, "--jdbctable=" + "BlAh", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "JBlAh" };
    String currentTime = new TimestampType().toString();
    String[] myData = { "1,2,2,222222,second,3.30,NULL," + currentTime, "2,3,3,333333, third ,NULL, 3.33," + currentTime, "3,4,4,444444, NULL ,4.40 ,4.44," + currentTime, "4,5,5,5555555,  \"abcde\"g, 5.50, 5.55," + currentTime, "5,6,NULL,666666, sixth, 6.60, 6.66," + currentTime };
    int invalidLineCnt = 0;
    int validLineCnt = 4;
    test_Interface(myOptions, jdbcOptions, myData, invalidLineCnt, validLineCnt);
}
Also used : TimestampType(org.voltdb.types.TimestampType) Test(org.junit.Test)

Example 79 with TimestampType

use of org.voltdb.types.TimestampType in project voltdb by VoltDB.

the class TestVoltBulkLoader method testCommon.

public void testCommon() throws Exception {
    String mySchema = "create table BLAH (" + // column that is partitioned on
    "clm_integer integer default 0 not null, " + "clm_tinyint tinyint default 0, " + "clm_smallint smallint default 0, " + "clm_bigint bigint default 0, " + "clm_string varchar(20) default null, " + "clm_decimal decimal default null, " + "clm_float float default null, " + //"clm_varinary varbinary(20) default null," +
    "clm_timestamp timestamp default null, " + "clm_geo geography default null," + "clm_geopt geography_point default null" + "); ";
    int myBatchSize = 200;
    TimestampType currentTime = new TimestampType();
    Object[][] myData = { { 1, 1, 1, 11111111, "first", 1.10, 1.11, currentTime, geo, geopt }, { 2, 2, 2, 222222, "second", 3.30, "NULL", currentTime, geo, geopt }, { 3, 3, 3, 333333, " third ", null, 3.33, currentTime, geo, geopt }, { 4, 4, 4, 444444, " NULL ", 4.40, 4.44, currentTime, geo, geopt }, { 5, 5, 5, 5555555, "  \"abcde\"g", 5.50, 5.55, currentTime, geo, geopt }, { 6, 6, "NULL", 666666, " sixth", 6.60, 6.66, currentTime, geo, geopt }, { 7, null, 7, 7777777, " seventh", 7.70, 7.77, currentTime, geo, geopt }, { 11, 1, 1, "\"1,000\"", "first", 1.10, 1.11, currentTime, geo, geopt }, //empty line
    {}, //invalid lines below
    { 8, 8 }, { 9, "NLL", 9, "\"1,000\"", "nine", 1.10, 1.11, currentTime }, { 10, 10, 10, "10 101 010", "second", 2.20, 2.22 }, { 12, "n ull", 12, 12121212, "twelveth", 12.12, 12.12 } };
    Integer[] failures = { 2, 6, 8, 9, 10, 11, 12, 13 };
    ArrayList<Integer> expectedFailures = new ArrayList<Integer>(Arrays.asList(failures));
    test_Interface(mySchema, myData, myBatchSize, expectedFailures, 0);
}
Also used : ArrayList(java.util.ArrayList) TimestampType(org.voltdb.types.TimestampType)

Example 80 with TimestampType

use of org.voltdb.types.TimestampType in project voltdb by VoltDB.

the class TestVoltBulkLoader method testBatchOptionThatSplits.

//Test batch option that splits.
public void testBatchOptionThatSplits() throws Exception {
    String mySchema = "create table BLAH (" + "clm_integer integer default 0 not null, " + // column that is partitioned on
    "clm_tinyint tinyint default 0, " + "clm_smallint smallint default 0, " + "clm_bigint bigint default 0, " + "clm_string varchar(20) default null, " + "clm_decimal decimal default null, " + "clm_float float default null, " + // + "clm_varinary varbinary(20) default null," +
    "clm_timestamp timestamp default null, " + "clm_geo geography default null," + "clm_geopt geography_point default null" + "); ";
    int myBatchSize = 2;
    TimestampType currentTime = new TimestampType();
    Object[][] myData = { { 1, 1, 1, 11111111, "first", 1.10, 1.11, currentTime, geo, geopt }, { 2, 2, 2, 222222, "second", 3.30, null, currentTime, geo, geopt }, { 3, 3, 3, 333333, " third ", null, 3.33, currentTime, geo, geopt }, { 4, 4, 4, 444444, " NULL ", 4.40, 4.44, currentTime, geo, geopt }, { 5, 5, 5, 5555555, "abcdeg", 5.50, 5.55, currentTime, geo, geopt }, { 6, 6, null, 666666, "sixth", 6.60, 6.66, currentTime, geo, geopt }, { 7, 7, 7, 7777777, " seventh", 7.70, 7.77, currentTime, geo, geopt }, { 11, 1, 1, 1000, "first", 1.10, 1.11, currentTime, geo, geopt }, //empty line
    {}, //invalid lines below
    { 8, 8 }, { 9, 9, 9, 900, "nine", 1.10, 1.11, currentTime, geo, geopt }, { 10, 10, 10, 10, "second", 2.20, 2.22, currentTime, geo, geopt }, { 12, null, 12, 12121212, "twelveth", 12.12, 12.12, currentTime, geo, geopt } };
    Integer[] failures = { 9, 10 };
    ArrayList<Integer> expectedFailures = new ArrayList<Integer>(Arrays.asList(failures));
    test_Interface(mySchema, myData, myBatchSize, expectedFailures, 0);
}
Also used : ArrayList(java.util.ArrayList) TimestampType(org.voltdb.types.TimestampType)

Aggregations

TimestampType (org.voltdb.types.TimestampType)127 VoltTable (org.voltdb.VoltTable)37 BigDecimal (java.math.BigDecimal)30 Test (org.junit.Test)23 Client (org.voltdb.client.Client)19 ArrayList (java.util.ArrayList)16 IOException (java.io.IOException)11 GeographyValue (org.voltdb.types.GeographyValue)11 GeographyPointValue (org.voltdb.types.GeographyPointValue)10 Date (java.util.Date)9 File (java.io.File)7 VoltTableRow (org.voltdb.VoltTableRow)7 ProcCallException (org.voltdb.client.ProcCallException)7 ByteBuffer (java.nio.ByteBuffer)5 SimpleDateFormat (java.text.SimpleDateFormat)5 ColumnInfo (org.voltdb.VoltTable.ColumnInfo)5 ClientResponse (org.voltdb.client.ClientResponse)5 Random (java.util.Random)4 VoltType (org.voltdb.VoltType)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2