Tabnine Logo
ViewIndex
Code IndexAdd Tabnine to your IDE (free)

How to use
ViewIndex
in
org.h2.index

Best Java code snippets using org.h2.index.ViewIndex (Showing top 20 results out of 315)

origin: com.h2database/h2

@Override
protected Cursor run() throws Exception {
  viewIndex.setupQueryParameters(viewIndex.getSession(), first, last, null);
  ArrayList<JoinBatch> joinBatches = batchUnion.joinBatches;
  for (int i = 0, size = joinBatches.size(); i < size; i++) {
    assert topFutureCursors[i] != null;
    joinBatches.get(i).viewTopFutureCursor = topFutureCursors[i];
  }
  ResultInterface localResult;
  boolean lazy = false;
  try {
    localResult = viewIndex.getQuery().query(0);
    lazy = localResult.isLazy();
  } finally {
    if (!lazy) {
      resetViewTopFutureCursorAfterQuery();
    }
  }
  return newCursor(localResult);
}
origin: com.h2database/h2

@Override
public PlanItem getBestPlanItem(Session session, int[] masks,
    TableFilter[] filters, int filter, SortOrder sortOrder,
    HashSet<Column> allColumnsSet) {
  final CacheKey cacheKey = new CacheKey(masks, this);
  Map<Object, ViewIndex> indexCache = session.getViewIndexCache(topQuery != null);
  ViewIndex i = indexCache.get(cacheKey);
  if (i == null || i.isExpired()) {
    i = new ViewIndex(this, index, session, masks, filters, filter, sortOrder);
    indexCache.put(cacheKey, i);
  }
  PlanItem item = new PlanItem();
  item.cost = i.getCost(session, masks, filters, filter, sortOrder, allColumnsSet);
  item.setIndex(i);
  return item;
}
origin: com.h2database/h2

