# IGNITE-540 Revert changes in generateColumnsFromQuery().

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

Branch: refs/heads/ignite-639
Commit: e1db4076f1719364a8498d7e6f6a52d13a454443
Parents: 39ee717
Author: sevdokimov <sevdoki...@gridgain.com>
Authored: Mon Apr 6 14:59:26 2015 +0300
Committer: sevdokimov <sevdoki...@gridgain.com>
Committed: Mon Apr 6 14:59:26 2015 +0300

----------------------------------------------------------------------
 .../h2/twostep/GridReduceQueryExecutor.java     | 29 ++++++++------------
 1 file changed, 12 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1db4076/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 acdc1bf..02c7c55 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
@@ -445,25 +445,20 @@ public class GridReduceQueryExecutor implements 
GridMessageListener {
             String name = expr.getAlias();
             long precision = expr.getPrecision();
             int displaySize = expr.getDisplaySize();
+            DataType dt = DataType.getDataType(type);
+            if (precision > 0 && (dt.defaultPrecision == 0 ||
+                (dt.defaultPrecision > precision && dt.defaultPrecision < 
Byte.MAX_VALUE))) {
+                // dont' set precision to MAX_VALUE if this is the default
+                precision = dt.defaultPrecision;
+            }
             int scale = expr.getScale();
-
-            if (type != Value.UNKNOWN) {
-                DataType dt = DataType.getDataType(type);
-
-                if (precision > 0 && (dt.defaultPrecision == 0 ||
-                    (dt.defaultPrecision > precision && dt.defaultPrecision < 
Byte.MAX_VALUE))) {
-                    // dont' set precision to MAX_VALUE if this is the default
-                    precision = dt.defaultPrecision;
-                }
-
-                if (scale > 0 && (dt.defaultScale == 0 ||
-                    (dt.defaultScale > scale && dt.defaultScale < precision)))
-                    scale = dt.defaultScale;
-
-                if (scale > precision)
-                    precision = scale;
+            if (scale > 0 && (dt.defaultScale == 0 ||
+                (dt.defaultScale > scale && dt.defaultScale < precision))) {
+                scale = dt.defaultScale;
+            }
+            if (scale > precision) {
+                precision = scale;
             }
-
             Column col = new Column(name, type, precision, scale, displaySize);
             cols.add(col);
         }

Reply via email to