You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "houyuting (via GitHub)" <gi...@apache.org> on 2025/01/08 03:11:20 UTC

[PR] Support ShowRecordLocationProcedure [hudi]

houyuting opened a new pull request, #12599:
URL: https://github.com/apache/hudi/pull/12599

   ### Change Logs
   
     Add show record location procedure feature , The pr is aim to  locate the bucket id and then the hdfs data file through the record key, it  is faster compared to select ${record_key} from table.
   
   ### Impact
   
   none
   
   ### Risk level (write none, low medium or high below)
   
   none
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12599:
URL: https://github.com/apache/hudi/pull/12599#issuecomment-2576628389

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1cfba1a6b7a6c8b2de86839f87b7823a82b52d36",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=2715",
       "triggerID" : "1cfba1a6b7a6c8b2de86839f87b7823a82b52d36",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1cfba1a6b7a6c8b2de86839f87b7823a82b52d36 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=2715) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on PR #12599:
URL: https://github.com/apache/hudi/pull/12599#issuecomment-2576951466

   The task is not minor, can you create a JIRA task to trace it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "TheR1sing3un (via GitHub)" <gi...@apache.org>.
TheR1sing3un commented on PR #12599:
URL: https://github.com/apache/hudi/pull/12599#issuecomment-2579166993

   Nice work! 
   But I think if we could implement a more general procedure instead of just using it for bucket indexes? Instead of passing in the `record_key`, we pass in the primary key/index columns` and then we `tag` the table based on its own index to find the corresponding file group or even file name.
   Thanks for your contribution, this procedure can be combined with cli tools later, which can greatly improve our daily troubleshooting efficiency.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12599:
URL: https://github.com/apache/hudi/pull/12599#issuecomment-2576722735

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1cfba1a6b7a6c8b2de86839f87b7823a82b52d36",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=2715",
       "triggerID" : "1cfba1a6b7a6c8b2de86839f87b7823a82b52d36",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1cfba1a6b7a6c8b2de86839f87b7823a82b52d36 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=2715) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "yuzhaojing (via GitHub)" <gi...@apache.org>.
yuzhaojing commented on code in PR #12599:
URL: https://github.com/apache/hudi/pull/12599#discussion_r1906543896


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/ShowRecordLocationProcedure.scala:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.hudi.command.procedures
+
+import java.util.function.Supplier
+
+import org.apache.hadoop.fs.{FileStatus, FileSystem, Path, PathFilter}
+import org.apache.hudi.common.fs.FSUtils
+import org.apache.hudi.common.model.HoodieKey
+import org.apache.hudi.exception.HoodieException
+import org.apache.hudi.hadoop.fs.HadoopFSUtils
+import org.apache.hudi.index.bucket.BucketIdentifier
+import org.apache.spark.internal.Logging
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.types.{DataTypes, Metadata, StructField, StructType}
+
+import scala.collection.JavaConverters._
+import scala.util.{Failure, Success, Try}
+
+class ShowRecordLocationProcedure extends BaseProcedure with ProcedureBuilder with Logging {
+  private val PARAMETERS = Array[ProcedureParameter](
+    ProcedureParameter.required(0, "table", DataTypes.StringType),
+    ProcedureParameter.required(1, "partition_path", DataTypes.StringType),
+    ProcedureParameter.required(2, "record_key", DataTypes.StringType),

Review Comment:
   Can it support multiple record keys?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12599:
URL: https://github.com/apache/hudi/pull/12599#issuecomment-2576625543

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1cfba1a6b7a6c8b2de86839f87b7823a82b52d36",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1cfba1a6b7a6c8b2de86839f87b7823a82b52d36",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1cfba1a6b7a6c8b2de86839f87b7823a82b52d36 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "yuzhaojing (via GitHub)" <gi...@apache.org>.
yuzhaojing commented on code in PR #12599:
URL: https://github.com/apache/hudi/pull/12599#discussion_r1906542891


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/ShowRecordLocationProcedure.scala:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.hudi.command.procedures
+
+import java.util.function.Supplier
+
+import org.apache.hadoop.fs.{FileStatus, FileSystem, Path, PathFilter}
+import org.apache.hudi.common.fs.FSUtils
+import org.apache.hudi.common.model.HoodieKey
+import org.apache.hudi.exception.HoodieException
+import org.apache.hudi.hadoop.fs.HadoopFSUtils
+import org.apache.hudi.index.bucket.BucketIdentifier
+import org.apache.spark.internal.Logging
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.types.{DataTypes, Metadata, StructField, StructType}
+
+import scala.collection.JavaConverters._
+import scala.util.{Failure, Success, Try}
+
+class ShowRecordLocationProcedure extends BaseProcedure with ProcedureBuilder with Logging {

Review Comment:
   Is this procedure only applicable to the bucket index? Can we extend it to all index types? Alternatively, we can add the verification of the bucket index in this pull request (PR) and deal with the remaining index types directly in subsequent pull requests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MINOR]Support ShowRecordLocationProcedure [hudi]

Posted by "yuzhaojing (via GitHub)" <gi...@apache.org>.
yuzhaojing commented on PR #12599:
URL: https://github.com/apache/hudi/pull/12599#issuecomment-2576848681

   Thanks for your contribution, left some comments.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org