From c6fdc457efa56331bcb67290216435b55495092d Mon Sep 17 00:00:00 2001
From: Aaron Kimball <aaron@cloudera.com>
Date: Wed, 6 Jan 2010 14:43:53 -0800
Subject: [PATCH] MAPREDUCE-1224. Calling "SELECT t.* from <table> AS t" to get meta information is too expensive for big tables

---
 .../apache/hadoop/sqoop/manager/SqlManager.java    |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/contrib/sqoop/src/java/org/apache/hadoop/sqoop/manager/SqlManager.java b/src/contrib/sqoop/src/java/org/apache/hadoop/sqoop/manager/SqlManager.java
index 16ceb95..b8a7339 100644
--- a/src/contrib/sqoop/src/java/org/apache/hadoop/sqoop/manager/SqlManager.java
+++ b/src/contrib/sqoop/src/java/org/apache/hadoop/sqoop/manager/SqlManager.java
@@ -65,7 +65,8 @@ public abstract class SqlManager implements ConnManager {
    * be tuned per-database, but the main extraction loop is still inheritable.
    */
   protected String getColNamesQuery(String tableName) {
-    return "SELECT t.* FROM " + tableName + " AS t";
+    // adding where clause to prevent loading a big table
+    return "SELECT t.* FROM " + tableName + " AS t WHERE 1=0";
   }
 
   @Override
-- 
1.6.0.4

