Question: In this problem we will be using Hive from Hadoop to write a python function which will transform a customer table and create a new

In this problem we will be using Hive from Hadoop to write a python function which will transform a customer table and create a new table. The new target table should have only three columns, c_custkey (no changes), c_address, and c_city.

Write python code that will

1)take in the c_address column, shorten it to 6 characters (i.e., if the value is longer, remove extra characters, but otherwise keep it as-is).

2)For c_city, add a space and a # to indicate the digit at the end (e.g., UNITED KI2 => UNITED KI #2, or INDONESIA4 => INDONESIA #4).

Tip: don't forget to add

#!/usr/bin/python

import sys

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!