/** * @return the metadata of the output partition to be written */ public static Map<String, String> getOutputPartitionMetadata(Map<String, String> arguments) { return FileSetProperties.propertiesWithPrefix(arguments, OUTPUT_PARTITION_METADATA_PREFIX); }
/** * @return the input format properties configured in the properties */ public static Map<String, String> getInputProperties(Map<String, String> properties) { return propertiesWithPrefix(properties, INPUT_PROPERTIES_PREFIX); }
/** * @return the output format properties configured in the properties */ public static Map<String, String> getOutputProperties(Map<String, String> properties) { return propertiesWithPrefix(properties, OUTPUT_PROPERTIES_PREFIX); }
/** * @return the Hive table properties configured in the properties */ public static Map<String, String> getTableProperties(Map<String, String> properties) { return propertiesWithPrefix(properties, PROPERTY_EXPLORE_TABLE_PROPERTY_PREFIX); }
/** * @return the properties for the explore format */ public static Map<String, String> getExploreFormatProperties(Map<String, String> properties) { String format = getExploreFormat(properties); if (format == null) { return Collections.emptyMap(); } return propertiesWithPrefix(properties, String.format("%s.%s.", PROPERTY_EXPLORE_FORMAT, format)); }
/** * @return the partition key of the output partition to be written; or null if no partition key was found * * @param arguments the runtime arguments for a partitioned dataset * @param partitioning the declared partitioning for the dataset, needed for proper interpretation of values */ @Nullable public static PartitionKey getOutputPartitionKey(Map<String, String> arguments, Partitioning partitioning) { // extract the arguments that describe the output partition key Map<String, String> keyArguments = FileSetProperties.propertiesWithPrefix(arguments, OUTPUT_PARTITION_KEY_PREFIX); if (keyArguments.isEmpty()) { return null; // there is no output partition key } // there is a partition key; now it is required to match the partitioning PartitionKey.Builder builder = PartitionKey.builder(); for (Map.Entry<String, FieldType> entry : partitioning.getFields().entrySet()) { String fieldName = entry.getKey(); FieldType fieldType = entry.getValue(); String stringValue = keyArguments.get(fieldName); Comparable fieldValue = convertFieldValue("key", "value", fieldName, fieldType, stringValue, false); builder.addField(fieldName, fieldValue); } return builder.build(); }