[
https://issues.apache.org/jira/browse/IMPALA-12311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17752545#comment-17752545
]
ASF subversion and git services commented on IMPALA-12311:
----------------------------------------------------------
Commit 826da820347387bd0587324cd29d44c9a29dd166 in impala's branch
refs/heads/master from Fang-Yu Rao
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=826da8203 ]
IMPALA-12311: Remove extra newlines in the updated golden file
This patch removes extra newlines added to subsections when we parse
test queries in an end-to-end test file. Specifically, in
parse_test_file_text(), we append an extra newline in every subsection
of a test query, resulting in one extra newline in the updated golden
file if we add '--update_results' when running this test file to produce
the updated golden file. This could be seen by looking at the updated
golding file under $IMPALA_HOME/logs/ee_tests after executing the
following.
$IMPALA_HOME/bin/impala-py.test \
--update_results \
$IMPALA_HOME/tests/query_test/test_tpcds_queries.py::TestTpcdsDecimalV2Query::test_tpcds_q1
The extra newline is needed for the verification of the subsections of
RESULTS, DML_RESULTS, ERRORS to disambiguate the case of no lines from
a single line with no text and will not be needed after the
verification.
To remove such extra newlines, we choose to do it in the place when
write_test_file() is called to output the updated golden file since this
requires fewer changes. An alternative could be to only add an extra
newline for those 3 subsections mentioned above and also remove the last
newline added in join_section_lines(), which would be called when the
actual contents do not match the expected contents specified in the
original golden file in the subsections of ERRORS, TYPES, LABELS,
RESULTS and DML_RESULTS. Additional changes to TestTestFileParser are
also required if we adopted the alternative.
Testing:
- Verified that the extra newlines are removed after this patch.
Change-Id: Ic7668a437267bd76afecba8f87ead32d82580414
Reviewed-on: http://gerrit.cloudera.org:8080/20272
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> Extra newlines are produced when an end-to-end test is run with
> update_results
> -------------------------------------------------------------------------------
>
> Key: IMPALA-12311
> URL: https://issues.apache.org/jira/browse/IMPALA-12311
> Project: IMPALA
> Issue Type: Bug
> Affects Versions: Impala 4.1.2
> Reporter: Fang-Yu Rao
> Assignee: Fang-Yu Rao
> Priority: Minor
> Labels: test-infra
>
> We found that extra newlines are produced in the updated golden file when the
> actual results do not match the expected results specified in the original
> golden file.
> Take
> [TestDecimalExprs::test_exprs()|https://github.com/apache/impala/blob/master/tests/query_test/test_decimal_queries.py#L75]
> for example, this test runs the test cases in
> [decimal-exprs.test|https://github.com/apache/impala/blob/master/testdata/workloads/functional-query/queries/QueryTest/decimal-exprs.test].
> Suppose that we modify the expected error message at
> [https://github.com/apache/impala/blob/master/testdata/workloads/functional-query/queries/QueryTest/decimal-exprs.test#L107]
> from "UDF WARNING: Decimal expression overflowed, returning NULL" to the
> following (the original string with an additional "x").
> {noformat}
> UDF WARNING: Decimal expression overflowed, returning NULLx
> {noformat}
> Then we run this test using the following command with the command line
> argument '--update_results'.
> {code:java}
> $IMPALA_HOME/bin/impala-py.test \
> --update_results \
> --junitxml=$IMPALA_EE_TEST_LOGS_DIR/results/test_decimal.xml \
> $IMPALA_HOME/tests/query_test/test_decimal_queries.py::TestDecimalExprs::test_exprs
> {code}
> In $IMPALA_HOME/logs/ee_tests/QueryTest_decimal-exprs.test, we will find that
> the following subsection corresponding to the query. There are 3 additional
> newlines in the subsection of 'ERRORS'.
> {noformat}
> ---- ERRORS
> UDF WARNING: Decimal expression overflowed, returning NULL
> ====
> {noformat}
> One of the newlines was produced in
> [join_section_lines()|https://github.com/apache/impala/blob/master/tests/util/test_file_parser.py#L298].
> This function is called when the actual results do not match the expected
> results in the following 4 places.
> # [test_section['ERRORS'] =
> join_section_lines(actual_errors)|https://github.com/apache/impala/blob/master/tests/common/test_result_verifier.py#L398].
> # [test_section['TYPES'] = join_section_lines(\[',
> '.join(actual_types)\])|https://github.com/apache/impala/blob/master/tests/common/test_result_verifier.py#L429].
> # [test_section['LABELS'] = join_section_lines(\[',
> '.join(actual_labels)\])|https://github.com/apache/impala/blob/master/tests/common/test_result_verifier.py#L451].
> # [test_section[result_section] =
> join_section_lines(actual.result_list)|https://github.com/apache/impala/blob/master/tests/common/test_result_verifier.py#L489].
> Thus, we also have the same issue for subsections like TYPES, LABELS, and
> RESULTS in such a scenario (actual results do not match expected ones). It
> would be good if a user/developer does not have to manually remove those
> extra newlines when trying to generate the golden files for new test files.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]