Search in sources :

Example 6 with DFSPropertiesConfiguration

use of org.apache.hudi.common.config.DFSPropertiesConfiguration in project hudi by apache.

the class UtilHelpers method readConfig.

public static DFSPropertiesConfiguration readConfig(Configuration hadoopConfig, Path cfgPath, List<String> overriddenProps) {
    DFSPropertiesConfiguration conf = new DFSPropertiesConfiguration(hadoopConfig, cfgPath);
    try {
        if (!overriddenProps.isEmpty()) {
            LOG.info("Adding overridden properties to file properties.");
            conf.addPropsFromStream(new BufferedReader(new StringReader(String.join("\n", overriddenProps))));
        }
    } catch (IOException ioe) {
        throw new HoodieIOException("Unexpected error adding config overrides", ioe);
    }
    return conf;
}
Also used : HoodieIOException(org.apache.hudi.exception.HoodieIOException) BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader) IOException(java.io.IOException) HoodieIOException(org.apache.hudi.exception.HoodieIOException) DFSPropertiesConfiguration(org.apache.hudi.common.config.DFSPropertiesConfiguration)

Example 7 with DFSPropertiesConfiguration

use of org.apache.hudi.common.config.DFSPropertiesConfiguration in project hudi by apache.

the class UtilHelpers method getConfig.

public static DFSPropertiesConfiguration getConfig(List<String> overriddenProps) {
    DFSPropertiesConfiguration conf = new DFSPropertiesConfiguration();
    try {
        if (!overriddenProps.isEmpty()) {
            LOG.info("Adding overridden properties to file properties.");
            conf.addPropsFromStream(new BufferedReader(new StringReader(String.join("\n", overriddenProps))));
        }
    } catch (IOException ioe) {
        throw new HoodieIOException("Unexpected error adding config overrides", ioe);
    }
    return conf;
}
Also used : HoodieIOException(org.apache.hudi.exception.HoodieIOException) BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader) IOException(java.io.IOException) HoodieIOException(org.apache.hudi.exception.HoodieIOException) DFSPropertiesConfiguration(org.apache.hudi.common.config.DFSPropertiesConfiguration)

Example 8 with DFSPropertiesConfiguration

use of org.apache.hudi.common.config.DFSPropertiesConfiguration in project hudi by apache.

the class StreamerUtil method readConfig.

/**
 * Read config from properties file (`--props` option) and cmd line (`--hoodie-conf` option).
 */
public static DFSPropertiesConfiguration readConfig(org.apache.hadoop.conf.Configuration hadoopConfig, Path cfgPath, List<String> overriddenProps) {
    DFSPropertiesConfiguration conf = new DFSPropertiesConfiguration(hadoopConfig, cfgPath);
    try {
        if (!overriddenProps.isEmpty()) {
            LOG.info("Adding overridden properties to file properties.");
            conf.addPropsFromStream(new BufferedReader(new StringReader(String.join("\n", overriddenProps))));
        }
    } catch (IOException ioe) {
        throw new HoodieIOException("Unexpected error adding config overrides", ioe);
    }
    return conf;
}
Also used : HoodieIOException(org.apache.hudi.exception.HoodieIOException) BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader) IOException(java.io.IOException) HoodieIOException(org.apache.hudi.exception.HoodieIOException) DFSPropertiesConfiguration(org.apache.hudi.common.config.DFSPropertiesConfiguration)

Aggregations

DFSPropertiesConfiguration (org.apache.hudi.common.config.DFSPropertiesConfiguration)8 Path (org.apache.hadoop.fs.Path)5 TypedProperties (org.apache.hudi.common.config.TypedProperties)5 Test (org.junit.jupiter.api.Test)5 BufferedReader (java.io.BufferedReader)3 IOException (java.io.IOException)3 StringReader (java.io.StringReader)3 HoodieIOException (org.apache.hudi.exception.HoodieIOException)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 HoodieTestDataGenerator (org.apache.hudi.common.testutils.HoodieTestDataGenerator)1 HoodieDeltaStreamer (org.apache.hudi.utilities.deltastreamer.HoodieDeltaStreamer)1