mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix comments
This commit is contained in:
parent
a71f9eb9e4
commit
f69c3175af
@ -2516,6 +2516,7 @@ protected:
|
||||
}
|
||||
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
/// CAST(Nothing, T) -> T
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
bool useDefaultImplementationForConstants() const override { return true; }
|
||||
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
|
||||
|
@ -51,6 +51,9 @@ public:
|
||||
}
|
||||
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
/// It's possible if expression_actions contains function that don't use
|
||||
/// default implementation for Nothing.
|
||||
/// Example: arrayMap(x -> CAST(x, 'UInt8'), []);
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
|
||||
private:
|
||||
@ -119,6 +122,9 @@ public:
|
||||
String getName() const override { return "FunctionCapture"; }
|
||||
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
/// It's possible if expression_actions contains function that don't use
|
||||
/// default implementation for Nothing and one of captured columns can be Nothing
|
||||
/// Example: SELECT arrayMap(x -> [x, arrayElement(y, 0)], []), [] as y
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
|
||||
|
||||
@ -249,6 +255,7 @@ public:
|
||||
|
||||
String getName() const override { return name; }
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
/// See comment in ExecutableFunctionCapture.
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
|
||||
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName &) const override { return return_type; }
|
||||
|
@ -225,8 +225,9 @@ ColumnPtr IExecutableFunction::defaultImplementationForNothing(
|
||||
getName(),
|
||||
result_type->getName());
|
||||
|
||||
return ColumnConst::create(ColumnNothing::create(1), input_rows_count);
|
||||
|
||||
if (input_rows_count > 0)
|
||||
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Cannot create non-empty column with type Nothing");
|
||||
return ColumnNothing::create(0);
|
||||
}
|
||||
|
||||
ColumnPtr IExecutableFunction::executeWithoutLowCardinalityColumns(
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
}
|
||||
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
/// array(..., Nothing, ...) -> Array(..., Nothing, ...)
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
bool useDefaultImplementationForConstants() const override { return true; }
|
||||
|
||||
|
@ -7,6 +7,12 @@
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int ILLEGAL_COLUMN;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -33,7 +39,6 @@ public:
|
||||
|
||||
size_t getNumberOfArguments() const override { return 1; }
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
bool useDefaultImplementationForConstants() const override { return true; }
|
||||
ColumnNumbers getArgumentsThatDontImplyNullableReturnType(size_t /*number_of_arguments*/) const override { return {0}; }
|
||||
|
||||
@ -46,6 +51,9 @@ public:
|
||||
{
|
||||
const ColumnPtr & col = arguments[0].column;
|
||||
|
||||
if (arguments[0].type->onlyNull() && !col->empty())
|
||||
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Cannot create non-empty column with type Nothing");
|
||||
|
||||
if (const auto * nullable_col = checkAndGetColumn<ColumnNullable>(*col))
|
||||
return nullable_col->getNestedColumnPtr();
|
||||
else
|
||||
|
@ -39,8 +39,6 @@ public:
|
||||
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
|
||||
bool isSuitableForConstantFolding() const override { return false; }
|
||||
|
||||
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return false; }
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return true; }
|
||||
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
/// map(..., Nothing) -> Map(..., Nothing)
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
bool useDefaultImplementationForConstants() const override { return true; }
|
||||
|
||||
|
@ -23,11 +23,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool useDefaultImplementationForNothing() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Get the function name.
|
||||
String getName() const override
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return false; }
|
||||
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
/// tuple(..., Nothing, ...) -> Tuple(..., Nothing, ...)
|
||||
bool useDefaultImplementationForNothing() const override { return false; }
|
||||
bool useDefaultImplementationForConstants() const override { return true; }
|
||||
|
||||
|
@ -4,32 +4,26 @@ Array(Nothing)
|
||||
Array(Nothing)
|
||||
[]
|
||||
Array(Nothing)
|
||||
Array(Nothing)
|
||||
Array(Nothing)
|
||||
[]
|
||||
Array(Nothing)
|
||||
Array(String)
|
||||
Array(Nothing)
|
||||
Array(Nothing)
|
||||
|
||||
Nothing
|
||||
Const(Nothing)
|
||||
Nothing
|
||||
Const(Nothing)
|
||||
Array(Array(Nothing))
|
||||
Array(Array(Nothing))
|
||||
Array(Map(UInt8, Nothing))
|
||||
Array(Map(UInt8, Nothing))
|
||||
Array(Tuple(Nothing))
|
||||
Array(Tuple(UInt8, Nothing))
|
||||
Nothing
|
||||
Nothing
|
||||
Nothing
|
||||
Nothing
|
||||
Array(Nothing)
|
||||
Const(Array(Nothing))
|
||||
Array(Nothing)
|
||||
Array(Nothing)
|
||||
Map(UInt8, Nothing)
|
||||
Const(Map(UInt8, Nothing))
|
||||
Map(UInt8, Nothing)
|
||||
Map(UInt8, Nothing)
|
||||
Tuple(UInt8, Nothing)
|
||||
Const(Tuple(UInt8, Nothing))
|
||||
Tuple(UInt8, Nothing)
|
||||
Tuple(UInt8, Nothing)
|
||||
Nothing
|
||||
Const(Nothing)
|
||||
Nothing
|
||||
Nothing
|
||||
|
@ -5,39 +5,36 @@ select toTypeName(arrayMap((x, y) -> x + y, [], []));
|
||||
select arrayMap((x, y) -> x + y, [], CAST([], 'Array(Int32)'));
|
||||
select toTypeName(arrayMap((x, y) -> x + y, [], CAST([], 'Array(Int32)')));
|
||||
|
||||
select toTypeName(arrayMap(x -> 2 * x, [assumeNotNull(NULL)]));
|
||||
select toColumnTypeName(arrayMap(x -> 2 * x, [assumeNotNull(NULL)]));
|
||||
|
||||
select arrayFilter(x -> 2 * x < 0, []);
|
||||
select toTypeName(arrayFilter(x -> 2 * x < 0, []));
|
||||
select toTypeName(arrayFilter(x -> 2 * x < 0, [assumeNotNull(NULL)]));
|
||||
select toColumnTypeName(arrayFilter(x -> 2 * x < 0, [assumeNotNull(NULL)]));
|
||||
|
||||
select CAST(assumeNotNull(NULL), 'String');
|
||||
select toTypeName(toInt32(assumeNotNull(NULL)));
|
||||
select toColumnTypeName(toInt32(assumeNotNull(NULL)));
|
||||
select toTypeName(arrayMap(x -> CAST(x, 'String'), []));
|
||||
select toTypeName(arrayMap(x -> toInt32(x), []));
|
||||
select toColumnTypeName(arrayMap(x -> toInt32(x), []));
|
||||
|
||||
select toTypeName(arrayMap(x -> [x], []));
|
||||
select toColumnTypeName(arrayMap(x -> [x], []));
|
||||
|
||||
select toTypeName(arrayMap(x ->map(1, x), []));
|
||||
select toColumnTypeName(arrayMap(x -> map(1, x), []));
|
||||
|
||||
select toTypeName(arrayMap(x ->tuple(x), []));
|
||||
select toColumnTypeName(arrayMap(x -> tuple(1, x), []));
|
||||
|
||||
select toTypeName(toInt32(assumeNotNull(materialize(NULL))));
|
||||
select toColumnTypeName(toInt32(assumeNotNull(materialize(NULL))));
|
||||
|
||||
select toTypeName(assumeNotNull(NULL));
|
||||
select toColumnTypeName(assumeNotNull(NULL));
|
||||
select toTypeName(assumeNotNull(materialize(NULL)));
|
||||
select toColumnTypeName(assumeNotNull(materialize(NULL)));
|
||||
|
||||
select toTypeName([assumeNotNull(NULL)]);
|
||||
select toColumnTypeName([assumeNotNull(NULL)]);
|
||||
select toTypeName([assumeNotNull(materialize(NULL))]);
|
||||
select toColumnTypeName([assumeNotNull(materialize(NULL))]);
|
||||
|
||||
select toTypeName(map(1, assumeNotNull(NULL)));
|
||||
select toColumnTypeName(map(1, assumeNotNull(NULL)));
|
||||
select toTypeName(map(1, assumeNotNull(materialize(NULL))));
|
||||
select toColumnTypeName(map(1, assumeNotNull(materialize(NULL))));
|
||||
|
||||
select toTypeName(tuple(1, assumeNotNull(NULL)));
|
||||
select toColumnTypeName(tuple(1, assumeNotNull(NULL)));
|
||||
select toTypeName(tuple(1, assumeNotNull(materialize(NULL))));
|
||||
select toColumnTypeName(tuple(1, assumeNotNull(materialize(NULL))));
|
||||
|
||||
select toTypeName(assumeNotNull(NULL) * 2);
|
||||
select toColumnTypeName(assumeNotNull(NULL) * 2);
|
||||
select toTypeName(assumeNotNull(materialize(NULL)) * 2);
|
||||
select toColumnTypeName(assumeNotNull(materialize(NULL)) * 2);
|
||||
|
@ -0,0 +1,3 @@
|
||||
OK
|
||||
OK
|
||||
OK
|
10
tests/queries/0_stateless/02294_nothing_arguments_in_functions_errors.sh
Executable file
10
tests/queries/0_stateless/02294_nothing_arguments_in_functions_errors.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(NULL)" 2>&1 | grep -q "ILLEGAL_COLUMN" && echo "OK" || echo "FAIL"
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(materialize(NULL))" 2>&1 | grep -q "ILLEGAL_TYPE_OF_ARGUMENT" && echo "OK" || echo "FAIL"
|
||||
$CLICKHOUSE_LOCAL -q "SELECT assumeNotNull(materialize(NULL)) from numbers(10)" 2>&1 | grep -q "ILLEGAL_TYPE_OF_ARGUMENT" && echo "OK" || echo "FAIL"
|
||||
|
Loading…
Reference in New Issue
Block a user