Package com.alvazan.orm.api.z8spi.meta

Examples of com.alvazan.orm.api.z8spi.meta.DboColumnMeta


    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    session.removeFromIndex(cf, indColFamily, rowKey, col);
  }
  public void addIndexPoint(IndexPoint pt, String partitionBy, String partitionId) {
    DboColumnMeta colMeta = pt.getColumnMeta();
    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
    byte[] rowKey = info.getRowKey();
    String indColFamily = info.getIndexColFamily();
    DboTableMeta cf = info.getEntityColFamily();
   
    IndexColumn col = new IndexColumn();
    if(colMeta != null)
      col.setColumnName(colMeta.getColumnName());
    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    col.setTtl(pt.getTtl());
    session.persistIndex(cf, indColFamily, rowKey, col);
  }
View Full Code Here


    if(keys == null)
      throw new IllegalArgumentException("keys list cannot be null");
    DboTableMeta meta = cachedMeta.getMeta(colFamily);
    if(meta == null)
      throw new IllegalArgumentException("Meta for columnfamily="+colFamily+" was not found");
    DboColumnMeta idMeta = meta.getIdColumnMeta();
    DirectCursor<byte[]> noSqlKeys = new TypedProxyWrappingCursor<Object>(idMeta, new IterableWrappingCursor<Object>(keys));
    return findAllImpl2(meta, keys, noSqlKeys, null, batchSize);
  }
