[HUDI-1869] Upgrading Spark3 To 3.1 (#3844)
Co-authored-by: pengzhiwei <pengzhiwei2015@icloud.com>
This commit is contained in:
@@ -36,7 +36,19 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
public class TestParquet2SparkSchemaUtils {
|
||||
private final SparkToParquetSchemaConverter spark2ParquetConverter =
|
||||
new SparkToParquetSchemaConverter(new SQLConf());
|
||||
private final SparkSqlParser parser = new SparkSqlParser(new SQLConf());
|
||||
private final SparkSqlParser parser = createSqlParser();
|
||||
|
||||
private static SparkSqlParser createSqlParser() {
|
||||
try {
|
||||
return SparkSqlParser.class.getDeclaredConstructor(SQLConf.class).newInstance(new SQLConf());
|
||||
} catch (Exception ne) {
|
||||
try { // For spark 3.1, there is no constructor with SQLConf, use the default constructor
|
||||
return SparkSqlParser.class.getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertPrimitiveType() {
|
||||
|
||||
Reference in New Issue
Block a user