sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-1969: Support getColumnSize method for Schema class
Date Mon, 05 Jan 2015 11:14:29 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 e8a4a97fe -> 1cf075fdf


SQOOP-1969: Support getColumnSize method for Schema class

(Qian Xu via Jarek Jarcec Cecho)


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

Branch: refs/heads/sqoop2
Commit: 1cf075fdff3b685073f6d079f8dee44776701c2e
Parents: e8a4a97
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Mon Jan 5 12:13:59 2015 +0100
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Mon Jan 5 12:13:59 2015 +0100

----------------------------------------------------------------------
 common/src/main/java/org/apache/sqoop/schema/Schema.java     | 8 ++++++--
 .../sqoop/connector/idf/CSVIntermediateDataFormat.java       | 2 +-
 .../org/apache/sqoop/connector/matcher/LocationMatcher.java  | 2 +-
 .../java/org/apache/sqoop/connector/matcher/NameMatcher.java | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/1cf075fd/common/src/main/java/org/apache/sqoop/schema/Schema.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/schema/Schema.java b/common/src/main/java/org/apache/sqoop/schema/Schema.java
index 5951e36..189dbe9 100644
--- a/common/src/main/java/org/apache/sqoop/schema/Schema.java
+++ b/common/src/main/java/org/apache/sqoop/schema/Schema.java
@@ -21,9 +21,9 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.schema.type.Column;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
@@ -59,7 +59,7 @@ public class Schema {
 
   private Schema() {
     creationDate = new Date();
-    columns = new LinkedList<Column>();
+    columns = new ArrayList<Column>();
     columNames = new HashSet<String>();
   }
 
@@ -123,6 +123,10 @@ public class Schema {
     return columns;
   }
 
+  public int getColumnsCount() {
+    return columns.size();
+  }
+
   public boolean isEmpty() {
     return columns.size() == 0;
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/1cf075fd/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
index 846aefd..ad1dc04 100644
--- a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
+++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
@@ -192,7 +192,7 @@ public class CSVIntermediateDataFormat extends IntermediateDataFormat<String>
{
       return null;
     }
 
-    if (fieldStringArray.length != schema.getColumnsArray().length) {
+    if (fieldStringArray.length != schema.getColumnsCount()) {
       throw new SqoopException(CSVIntermediateDataFormatError.CSV_INTERMEDIATE_DATA_FORMAT_0005,
           "The data " + getCSVTextData() + " has the wrong number of fields.");
     }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/1cf075fd/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/LocationMatcher.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/LocationMatcher.java
b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/LocationMatcher.java
index 879684c..01adaf0 100644
--- a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/LocationMatcher.java
+++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/LocationMatcher.java
@@ -42,7 +42,7 @@ public class LocationMatcher extends Matcher {
   @Override
   public Object[] getMatchingData(Object[] fields) {
 
-    Object[] out = new Object[getToSchema().getColumnsArray().length];
+    Object[] out = new Object[getToSchema().getColumnsCount()];
 
     int i = 0;
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/1cf075fd/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/NameMatcher.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/NameMatcher.java
b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/NameMatcher.java
index 9c2f7d5..c01b916 100644
--- a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/NameMatcher.java
+++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/matcher/NameMatcher.java
@@ -35,7 +35,7 @@ public class NameMatcher extends Matcher {
 
   @Override
   public Object[] getMatchingData(Object[] fields) {
-    Object[] out = new Object[getToSchema().getColumnsArray().length];
+    Object[] out = new Object[getToSchema().getColumnsCount()];
 
     HashMap<String,Column> colNames = new HashMap<String, Column>();
 


Mime
View raw message