mirror of
https://github.com/apache/impala.git
synced 2026-01-22 09:01:58 -05:00
The .test file parser implemented an unconventional method for parsing single-quoted strings in comma-separated value format. This didn't handle trailing commas in the string correctly. This commit switches to using a conventional method for parsing comma-separated value format: * Commas enclosed by single quotes are not treated as field separators * Single quotes can be escaped within a string by doubling them. I looked into using Python's .csv module for this, but it wouldn't work without modifying the test file format more because it automatically discards the quotes during parsing, which are actually semantically important in .test files. E.g. without the quotes we can't distinguish between the literal string 'regex:...' and the regex regex:.... Testing: Ran exhaustive tests and fixed .test files that required modifications. Will rerun before merging. Added a couple of tests to exercise edge cases in the test file parser. Change-Id: I18ddcb0440490ddf8184be66d3681038a1615dd9 Reviewed-on: http://gerrit.cloudera.org:8080/11800 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Tim Armstrong <tarmstrong@cloudera.com>
27 lines
436 B
Plaintext
27 lines
436 B
Plaintext
====
|
|
---- QUERY
|
|
# Reproduces IMPALA-6734. Before fixing this would pass if the results had a single
|
|
# quote for each value instead of the correct string.
|
|
select "a comma,"
|
|
from alltypestiny
|
|
---- RESULTS
|
|
'a comma,'
|
|
'a comma,'
|
|
'a comma,'
|
|
'a comma,'
|
|
'a comma,'
|
|
'a comma,'
|
|
'a comma,'
|
|
'a comma,'
|
|
---- TYPES
|
|
STRING
|
|
====
|
|
---- QUERY
|
|
# Test that escaping single quotes in result string works.
|
|
select "'"
|
|
---- RESULTS
|
|
''''
|
|
---- TYPES
|
|
STRING
|
|
====
|