You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Mariano Ruiz (JIRA)" <ji...@apache.org> on 2018/11/09 14:05:00 UTC

[jira] [Commented] (DRILL-6840) Exporting to CSV using !set csvquotecharacter '"' not working in latest stable or snaptshot versions

    [ https://issues.apache.org/jira/browse/DRILL-6840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16681474#comment-16681474 ] 

Mariano Ruiz commented on DRILL-6840:
-------------------------------------

Also mention that when you execute:
{code:java}
!set csvquotecharacter '"'
{code}
Using the latest stable version 1.4.0, it throws an error {{java.lang.StringIndexOutOfBoundsException: String index out of range: -1}}, but I didn't report it because it was solved in the latest SNAPSHOT version.

There is a good thread about this at [https://stackoverflow.com/questions/52617644/apache-drill-how-to-query-a-parquet-file-and-output-the-result-into-a-csv-file]

> Exporting to CSV using !set csvquotecharacter '"' not working in latest stable or snaptshot versions
> ----------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-6840
>                 URL: https://issues.apache.org/jira/browse/DRILL-6840
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Storage - Text &amp; CSV
>    Affects Versions: Future, 1.14.0
>         Environment: * Tested with latest version *Apache Drill* 1.14.0, and building the latest version from master (Github repo), commit ad61c6bc1dd24994e50fe7dfed043d5e57dba8f9 at _Nov 5, 2018_.
>  * *Linux* x64, Ubuntu 16.04
>  * *OpenJDK* Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.17.10.1-b11)
>  * Apache *Maven* 3.5.0
>            Reporter: Mariano Ruiz
>            Priority: Minor
>              Labels: csv, csvparser, export
>
> Using latest stable version and latest SNAPSHOT version, when I export to a CSV file the result of a query, the text fields aren't enclosed with double quotes as specified.
> Steps:
> {code:java}
> 0: jdbc:drill:zk=local> USE dfs.tmp;
> +-------+--------------------------------------+
> |  ok   |               summary                |
> +-------+--------------------------------------+
> | true  | Default schema changed to [dfs.tmp]  |
> +-------+--------------------------------------+
> 1 row selected (0.126 seconds)
> 0: jdbc:drill:zk=local> ALTER SESSION SET `store.format`='csv';
> +-------+------------------------+
> |  ok   |        summary         |
> +-------+------------------------+
> | true  | store.format updated.  |
> +-------+------------------------+
> 1 row selected (0.117 seconds)
> 0: jdbc:drill:zk=local> !set csvquotecharacter '"'
> 0: jdbc:drill:zk=local> CREATE TABLE dfs.tmp.prods_without_brand AS SELECT * FROM dfs.`/tmp/prods.csv` WHERE brand = '';
> +-----------+----------------------------+
> | Fragment  | Number of records written  |
> +-----------+----------------------------+
> | 0_0       | 112                        |
> +-----------+----------------------------+
> 1 row selected (0.198 seconds)
> 0: jdbc:drill:zk=local> 
> {code}
> The CSV output doesn't have any field enclosed with *{color:red}"{color}*, even those that have values with the *{color:red},{color}* character, so the CSV is broken.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)