Package com.alvazan.orm.api.z3api

Examples of com.alvazan.orm.api.z3api.NoSqlTypedSession


   
  }
 
  @Test
  public void testInnerJoinParts2() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Account as a WHERE a.isActive = false", 50);
   
    Cursor<IndexColumnInfo> cursor = result.getCursor();
    List<ViewInfo> views = result.getViews();
   
    ViewInfo viewAct = views.get(0);
View Full Code Here


    Assert.assertFalse(cursor.next());
  }
 
  @Test
  public void testInnerJoinParts2Backward() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Account as a WHERE a.isActive = false", 50);
   
    Cursor<IndexColumnInfo> cursor = result.getCursor();
    cursor.afterLast();
    List<ViewInfo> views = result.getViews();
   
View Full Code Here

    Assert.assertFalse(cursor.previous());
  }
 
  @Test
  public void testInnerJoinBackward() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Activity as e INNER JOIN e.account  as a WHERE e.numTimes < 15 and a.isActive = false", 50);
   
    Cursor<IndexColumnInfo> cursor = result.getCursor();
    cursor.afterLast();
    List<ViewInfo> views = result.getViews();
   
View Full Code Here

   * backward the second time because the of the cache.
   * @throws InterruptedException
   */
  @Test
  public void testInnerJoinBackwardRepeatedly() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Activity as e INNER JOIN e.account  as a WHERE e.numTimes < 15 and a.isActive = false", 50);
    List<ViewInfo> views = result.getViews();
    Cursor<IndexColumnInfo> cursor = result.getCursor();
    cursor.afterLast();
    //iterate all the way through to force everything to load once, then ensure things are still in the correct (reversed) order:
    while(cursor.previous()){cursor.getCurrent();}
View Full Code Here

//    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
//  }

  @Test
  public void testJoinViewButNoJoin() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Activity as e WHERE e.numTimes < 15", 50);
    List<ViewInfo> views = result.getViews();
    Assert.assertEquals(1, views.size());
    Cursor<IndexColumnInfo> cursor = result.getCursor();

    ViewInfo viewAct = views.get(0);
View Full Code Here

    Assert.assertEquals(expectedKey, key);
  }

  @Test
  public void testOuterJoin() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Activity as e LEFT JOIN e.account as a WHERE e.numTimes < 15 and a.isActive = false", 50);
    List<ViewInfo> views = result.getViews();
    Cursor<IndexColumnInfo> cursor = result.getCursor();

    ViewInfo viewAct = views.get(0);
    ViewInfo viewAcc = views.get(1);
View Full Code Here

   * This is setup to match postgres result we saw
   * @throws InterruptedException
   */
  @Test
  public void testOuterJoinWithNullClause() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();
   
    QueryResult result = s.createQueryCursor("select * FROM Activity as e LEFT JOIN e.account as a WHERE e.numTimes < 15 and (e.account = null or a.isActive = false)", 50);
    List<ViewInfo> views = result.getViews();
    Cursor<IndexColumnInfo> cursor = result.getCursor();

    ViewInfo viewAct = views.get(0);
    ViewInfo viewAcc = views.get(1);
View Full Code Here

import com.alvazan.orm.api.z8spi.meta.ViewInfo;

public class CmdSelect {

  void processSelect(String cmd, NoSqlEntityManager mgr) {
    NoSqlTypedSession s = mgr.getTypedSession();
    try {
      QueryResult result = s.createQueryCursor(cmd, 100);
      Cursor<List<TypedRow>> cursor = result.getAllViewsCursor();

      processBatch(cursor, result.getViews());
     
    } catch(ParseException e) {
View Full Code Here

  public void reindex(String cmd, NoSqlEntityManager mgr) {
    String oldCommand = cmd.substring(8);
    String command = oldCommand.trim();
    ColFamilyData data = parseData(mgr, command);
   
    NoSqlTypedSession s = mgr.getTypedSession();
    String cf = data.getColFamily();
    String field = data.getColumn();
    String by = data.getPartitionBy();
    String id = data.getPartitionId();
        DboTableMeta meta = data.getTableMeta();
        DboColumnMeta colMeta = data.getColumnMeta();
        if (!colMeta.isIndexed()) {
            // check if it was indexed earlier and now not indexed. If yes, then remove the indices.
            // Issue #120
            System.out.println("The column " + field + " is not indexed");
            ScanInfo info = ScanInfo.createScanInfo(colMeta, by, id);
            DboTableMeta indexTableMeta = mgr.find(DboTableMeta.class, info.getIndexColFamily());
            System.out.println("Wait...we are checking if it was indexed earlier and removing all its old indexes.");
            mgr.getSession().remove(indexTableMeta, info.getRowKey());
            s.flush();
            return;
        }

    Cursor<IndexPoint> indexView = s.indexView(cf, field, by, id);
    Cursor<IndexPoint> indexView2 = s.indexView(cf, field, by, id);
   
    System.out.println("indexed value type="+colMeta.getStorageType());
    System.out.println("row key type="+meta.getIdColumnMeta().getStorageType());
    System.out.println("It is safe to kill this process at any time since it only removes duplicates");
    System.out.println("Beginning re-index");
View Full Code Here

  public void processIndex(String cmd, NoSqlEntityManager mgr) {
    String oldCommand = cmd.substring(10);
    String command = oldCommand.trim();
   
    ColFamilyData data = parseData(mgr, command);
    NoSqlTypedSession s = mgr.getTypedSession();
   
    String cf = data.getColFamily();
    String field = data.getColumn();
    String by = data.getPartitionBy();
    String id = data.getPartitionId();

    Cursor<IndexPoint> indexView = s.indexView(cf, field, by, id);

    DboTableMeta meta = data.getTableMeta();
    DboColumnMeta colMeta = data.getColumnMeta();
    System.out.println("indexed value type="+colMeta.getStorageType());
    System.out.println("row key type="+meta.getIdColumnMeta().getStorageType());
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z3api.NoSqlTypedSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.