Strangely that works through HUE, but not via the shell (hive -e). It also doesn't work via my script file, which is what I really want.
I can take it from here, as I now know it's possible in my version/setup :). Thank you very much for the input. Yonathan Maalo -----Original Message----- From: Per Ullberg [mailto:[email protected]] Sent: 23 June 2016 09:33 To: [email protected] Subject: Re: Create table with parameterized location This works for me: > SET rootpath=/user/per.ullberg/foo; hive> > DROP TABLE bar; OK Time taken: 0.119 seconds hive> > CREATE EXTERNAL TABLE bar ( > Dim1 STRING, > Dim2 STRING, > Dim3 STRING ) > LOCATION '${hiveconf:rootpath}'; OK Time taken: 0.052 seconds hive> > SELECT * FROM bar; OK foo bar baz NULL NULL Time taken: 0.058 seconds, Fetched: 1 row(s) hive> Guess you're getting the ' in the wrong places. regards /Pelle On Thu, Jun 23, 2016 at 10:17 AM, <[email protected]> wrote: > Thank you for the response. The variable is set according to 'set;'. > I've tried your suggestion prior to posting, I've also tried removing > the single quotes in the value and then tried putting > ${hiveconf:rootpath} inside quotes i.e. '${hiveconf:rootpath} ' and > without quotes. Whenever I put ${hiveconf:rootpath} inside quotes, the error > changes to: > > FAILED: IllegalArgumentException Can not create a Path from an empty > string > > Cheers, > > Yonathan Maalo > BT Technology, Service & Operations > Mob: 07483981150 > Email: [email protected] > > > -----Original Message----- > From: Per Ullberg [mailto:[email protected]] > Sent: 22 June 2016 18:49 > To: [email protected] > Subject: Re: Create table with parameterized location > > Try to skip the spaces when doing the set. > > You can execute 'set;' to verify that rootpath is set as expected. > > /Pelle > > On Wednesday, June 22, 2016, <[email protected]> wrote: > > > Hello, > > I've tried something like the following > > > > set rootpath = 'hdfs_path'; > > DROP TABLE mytable; > > CREATE [EXTERNAL] TABLE mytable ( > > Dim1 STRING, > > Dim2 STRING, > > Dim3 STRING ) > > LOCATION ${hiveconf:rootpath}; > > > > I get this error: > > > > > > FAILED: ParseException line 1:126 mismatched input '<EOF>' expecting > > StringLiteral near 'LOCATION' in table location specification > > > > I am using Hive 1.1.0 with Cloudera 5.4.8. > > > > Does anyone have an idea how to solve this? > > > > All the best, > > > > Yonathan > > > > > > -- > > *Per Ullberg* > Tech Lead > Odin - Uppsala > > Klarna AB > Sveavägen 46, 111 34 Stockholm > Tel: +46 8 120 120 00 > Reg no: 556737-0431 > klarna.com > -- *Per Ullberg* Tech Lead Odin - Uppsala Klarna AB Sveavägen 46, 111 34 Stockholm Tel: +46 8 120 120 00 Reg no: 556737-0431 klarna.com
