[teiid-commits] teiid SVN: r3711 - in trunk: documentation/admin-guide/src/main/docbook/en-US/content and 3 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Wed Nov 30 21:03:44 EST 2011
Author: shawkins
Date: 2011-11-30 21:03:44 -0500 (Wed, 30 Nov 2011)
New Revision: 3711
Modified:
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml
trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
Log:
TEIID-1600 allowing backward compatibility to work with avg as well
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-11-30 22:17:23 UTC (rev 3710)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-12-01 02:03:44 UTC (rev 3711)
@@ -41,8 +41,8 @@
<li>7.x or earlier VDBs with table cardinalities set the old unknown value 0 will now report that value as -1 via the metadata API or SYS.TABLES.
<li>Exact fixed point literals, e.g. 1.0, are now parsed as decimal/BigDecimal values as per the ANSI specification, rather than as double values.
Also the AVG aggregate function will return an exact numeric (BigDecimal) value for integral types rather than returning a double value.
- Views that were projecting doubles from exact numeric literals or using AVG will need to be updated. There is also a new system property org.teiid.parseDecimalAsDouble to
- enable the pre-8.0 parsing of exact fixed point literals as doubles. The BigDecimal form of the AVG function now uses the same precision and scale logic as the division system function, rather than using a
+ Views that were projecting doubles from exact numeric literals or using AVG will need to be updated. There is also a new system property org.teiid.decimalAsDouble to
+ enable the pre-8.0 behavior. The BigDecimal form of the AVG function now uses the same precision and scale logic as the division system function, rather than using a
fixed scale of 9.
<li>BigDecimal division that returns a quotient that is equal to zero will have a scale of zero as well. Prior releases would typically return a zero value with a scale of 16.
</ul>
Modified: trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml
===================================================================
--- trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml 2011-11-30 22:17:23 UTC (rev 3710)
+++ trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml 2011-12-01 02:03:44 UTC (rev 3711)
@@ -41,8 +41,8 @@
</para>
</listitem>
<listitem>
- <para><emphasis>org.teiid.parseDecimalAsDouble</emphasis> - defaults to false.
- Set to true to parse exact fixed point literals, e.g. 1.0, as double values rather than as decimal/BigDecimal values in the same way as releases earlier than 8.0.
+ <para><emphasis>org.teiid.decimalAsDouble</emphasis> - defaults to false.
+ Set to true to parse exact fixed point literals, e.g. 1.0, as double values rather than as decimal/BigDecimal values and to return a double value from the AVG function for integral values in the same way as releases earlier than 8.0.
</para>
</listitem>
</itemizedlist>
Modified: trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java 2011-11-30 22:17:23 UTC (rev 3710)
+++ trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java 2011-12-01 02:03:44 UTC (rev 3711)
@@ -50,7 +50,7 @@
public class SQLParserUtil {
- public static final boolean PARSE_DECIMAL_AS_DOUBLE = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.parseDecimalAsDouble", false); //$NON-NLS-1$
+ public static final boolean DECIMAL_AS_DOUBLE = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.decimalAsDouble", false); //$NON-NLS-1$
String matchesAny(String arg, String ... expected) {
for (String string : expected) {
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2011-11-30 22:17:23 UTC (rev 3710)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2011-12-01 02:03:44 UTC (rev 3711)
@@ -29,6 +29,7 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.HashCodeUtil;
+import org.teiid.query.parser.SQLParserUtil;
import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.lang.OrderBy;
@@ -90,10 +91,10 @@
SUM_TYPES.put(DataTypeManager.DefaultDataClasses.BIG_DECIMAL, DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
AVG_TYPES = new HashMap<Class<?>, Class<?>>();
- AVG_TYPES.put(DataTypeManager.DefaultDataClasses.BYTE, DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
- AVG_TYPES.put(DataTypeManager.DefaultDataClasses.SHORT, DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
- AVG_TYPES.put(DataTypeManager.DefaultDataClasses.INTEGER, DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
- AVG_TYPES.put(DataTypeManager.DefaultDataClasses.LONG, DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
+ AVG_TYPES.put(DataTypeManager.DefaultDataClasses.BYTE, SQLParserUtil.DECIMAL_AS_DOUBLE?DataTypeManager.DefaultDataClasses.DOUBLE:DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
+ AVG_TYPES.put(DataTypeManager.DefaultDataClasses.SHORT, SQLParserUtil.DECIMAL_AS_DOUBLE?DataTypeManager.DefaultDataClasses.DOUBLE:DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
+ AVG_TYPES.put(DataTypeManager.DefaultDataClasses.INTEGER, SQLParserUtil.DECIMAL_AS_DOUBLE?DataTypeManager.DefaultDataClasses.DOUBLE:DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
+ AVG_TYPES.put(DataTypeManager.DefaultDataClasses.LONG, SQLParserUtil.DECIMAL_AS_DOUBLE?DataTypeManager.DefaultDataClasses.DOUBLE:DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
AVG_TYPES.put(DataTypeManager.DefaultDataClasses.BIG_INTEGER, DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
AVG_TYPES.put(DataTypeManager.DefaultDataClasses.FLOAT, DataTypeManager.DefaultDataClasses.DOUBLE);
AVG_TYPES.put(DataTypeManager.DefaultDataClasses.DOUBLE, DataTypeManager.DefaultDataClasses.DOUBLE);
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2011-11-30 22:17:23 UTC (rev 3710)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2011-12-01 02:03:44 UTC (rev 3711)
@@ -4004,7 +4004,7 @@
} |
t=<DECIMALVAL> {
try {
- if (PARSE_DECIMAL_AS_DOUBLE) {
+ if (DECIMAL_AS_DOUBLE) {
constant = new Constant(Double.valueOf(t.image), DataTypeManager.DefaultDataClasses.DOUBLE);
} else {
constant = new Constant(new java.math.BigDecimal(t.image), DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
More information about the teiid-commits
mailing list