public QueryRecordExecutor(Cluster cluster, QueryPolicy policy, Statement statement, Node node) throws AerospikeException { super(cluster, policy, statement, node); this.recordSet = new RecordSet(this, policy.recordQueueSize); statement.prepare(true); initializeThreads(); }
protected final void initializeThreads() { // Detect cluster migrations when performing scan. long clusterKey = policy.failOnClusterChange ? QueryValidate.validateBegin(nodes[0], statement.namespace) : 0; boolean first = true; // Initialize threads. for (int i = 0; i < nodes.length; i++) { MultiCommand command = createCommand(clusterKey, first); threads[i] = new QueryThread(nodes[i], command); first = false; } }
@Override protected void parseRow(Key key) throws IOException { Record record = parseRecord(); if (! valid) { throw new AerospikeException.QueryTerminated(); } if (! recordSet.put(new KeyRecord(key, record))) { stop(); throw new AerospikeException.QueryTerminated(); } } }
@Override public void close() { resultSet.close(); } }
/** * Create 64 bit integer "=" operation predicate. */ public static PredExp integerEqual() { return new Op(INTEGER_EQUAL); }
/** * Create string bin predicate. */ public static PredExp stringBin(String name) { return new StringValue(name, STRING_BIN); }
/** * Create "and" expression. * * @param nexp number of expressions to perform "and" operation. Usually two. */ public static PredExp and(int nexp) { return new AndOr(AND, nexp); }
/** * Write predicate expressions to write protocol. * For internal use only. */ public static int write(PredExp[] predExp, byte[] buf, int offset) { for (PredExp pred : predExp) { offset = pred.write(buf, offset); } return offset; }
/** * Provide Iterator for RecordSet. */ @Override public Iterator<KeyRecord> iterator() { return new RecordSetIterator(this); }
@Override protected void parseRow(Key key) throws IOException { Record record = parseRecord(); if (! valid) { throw new AerospikeException.QueryTerminated(); } if (! recordSet.put(new KeyRecord(key, record))) { stop(); throw new AerospikeException.QueryTerminated(); } } }
public QueryRecordExecutor(Cluster cluster, QueryPolicy policy, Statement statement, Node node) throws AerospikeException { super(cluster, policy, statement, node); this.recordSet = new RecordSet(this, policy.recordQueueSize); statement.prepare(true); initializeThreads(); }
protected final void initializeThreads() { // Detect cluster migrations when performing scan. long clusterKey = policy.failOnClusterChange ? QueryValidate.validateBegin(nodes[0], statement.namespace) : 0; boolean first = true; // Initialize threads. for (int i = 0; i < nodes.length; i++) { MultiCommand command = createCommand(clusterKey, first); threads[i] = new QueryThread(nodes[i], command); first = false; } }
/** * Create 64 bit integer ">" operation predicate. */ public static PredExp integerGreater() { return new Op(INTEGER_GREATER); }
/** * Create geospatial bin predicate. */ public static PredExp geoJSONBin(String name) { return new StringValue(name, GEOJSON_BIN); }
/** * Create 64 bit integer "<" operation predicate. */ public static PredExp integerLess() { return new Op(INTEGER_LESS); }
/** * Create list bin predicate. */ public static PredExp listBin(String name) { return new StringValue(name, LIST_BIN); }
/** * Create 64 bit integer "!=" operation predicate. */ public static PredExp integerUnequal() { return new Op(INTEGER_UNEQUAL); }
/** * Create string variable used in list/map iterations. */ public static PredExp stringVar(String name) { return new StringValue(name, STRING_VAR); }
/** * Create geospatial json "contains" predicate. */ public static PredExp geoJSONContains() { return new Op(GEOJSON_CONTAINS); }