Author: shawkins
Date: 2011-11-10 11:48:57 -0500 (Thu, 10 Nov 2011)
New Revision: 3629
Modified:
trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
Log:
TEIID-1821 fix for default expression resolving/validation
Modified:
trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java 2011-11-10
16:29:43 UTC (rev 3628)
+++
trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java 2011-11-10
16:48:57 UTC (rev 3629)
@@ -349,7 +349,7 @@
if (column.getDefaultExpression() == null) {
continue;
}
- ResolverVisitor.resolveLanguageObject(column.getDefaultExpression(), metadata);
+ visitNode(column.getDefaultExpression());
Expression ex = ResolverUtil.convertExpression(column.getDefaultExpression(),
DataTypeManager.getDataTypeName(column.getSymbol().getType()), metadata);
column.setDefaultExpression(ex);
}
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2011-11-10
16:29:43 UTC (rev 3628)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2011-11-10
16:48:57 UTC (rev 3629)
@@ -1385,7 +1385,7 @@
boolean hasOrdinal = false;
for (XMLColumn xc : obj.getColumns()) {
if (!xc.isOrdinal()) {
- if (xc.getDefaultExpression() != null &&
!EvaluatableVisitor.isFullyEvaluatable(obj, false)) {
+ if (xc.getDefaultExpression() != null &&
!EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) {
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default",
xc.getDefaultExpression()), obj); //$NON-NLS-1$
}
continue;
Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-11-10
16:29:43 UTC (rev 3628)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-11-10
16:48:57 UTC (rev 3629)
@@ -1791,6 +1791,10 @@
@Test public void testXMLTablePassingMultipleContext() {
helpValidate("select * from pm1.g1, xmltable('/' passing
xmlparse(DOCUMENT '<a/>'), xmlparse(DOCUMENT '<b/>')) as
x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT
'<a/>'), XMLPARSE(DOCUMENT '<b/>')) AS x"},
RealMetadataFactory.example1Cached());
}
+
+ @Test public void testInvalidDefault() {
+ helpValidate("select * from pm1.g1, xmltable('/' passing
xmlparse(DOCUMENT '<a/>') columns y string default 'a', x string
default (select e1 from pm1.g1)) as x", new String[] {"XMLTABLE('/'
PASSING XMLPARSE(DOCUMENT '<a/>') COLUMNS y string DEFAULT 'a', x
string DEFAULT (SELECT e1 FROM pm1.g1)) AS x"},
RealMetadataFactory.example1Cached());
+ }
@Ignore("this is actually handled by saxon and will show up during
resolving")
@Test public void testXMLTablePassingSameName() {
Show replies by thread