sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1297199 - /incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java
Date Mon, 05 Mar 2012 19:44:01 GMT
Author: blee
Date: Mon Mar  5 19:44:00 2012
New Revision: 1297199

URL: http://svn.apache.org/viewvc?rev=1297199&view=rev
Log:
SQOOP-416 Allow code-generation arguments with Avro imports

Modified:
    incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java

Modified: incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java?rev=1297199&r1=1297198&r2=1297199&view=diff
==============================================================================
--- incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java (original)
+++ incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java Mon Mar 
5 19:44:00 2012
@@ -65,10 +65,14 @@ public class AvroSchemaGenerator {
       fields.add(field);
     }
 
+    TableClassName tableClassName = new TableClassName(options);
+    String shortClassName = tableClassName.getShortClassForTable(tableName);
     String avroTableName = (tableName == null ? "QueryResult" : tableName);
+    String avroName = (shortClassName == null ? avroTableName : shortClassName);
+    String avroNamespace = tableClassName.getPackageForTable();
 
     String doc = "Sqoop import of " + avroTableName;
-    Schema schema = Schema.createRecord(avroTableName, doc, null, false);
+    Schema schema = Schema.createRecord(avroName, doc, avroNamespace, false);
     schema.setFields(fields);
     schema.addProp("tableName", avroTableName);
     return schema;



Mime
View raw message