Пример #1
0
 public void setUpPartitionedTableWithName() {
   transportExecutor.exec(
       "create table parted (id int, name string, date timestamp) partitioned by (date)");
   transportExecutor.ensureGreen();
   transportExecutor.execBulk(
       "insert into parted (id, name, date) values (?, ?, ?)",
       new Object[][] {
         {1, "Trillian", null},
         {2, null, 0L},
         {3, "Ford", 1396388720242L}
       });
   transportExecutor.ensureGreen();
   transportExecutor.refresh("parted");
 }
Пример #2
0
 public void setUpArrayTables() {
   transportExecutor.exec(
       "create table any_table ("
           + "  id int primary key,"
           + "  temps array(double),"
           + "  names array(string),"
           + "  tags array(string)"
           + ") with (number_of_replicas=0)");
   transportExecutor.ensureGreen();
   SQLResponse response =
       transportExecutor.exec(
           "insert into any_table (id, temps, names, tags) values (?,?,?,?), (?,?,?,?), (?,?,?,?), (?,?,?,?)",
           1,
           Arrays.asList(0L, 0L, 0L),
           Arrays.asList("Dornbirn", "Berlin", "St. Margrethen"),
           Arrays.asList("cool"),
           2,
           Arrays.asList(0, 1, -1),
           Arrays.asList("Dornbirn", "Dornbirn", "Dornbirn"),
           Arrays.asList("cool", null),
           3,
           Arrays.asList(42, -42),
           Arrays.asList("Hangelsberg", "Berlin"),
           Arrays.asList("kuhl", "cool"),
           4,
           null,
           null,
           Arrays.asList("kuhl", null));
   assertThat(response.rowCount(), is(4L));
   transportExecutor.refresh("any_table");
 }
Пример #3
0
  public void setUpEmployees() {
    transportExecutor.exec(
        "create table employees ("
            + " name string, "
            + " department string,"
            + " hired timestamp, "
            + " age short,"
            + " income double, "
            + " good boolean"
            + ") with (number_of_replicas=0)");
    transportExecutor.ensureGreen();
    transportExecutor.exec(
        "insert into employees (name, department, hired, age, income, good) values (?, ?, ?, ?, ?, ?)",
        new Object[] {"dilbert", "engineering", "1985-01-01", 47, 4000.0, true});
    transportExecutor.exec(
        "insert into employees (name, department, hired, age, income, good) values (?, ?, ?, ?, ?, ?)",
        new Object[] {"wally", "engineering", "2000-01-01", 54, 6000.0, true});
    transportExecutor.exec(
        "insert into employees (name, department, hired, age, income, good) values (?, ?, ?, ?, ?, ?)",
        new Object[] {
          "pointy haired boss", "management", "2010-10-10", 45, Double.MAX_VALUE, false
        });

    transportExecutor.exec(
        "insert into employees (name, department, hired, age, income, good) values (?, ?, ?, ?, ?, ?)",
        new Object[] {"catbert", "HR", "1990-01-01", 12, 999999999.99, false});
    transportExecutor.exec(
        "insert into employees (name, department, income) values (?, ?, ?)",
        new Object[] {"ratbert", "HR", 0.50});
    transportExecutor.exec(
        "insert into employees (name, department, age) values (?, ?, ?)",
        new Object[] {"asok", "internship", 28});
    transportExecutor.refresh("employees");
  }
Пример #4
0
 public void createTestTableWithPrimaryKey() {
   transportExecutor.exec(
       "create table test ("
           + "  pk_col string primary key, "
           + "  message string"
           + ") with (number_of_replicas=0)");
   transportExecutor.ensureGreen();
 }
Пример #5
0
 public void setUpCharacters() {
   transportExecutor.exec(
       "create table characters (id int primary key, name string, female boolean, details object)");
   transportExecutor.ensureGreen();
   transportExecutor.execBulk(
       "insert into characters (id, name, female) values (?, ?, ?)",
       new Object[][] {
         new Object[] {1, "Arthur", false},
         new Object[] {2, "Ford", false},
         new Object[] {3, "Trillian", true},
         new Object[] {4, "Arthur", true}
       });
   transportExecutor.refresh("characters");
 }
Пример #6
0
 public void partitionTableSetup() {
   transportExecutor.exec(
       "create table parted ("
           + "id int primary key,"
           + "date timestamp primary key,"
           + "o object(ignored)"
           + ") partitioned by (date) with (number_of_replicas=0)");
   transportExecutor.ensureGreen();
   transportExecutor.exec("insert into parted (id, date) values (1, '2014-01-01')");
   transportExecutor.exec("insert into parted (id, date) values (2, '2014-01-01')");
   transportExecutor.exec("insert into parted (id, date) values (3, '2014-02-01')");
   transportExecutor.exec("insert into parted (id, date) values (4, '2014-02-01')");
   transportExecutor.exec("insert into parted (id, date) values (5, '2014-02-01')");
   transportExecutor.refresh("parted");
 }