mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 01:50:32 +08:00
SQOOP-2839: Sqoop import failure due to data member conflict in ORM code for table
(VISHNU S NAIR via Jarek Jarcec Cecho)
This commit is contained in:
parent
b84ebf1e84
commit
cfa7927c2a
@ -121,6 +121,8 @@ public class ClassWriter {
|
|||||||
// not strictly reserved words, but collides with
|
// not strictly reserved words, but collides with
|
||||||
// our imports
|
// our imports
|
||||||
JAVA_RESERVED_WORDS.add("Text");
|
JAVA_RESERVED_WORDS.add("Text");
|
||||||
|
//Fix For Issue SQOOP-2839
|
||||||
|
JAVA_RESERVED_WORDS.add("PROTOCOL_VERSION");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String PROPERTY_CODEGEN_METHODS_MAXCOLS =
|
public static final String PROPERTY_CODEGEN_METHODS_MAXCOLS =
|
||||||
|
@ -373,6 +373,8 @@ public void testJavaIdentifierConversion() {
|
|||||||
"9isLegalInSql"));
|
"9isLegalInSql"));
|
||||||
assertEquals("____", ClassWriter.toJavaIdentifier("___"));
|
assertEquals("____", ClassWriter.toJavaIdentifier("___"));
|
||||||
assertEquals("__class", ClassWriter.toJavaIdentifier("_class"));
|
assertEquals("__class", ClassWriter.toJavaIdentifier("_class"));
|
||||||
|
//Checking Java identifier for Constant PROTOCOL_VERSION
|
||||||
|
assertEquals("_PROTOCOL_VERSION", ClassWriter.toJavaIdentifier("PROTOCOL_VERSION"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -405,6 +407,38 @@ public void testWeirdColumnNames() throws SQLException {
|
|||||||
+ HsqldbTestServer.getTableName());
|
+ HsqldbTestServer.getTableName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test For checking Codegneration perfroming successfully
|
||||||
|
// in case of Table with Column name as PROTOCOL_VERSION
|
||||||
|
@Test
|
||||||
|
public void testColumnNameAsProtocolVersion() throws SQLException {
|
||||||
|
// Recreate the table with column name as PROTOCOL_VERSION.
|
||||||
|
String tableName = HsqldbTestServer.getTableName();
|
||||||
|
Connection connection = testServer.getConnection();
|
||||||
|
Statement st = connection.createStatement();
|
||||||
|
try {
|
||||||
|
st.executeUpdate("DROP TABLE " + tableName + " IF EXISTS");
|
||||||
|
st.executeUpdate("CREATE TABLE " + tableName
|
||||||
|
+ " (PROTOCOL_VERSION INT)");
|
||||||
|
st.executeUpdate("INSERT INTO " + tableName + " VALUES(42)");
|
||||||
|
connection.commit();
|
||||||
|
} finally {
|
||||||
|
st.close();
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
String [] argv = {
|
||||||
|
"--bindir",
|
||||||
|
JAR_GEN_DIR,
|
||||||
|
"--outdir",
|
||||||
|
CODE_GEN_DIR,
|
||||||
|
"--package-name",
|
||||||
|
OVERRIDE_PACKAGE_NAME,
|
||||||
|
};
|
||||||
|
|
||||||
|
runGenerationTest(argv, OVERRIDE_PACKAGE_NAME + "."
|
||||||
|
+ HsqldbTestServer.getTableName());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCloningTableWithVarbinaryDoesNotThrowNPE() throws SQLException,
|
public void testCloningTableWithVarbinaryDoesNotThrowNPE() throws SQLException,
|
||||||
IOException, ClassNotFoundException, NoSuchMethodException,
|
IOException, ClassNotFoundException, NoSuchMethodException,
|
||||||
|
Loading…
Reference in New Issue
Block a user