[
https://issues.apache.org/jira/browse/CALCITE-2769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16761392#comment-16761392
]
Chiradip Mandal edited comment on CALCITE-2769 at 2/6/19 3:00 AM:
------------------------------------------------------------------
Then it fails like this - the test case that fails is the following:
{code:java}
@Test public void testReadme() throws SQLException {
final String sql = "SELECT d.name, COUNT(*) cnt"
+ " FROM emps AS e"
+ " JOIN depts AS d ON e.deptno = d.deptno"
+ " GROUP BY d.name";
sql("smart", sql)
.returns("NAME=Sales; CNT=1", "NAME=Marketing; CNT=2").ok();
}
{code}
{noformat}
130, Alice, 40, F, Vancouver, 2, null, false, true, 2007-01-01
[ERROR] Tests run: 38, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 2.152
s <<< FAILURE! - in org.apache.calcite.test.CsvTest
[ERROR] testReadme(org.apache.calcite.test.CsvTest) Time elapsed: 0.104 s <<<
FAILURE!
java.lang.AssertionError: expected:<[NAME=Sales; CNT=1, NAME=Marketing; CNT=2]>
but was:<[NAME=Sales; CNT=1]>
at org.apache.calcite.test.CsvTest.lambda$expect$1(CsvTest.java:321)
at org.apache.calcite.test.CsvTest.checkSql(CsvTest.java:357)
at org.apache.calcite.test.CsvTest.access$300(CsvTest.java:67)
at org.apache.calcite.test.CsvTest.testReadme(CsvTest.java:471)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]
CsvTest.testReadme:471->access$300:67->checkSql:357->lambda$expect$1:321
expected:<[NAME=Sales; CNT=1, NAME=Marketing; CNT=2]> but was:<[NAME=Sales;
CNT=1]>
[INFO]
[ERROR] Tests run: 38, Failures: 1, Errors: 0, Skipped: 3
{noformat}
was (Author: chiradip):
{noformat}
130, Alice, 40, F, Vancouver, 2, null, false, true, 2007-01-01
[ERROR] Tests run: 38, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 2.152
s <<< FAILURE! - in org.apache.calcite.test.CsvTest
[ERROR] testReadme(org.apache.calcite.test.CsvTest) Time elapsed: 0.104 s <<<
FAILURE!
java.lang.AssertionError: expected:<[NAME=Sales; CNT=1, NAME=Marketing; CNT=2]>
but was:<[NAME=Sales; CNT=1]>
at org.apache.calcite.test.CsvTest.lambda$expect$1(CsvTest.java:321)
at org.apache.calcite.test.CsvTest.checkSql(CsvTest.java:357)
at org.apache.calcite.test.CsvTest.access$300(CsvTest.java:67)
at org.apache.calcite.test.CsvTest.testReadme(CsvTest.java:471)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]
CsvTest.testReadme:471->access$300:67->checkSql:357->lambda$expect$1:321
expected:<[NAME=Sales; CNT=1, NAME=Marketing; CNT=2]> but was:<[NAME=Sales;
CNT=1]>
[INFO]
[ERROR] Tests run: 38, Failures: 1, Errors: 0, Skipped: 3
{noformat}
> CSV Adapter does not handle - Empty and malformed csv lines, space before or
> after comma
> ----------------------------------------------------------------------------------------
>
> Key: CALCITE-2769
> URL: https://issues.apache.org/jira/browse/CALCITE-2769
> Project: Calcite
> Issue Type: Bug
> Components: csv-adapter
> Affects Versions: 1.18.0
> Reporter: Chiradip Mandal
> Assignee: Julian Hyde
> Priority: Major
> Fix For: next
>
>
> File: org.apache.calcite.adapter.csv.CsvEnumerator.java in example folder did
> not handle CSV with space between delimiter i.e."," and also did not handle
> empty lines or malformed lines in the middle of the file or to the end. The
> sqlline crashes is there is an empty line with
> java.lang.ArrayIndexOutOfBoundsException.
>
> java.lang.ArrayIndexOutOfBoundsException: 1
> at
> org.apache.calcite.adapter.csv.CsvEnumerator$ArrayRowConverter.convertNormalRow(CsvEnumerator.java:347)
> at
> org.apache.calcite.adapter.csv.CsvEnumerator$ArrayRowConverter.convertRow(CsvEnumerator.java:339)
> at
> org.apache.calcite.adapter.csv.CsvEnumerator$ArrayRowConverter.convertRow(CsvEnumerator.java:317)
> at
> org.apache.calcite.adapter.csv.CsvEnumerator.moveNext(CsvEnumerator.java:204)
> at
> org.apache.calcite.linq4j.EnumerableDefaults$10$1.moveNext(EnumerableDefaults.java:1878)
> at
> org.apache.calcite.linq4j.EnumerableDefaults$10$1.moveNext(EnumerableDefaults.java:1878)
> at
> org.apache.calcite.linq4j.TransformedEnumerator.moveNext(TransformedEnumerator.java:35)
> at org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.next(Linq4j.java:684)
> at org.apache.calcite.avatica.util.IteratorCursor.next(IteratorCursor.java:46)
> at org.apache.calcite.avatica.AvaticaResultSet.next(AvaticaResultSet.java:217)
> at sqlline.IncrementalRows.hasNext(IncrementalRows.java:73)
> at sqlline.TableOutputFormat.print(TableOutputFormat.java:38)
> at sqlline.SqlLine.print(SqlLine.java:1719)
> at sqlline.Commands.execute(Commands.java:949)
> at sqlline.Commands.sql(Commands.java:882)
> at sqlline.SqlLine.dispatch(SqlLine.java:725)
> at sqlline.SqlLine.begin(SqlLine.java:540)
> at sqlline.SqlLine.start(SqlLine.java:264)
> at sqlline.SqlLine.main(SqlLine.java:195)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)