You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/03/13 10:28:18 UTC

[44/50] [abbrv] ignite git commit: Merge branch 'ignite-2.0' into ignite-2.0-merge

Merge branch 'ignite-2.0' into ignite-2.0-merge

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a6b077a7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a6b077a7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a6b077a7

Branch: refs/heads/ignite-4565-ddl
Commit: a6b077a782a72e45d59810c7449f0dd4a01a8169
Parents: e18fcda 86fad98
Author: devozerov <vo...@gridgain.com>
Authored: Fri Mar 10 17:33:20 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Mar 10 17:33:20 2017 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    | 31 +++++---------------
 1 file changed, 8 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b077a7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index f107386,8223fef..cc91f43
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@@ -648,14 -642,20 +648,13 @@@ public class GridQueryProcessor extend
                  INDEXING.module() + " to classpath or moving it from 'optional' to 'libs' folder).");
      }
  
- 
      /**
 -     * @param space Space.
 -     * @param clause Clause.
 -     * @param params Parameters collection.
 -     * @param resType Result type.
 -     * @param filters Filters.
 -     * @return Key/value rows.
 -     * @throws IgniteCheckedException If failed.
 +     * @param cctx Cache context.
 +     * @param qry Query.
 +     * @return Cursor.
       */
 -    @SuppressWarnings("unchecked")
 -    public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> query(final String space, final String clause,
 -        final Collection<Object> params, final String resType, final IndexingQueryFilter filters)
 -        throws IgniteCheckedException {
 -        checkEnabled();
 +    public QueryCursor<List<?>> queryTwoStep(final GridCacheContext<?,?> cctx, final SqlFieldsQuery qry) {
 +        checkxEnabled();
  
          if (!busyLock.enterBusy())
              throw new IllegalStateException("Failed to execute query (grid is stopping).");
@@@ -748,25 -745,48 +747,19 @@@
  
          try {
              return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx,
 -                new IgniteOutClosureX<Iterator<Cache.Entry<K, V>>>() {
 -                    @Override public Iterator<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
 -                        String space = cctx.name();
 +                new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
 +                    @Override public QueryCursor<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
                          String type = qry.getType();
 -                        String sqlQry = qry.getSql();
 -                        Object[] params = qry.getArgs();
  
-                         QueryTypeDescriptorImpl typeDesc = typesByName.get(
-                             new QueryTypeNameKey(
-                                 cctx.name(),
-                                 type));
- 
-                         if (typeDesc == null || !typeDesc.registered())
-                             throw new CacheException("Failed to find SQL table for type: " + type);
 -                        QueryTypeDescriptorImpl typeDesc = type(space, type);
++                        QueryTypeDescriptorImpl typeDesc = type(cctx.name(), type);
  
 -                        final GridCloseableIterator<IgniteBiTuple<K, V>> i = idx.queryLocalSql(
 -                            space,
 -                            qry.getSql(),
 -                            qry.getAlias(),
 -                            F.asList(params),
 -                            typeDesc,
 -                            idx.backupFilter(requestTopVer.get(), null));
 +                        qry.setType(typeDesc.name());
  
                          sendQueryExecutedEvent(
 -                            sqlQry,
 -                            params);
 -
 -                        return new ClIter<Cache.Entry<K, V>>() {
 -                            @Override public void close() throws Exception {
 -                                i.close();
 -                            }
 -
 -                            @Override public boolean hasNext() {
 -                                return i.hasNext();
 -                            }
 -
 -                            @Override public Cache.Entry<K, V> next() {
 -                                IgniteBiTuple<K, V> t = i.next();
 -
 -                                return new CacheEntryImpl<>(
 -                                    (K)cctx.unwrapBinaryIfNeeded(t.getKey(), keepBinary, false),
 -                                    (V)cctx.unwrapBinaryIfNeeded(t.getValue(), keepBinary, false));
 -                            }
 -
 -                            @Override public void remove() {
 -                                throw new UnsupportedOperationException();
 -                            }
 -                        };
 +                            qry.getSql(),
 +                            qry.getArgs());
 +
 +                        return idx.queryLocalSql(cctx, qry, idx.backupFilter(requestTopVer.get(), null), keepBinary);
                      }
                  }, true);
          }