add example for test

This commit is contained in:
taiyang-li 2023-06-26 16:50:18 +08:00
parent 1d2600f706
commit d208b0de3d
2 changed files with 11 additions and 5 deletions

View File

@ -73,3 +73,9 @@ target_link_libraries (snappy_read_buffer PRIVATE clickhouse_common_io)
clickhouse_add_executable (hadoop_snappy_read_buffer hadoop_snappy_read_buffer.cpp)
target_link_libraries (hadoop_snappy_read_buffer PRIVATE clickhouse_common_io)
if (TARGET ch_contrib::hdfs)
clickhouse_add_executable (read_buffer_from_hdfs read_buffer_from_hdfs.cpp)
target_link_libraries (read_buffer_from_hdfs PRIVATE dbms ch_contrib::hdfs)
endif ()

View File

@ -11,15 +11,15 @@ using namespace DB;
int main()
{
setenv("LIBHDFS3_CONF", "/data1/clickhouse_official/conf/hdfs-site.bigocluster.xml", true); /// NOLINT
String hdfs_uri = "hdfs://bigocluster";
String hdfs_file_path = "/data/hive/report_tb.db/bigolive_wj_pos_sdk_video_stats_event_allv1/day=2023-03-14/"
"part-00014-272de29e-098c-4007-987a-f6b7ae740402-c000";
setenv("LIBHDFS3_CONF", "/path/to/hdfs-site.xml", true); /// NOLINT
String hdfs_uri = "hdfs://cluster_name";
String hdfs_file_path = "/path/to/hdfs/file";
ConfigurationPtr config = Poco::AutoPtr(new Poco::Util::MapConfiguration());
ReadSettings read_settings;
ReadBufferFromHDFS read_buffer(hdfs_uri, hdfs_file_path, *config, read_settings, 625150306UL, false);
ReadBufferFromHDFS read_buffer(hdfs_uri, hdfs_file_path, *config, read_settings, 2097152UL, false);
String download_path = "./download";
WriteBufferFromFile write_buffer(download_path);
copyData(read_buffer, write_buffer);
return 0;
}