drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-5772) Add unit tests to indicate how utf-8 support can be enabled / disabled in Drill
Date Wed, 13 Sep 2017 00:37:00 GMT

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

ASF GitHub Bot commented on DRILL-5772:

Github user paul-rogers commented on the issue:

    @arina-ielchiieva, thanks for the explanation. Drill's runtime framework assumes that
data is either:
    1. ASCII (or, at least, single-byte character set based on ASCII), or
    2. UTF-8 (data is converted to/from UTF-8 when converting VarChar to a Java String.)
    Since Drill's code seems to assume ASCII (when it cares about character format), then
one could claim that Drill does not have an encoding: it just treats characters as bytes.
But, things such as determining string length, doing pattern matching, and so on must be aware
of the character set -- if only to know which bytes are continuations of a multi-byte character.
(That is, a three-byte sequence in UTF-8 might be one, two or three characters, depending.)
    Now, if the planner assumes ISO-8859-1, but the Drill execution engine assumes UTF-8,
then string constants passed from one to the other can become corrupted in the case where
a particular byte sequence in ISO-8859-1 represents a different character than that same byte
sequence in UTF-8.
    Where would this occur? Look at the [ISO-8859-1](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
definition. ISO-8859 is a single-byte character set with meanings associated to the bytes
in the range 0x40 to 0x7f. But, in UTF-8, the high bit indicates a prefix character. So, 0xF7
is a valid single-byte character in ISO-8859, but is a lead-in character in UTF-8.
    The point here is that setting the character set would seem to be a global setting. If
the Saffron setting is purely for the parser (how to interpret incoming text), and the parser
always produces Java strings in UTF-16 (which are then encoded into UTF-8 for execution),
then we're fine.
    But, if the parser encoding is written as bytes sent to the execution engine, we're in
    Further, Drill has a web UI. The typical web character set is UTF-8, so queries coming
from the web UI are encoded in UTF-8.
    All this suggests two things:
    1. Drill should either always accept UTF-8 (the Saffron property should always be set.)
    2. The property is specified by the client and used to decode the bytes within a Protobuf
message to produce a character stream given to the parser.
    It appears that UTF-8 is the default Protobuf String type encoding; sender and receiver
would have to agree on another format. Does Drill have such an RPC property? I've not seen
it, but I'm not an expert.
    In short, if this change ensures that the parser *always* uses UTF-8, then this is good.
If the character encoding is an option, then we have to consider all the above issues to have
a fully working, end-to-end solution.

> Add unit tests to indicate how utf-8 support can be enabled / disabled in Drill
> -------------------------------------------------------------------------------
>                 Key: DRILL-5772
>                 URL: https://issues.apache.org/jira/browse/DRILL-5772
>             Project: Apache Drill
>          Issue Type: Task
>    Affects Versions: 1.11.0
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>              Labels: doc-impacting
>             Fix For: 1.12.0
> Add unit test to indicated how utf-8 support can be enabled in Drill.
> To select utf-8 data user needs to update system property {{saffron.default.charset}}
to {{UTF-16LE}} before starting the drillbit. Calcite uses this property to get default charset,
if it is not set then {{ISO-8859-1}} is used by default. Drill gets default charset from Calcite.
> This information should be also documented, probably in https://drill.apache.org/docs/data-type-conversion/.

This message was sent by Atlassian JIRA

View raw message