Support of Nullable types in MySQL function

Add setting 'external_tables_use_nulls'
This commit is contained in:
Emmanuel Donin de Rosière 2019-02-07 14:34:58 +01:00
parent 98b70f524c
commit cde57600d9
2 changed files with 3 additions and 1 deletions

View File

@ -300,6 +300,7 @@ struct Settings
M(SettingBool, allow_experimental_multiple_joins_emulation, false, "Emulate multiple joins using subselects") \
M(SettingBool, allow_experimental_cross_to_join_conversion, false, "Convert CROSS JOIN to INNER JOIN if possible") \
M(SettingBool, cancel_http_readonly_queries_on_client_close, false, "Cancel HTTP readonly queries when a client closes the connection without waiting for response.") \
M(SettingBool, external_tables_use_nulls, true, "If it is set to true, external tables will implicitly use Nullable type if needed.") \
#define DECLARE(TYPE, NAME, DEFAULT, DESCRIPTION) \
TYPE NAME {DEFAULT};

View File

@ -158,7 +158,8 @@ StoragePtr TableFunctionMySQL::executeImpl(const ASTPtr & ast_function, const Co
(*block.getByPosition(0).column)[i].safeGet<String>(),
getDataType(
(*block.getByPosition(1).column)[i].safeGet<String>(),
(*block.getByPosition(2).column)[i].safeGet<UInt64>(),
(*block.getByPosition(2).column)[i].safeGet<UInt64>()
&& context.getSettings().external_tables_use_nulls,
(*block.getByPosition(3).column)[i].safeGet<UInt64>(),
(*block.getByPosition(4).column)[i].safeGet<UInt64>()));