Author: shawkins
Date: 2012-07-26 10:43:40 -0400 (Thu, 26 Jul 2012)
New Revision: 4271
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
Log:
TEIID-2117 adding binary support
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2012-07-25
19:39:59 UTC (rev 4270)
+++
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2012-07-26
14:43:40 UTC (rev 4271)
@@ -83,6 +83,8 @@
typeMapping.put(DataTypeManager.DefaultDataClasses.DATE, BuiltInAtomicType.DATE);
typeMapping.put(DataTypeManager.DefaultDataClasses.FLOAT, BuiltInAtomicType.FLOAT);
typeMapping.put(DataTypeManager.DefaultDataClasses.DOUBLE, BuiltInAtomicType.DOUBLE);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.BLOB,
BuiltInAtomicType.HEX_BINARY);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.VARBINARY,
BuiltInAtomicType.HEX_BINARY);
}
private static TeiidRuntimeException EARLY_TERMINATION = new TeiidRuntimeException();
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2012-07-25
19:39:59 UTC (rev 4270)
+++
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2012-07-26
14:43:40 UTC (rev 4271)
@@ -38,6 +38,7 @@
import org.junit.Test;
import org.teiid.api.exception.query.ExpressionEvaluationException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.BinaryType;
import org.teiid.core.types.BlobImpl;
import org.teiid.core.types.BlobType;
import org.teiid.core.types.DataTypeManager;
@@ -195,6 +196,17 @@
process(sql, expected);
}
+ @Test public void testXmlTableBinary() throws Exception {
+ String sql = "select * from xmltable('/a/b' passing
convert('<a
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><b
xsi:type=\"xs:hexBinary\">0FAB</b><b>1F1C</b></a>',
xml) columns val varbinary path '/.') as x"; //$NON-NLS-1$
+
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList(new BinaryType(new byte[] {0xf, (byte)0xab})),
+ Arrays.asList(new BinaryType(new byte[] {0x1F, 0x1C})),
+ };
+
+ process(sql, expected);
+ }
+
@Test(expected=TeiidProcessingException.class) public void testXmlTableAsynchError()
throws Exception {
String sql = "select * from xmltable('/a/b' passing
convert('<a><b>first</b><b
x=\"attr\">second</b></a>', xml) columns x blob path
'@x', val string path '/.') as x"; //$NON-NLS-1$