You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ar...@apache.org on 2011/09/07 04:46:13 UTC

svn commit: r1165969 - /incubator/sqoop/trunk/src/java/com/cloudera/sqoop/orm/ClassWriter.java

Author: arvind
Date: Wed Sep  7 02:46:12 2011
New Revision: 1165969

URL: http://svn.apache.org/viewvc?rev=1165969&view=rev
Log:
SQOOP-330. Descriptive error message when column name cannot be determined.

(Jarek Jarcec Cecho via Arvind Prabhakar)

Modified:
    incubator/sqoop/trunk/src/java/com/cloudera/sqoop/orm/ClassWriter.java

Modified: incubator/sqoop/trunk/src/java/com/cloudera/sqoop/orm/ClassWriter.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/trunk/src/java/com/cloudera/sqoop/orm/ClassWriter.java?rev=1165969&r1=1165968&r2=1165969&view=diff
==============================================================================
--- incubator/sqoop/trunk/src/java/com/cloudera/sqoop/orm/ClassWriter.java (original)
+++ incubator/sqoop/trunk/src/java/com/cloudera/sqoop/orm/ClassWriter.java Wed Sep  7 02:46:12 2011
@@ -21,7 +21,6 @@ package com.cloudera.sqoop.orm;
 import org.apache.hadoop.io.BytesWritable;
 import com.cloudera.sqoop.SqoopOptions;
 import com.cloudera.sqoop.manager.ConnManager;
-import com.cloudera.sqoop.manager.SqlManager;
 import com.cloudera.sqoop.lib.BigDecimalSerializer;
 import com.cloudera.sqoop.lib.BooleanParser;
 import com.cloudera.sqoop.lib.DelimiterSet;
@@ -1041,8 +1040,17 @@ public class ClassWriter {
     String [] cleanedColNames = cleanColNames(colNames);
     Set<String> uniqColNames = new HashSet<String>();
     for (int i = 0; i < colNames.length; i++) {
-      // Guarantee uniq col identifier
       String identifier = cleanedColNames[i];
+
+      // Name can't be blank
+      if(identifier.isEmpty()) {
+        throw new IllegalArgumentException("We found column without column "
+                + "name. Please verify that you've entered all column names "
+                + "in your query if using free form query import (consider "
+                + "adding clause AS if you're using column transformation)");
+      }
+
+      // Guarantee uniq col identifier
       if (uniqColNames.contains(identifier)) {
           throw new IllegalArgumentException("Duplicate Column identifier "
               + "specified: '" + identifier + "'");