View Full Code Here

  public Cursor<IndexPoint> indexView(String columnFamily, String column,
      String partitionBy, String partitionId) {
    DboTableMeta meta = cachedMeta.getMeta(columnFamily);
    if(meta == null)
      throw new IllegalArgumentException("columnFamily="+columnFamily+" not found");
    DboColumnMeta colMeta = meta.getColumnMeta(column);
    if (colMeta == null) {
      colMeta = meta.getIdColumnMeta();
      if (!(colMeta != null && colMeta.getColumnName().equals(column)))
        throw new IllegalArgumentException("Column=" + column
            + " not found on meta info for column family="
            + columnFamily);
    }
   
    if(!colMeta.isIndexed())
      throw new IllegalArgumentException("Column="+column+" is not an indexed column");
    else if(meta.getPartitionedColumns().size() > 1 && partitionBy == null)
      throw new IllegalArgumentException("Must supply partitionBy parameter BECAUSE this column family="+columnFamily+" is partitioned multiple ways");
   
    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
View Full Code Here

  public int count(String columnFamily, String indexedColName, Object value) {
    DboTableMeta meta = cachedMeta.getMeta(columnFamily);
    if(meta == null)
      throw new IllegalArgumentException("columnFamily="+columnFamily+" not found");
    DboColumnMeta colMeta = meta.getColumnMeta(indexedColName);
    if(colMeta == null)
      throw new IllegalArgumentException("Column="+indexedColName+" not found on meta info for column family="+columnFamily);
    else if(!colMeta.isIndexed())
      throw new IllegalArgumentException("Column="+indexedColName+" is not an indexed column");
    String query = "SELECT * FROM " +  columnFamily + " WHERE " + indexedColName + " = ";
    String valueString = new String();
    if (value != null) {
      if (value instanceof String)
View Full Code Here

  @Override
  public AbstractCursor<IndexColumn> scanIndex(ScanInfo scan, Key from,
      Key to, Integer batchSize, BatchListener l, MetaLookup mgr) {
    byte[] rowKey = scan.getRowKey();
    String indexTableName = scan.getIndexColFamily();
    DboColumnMeta colMeta = scan.getColumnName();
    DboTableMeta entityDbCollection = scan.getEntityColFamily();

        // Here we don't bother using an index at all since there is no where clause to begin with
        // ALSO, we don't want this code to be the case if we are doing a CursorToMany which has to
        // use an index so check the column type
View Full Code Here

  @Override
  public AbstractCursor<IndexColumn> scanIndex(ScanInfo scanInfo,
      List<byte[]> values, BatchListener list, MetaLookup mgr) {
    byte[] rowKey = scanInfo.getRowKey();
    String indexTableName = scanInfo.getIndexColFamily();
    DboColumnMeta colMeta = scanInfo.getColumnName();
    CursorForValues cursor = new CursorForValues(rowKey, list, indexTableName, values);
    cursor.setupMore(db, colMeta);
    return cursor;
  }
View Full Code Here

    ExpressionNode root = spiMeta.getASTTree();
    if(root == null) {
      ViewInfoImpl tableInfo = (ViewInfoImpl) spiMeta.getTargetViews().get(0);
      DboTableMeta tableMeta = tableInfo.getTableMeta();
      PartitionMeta partitionMeta = tableInfo.getPartition();
      DboColumnMeta partColMeta = null;
      if (partitionMeta != null)
        partColMeta = partitionMeta.getPartitionColumn();
      DboColumnMeta metaCol = tableMeta.getAnyIndex(indexedColumn, partColMeta);

      ScanInfo scanInfo = createScanInfo(tableInfo, metaCol);

      alreadyJoinedViews.add(tableInfo);
      AbstractCursor<IndexColumn> scan = session.scanIndex(scanInfo, null, null, batchSize);
View Full Code Here

  private ScanInfo createScanInfo(ViewInfoImpl tableInfo, DboColumnMeta metaCol) {
    PartitionMeta partitionMeta = tableInfo.getPartition();
    String partitionBy = null;
    String partitionId = null;
    if(partitionMeta != null) {
      DboColumnMeta colMeta = partitionMeta.getPartitionColumn();
      partitionBy = colMeta.getColumnName();
      byte[] partId = retrieveValue(colMeta, (ExpressionNode) partitionMeta.getNode());
      Object partIdObj = colMeta.convertFromStorage2(partId);
      partitionId = colMeta.convertTypeToString(partIdObj);
    }

    ScanInfo scanInfo = ScanInfo.createScanInfo(metaCol, partitionBy, partitionId);
    return scanInfo;
  }
View Full Code Here

    if(joinType == JoinType.INNER || joinType == JoinType.LEFT_OUTER) {
      //We need to proxy the right results to translate to the same primary key as the
      //left results and our And and Or Cursor can then take care of the rest
      JoinInfo joinInfo = root.getJoinMeta().getPrimaryJoinInfo();
      ViewInfoImpl newView = joinInfo.getPrimaryTable();
      DboColumnMeta col = joinInfo.getPrimaryCol();
      ScanInfo scanInfo = createScanInfo(newView, col);
      //FROM an ORM perspective, we join to smaller tables in general as we don't want to blow out memory so do the
      //join first(ie. we process left sides first in and and or cursors)
      CursorForJoin temp = new CursorForJoin(newView, leftView, leftResults, joinType);
      temp.setColMeta(col);
View Full Code Here

      attr = (StateAttribute) grandChild.getState();
    } else {
      attr = (StateAttribute) root.getChild(ChildSide.LEFT).getState();
    }
   
    DboColumnMeta info = attr.getColumnInfo();
    ViewInfoImpl viewInfo = attr.getViewInfo();   
    ScanInfo scanInfo = createScanInfo(viewInfo, info);
    alreadyJoinedViews.add(viewInfo);
   
    if(info.isIndexed()) {
      //its an indexed column
      return processIndexColumn(root, scanInfo, viewInfo, info);
    } else if (info.getOwner().getIdColumnMeta().getColumnName().equals(info.getColumnName())) {
      //its a non-indexed primary key
      return  processPrimaryKey(root, scanInfo, viewInfo, info);
    } else
      throw new IllegalArgumentException("You cannot have '"+info.getColumnName() + "' in your sql query since "+info.getColumnName()+" is neither a Primary Key nor a column with @Index annotation on the field in the entity");     
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.meta.DboColumnMeta

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.