@@ -12,7 +12,7 @@ namespace ErrorCodes
1212 extern const int LOGICAL_ERROR;
1313}
1414
15- MetadataStorageType metadataTypeFromString (const String & type)
15+ MetadataStorageType metadataTypeFromString (const std::string & type)
1616{
1717 auto check_type = Poco::toLower (type);
1818 if (check_type == " local" )
@@ -60,25 +60,49 @@ std::string DataSourceDescription::toString() const
6060 case DataSourceType::RAM:
6161 return " memory" ;
6262 case DataSourceType::ObjectStorage:
63- {
64- switch (object_storage_type)
65- {
66- case ObjectStorageType::S3:
67- return " s3" ;
68- case ObjectStorageType::HDFS:
69- return " hdfs" ;
70- case ObjectStorageType::Azure:
71- return " azure_blob_storage" ;
72- case ObjectStorageType::Local:
73- return " local_blob_storage" ;
74- case ObjectStorageType::Web:
75- return " web" ;
76- case ObjectStorageType::None:
77- return " none" ;
78- case ObjectStorageType::Max:
79- throw Exception (ErrorCodes::LOGICAL_ERROR, " Unexpected object storage type: Max" );
80- }
81- }
63+ return DB::toString (object_storage_type);
8264 }
8365}
66+
67+ ObjectStorageType objectStorageTypeFromString (const std::string & type)
68+ {
69+ auto check_type = Poco::toLower (type);
70+ if (check_type == " s3" )
71+ return ObjectStorageType::S3;
72+ if (check_type == " hdfs" )
73+ return ObjectStorageType::HDFS;
74+ if (check_type == " azure_blob_storage" || check_type == " azure" )
75+ return ObjectStorageType::Azure;
76+ if (check_type == " local_blob_storage" || check_type == " local" )
77+ return ObjectStorageType::Local;
78+ if (check_type == " web" )
79+ return ObjectStorageType::Web;
80+ if (check_type == " none" )
81+ return ObjectStorageType::None;
82+
83+ throw Exception (ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG,
84+ " Unknown object storage type: {}" , type);
85+ }
86+
87+ std::string toString (ObjectStorageType type)
88+ {
89+ switch (type)
90+ {
91+ case ObjectStorageType::S3:
92+ return " s3" ;
93+ case ObjectStorageType::HDFS:
94+ return " hdfs" ;
95+ case ObjectStorageType::Azure:
96+ return " azure_blob_storage" ;
97+ case ObjectStorageType::Local:
98+ return " local_blob_storage" ;
99+ case ObjectStorageType::Web:
100+ return " web" ;
101+ case ObjectStorageType::None:
102+ return " none" ;
103+ case ObjectStorageType::Max:
104+ throw Exception (ErrorCodes::LOGICAL_ERROR, " Unexpected object storage type: Max" );
105+ }
106+ }
107+
84108}
0 commit comments