ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [23/23] ignite git commit: ignite-sql-opt
Date Fri, 20 Nov 2015 05:49:33 GMT
ignite-sql-opt


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

Branch: refs/heads/ignite-sql-opt
Commit: d46109fc46107e9997bba105ad71511a1a8bd7f4
Parents: f939df4
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Nov 20 08:47:46 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Nov 20 08:48:35 2015 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    | 51 ++------------------
 .../query/GridQueryTypeDescriptor.java          |  2 -
 .../processors/query/h2/IgniteH2Indexing.java   | 14 +-----
 .../h2/GridIndexingSpiAbstractSelfTest.java     |  6 ---
 .../cache/IgniteSqlQueryBenchmark.java          |  5 +-
 5 files changed, 8 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d46109fc/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git 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
index 910bfb0..84db145 100644
--- 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
@@ -60,7 +60,6 @@ import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
 import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
 import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
-import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
@@ -79,7 +78,6 @@ import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.spi.indexing.IndexingQueryFilter;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
-import sun.misc.Unsafe;
 
 import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED;
 import static org.apache.ignite.internal.IgniteComponentType.INDEXING;
@@ -1541,7 +1539,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    public abstract static class Property {
+    private abstract static class Property {
         /**
          * Gets this property value from the given object.
          *
@@ -1563,12 +1561,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         public abstract Class<?> type();
     }
 
-    enum FieldType {
-        INT,
-        DOUBLE,
-        OBJ
-    }
-
     /**
      * Description of type property.
      */
@@ -1588,12 +1580,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         /** */
         private boolean key;
 
-        private static Unsafe unsafe = GridUnsafe.unsafe();
-
-        private long off;
-
-        private FieldType type;
-
         /**
          * Constructor.
          *
@@ -1609,21 +1595,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             ((AccessibleObject) member).setAccessible(true);
 
             field = member instanceof Field;
-
-            if (field) {
-                Field field0 = (Field) member;
-
-                Class<?> t = field0.getType();
-
-                if (t.equals(int.class))
-                    type = FieldType.INT;
-                else if (t.equals(double.class))
-                    type = FieldType.DOUBLE;
-                else
-                    type = FieldType.OBJ;
-
-                off = unsafe.objectFieldOffset(field0);
-            }
         }
 
         /** {@inheritDoc} */
@@ -1638,18 +1609,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
             try {
                 if (field) {
-                    switch (type) {
-                        case INT:
-                            return unsafe.getInt(x, off);
-                        case DOUBLE:
-                            return unsafe.getDouble(x, off);
-                        case OBJ:
-                            return unsafe.getObject(x, off);
-                    }
-                    return null;
-//                    Field field = (Field)member;
-//
-//                    return field.get(x);
+                    Field field = (Field)member;
+
+                    return field.get(x);
                 }
                 else {
                     Method mtd = (Method)member;
@@ -1845,11 +1807,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             return fields;
         }
 
-        @Override
-        public Property property(String name) {
-            return props.get(name);
-        }
-
         /** {@inheritDoc} */
         @SuppressWarnings("unchecked")
         @Override public <T> T value(String field, Object key, Object val) throws IgniteCheckedException
{

http://git-wip-us.apache.org/repos/asf/ignite/blob/d46109fc/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
index 3b16274..b05e1d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
@@ -38,8 +38,6 @@ public interface GridQueryTypeDescriptor {
      */
     public Map<String, Class<?>> fields();
 
-    public GridQueryProcessor.Property property(String name);
-
     /**
      * Gets field value for given key and value.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/d46109fc/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index f6ea9f6..4c07132 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -79,7 +79,6 @@ import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
 import org.apache.ignite.internal.processors.query.GridQueryFieldsResultAdapter;
 import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor;
 import org.apache.ignite.internal.processors.query.GridQueryIndexing;
-import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOffheap;
@@ -174,7 +173,7 @@ import static org.h2.result.SortOrder.DESCENDING;
 public class IgniteH2Indexing implements GridQueryIndexing {
     /** Default DB options. */
     private static final String DB_OPTIONS = ";LOCK_MODE=3;MULTI_THREADED=1;DB_CLOSE_ON_EXIT=FALSE"
+
-        ";DEFAULT_LOCK_TIMEOUT=10000;FUNCTIONS_IN_SCHEMA=true;OPTIMIZE_REUSE_RESULTS=0;QUERY_CACHE_SIZE=100;"
+
+        ";DEFAULT_LOCK_TIMEOUT=10000;FUNCTIONS_IN_SCHEMA=true;OPTIMIZE_REUSE_RESULTS=0;QUERY_CACHE_SIZE=0;"
+
         "RECOMPILE_ALWAYS=1;MAX_OPERATION_MEMORY=0";
 
     /** Field name for key. */
@@ -2111,9 +2110,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         /** */
         private final boolean preferSwapVal;
 
-        /** */
-        private final GridQueryProcessor.Property[] properties;
-
         /**
          * @param type Type descriptor.
          * @param schema Schema.
@@ -2144,11 +2140,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             valType = DataType.getTypeFromClass(type.valueClass());
 
             preferSwapVal = schema.ccfg.getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED;
-
-            properties = new GridQueryProcessor.Property[fields.length];
-
-            for (int i = 0; i < fields.length; i++)
-                properties[i] = type.property(fields[i]);
         }
 
         /** {@inheritDoc} */
@@ -2302,8 +2293,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         /** {@inheritDoc} */
         @Override public Object columnValue(Object key, Object val, int col) {
             try {
-                return properties[col].value(key, val);
-                //return type.value(fields[col], key, val);
+                return type.value(fields[col], key, val);
             }
             catch (IgniteCheckedException e) {
                 throw DbException.convert(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d46109fc/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index f635df7..acfe3b6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -34,7 +34,6 @@ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
 import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor;
 import org.apache.ignite.internal.processors.query.GridQueryIndexType;
-import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -505,11 +504,6 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
             return valFields;
         }
 
-        @Override
-        public GridQueryProcessor.Property property(String name) {
-            return null;
-        }
-
         /** {@inheritDoc} */
         @SuppressWarnings("unchecked")
         @Override public <T> T value(String field, Object key, Object val) throws IgniteSpiException
{

http://git-wip-us.apache.org/repos/asf/ignite/blob/d46109fc/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
index 4c0f670..8e31455 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
@@ -64,10 +64,9 @@ public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark<Intege
         for (Cache.Entry<Integer, Object> entry : entries) {
             Person p = (Person)entry.getValue();
 
-            if (p.getSalary() < salary || p.getSalary() > maxSalary) {
+            if (p.getSalary() < salary || p.getSalary() > maxSalary)
                 throw new Exception("Invalid person retrieved [min=" + salary + ", max="
+ maxSalary +
-                    ", person=" + p + ']');
-            }
+                        ", person=" + p + ']');
         }
 
         return true;


Mime
View raw message