PHOENIX-2542 - CSV bulk loading with --schema option is broken

Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a6646d7e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a6646d7e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a6646d7e

Branch: refs/heads/calcite
Commit: a6646d7ebdac53e4b011c6c6b57b8fc5b679d3ff
Parents: aaab87a
Author: ravimagham <ravi.mag...@bazaarvoice.com>
Authored: Thu Jan 28 07:42:04 2016 -0800
Committer: ravimagham <ravi.mag...@bazaarvoice.com>
Committed: Thu Jan 28 07:42:04 2016 -0800

----------------------------------------------------------------------
 .../it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java   | 5 +++--
 .../java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6646d7e/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
index 87652ab..6bc03bf 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
@@ -95,7 +95,7 @@ public class CsvBulkLoadToolIT {
     public void testBasicImport() throws Exception {
 
         Statement stmt = conn.createStatement();
-        stmt.execute("CREATE TABLE TABLE1 (ID INTEGER NOT NULL PRIMARY KEY, 
NAME VARCHAR, T DATE) SPLIT ON (1,2)");
+        stmt.execute("CREATE TABLE S.TABLE1 (ID INTEGER NOT NULL PRIMARY KEY, 
NAME VARCHAR, T DATE) SPLIT ON (1,2)");
 
         FileSystem fs = FileSystem.get(hbaseTestUtil.getConfiguration());
         FSDataOutputStream outputStream = fs.create(new 
Path("/tmp/input1.csv"));
@@ -110,10 +110,11 @@ public class CsvBulkLoadToolIT {
         int exitCode = csvBulkLoadTool.run(new String[] {
                 "--input", "/tmp/input1.csv",
                 "--table", "table1",
+                "--schema", "s",
                 "--zookeeper", zkQuorum});
         assertEquals(0, exitCode);
 
-        ResultSet rs = stmt.executeQuery("SELECT id, name, t FROM table1 ORDER 
BY id");
+        ResultSet rs = stmt.executeQuery("SELECT id, name, t FROM s.table1 
ORDER BY id");
         assertTrue(rs.next());
         assertEquals(1, rs.getInt(1));
         assertEquals("Name 1", rs.getString(2));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6646d7e/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
index 4b5d618..f6ba5f6 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/AbstractBulkLoadTool.java
@@ -208,7 +208,7 @@ public abstract class AbstractBulkLoadTool extends 
Configured implements Tool {
         FormatToKeyValueMapper.configureColumnInfoList(conf, importColumns);
         boolean ignoreInvalidRows = 
cmdLine.hasOption(IGNORE_ERRORS_OPT.getOpt());
         conf.setBoolean(FormatToKeyValueMapper.IGNORE_INVALID_ROW_CONFKEY, 
ignoreInvalidRows);
-        conf.set(FormatToKeyValueMapper.TABLE_NAME_CONFKEY, tableName);
+        conf.set(FormatToKeyValueMapper.TABLE_NAME_CONFKEY, 
qualifiedTableName);
 
         // give subclasses their hook
         configureOptions(cmdLine, importColumns, conf);

Reply via email to