sudhar91 commented on code in PR #592:
URL: https://github.com/apache/incubator-xtable/pull/592#discussion_r1885714144
##########
xtable-core/src/main/java/org/apache/xtable/parquet/ParquetPartitionHelper.java:
##########
@@ -0,0 +1,69 @@
+package org.apache.xtable.parquet;
+
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.xtable.model.schema.InternalPartitionField;
+import org.apache.xtable.model.schema.InternalSchema;
+import org.apache.xtable.model.schema.PartitionTransformType;
+import org.apache.xtable.model.stat.PartitionValue;
+import org.apache.xtable.model.stat.Range;
+import org.apache.xtable.schema.SchemaFieldFinder;
+
+public class ParquetPartitionHelper {
+ private static final ParquetPartitionHelper INSTANCE = new
ParquetPartitionHelper();
+
+ public static ParquetPartitionHelper getInstance() {
+ return INSTANCE;
+ }
+
+ public List<InternalPartitionField> getInternalPartitionField(
+ Set<String> partitionList, InternalSchema schema) {
+ List<InternalPartitionField> partitionFields = new ArrayList<>();
+
+ for (String partitionKey : partitionList) {
+
+ partitionFields.add(
+ InternalPartitionField.builder()
+
.sourceField(SchemaFieldFinder.getInstance().findFieldByPath(schema,
partitionKey))
+ .transformType(PartitionTransformType.VALUE)
+ .build());
+ }
+
+ return partitionFields;
+ }
+
+ // TODO logic is too complicated can be simplified
+ public List<PartitionValue> getPartitionValue(
+ String basePath,
+ String filePath,
+ InternalSchema schema,
+ Map<String, List<String>> partitionInfo) {
+ List<PartitionValue> partitionValues = new ArrayList<>();
+ java.nio.file.Path base = Paths.get(basePath).normalize();
Review Comment:
Noted , overall i need to simplify the logic as it is bit complicated
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]