Author: shawkins
Date: 2011-05-11 23:37:24 -0400 (Wed, 11 May 2011)
New Revision: 3165
Added:
branches/7.4.x/engine/src/test/resources/text/cdm_dos_win.txt
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-1584 fixing support for windows line terminators
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-05-11
14:02:20 UTC (rev 3164)
+++
branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java 2011-05-12
03:37:24 UTC (rev 3165)
@@ -246,8 +246,12 @@
switch (c) {
case '\r':
cr = true;
+ textLine++;
+ return '\n';
case -1:
eof = true;
+ textLine++;
+ return '\n';
case '\n':
textLine++;
return '\n';
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-05-11
14:02:20 UTC (rev 3164)
+++
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-05-12
03:37:24 UTC (rev 3165)
@@ -75,6 +75,19 @@
processPreparedStatement(sql, expected, dataManager, new
DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(),
Arrays.asList(clobFromFile("text/cdm_dos.txt")));
}
+ @Test public void testTextTableFixedWin() throws Exception {
+ String sql = "select max(compkey), max(cdm_id), max(currency),
max(\"start\"), max(maturity), max(amount), count(*) from texttable(? COLUMNS
compkey string width 76, CDM_ID string width 14, CURRENCY string width 9,
\"START\" string width 31, MATURITY string width 31, AMOUNT double width 21,
RECORDSOURCE string width 13, SUMMIT_ID string width 15, RATE double width 20, SPREAD
double width 20, DESK string width 14) x"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList("000369USD05/20/200405/20/2007", "000369",
"USD", "12/18/2000", "12/19/2005", 6.7209685146E8, 52),
+ };
+
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+
+ processPreparedStatement(sql, expected, dataManager, new
DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(),
Arrays.asList(clobFromFile("text/cdm_dos_win.txt")));
+ }
+
@Test public void testTextTableFixedPartial() throws Exception {
String sql = "select max(length(compkey)) from texttable(? COLUMNS compkey
string width 76) x"; //$NON-NLS-1$
Added: branches/7.4.x/engine/src/test/resources/text/cdm_dos_win.txt
===================================================================
--- branches/7.4.x/engine/src/test/resources/text/cdm_dos_win.txt
(rev 0)
+++ branches/7.4.x/engine/src/test/resources/text/cdm_dos_win.txt 2011-05-12 03:37:24 UTC
(rev 3165)
@@ -0,0 +1,52 @@
+ 000183USD07/26/200107/26/2004 000183
USD 07/26/2001 07/26/2004
10000000.00 Summit 195205NY 0.005450 0.000000 MCREDCLN
+ 000184USD07/26/200107/26/2004 000184
USD 07/26/2001 07/26/2004
10000000.00 Summit 195219NY 0.005450 0.000000 NYBDUMMY
+ 000185USD07/26/200107/26/2004 000185
USD 07/26/2001 07/26/2004
10000000.00 Summit 195233NY 0.009700 0.000000 MCREDCLN
+ 000186USD07/26/200107/26/2004 000186
USD 07/26/2001 07/26/2004
10000000.00 Summit 195234NY 0.009700 0.000000 NYBDUMMY
+ 000258AUSD12/12/200209/15/2005 000258
USD 12/12/2002 09/15/2005
10000000.00 Summit 247299N 0.011500 0.000000 DCC2
+ 000259AUSD01/17/200303/20/2005 000259
USD 01/17/2003 03/20/2005
10000000.00 Summit 247300N 0.011000 0.000000 DCC2
+ 000273USD04/25/200307/07/2006 000273
USD 04/25/2003 07/07/2006
5000000.00 Summit 258123NY 0.008000 0.000000 LTINV
+ 000276AUSD05/10/200306/20/2008 000276
USD 05/10/2003 06/20/2008
10000000.00 Summit 260100N 0.033000 0.000000 DCC2
+ 000277AUSD05/10/200306/20/2008 000277
USD 05/10/2003 06/20/2008
5000000.00 Summit 260101N 0.006500 0.000000 DCC2
+ 000278AUSD05/13/200306/20/2008 000278
USD 05/13/2003 06/20/2008
5000000.00 Summit 260102N 0.033000 0.000000 DCC2
+ 000279AUSD05/14/200306/20/2008 000279
USD 05/14/2003 06/20/2008
5000000.00 Summit 260131N 0.033000 0.000000 DCC2
+ 000280USD06/11/200307/07/2006 000280
USD 06/11/2003 07/07/2006
5000000.00 Summit 264602NY 0.008900 0.000000 LTINV
+ 000289AUSD07/03/200309/20/2008 000289
USD 07/03/2003 09/20/2008
5000000.00 Summit 265496NY 0.004400 0.000000 LTINV
+ 000292USD07/19/200309/20/2008 000292
USD 07/19/2003 09/20/2008
5000000.00 Summit 271005NY 0.005000 0.000000 LTINV
+ 000350USD01/28/200403/20/2009 000350
USD 01/28/2004 03/20/2009
10000000.00 Summit 314996N 0.005200 0.000000 DCC2
+ 000354USD03/10/200403/10/2007 000354
USD 03/10/2004 03/10/2007
9324082.77 Summit 318622NY 0.037500 0.000000 LTTRSCDS
+ 000357USD03/16/200403/16/2007 000357
USD 03/16/2004 03/16/2007
9924050.62 Summit 318638NY 0.030000 0.000000 LTTRSCDS
+ 000359USD03/09/200403/09/2007 000359
USD 03/09/2004 03/09/2007
9329349.59 Summit 318641NY 0.027500 0.000000 LTTRSCDS
+ 000360USD03/18/200403/18/2007 000360
USD 03/18/2004 03/18/2007
232935.47 Summit 318642NY 0.032500 0.000000 LTTRSCDS
+ 000352USD04/08/200404/08/2007 000352
USD 04/08/2004 04/08/2007
9788013.59 Summit 318643NY 0.032500 0.000000 LTTRSCDS
+ 000353USD03/04/200403/04/2007 000353
USD 03/04/2004 03/04/2007
809831.58 Summit 318644NY 0.032500 0.000000 LTTRSCDS
+ 000353USD03/04/200403/04/2007 000353
USD 03/04/2004 03/04/2007
705882.35 Summit 325357NY 0.032500 0.000000 LTTRSCDS
+ 000353USD03/04/200403/04/2007 000353
USD 03/04/2004 03/04/2007
156623.38 Summit 325358NY 0.032500 0.000000 LTTRSCDS
+ 000353USD03/04/200403/04/2007 000353
USD 03/04/2004 03/04/2007
278643.02 Summit 325363NY 0.032500 0.000000 LTTRSCDS
+ 000353USD03/04/200403/04/2007 000353
USD 03/04/2004 03/04/2007
711809.48 Summit 325364NY 0.032500 0.000000 LTTRSCDS
+ 000359USD03/09/200403/09/2007 000359
USD 03/09/2004 03/09/2007
76890.25 Summit 325366NY 0.027500 0.000000 LTTRSCDS
+ 000360USD03/18/200403/18/2007 000360
USD 03/18/2004 03/18/2007
1049811.00 Summit 329001NY 0.032500 0.000000 LTTRSCDS
+ 000360USD03/18/200403/18/2007 000360
USD 03/18/2004 03/18/2007
414407.12 Summit 329002NY 0.032500 0.000000 LTTRSCDS
+ 000360USD03/18/200403/18/2007 000360
USD 03/18/2004 03/18/2007
1204408.30 Summit 329003NY 0.032500 0.000000 LTTRSCDS
+ 000360USD03/18/200403/18/2007 000360
USD 03/18/2004 03/18/2007
1058626.60 Summit 329004NY 0.032500 0.000000 LTTRSCDS
+ 000362USD04/12/200404/12/2007 000362
USD 04/12/2004 04/12/2007
194934.82 Summit 331567NY 0.040000 0.000000 LTTRSCDS
+ 000362USD04/12/200404/12/2007 000362
USD 04/12/2004 04/12/2007
131062.23 Summit 335678NY 0.040000 0.000000 LTTRSCDS
+ 000362USD04/12/200404/12/2007 000362
USD 04/12/2004 04/12/2007
1094136.66 Summit 335679NY 0.040000 0.000000 LTTRSCDS
+ 000362USD04/12/200404/12/2007 000362
USD 04/12/2004 04/12/2007
2785075.14 Summit 335680NY 0.040000 0.000000 LTTRSCDS
+ 000362USD04/12/200404/12/2007 000362
USD 04/12/2004 04/12/2007
2785075.14 Summit 335681NY 0.040000 0.000000 LTTRSCDS
+ 000362USD04/12/200404/12/2007 000362
USD 04/12/2004 04/12/2007
2984009.08 Summit 335682NY 0.040000 0.000000 LTTRSCDS
+ 000363USD05/03/200405/03/2007 000363
USD 05/03/2004 05/03/2007
10000000.00 Summit 338242NY 0.025000 0.000000 LTTRSCDS
+ 000364USD05/17/200405/17/2007 000364
USD 05/17/2004 05/17/2007
5000000.00 Summit 338820NY 0.032500 0.000000 LTTRSCDS
+ 000365USD05/07/200406/20/2009 000365
USD 05/07/2004 06/20/2009
5000000.00 Summit 340411N 0.004800 0.000000 DCC2
+ 000099USD12/06/199912/06/2004 000099
USD 12/06/1999 12/06/2004
200000000.00 Summit 340805NY 0.000000 0.000000 PCTRSCDS
+ 000129USD04/03/200010/01/2008 000129
USD 04/03/2000 10/01/2008
200000000.00 Summit 340834NY 0.000000 0.000000 PCTRSCDS
+ 000148USD09/12/200012/19/2005 000148
USD 09/12/2000 12/19/2005
573667.12 Summit 340844NY 0.000000 0.000000 PCTRSCDS
+ 000149USD09/12/200012/19/2005 000149
USD 09/12/2000 12/19/2005
2118155.52 Summit 340847NY 0.000000 0.000000 PCTRSCDS
+ 000150USD09/12/200012/19/2005 000150
USD 09/12/2000 12/19/2005
4986491.88 Summit 340848NY 0.000000 0.000000 PCTRSCDS
+ 000366USD05/06/200405/06/2007 000366
USD 05/06/2004 05/06/2007
3058823.53 Summit 341369NY 0.030000 0.000000 LTTRSCDS
+ 000367USD05/06/200405/06/2007 000367
USD 05/06/2004 05/06/2007
6941176.47 Summit 341377NY 0.030000 0.000000 LTTRSCDS
+ 000213USD02/11/200202/11/2007 000213
USD 02/11/2002 02/11/2007
8000000.00 Summit 343117NY 0.056500 0.000000 CNA2
+ 000272USD03/05/200301/31/2005 000272
USD 03/05/2003 01/31/2005
28000000.00 Summit 343123NY 0.006000 0.000000 CNA2
+ 000333USD11/13/200311/20/2004 000333
USD 11/13/2003 11/20/2004
25000000.00 Summit 343151NY 0.003800 0.000000 CNA2
+ 000368USD05/24/200405/24/2007 000368
USD 05/24/2004 05/24/2007
10000000.00 Summit 343169NY 0.025000 0.000000 LTTRSCDS
+ 000168USD12/18/200001/31/2006 000168
USD 12/18/2000 01/31/2006
672096851.46 Summit 344846NY 0.000000 0.000000 ASGCGD
+ 000369USD05/20/200405/20/2007 000369
USD 05/20/2004 05/20/2007
10000000.00 Summit 344851NY 0.032500 0.000000 LTTRSCDS
Property changes on: branches/7.4.x/engine/src/test/resources/text/cdm_dos_win.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain