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

Chris Hillery commented on ASTERIXDB-1361:
------------------------------------------

2. You need to have a datatype declared that matches the format of the output, 
and then put eg.

   set output-record-type "csv_type";

at the top of your query.


3. We discussed this at some length back when the CSV feature (and 
CSV-with-header, in particular) was introduced, and the consensus was "yeah, 
maybe, but it would be hard to do well and so probably not worth it". In 
particular, with a completely ad-hoc query like that, there are a lot of 
additional error conditions to check for, like whether each item in the result 
sequence has the same type (or else the header wouldn't match). Also, even 
then, you'd have to introspect the header information from the "first item in 
the result", and it turns out that with a distributed engine, getting the 
"first" item (and then outputting some information prior to outputting that 
item) is pretty challenging.

The output-record-type annotation, in addition to declaring a type that 
CSV-with-header can use to know the header information, also introduces a plan 
step that coerces the output to be a sequence of that type. That solves a bunch 
of problems, like ensuring that the fields in each record are in the same 
order. It also means that many of those errors I talked about above are caught 
automatically, with meaningful error messages. It's a small simplicity hit with 
a huge functionality upside.

> CSV (with header) broken in ADM/AQL 101 
> ----------------------------------------
>
>                 Key: ASTERIXDB-1361
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1361
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: AsterixDB, Data Formats, Web Interface
>         Environment: AsterixDB on OSX through Web interface in Firefox
>            Reporter: Michael J. Carey
>            Assignee: Chris Hillery
>
> Try typing 1+1 to AsterixDB with CSV (with header) selected as the format.
> It causes an INTERNAL ERROR.
> Nothing should ever cause an internal error.
> :-)
> Also try typing {"name":"Mike", "salary":100}.
> This also gets the same internal error.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to