@@ -35,31 +35,32 @@ public PrestoQueryNode(DeltaConfig.Config config) {
3535
3636 @ Override
3737 public void execute (ExecutionContext context , int curItrCount ) throws Exception {
38- if (context .getHoodieTestSuiteWriter ().getCfg ().enablePrestoValidation ) {
39- int validateOnceEveryItr = config .validateOnceEveryIteration ();
40- int itrCountToExecute = config .getIterationCountToExecute ();
41- if ((itrCountToExecute != -1 && itrCountToExecute == curItrCount )
42- || (itrCountToExecute == -1 && ((curItrCount % validateOnceEveryItr ) == 0 ))) {
43- log .info ("Executing presto query node {}" , this .getName ());
44- String url = context .getHoodieTestSuiteWriter ().getCfg ().prestoJdbcUrl ;
45- if (StringUtils .isNullOrEmpty (url )) {
46- throw new IllegalArgumentException ("Presto JDBC connection url not provided. Please set --presto-jdbc-url." );
47- }
48- String user = context .getHoodieTestSuiteWriter ().getCfg ().prestoUsername ;
49- String pass = context .getHoodieTestSuiteWriter ().getCfg ().prestoPassword ;
50- try {
51- Class .forName ("com.facebook.presto.jdbc.PrestoDriver" );
52- } catch (ClassNotFoundException e ) {
53- throw new HoodieValidationException ("Presto query validation failed due to " + e .getMessage (), e );
54- }
55- try (Connection connection = DriverManager .getConnection (url , user , pass )) {
56- Statement stmt = connection .createStatement ();
57- setSessionProperties (this .config .getPrestoProperties (), stmt );
58- executeAndValidateQueries (this .config .getPrestoQueries (), stmt );
59- stmt .close ();
60- } catch (Exception e ) {
61- throw new HoodieValidationException ("Presto query validation failed due to " + e .getMessage (), e );
62- }
38+ if (!context .getHoodieTestSuiteWriter ().getCfg ().enablePrestoValidation ) {
39+ return ;
40+ }
41+ int validateOnceEveryItr = config .validateOnceEveryIteration ();
42+ int itrCountToExecute = config .getIterationCountToExecute ();
43+ if ((itrCountToExecute != -1 && itrCountToExecute == curItrCount )
44+ || (itrCountToExecute == -1 && ((curItrCount % validateOnceEveryItr ) == 0 ))) {
45+ log .info ("Executing presto query node {}" , this .getName ());
46+ String url = context .getHoodieTestSuiteWriter ().getCfg ().prestoJdbcUrl ;
47+ if (StringUtils .isNullOrEmpty (url )) {
48+ throw new IllegalArgumentException ("Presto JDBC connection url not provided. Please set --presto-jdbc-url." );
49+ }
50+ String user = context .getHoodieTestSuiteWriter ().getCfg ().prestoUsername ;
51+ String pass = context .getHoodieTestSuiteWriter ().getCfg ().prestoPassword ;
52+ try {
53+ Class .forName ("com.facebook.presto.jdbc.PrestoDriver" );
54+ } catch (ClassNotFoundException e ) {
55+ throw new HoodieValidationException ("Presto query validation failed due to " + e .getMessage (), e );
56+ }
57+ try (Connection connection = DriverManager .getConnection (url , user , pass )) {
58+ Statement stmt = connection .createStatement ();
59+ setSessionProperties (this .config .getPrestoProperties (), stmt );
60+ executeAndValidateQueries (this .config .getPrestoQueries (), stmt );
61+ stmt .close ();
62+ } catch (Exception e ) {
63+ throw new HoodieValidationException ("Presto query validation failed due to " + e .getMessage (), e );
6364 }
6465 }
6566 }
0 commit comments