ignite-sql-tests - rename
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/48ce2a80 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/48ce2a80 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/48ce2a80 Branch: refs/heads/ignite-sql-tests Commit: 48ce2a808be35381b218a8b41fcec5deb31c3636 Parents: 0a084f6 Author: S.Vladykin <svlady...@gridgain.com> Authored: Mon Mar 2 16:50:22 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Mon Mar 2 16:50:22 2015 +0300 ---------------------------------------------------------------------- modules/codegen/pom.xml | 6 + .../query/h2/twostep/GridMapQueryExecutor.java | 8 +- .../query/h2/twostep/GridMergeIndex.java | 4 +- .../h2/twostep/GridMergeIndexUnsorted.java | 5 + .../h2/twostep/GridReduceQueryExecutor.java | 8 +- .../query/h2/twostep/GridResultPage.java | 6 +- .../twostep/messages/GridNextPageRequest.java | 77 -------- .../twostep/messages/GridNextPageResponse.java | 194 ------------------ .../messages/GridQueryNextPageRequest.java | 77 ++++++++ .../messages/GridQueryNextPageResponse.java | 195 +++++++++++++++++++ 10 files changed, 295 insertions(+), 285 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/codegen/pom.xml ---------------------------------------------------------------------- diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml index 5b9e1db..2071972 100644 --- a/modules/codegen/pom.xml +++ b/modules/codegen/pom.xml @@ -46,5 +46,11 @@ <artifactId>ignite-core</artifactId> <version>${ignite.version}</version> </dependency> + + <dependency> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-indexing</artifactId> + <version>${ignite.version}</version> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java index 24918da..8b09b16 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java @@ -96,8 +96,8 @@ public class GridMapQueryExecutor { if (msg instanceof GridQueryRequest) executeLocalQuery(node, (GridQueryRequest)msg); - else if (msg instanceof GridNextPageRequest) - sendNextPage(node, (GridNextPageRequest)msg); + else if (msg instanceof GridQueryNextPageRequest) + sendNextPage(node, (GridQueryNextPageRequest)msg); else processed = false; @@ -212,7 +212,7 @@ public class GridMapQueryExecutor { * @param node Node. * @param req Request. */ - private void sendNextPage(ClusterNode node, GridNextPageRequest req) { + private void sendNextPage(ClusterNode node, GridQueryNextPageRequest req) { ConcurrentMap<Long, QueryResults> nodeRess = qryRess.get(node.id()); QueryResults qr = nodeRess == null ? null : nodeRess.get(req.queryRequestId()); @@ -258,7 +258,7 @@ public class GridMapQueryExecutor { try { ctx.io().sendUserMessage(F.asList(node), - new GridNextPageResponse(qr.qryReqId, qry, page, allRows, last, rows), + new GridQueryNextPageResponse(qr.qryReqId, qry, page, allRows, last, rows), GridTopic.TOPIC_QUERY, false, 0); } catch (IgniteCheckedException e) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java index 1c93c5d..71cc151 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java @@ -131,9 +131,7 @@ public abstract class GridMergeIndex extends BaseIndex { * @param last Last row. * @return Cursor. */ - protected Cursor findAllFetched(List<Row> fetched, @Nullable SearchRow first, @Nullable SearchRow last) { - return new IteratorCursor(fetched.iterator()); - } + protected abstract Cursor findAllFetched(List<Row> fetched, @Nullable SearchRow first, @Nullable SearchRow last); /** {@inheritDoc} */ @Override public void checkRename() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java index 6c11a3a..81ba6c7 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java @@ -48,6 +48,11 @@ public class GridMergeIndexUnsorted extends GridMergeIndex { } /** {@inheritDoc} */ + @Override protected Cursor findAllFetched(List<Row> fetched, @Nullable SearchRow first, @Nullable SearchRow last) { + return new IteratorCursor(fetched.iterator()); + } + + /** {@inheritDoc} */ @Override protected Cursor findInStream(@Nullable SearchRow first, @Nullable SearchRow last) { return new FetchingCursor(new Iterator<Row>() { /** */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java index 4e93f17..9aec279 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java @@ -77,8 +77,8 @@ public class GridReduceQueryExecutor { boolean processed = true; - if (msg instanceof GridNextPageResponse) - onNextPage(node, (GridNextPageResponse)msg); + if (msg instanceof GridQueryNextPageResponse) + onNextPage(node, (GridQueryNextPageResponse)msg); else if (msg instanceof GridQueryFailResponse) onFail(node, (GridQueryFailResponse)msg); else @@ -115,7 +115,7 @@ public class GridReduceQueryExecutor { * @param node Node. * @param msg Message. */ - private void onNextPage(final ClusterNode node, GridNextPageResponse msg) { + private void onNextPage(final ClusterNode node, GridQueryNextPageResponse msg) { final long qryReqId = msg.queryRequestId(); final int qry = msg.query(); final int pageSize = msg.rows().size(); @@ -139,7 +139,7 @@ public class GridReduceQueryExecutor { return; // No-op if this message known to be the last. try { - ctx.io().sendUserMessage(F.asList(node), new GridNextPageRequest(qryReqId, qry, pageSize), + ctx.io().sendUserMessage(F.asList(node), new GridQueryNextPageRequest(qryReqId, qry, pageSize), GridTopic.TOPIC_QUERY, false, 0); } catch (IgniteCheckedException e) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java index 164effc..a7b3d6f 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java @@ -28,13 +28,13 @@ public class GridResultPage<Z> { private final Z src; /** */ - protected final GridNextPageResponse res; + protected final GridQueryNextPageResponse res; /** * @param src Source. * @param res Response. */ - protected GridResultPage(Z src, GridNextPageResponse res) { + protected GridResultPage(Z src, GridQueryNextPageResponse res) { this.src = src; this.res = res; } @@ -49,7 +49,7 @@ public class GridResultPage<Z> { /** * @return Response. */ - public GridNextPageResponse response() { + public GridQueryNextPageResponse response() { return res; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageRequest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageRequest.java deleted file mode 100644 index a164875..0000000 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageRequest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.query.h2.twostep.messages; - - -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.io.*; - -/** - * Request to fetch next page. - */ -public class GridNextPageRequest implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private long qryReqId; - - /** */ - private int qry; - - /** */ - private int pageSize; - - /** - * @param qryReqId Query request ID. - * @param qry Query. - * @param pageSize Page size. - */ - public GridNextPageRequest(long qryReqId, int qry, int pageSize) { - this.qryReqId = qryReqId; - this.qry = qry; - this.pageSize = pageSize; - } - - /** - * @return Query request ID. - */ - public long queryRequestId() { - return qryReqId; - } - - /** - * @return Query. - */ - public int query() { - return qry; - } - - /** - * @return Page size. - */ - public int pageSize() { - return pageSize; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridNextPageRequest.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageResponse.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageResponse.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageResponse.java deleted file mode 100644 index 55f8ebb..0000000 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridNextPageResponse.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.query.h2.twostep.messages; - -import org.apache.ignite.internal.util.typedef.internal.*; -import org.h2.store.*; -import org.h2.value.*; - -import java.io.*; -import java.util.*; - -/** - * Next page response. - */ -public class GridNextPageResponse implements Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private long qryReqId; - - /** */ - private int qry; - - /** */ - private int page; - - /** */ - private int allRows; - - /** */ - private Collection<Value[]> rows; - - /** */ - private boolean last; - - /** - * For {@link Externalizable}. - */ - public GridNextPageResponse() { - // No-op. - } - - /** - * @param qryReqId Query request ID. - * @param qry Query. - * @param page Page. - * @param allRows All rows count. - * @param last Last row. - * @param rows Rows. - */ - public GridNextPageResponse(long qryReqId, int qry, int page, int allRows, boolean last, Collection<Value[]> rows) { - assert rows != null; - - this.qryReqId = qryReqId; - this.qry = qry; - this.page = page; - this.allRows = allRows; - this.last = last; - this.rows = rows; - } - - /** - * @return Query request ID. - */ - public long queryRequestId() { - return qryReqId; - } - - /** - * @return Query. - */ - public int query() { - return qry; - } - - /** - * @return Page. - */ - public int page() { - return page; - } - - /** - * @return All rows. - */ - public int allRows() { - return allRows; - } - - /** - * @return {@code true} If this is the last page. - */ - public boolean isLast() { - return last; - } - - /** - * @return Rows. - */ - public Collection<Value[]> rows() { - return rows; - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeLong(qryReqId); - out.writeInt(qry); - out.writeInt(page); - out.writeBoolean(last); - out.writeInt(allRows); - - out.writeInt(rows.size()); - - if (rows.isEmpty()) - return; - - Data data = Data.create(null, 512); - - boolean first = true; - - for (Value[] row : rows) { - if (first) { - out.writeInt(row.length); - - first = false; - } - - for (Value val : row) { - data.checkCapacity(data.getValueLen(val)); - - data.writeValue(val); - } - } - - out.writeInt(data.length()); - out.write(data.getBytes(), 0, data.length()); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - qryReqId = in.readLong(); - qry = in.readInt(); - page = in.readInt(); - last = in.readBoolean(); - allRows = in.readInt(); - - int rowCnt = in.readInt(); - - if (rowCnt == 0) - rows = Collections.emptyList(); - else { - rows = new ArrayList<>(rowCnt); - - int cols = in.readInt(); - int dataSize = in.readInt(); - - byte[] dataBytes = new byte[dataSize]; - - in.readFully(dataBytes); - - Data data = Data.create(null, dataBytes); - - for (int r = 0; r < rowCnt; r++) { - Value[] row = new Value[cols]; - - for (int c = 0; c < cols; c++) - row[c] = data.readValue(); - - rows.add(row); - } - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridNextPageResponse.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java new file mode 100644 index 0000000..ae7e1e3 --- /dev/null +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageRequest.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.query.h2.twostep.messages; + + +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.io.*; + +/** + * Request to fetch next page. + */ +public class GridQueryNextPageRequest implements Serializable { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private long qryReqId; + + /** */ + private int qry; + + /** */ + private int pageSize; + + /** + * @param qryReqId Query request ID. + * @param qry Query. + * @param pageSize Page size. + */ + public GridQueryNextPageRequest(long qryReqId, int qry, int pageSize) { + this.qryReqId = qryReqId; + this.qry = qry; + this.pageSize = pageSize; + } + + /** + * @return Query request ID. + */ + public long queryRequestId() { + return qryReqId; + } + + /** + * @return Query. + */ + public int query() { + return qry; + } + + /** + * @return Page size. + */ + public int pageSize() { + return pageSize; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridQueryNextPageRequest.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48ce2a80/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java new file mode 100644 index 0000000..6ea8d08 --- /dev/null +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java @@ -0,0 +1,195 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.query.h2.twostep.messages; + +import org.apache.ignite.internal.util.typedef.internal.*; +import org.h2.store.*; +import org.h2.value.*; + +import java.io.*; +import java.util.*; + +/** + * Next page response. + */ +public class GridQueryNextPageResponse implements Externalizable { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private long qryReqId; + + /** */ + private int qry; + + /** */ + private int page; + + /** */ + private int allRows; + + /** */ + private Collection<Value[]> rows; + + /** */ + private boolean last; + + /** + * For {@link Externalizable}. + */ + public GridQueryNextPageResponse() { + // No-op. + } + + /** + * @param qryReqId Query request ID. + * @param qry Query. + * @param page Page. + * @param allRows All rows count. + * @param last Last row. + * @param rows Rows. + */ + public GridQueryNextPageResponse(long qryReqId, int qry, int page, int allRows, boolean last, + Collection<Value[]> rows) { + assert rows != null; + + this.qryReqId = qryReqId; + this.qry = qry; + this.page = page; + this.allRows = allRows; + this.last = last; + this.rows = rows; + } + + /** + * @return Query request ID. + */ + public long queryRequestId() { + return qryReqId; + } + + /** + * @return Query. + */ + public int query() { + return qry; + } + + /** + * @return Page. + */ + public int page() { + return page; + } + + /** + * @return All rows. + */ + public int allRows() { + return allRows; + } + + /** + * @return {@code true} If this is the last page. + */ + public boolean isLast() { + return last; + } + + /** + * @return Rows. + */ + public Collection<Value[]> rows() { + return rows; + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + out.writeLong(qryReqId); + out.writeInt(qry); + out.writeInt(page); + out.writeBoolean(last); + out.writeInt(allRows); + + out.writeInt(rows.size()); + + if (rows.isEmpty()) + return; + + Data data = Data.create(null, 512); + + boolean first = true; + + for (Value[] row : rows) { + if (first) { + out.writeInt(row.length); + + first = false; + } + + for (Value val : row) { + data.checkCapacity(data.getValueLen(val)); + + data.writeValue(val); + } + } + + out.writeInt(data.length()); + out.write(data.getBytes(), 0, data.length()); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + qryReqId = in.readLong(); + qry = in.readInt(); + page = in.readInt(); + last = in.readBoolean(); + allRows = in.readInt(); + + int rowCnt = in.readInt(); + + if (rowCnt == 0) + rows = Collections.emptyList(); + else { + rows = new ArrayList<>(rowCnt); + + int cols = in.readInt(); + int dataSize = in.readInt(); + + byte[] dataBytes = new byte[dataSize]; + + in.readFully(dataBytes); + + Data data = Data.create(null, dataBytes); + + for (int r = 0; r < rowCnt; r++) { + Value[] row = new Value[cols]; + + for (int c = 0; c < cols; c++) + row[c] = data.readValue(); + + rows.add(row); + } + } + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridQueryNextPageResponse.class, this); + } +}