| 815 | } |
| 816 | |
| 817 | ColumnPtr executeForNullableThenElse(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const |
| 818 | { |
| 819 | const ColumnWithTypeAndName & arg_cond = arguments[0]; |
| 820 | const ColumnWithTypeAndName & arg_then = arguments[1]; |
| 821 | const ColumnWithTypeAndName & arg_else = arguments[2]; |
| 822 | |
| 823 | const auto * then_is_nullable = checkAndGetColumn<ColumnNullable>(*arg_then.column); |
| 824 | const auto * else_is_nullable = checkAndGetColumn<ColumnNullable>(*arg_else.column); |
| 825 | |
| 826 | if (!then_is_nullable && !else_is_nullable) |
| 827 | return nullptr; |
| 828 | |
| 829 | /** Calculate null mask of result and nested column separately. |
| 830 | */ |
| 831 | ColumnPtr result_null_mask; |
| 832 | |
| 833 | { |
| 834 | ColumnsWithTypeAndName temporary_columns( |
| 835 | { |
| 836 | arg_cond, |
| 837 | { |
| 838 | then_is_nullable |
| 839 | ? then_is_nullable->getNullMapColumnPtr() |
| 840 | : DataTypeUInt8().createColumnConstWithDefaultValue(input_rows_count), |
| 841 | std::make_shared<DataTypeUInt8>(), |
| 842 | "" |
| 843 | }, |
| 844 | { |
| 845 | else_is_nullable |
| 846 | ? else_is_nullable->getNullMapColumnPtr() |
| 847 | : DataTypeUInt8().createColumnConstWithDefaultValue(input_rows_count), |
| 848 | std::make_shared<DataTypeUInt8>(), |
| 849 | "" |
| 850 | } |
| 851 | }); |
| 852 | |
| 853 | result_null_mask = executeImpl(temporary_columns, std::make_shared<DataTypeUInt8>(), input_rows_count); |
| 854 | } |
| 855 | |
| 856 | ColumnPtr result_nested_column; |
| 857 | |
| 858 | { |
| 859 | ColumnsWithTypeAndName temporary_columns( |
| 860 | { |
| 861 | arg_cond, |
| 862 | { |
| 863 | recursiveGetNestedColumnWithoutNullable(arg_then.column), |
| 864 | removeNullable(arg_then.type), |
| 865 | "" |
| 866 | }, |
| 867 | { |
| 868 | recursiveGetNestedColumnWithoutNullable(arg_else.column), |
| 869 | removeNullable(arg_else.type), |
| 870 | "" |
| 871 | } |
| 872 | }); |
| 873 | |
| 874 | result_nested_column = executeImpl(temporary_columns, removeNullable(result_type), temporary_columns.front().column->size()); |
nothing calls this directly
no test coverage detected