diff --git a/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.cpp b/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.cpp index d0574e7ff2693..9da29134f8194 100644 --- a/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.cpp +++ b/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.cpp @@ -54,8 +54,8 @@ void NormalFileWriter::close() writer->finish(); } -FileWriterWrapper * -createFileWriterWrapper(const std::string & file_uri, const std::vector & preferred_column_names, const std::string & format_hint) +std::unique_ptr +createFileWriterWrapper(const std::string & file_uri, const DB::Names & preferred_column_names, const std::string & format_hint) { // the passed in file_uri is exactly what is expected to see in the output folder // e.g /xxx/中文/timestamp_field=2023-07-13 03%3A00%3A17.622/abc.parquet @@ -66,7 +66,7 @@ createFileWriterWrapper(const std::string & file_uri, const std::vector(file, context); } } diff --git a/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.h b/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.h index 5c8061c5e5193..b3cad774612f7 100644 --- a/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.h +++ b/cpp-ch/local-engine/Storages/Output/FileWriterWrappers.h @@ -65,6 +65,6 @@ class NormalFileWriter : public FileWriterWrapper std::unique_ptr writer; }; -FileWriterWrapper * -createFileWriterWrapper(const std::string & file_uri, const std::vector & preferred_column_names, const std::string & format_hint); +std::unique_ptr +createFileWriterWrapper(const std::string & file_uri, const DB::Names & preferred_column_names, const std::string & format_hint); } diff --git a/cpp-ch/local-engine/local_engine_jni.cpp b/cpp-ch/local-engine/local_engine_jni.cpp index 44662c36ce4a2..219c65f7ff0f3 100644 --- a/cpp-ch/local-engine/local_engine_jni.cpp +++ b/cpp-ch/local-engine/local_engine_jni.cpp @@ -860,7 +860,7 @@ JNIEXPORT jlong Java_org_apache_spark_sql_execution_datasources_CHDatasourceJniW auto file_uri = jstring_to_cstring(env, file_uri_); auto format_hint = jstring_to_cstring(env, format_hint_); // for HiveFileFormat, the file url may not end with .parquet, so we pass in the format as a hint - auto * writer = local_engine::createFileWriterWrapper(file_uri, names, format_hint); + auto * writer = local_engine::createFileWriterWrapper(file_uri, names, format_hint).release(); return reinterpret_cast(writer); LOCAL_ENGINE_JNI_METHOD_END(env, 0) }