From 10fae040070d36b371dba11102893d0e87ebd117 Mon Sep 17 00:00:00 2001 From: v-zhangjc9 Date: Wed, 8 May 2024 14:14:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(hudi-query):=20=E4=BF=AE=E5=A4=8D=E5=86=99h?= =?UTF-8?q?dfs=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9=E5=8F=96=E5=80=BC?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/httpRequests/http-requests-log.http | 36 ++++++++++++++----- .../service/forest/service/HudiService.java | 10 +++--- test/test.http | 19 +++++++++- 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/.idea/httpRequests/http-requests-log.http b/.idea/httpRequests/http-requests-log.http index 027af86..6946787 100644 --- a/.idea/httpRequests/http-requests-log.http +++ b/.idea/httpRequests/http-requests-log.http @@ -1,3 +1,31 @@ +POST http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@b12s8.hdp.dc:15391/hdfs/write?root=hdfs://b2/apps/datalake/test/test.txt&overwrite=true +Content-Type: text/plain +Content-Length: 738 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.10) +Cookie: JSESSIONID=E6FF5447C8553BA4268979B8C5779363 +Accept-Encoding: br,deflate,gzip,x-gzip + +\#Properties saved on 2023-12-26T09:18:39.583Z +\#Tue Dec 26 17:18:39 CST 2023 +hoodie.table.precombine.field=update_ts +hoodie.datasource.write.drop.partition.columns=false +hoodie.table.partition.fields=CITY_ID +hoodie.table.type=MERGE_ON_READ +hoodie.archivelog.folder=archived +hoodie.compaction.payload.class=org.apache.hudi.common.model.OverwriteWithLatestAvroPayload +hoodie.timeline.layout.version=1 +hoodie.table.version=4 +hoodie.table.recordkey.fields=_key +hoodie.datasource.write.partitionpath.urlencode=false +hoodie.table.name=dws_account +hoodie.table.keygenerator.class=org.apache.hudi.keygen.SimpleKeyGenerator +hoodie.table.timeline.timezone=LOCAL +hoodie.datasource.write.hive_style_partitioning=false +hoodie.table.checksum=989688289 + +### + POST http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@b12s8.hdp.dc:15391/hdfs/write?root=hdfs://b2/apps/datalake/test/test.txt&overwrite=true Content-Length: 11 Content-Type: */*; charset=UTF-8 @@ -426,11 +454,3 @@ Accept-Encoding: br,deflate,gzip,x-gzip ### -GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/queue/queue/clear?name=compaction-queue-pre -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9) -Cookie: JSESSIONID=9AB8D98C10FACE15EA1CB758D79F8877 -Accept-Encoding: br,deflate,gzip,x-gzip - -### - diff --git a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/HudiService.java b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/HudiService.java index 12bde31..33882b4 100644 --- a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/HudiService.java +++ b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/HudiService.java @@ -1,6 +1,8 @@ package com.lanyuanxiaoyao.service.forest.service; import com.dtflys.forest.annotation.BaseRequest; +import com.dtflys.forest.annotation.Body; +import com.dtflys.forest.annotation.BodyType; import com.dtflys.forest.annotation.Get; import com.dtflys.forest.annotation.Post; import com.dtflys.forest.annotation.Query; @@ -77,11 +79,11 @@ public interface HudiService { @Get("/hdfs/read") String read(@Query("root") String root); - @Post("/hdfs/write") - String write(@Query("root") String root, String text); + @Post(value = "/hdfs/write", contentType = "plain/text") + String write(@Query("root") String root, @Body String text); - @Post("/hdfs/write") - String write(@Query("root") String root, String text, @Query("overwrite") Boolean overwrite); + @Post(value = "/hdfs/write", contentType = "plain/text") + String write(@Query("root") String root, @Body String text, @Query("overwrite") Boolean overwrite); @Get("/hdfs/download") InputStream download(@Query("root") String root); diff --git a/test/test.http b/test/test.http index 97084a4..f062ee5 100644 --- a/test/test.http +++ b/test/test.http @@ -102,5 +102,22 @@ GET http://{{username}}:{{password}}@b12s10.hdp.dc:16695/hdfs/list?root=hdfs://b ### Test HDFS write POST http://{{username}}:{{password}}@b12s8.hdp.dc:15391/hdfs/write?root=hdfs://b2/apps/datalake/test/test.txt&overwrite=true +Content-Type: text/plain -Hello world +\#Properties saved on 2023-12-26T09:18:39.583Z +\#Tue Dec 26 17:18:39 CST 2023 +hoodie.table.precombine.field=update_ts +hoodie.datasource.write.drop.partition.columns=false +hoodie.table.partition.fields=CITY_ID +hoodie.table.type=MERGE_ON_READ +hoodie.archivelog.folder=archived +hoodie.compaction.payload.class=org.apache.hudi.common.model.OverwriteWithLatestAvroPayload +hoodie.timeline.layout.version=1 +hoodie.table.version=4 +hoodie.table.recordkey.fields=_key +hoodie.datasource.write.partitionpath.urlencode=false +hoodie.table.name=dws_account +hoodie.table.keygenerator.class=org.apache.hudi.keygen.SimpleKeyGenerator +hoodie.table.timeline.timezone=LOCAL +hoodie.datasource.write.hive_style_partitioning=false +hoodie.table.checksum=989688289