initBaseIndex(view, 0, null, null, IndexType.createNonUnique(false));
this.view = view;
this.querySQL = index.querySQL;
columns = new Column[0];
if (!recursive) {
  query = getQuery(session, masks, filters, filter, sortOrder);
origin: com.h2database/h2

private Cursor find(Session session, SearchRow first, SearchRow last,
    SearchRow intersection) {
  if (recursive) {
    return findRecursive(first, last);
  }
  setupQueryParameters(session, first, last, intersection);
  ResultInterface result = query.query(0);
  return new ViewCursor(this, result, first, last);
}
origin: apache/ignite

/**
 * @param f Table filter.
 * @return Sub-query.
 */
private static Query getSubQuery(TableFilter f) {
  return ((ViewIndex)f.getIndex()).getQuery();
}
origin: com.h2database/com.springsource.org.h2

public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException {
  PlanItem item = new PlanItem();
  item.cost = index.getCost(session, masks);
  IntArray masksArray = new IntArray(masks == null ? new int[0] : masks);
  ViewIndex i2 = (ViewIndex) indexCache.get(masksArray);
  if (i2 == null || i2.getSession() != session) {
    i2 = new ViewIndex(this, index, session, masks);
    indexCache.put(masksArray, i2);
  }
  item.setIndex(i2);
  return item;
}
origin: com.h2database/h2

@Override
public final boolean addSearchRows(SearchRow first, SearchRow last) {
  resetAfterFind();
  viewIndex.setupQueryParameters(viewIndex.getSession(), first, last, null);
  R r;
  if (resultSize < result.size()) {
    // get reused runner
    r = queryRunner(resultSize);
  } else {
    // create new runner
    result.add(r = newQueryRunner());
  }
  r.first = first;
  r.last = last;
  if (!collectSearchRows(r)) {
    r.clear();
    return false;
  }
  resultSize++;
  return true;
}
origin: com.h2database/h2

boolean res = result.next();
if (!res) {
  if (index.isRecursive()) {
    result.reset();
  } else {
  comp = index.compareRows(current, first);
  if (comp < 0) {
    continue;
  comp = index.compareRows(current, last);
  if (comp > 0) {
    continue;
origin: com.h2database/h2

private synchronized void init(String querySQL, ArrayList<Parameter> params,
    Column[] columnTemplates, Session session, boolean allowRecursive, boolean literalsChecked,
    boolean isTableExpression, boolean isPersistent) {
  this.querySQL = querySQL;
  this.columnTemplates = columnTemplates;
  this.allowRecursive = allowRecursive;
  this.isRecursiveQueryDetected = false;
  this.isTableExpression = isTableExpression;
  this.isPersistent = isPersistent;
  index = new ViewIndex(this, querySQL, params, allowRecursive);
  initColumnsAndTables(session, literalsChecked);
}
origin: com.h2database/h2

/**
 * Constructor for the original index in {@link TableView}.
 *
 * @param view the table view
 * @param querySQL the query SQL
 * @param originalParameters the original parameters
 * @param recursive if the view is recursive
 */
public ViewIndex(TableView view, String querySQL,
    ArrayList<Parameter> originalParameters, boolean recursive) {
  initBaseIndex(view, 0, null, null, IndexType.createNonUnique(false));
  this.view = view;
  this.querySQL = querySQL;
  this.originalParameters = originalParameters;
  this.recursive = recursive;
  columns = new Column[0];
  this.createSession = null;
  this.indexMasks = null;
  // this is a main index of TableView, it does not need eviction time
  // stamp
  evaluatedAt = Long.MIN_VALUE;
}
origin: com.h2database/h2

  cols[i] = columnTemplates[i].getClone();
index.setRecursive(true);
createException = null;
origin: com.h2database/h2

@Override
public Cursor find(Session session, SearchRow first, SearchRow last) {
  return find(session, first, last, null);
}
origin: com.h2database/h2

public ViewCursor(ViewIndex index, ResultInterface result, SearchRow first,
    SearchRow last) {
  this.table = index.getTable();
  this.index = index;
  this.result = result;
  this.first = first;
  this.last = last;
}
origin: com.h2database/h2

boolean initialize() {
  return collectJoinBatches(viewIndex.getQuery()) && joinBatches != null;
}
origin: org.wowtools/h2

@Override
public final boolean addSearchRows(SearchRow first, SearchRow last) {
  resetAfterFind();
  viewIndex.setupQueryParameters(viewIndex.getSession(), first, last, null);
  R r;
  if (resultSize < result.size()) {
    // get reused runner
    r = queryRunner(resultSize);
  } else {
    // create new runner
    result.add(r = newQueryRunner());
  }
  r.first = first;
  r.last = last;
  if (!collectSearchRows(r)) {
    r.clear();
    return false;
  }
  resultSize++;
  return true;
}
origin: org.wowtools/h2

private Cursor find(Session session, SearchRow first, SearchRow last,
    SearchRow intersection) {
  if (recursive) {
    return findRecursive(first, last);
  }
  setupQueryParameters(session, first, last, intersection);
  LocalResult result = query.query(0);
  return new ViewCursor(this, result, first, last);
}
origin: org.wowtools/h2

boolean res = result.next();
if (!res) {
  if (index.isRecursive()) {
    result.reset();
  } else {
  comp = index.compareRows(current, first);
  if (comp < 0) {
    continue;
  comp = index.compareRows(current, last);
  if (comp > 0) {
    continue;
origin: com.eventsourcing/h2

private synchronized void init(String querySQL, ArrayList<Parameter> params,
    Column[] columnTemplates, Session session, boolean recursive) {
  this.querySQL = querySQL;
  this.columnTemplates = columnTemplates;
  this.recursive = recursive;
  index = new ViewIndex(this, querySQL, params, recursive);
  initColumnsAndTables(session);
}
origin: com.h2database/com.springsource.org.h2

public ViewIndex(TableView view, String querySQL, ObjectArray originalParameters, boolean recursive) {
  initBaseIndex(view, 0, null, null, IndexType.createNonUnique(false));
  this.querySQL = querySQL;
  this.originalParameters = originalParameters;
  this.recursive = recursive;
  columns = new Column[0];
}
origin: org.wowtools/h2

  cols[i] = columnTemplates[i].getClone();
index.setRecursive(true);
createException = null;
org.h2.indexViewIndex

Javadoc

This object represents a virtual index for a query. Actually it only represents a prepared SELECT statement.

Most used methods

  • getQuery
  • <init>
    Constructor for plan item generation. Over this index the query will be executed.
  • getCost
  • getSession
  • initBaseIndex
  • setRecursive
  • compareRows
  • find
  • findRecursive
  • getTable
  • isExpired
  • isRecursive
  • isExpired,
  • isRecursive,
  • prepareSubQuery,
  • setParameter,
  • setupQueryParameters

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now