mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 10:12:05 +08:00
SQOOP-1494: Fix generateArvoSchema in DataDrivenImportJob
(Qian Xu via Jarek Jarcec Cecho)
This commit is contained in:
parent
41724c31d4
commit
e23d1571bd
@ -88,7 +88,7 @@ protected void configureMapper(Job job, String tableName,
|
|||||||
job.setOutputValueClass(NullWritable.class);
|
job.setOutputValueClass(NullWritable.class);
|
||||||
} else if (options.getFileLayout()
|
} else if (options.getFileLayout()
|
||||||
== SqoopOptions.FileLayout.AvroDataFile) {
|
== SqoopOptions.FileLayout.AvroDataFile) {
|
||||||
Schema schema = generateArvoSchema(tableName);
|
Schema schema = generateAvroSchema(tableName);
|
||||||
try {
|
try {
|
||||||
writeAvroSchema(schema);
|
writeAvroSchema(schema);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
@ -101,7 +101,7 @@ protected void configureMapper(Job job, String tableName,
|
|||||||
Configuration conf = job.getConfiguration();
|
Configuration conf = job.getConfiguration();
|
||||||
// An Avro schema is required for creating a dataset that manages
|
// An Avro schema is required for creating a dataset that manages
|
||||||
// Parquet data records. The import will fail, if schema is invalid.
|
// Parquet data records. The import will fail, if schema is invalid.
|
||||||
Schema schema = generateArvoSchema(tableName);
|
Schema schema = generateAvroSchema(tableName);
|
||||||
String uri;
|
String uri;
|
||||||
if (options.doHiveImport()) {
|
if (options.doHiveImport()) {
|
||||||
uri = "dataset:hive?dataset=" + options.getTableName();
|
uri = "dataset:hive?dataset=" + options.getTableName();
|
||||||
@ -115,7 +115,7 @@ protected void configureMapper(Job job, String tableName,
|
|||||||
job.setMapperClass(getMapperClass());
|
job.setMapperClass(getMapperClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Schema generateArvoSchema(String tableName) throws IOException {
|
private Schema generateAvroSchema(String tableName) throws IOException {
|
||||||
ConnManager connManager = getContext().getConnManager();
|
ConnManager connManager = getContext().getConnManager();
|
||||||
AvroSchemaGenerator generator = new AvroSchemaGenerator(options,
|
AvroSchemaGenerator generator = new AvroSchemaGenerator(options,
|
||||||
connManager, tableName);
|
connManager, tableName);
|
||||||
|
Loading…
Reference in New Issue
Block a user