mirror of
https://github.com/apache/sqoop.git
synced 2025-05-19 02:10:54 +08:00
SQOOP-1395: Potential naming conflict in Avro schema
(Qian Xu via Jarek Jarcec Cecho)
This commit is contained in:
parent
f47a4fc25c
commit
500b75ae4b
@ -71,8 +71,8 @@ public Schema generate() throws IOException {
|
|||||||
|
|
||||||
TableClassName tableClassName = new TableClassName(options);
|
TableClassName tableClassName = new TableClassName(options);
|
||||||
String shortClassName = tableClassName.getShortClassForTable(tableName);
|
String shortClassName = tableClassName.getShortClassForTable(tableName);
|
||||||
String avroTableName = (tableName == null ? "QueryResult" : tableName);
|
String avroTableName = (tableName == null ? TableClassName.QUERY_RESULT : tableName);
|
||||||
String avroName = (shortClassName == null ? avroTableName : shortClassName);
|
String avroName = "sqoop_import_" + (shortClassName == null ? avroTableName : shortClassName);
|
||||||
String avroNamespace = tableClassName.getPackageForTable();
|
String avroNamespace = tableClassName.getPackageForTable();
|
||||||
|
|
||||||
String doc = "Sqoop import of " + avroTableName;
|
String doc = "Sqoop import of " + avroTableName;
|
||||||
|
@ -33,6 +33,8 @@ public class TableClassName {
|
|||||||
public static final Log LOG = LogFactory.getLog(
|
public static final Log LOG = LogFactory.getLog(
|
||||||
TableClassName.class.getName());
|
TableClassName.class.getName());
|
||||||
|
|
||||||
|
public static final String QUERY_RESULT = "QueryResult";
|
||||||
|
|
||||||
private final SqoopOptions options;
|
private final SqoopOptions options;
|
||||||
|
|
||||||
public TableClassName(final SqoopOptions opts) {
|
public TableClassName(final SqoopOptions opts) {
|
||||||
@ -84,7 +86,7 @@ public String getClassForTable(String tableName) {
|
|||||||
|
|
||||||
String queryName = tableName;
|
String queryName = tableName;
|
||||||
if (null == queryName) {
|
if (null == queryName) {
|
||||||
queryName = "QueryResult";
|
queryName = QUERY_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
String packageName = options.getPackageName();
|
String packageName = options.getPackageName();
|
||||||
|
Loading…
Reference in New Issue
Block a user