Review Board 1.7.22


SQOOP-781 Sqoop2: Improve logging in GenericJdbcImportInitializer

Review Request #8640 - Created Dec. 17, 2012 and submitted

Jarek Cecho
SQOOP-781
Reviewers
Sqoop
sqoop-sqoop2
I've added printing interesting information to the log.

 
connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportInitializer.java
Revision 3ce6bb907ad38b21316d2444182b481393c9a2b9 New Change
[20] 188 lines
[+20] [+] private void configurePartitionProperties(MutableContext context, ConnectionConfiguration connectionConfig, ImportJobConfiguration jobConfig) {
189
            GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0006);
189
            GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0006);
190
      }
190
      }
191

    
   
191

   
192
      rs.next();
192
      rs.next();
193

    
   
193

   
194
      context.setString(
194
      int columnType = rsmd.getColumnType(1);
195
          GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNTYPE,
195
      String min = rs.getString(1);
196
          String.valueOf(rsmd.getColumnType(1)));
196
      String max = rs.getString(2);
197
      context.setString(
197

   
198
          GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MINVALUE,
198
      LOG.info("Boundaries: min=" + min + ", max=" + max + ", columnType=" + columnType);
199
          rs.getString(1));
199

   
200
      context.setString(
200
      context.setInteger(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNTYPE, columnType);
201
          GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MAXVALUE,
201
      context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MINVALUE, min);
202
          rs.getString(2));
202
      context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MAXVALUE, max);
203

    
   
203

   
204
    } catch (SQLException e) {
204
    } catch (SQLException e) {
205
      throw new SqoopException(
205
      throw new SqoopException(
206
          GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0006, e);
206
          GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0006, e);
207
    }
207
    }
[+20] [20] 80 lines
[+20] [+] private void configureTableProperties(MutableContext context, ConnectionConfiguration connectionConfig, ImportJobConfiguration jobConfig) {
288
      // when neither are specified:
288
      // when neither are specified:
289
      throw new SqoopException(
289
      throw new SqoopException(
290
          GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0008);
290
          GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0008);
291
    }
291
    }
292

    
   
292

   
293
    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_DATA_SQL,
293
    LOG.info("Using dataSql: " + dataSql);
294
        dataSql.toString());
294
    LOG.info("Field names: " + fieldNames);

    
   
295

   

    
   
296
    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_DATA_SQL, dataSql);
295
    context.setString(Constants.JOB_ETL_FIELD_NAMES, fieldNames);
297
    context.setString(Constants.JOB_ETL_FIELD_NAMES, fieldNames);
296
  }
298
  }
297
}
299
}
  1. connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcImportInitializer.java: Loading...