Author: shawkins
Date: 2012-08-29 19:32:18 -0400 (Wed, 29 Aug 2012)
New Revision: 4381
Modified:
trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java
trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java
trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java
Log:
TEIID-2174 fix for case sensitive ddl types
Modified: trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java 2012-08-28 20:03:45
UTC (rev 4380)
+++ trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java 2012-08-29 23:32:18
UTC (rev 4381)
@@ -24,6 +24,8 @@
import java.io.Serializable;
+import org.teiid.core.types.DataTypeManager;
+
/**
* A function parameter defines the name and description of an input or output
* parameter for a function. The name should not be null, but that is not
@@ -124,7 +126,7 @@
if(type == null) {
this.type = null;
} else {
- this.type = type.toLowerCase();
+ this.type = DataTypeManager.getCanonicalString(type.toLowerCase());
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java 2012-08-28
20:03:45 UTC (rev 4380)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java 2012-08-29
23:32:18 UTC (rev 4381)
@@ -27,10 +27,10 @@
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.TreeMap;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -57,7 +57,7 @@
}
private List<Datatype> dataTypes = new ArrayList<Datatype>();
- private Map<String, Datatype> typeMap = new HashMap<String, Datatype>();
+ private Map<String, Datatype> typeMap = new TreeMap<String,
Datatype>(String.CASE_INSENSITIVE_ORDER);
private MetadataStore systemStore;
public SystemMetadata() {
Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java 2012-08-28
20:03:45 UTC (rev 4380)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java 2012-08-29
23:32:18 UTC (rev 4381)
@@ -496,6 +496,15 @@
assertTrue( fm.getInputParameters().get(0).isVarArg());
}
+ @Test public void testMixedCaseTypes() throws Exception {
+ String ddl = "CREATE FUNCTION SourceFunc(flag Boolean) RETURNS varchaR options
(UUID 'z')";
+
+ Schema s = helpParse(ddl, "model").getSchema();
+
+ FunctionMethod fm = s.getFunction("z");
+ assertEquals("boolean", fm.getInputParameters().get(0).getType());
+ }
+
@Test(expected=ParseException.class) public void testInvalidFunctionBody() throws
Exception {
String ddl = "CREATE FUNCTION SourceFunc(flag boolean) RETURNS varchar AS SELECT
'a';";
Show replies by date