Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/593#discussion_r82304834 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/TextReader.java --- @@ -231,33 +231,34 @@ private void parseQuotedValue(byte prev) throws IOException { final TextInput input = this.input; final byte quote = this.quote; - ch = input.nextChar(); + try { + input.setMonitorForNewLine(false); + ch = input.nextChar(); - while (!(prev == quote && (ch == delimiter || ch == newLine || isWhite(ch)))) { - if (ch != quote) { - if (prev == quote) { // unescaped quote detected - if (parseUnescapedQuotes) { - output.append(quote); - output.append(ch); - parseQuotedValue(ch); - break; - } else { - throw new TextParsingException( - context, - "Unescaped quote character '" - + quote - + "' inside quoted value of CSV field. To allow unescaped quotes, set 'parseUnescapedQuotes' to 'true' in the CSV parser settings. Cannot parse CSV input."); + while (!(prev == quote && (ch == delimiter || ch == newLine || isWhite(ch)))) { + if (ch != quote) { + if (prev == quote) { // unescaped quote detected + if (parseUnescapedQuotes) { + output.append(quote); + output.append(ch); + parseQuotedValue(ch); + break; + } else { + throw new TextParsingException(context, "Unescaped quote character '" + quote + "' inside quoted value of CSV field. To allow unescaped quotes, set 'parseUnescapedQuotes' to 'true' in the CSV parser settings. Cannot parse CSV input."); + } } + output.append(ch); + prev = ch; + } else if (prev == quoteEscape) { + output.append(quote); + prev = NULL_BYTE; + } else { + prev = ch; } - output.append(ch); - prev = ch; - } else if (prev == quoteEscape) { - output.append(quote); - prev = NULL_BYTE; - } else { - prev = ch; + ch = input.nextChar(); } - ch = input.nextChar(); + } finally { --- End diff -- I see why it is done in finally. However, as noted above, I'm not sure that pushing this kind of flag into the getChar function is the optimal approach...
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---