Author: shawkins
Date: 2011-08-16 12:03:23 -0400 (Tue, 16 Aug 2011)
New Revision: 3385
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
Log:
TEIID-1712 allowing for partial delimited lines
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
===================================================================
---
branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java 2011-08-16
14:37:23 UTC (rev 3384)
+++
branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java 2011-08-16
16:03:23 UTC (rev 3385)
@@ -184,14 +184,16 @@
index = nameIndexes.get(col.getName());
}
if (index >= vals.size()) {
- throw new
TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.no_value",
col.getName(), textLine, systemId)); //$NON-NLS-1$
+ //throw new
TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.no_value",
col.getName(), textLine, systemId)); //$NON-NLS-1$
+ tuple.add(null);
+ } else {
+ val = vals.get(index);
+ try {
+ tuple.add(DataTypeManager.transformValue(val,
table.getColumns().get(output).getSymbol().getType()));
+ } catch (TransformationException e) {
+ throw new TeiidProcessingException(e,
QueryPlugin.Util.getString("TextTableNode.conversion_error", col.getName(),
textLine, systemId)); //$NON-NLS-1$
+ }
}
- val = vals.get(index);
- try {
- tuple.add(DataTypeManager.transformValue(val,
table.getColumns().get(output).getSymbol().getType()));
- } catch (TransformationException e) {
- throw new TeiidProcessingException(e,
QueryPlugin.Util.getString("TextTableNode.conversion_error", col.getName(),
textLine, systemId)); //$NON-NLS-1$
- }
}
addBatchRow(tuple);
}
Modified:
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
---
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-08-16
14:37:23 UTC (rev 3384)
+++
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-08-16
16:03:23 UTC (rev 3385)
@@ -171,6 +171,17 @@
process(sql, expected);
}
+ @Test public void testMissingValues() throws Exception {
+ String sql = "select * from texttable('a,b\nc' COLUMNS c1 string, c2
string) x"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList("a", "b"),
+ Arrays.asList("c", null),
+ };
+
+ process(sql, expected);
+ }
+
@Test public void testQuote() throws Exception {
String sql = "select * from texttable(' \" a\", \"
\"\" \"' COLUMNS c1 string, c2 string) x"; //$NON-NLS-1$
Show replies by date