**Use case**

We want to import a CSV file which may contain malformed column values
(like non-numeric characters in an Int32 column). While doing that we
want to skip invalid rows and continue inserting valid rows, and also
gather information about rows that have been skipped (such as line
numbers).

If we directly use the regular INSERT statement for inserting data,
the entire statement fails once it encounters an erroneous row. So we
tried inserting them as String into a temporary table, and copying
only valid rows to the final table.

To filter valid rows we tried doing something like `CAST(x, 'Nullable(Int32)')`,
but it turned out the following two cases throw
exceptions as opposed to returning NULL values:

1. SELECT cast('CCC', 'Nullable(Enum(\'AAA\'=1,\'BBB\'=2))')
2. SELECT cast('[\'AAA\',\'BBB\']', 'Nullable(Array(Enum(\'AAA\'=1,\'BBB\'=2)))')

**Describe the solution you'd like**

For (1) returning NULL would be the expected behavior.

For (2) `Nullable(Array(X))` being prohibited (#1062) is the source of
the problem. The most intuitive solution would be to allow `CAST(x,
'Nullable(Array(Enum(...)))')`
and return `NULL` when the conversion fails.

**Describe alternatives you've considered**

Adding another function ``tryCast(value, type)`` which is like
``cast()`` but has a special case on ``tryCast(x, 'Array(...)')``. In
case of error it returns an empty array if the destination type is
`Array(...)`, but for any other types it returns `NULL`.

#include <Columns/ColumnLowCardinality.h>
#include <Functions/toFixedString.h>
namespace DB
{
namespace ErrorCodes
{
    extern const int ATTEMPT_TO_READ_AFTER_EOF;
    extern const int CANNOT_PARSE_NUMBER;
    extern const int CANNOT_READ_ARRAY_FROM_TEXT;
    extern const int CANNOT_PARSE_INPUT_ASSERTION_FAILED;
    extern const int CANNOT_PARSE_QUOTED_STRING;
    extern const int CANNOT_PARSE_ESCAPE_SEQUENCE;
    extern const int CANNOT_PARSE_DATE;
    extern const int CANNOT_PARSE_DATETIME;
    extern const int CANNOT_PARSE_TEXT;
    extern const int CANNOT_PARSE_UUID;
    extern const int TOO_FEW_ARGUMENTS_FOR_FUNCTION;
    extern const int LOGICAL_ERROR;
    extern const int TYPE_MISMATCH;
    extern const int CANNOT_CONVERT_TYPE;
    extern const int ILLEGAL_COLUMN;
    extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
    extern const int ILLEGAL_TYPE_OF_ARGUMENT;
    extern const int NOT_IMPLEMENTED;
    extern const int CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN;
}
/** Type conversion functions.
  * toType - conversion in "natural way";
  */
inline UInt32 extractToDecimalScale(const ColumnWithTypeAndName & named_column)