The source table is a partitioned external table and the target table is also external but not partitioned.
A straight create table as .. from external table won't work hive> CREATE EXTERNAL TABLE sales5 AS SELECT * FROM SALES; FAILED: SemanticException [Error 10070]: CREATE-TABLE-AS-SELECT cannot create external table Does not work for external tables The other option is to use LIKE CREATE EXTERNAL TABLE sales6 LIKE sales; That will copy the schema image with existing partitions to new table with no data hive> show create table sales6; OK CREATE EXTERNAL TABLE `sales6`( `prod_id` bigint, `cust_id` bigint, `time_id` timestamp, `channel_id` bigint, `promo_id` bigint, `quantity_sold` decimal(10,0), `amount_sold` decimal(10,0)) *PARTITIONED BY ( `year` int, `month` int)* ----- Which is not that useful HTH Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>* http://talebzadehmich.wordpress.com *Disclaimer:* Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction. On 7 August 2016 at 14:39, Marcin Tustin <mtus...@handybook.com> wrote: > Yes, but a create table unpartitioned as select * from partitioned will > create an unpartitioned table with all the data in partitioned table. It > won't lose the partition column, but nowhere do I see a need for that > column to be removed. > > On Sun, Aug 7, 2016 at 9:25 AM, Mich Talebzadeh <mich.talebza...@gmail.com > > wrote: > >> Hi Marcin, >> >> The thread owner question was >> >> "Hi I've a scenario where I need to create a table from partitioned >> table but my destination table should not be partitioned. I won't be >> knowing the schema so I cannot create manually the destination table. By >> the way both tables are external tables." >> >> This can be easily achieved through Spark by reading the Hive external >> table (assuming that the thread owner knows its name and the Hive database >> name :)) into a DF >> >> DF will display all the column names and a filter on it can get rid of >> the partition columns. >> >> New table can be created without those two columns and of course will not >> be partitioned. >> >> HTH >> >> Dr Mich Talebzadeh >> >> >> >> LinkedIn * >> https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw >> <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>* >> >> >> >> http://talebzadehmich.wordpress.com >> >> >> *Disclaimer:* Use it at your own risk. Any and all responsibility for >> any loss, damage or destruction of data or any other property which may >> arise from relying on this email's technical content is explicitly >> disclaimed. The author will in no case be liable for any monetary damages >> arising from such loss, damage or destruction. >> >> >> >> On 7 August 2016 at 13:17, Marcin Tustin <mtus...@handybook.com> wrote: >> >>> Will CREATE TABLE sales5 AS SELECT * FROM SALES; not work for you? >>> >>> On Thu, Aug 4, 2016 at 5:05 PM, Nagabhushanam Bheemisetty < >>> nbheemise...@gmail.com> wrote: >>> >>>> Hi I've a scenario where I need to create a table from partitioned >>>> table but my destination table should not be partitioned. I won't be >>>> knowing the schema so I cannot create manually the destination table. By >>>> the way both tables are external tables. >>>> >>> >>> >>> Want to work at Handy? Check out our culture deck and open roles >>> <http://www.handy.com/careers> >>> Latest news <http://www.handy.com/press> at Handy >>> Handy just raised $50m >>> <http://venturebeat.com/2015/11/02/on-demand-home-service-handy-raises-50m-in-round-led-by-fidelity/> >>> led >>> by Fidelity >>> >>> >> > > Want to work at Handy? Check out our culture deck and open roles > <http://www.handy.com/careers> > Latest news <http://www.handy.com/press> at Handy > Handy just raised $50m > <http://venturebeat.com/2015/11/02/on-demand-home-service-handy-raises-50m-in-round-led-by-fidelity/> > led > by Fidelity > >