You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "simhadri-g (via GitHub)" <gi...@apache.org> on 2023/05/24 14:41:52 UTC

[GitHub] [hive] simhadri-g commented on a diff in pull request #4346: HIVE-26832: Implement SHOW PARTITIONS for Iceberg Tables

simhadri-g commented on code in PR #4346:
URL: https://github.com/apache/hive/pull/4346#discussion_r1204289566


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -1391,4 +1403,64 @@ Boolean hasAppendsOnly(Iterable<Snapshot> snapshots, SnapshotContext since) {
 
     return null;
   }
+
+  @Override
+  public List<String> showPartitions(DDLOperationContext context, org.apache.hadoop.hive.ql.metadata.Table hmstbl) {
+    Configuration confs = context.getConf();
+    Path path = new Path(hmstbl.getParameters().get("metadata_location"));
+    List<String> parts = Lists.newArrayList();
+    JobConf job = HiveTableUtil.getJobConf(confs, path, hmstbl);
+    Class<? extends InputFormat> formatter = hmstbl.getInputFormatClass();
+
+    try {
+      InputFormat inputFormat = FetchOperator.getInputFormatFromCache(formatter, job);
+      InputSplit[] splits = inputFormat.getSplits(job, 1);
+      try (RecordReader<WritableComparable, Writable> reader = inputFormat.getRecordReader(splits[0], job,
+          Reporter.NULL)) {
+        parts = getParts(context, job, reader, hmstbl);
+      }
+      return parts;
+    } catch (Exception e) {
+      LOG.warn("Warn:", e);

Review Comment:
   Sure, i have updated the PR.  :) 



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org