Uploaded image for project: 'Sqoop (Retired)'
  1. Sqoop (Retired)
  2. SQOOP-1204

Issue with Sqoop column aliases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.4.4
    • 1.4.5
    • None
    • None
    • Linux

    Description

      I came across an issue in Sqoop v1.4.4 import for column aliases. I remember it was present even in earlier versions [I first saw this issue in v1.2.0 dating back to mid-2011].

      Consider a Sqoop import:
      sqoop import --connect jdbc:mysql://my_ip/my_db --username root --password **** --query "SELECT c.id AS cid, concat(c.firstname, c.lastname) AS name FROM customer c LIMIT 10"

      The above query gets me the data as required and but one of the column aliases is incorrect [instead of cid, it shows the column alias as id].
      id name

      I have found a workaround [though it is not elegant per-se]
      sqoop import --connect jdbc:mysql://my_ip/my_db --username root --password **** --query "SELECT concat(c.id, ‘’) AS cid, concat(c.firstname, c.lastname) AS name FROM customer c LIMIT 10"

      The above query gets me the data as required and with the exact column aliases I have mentioned.
      cid name

      If I am getting just the column, Sqoop does not consider the column alias. And if I give a function like concat as above, it considers the column alias as well.

      Attachments

        Issue Links

          Activity

            People

              p7h Prashanth Babu
              p7h Prashanth Babu
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: