Hi Vinod,
Thanks for the prompt reply.
Understood your point and sorry for not providing the complete code segment
earlier.
I have the getFilePath function which should return a URL like this.
home/user/Desktop/logDir/logs/log_0_testServer_2012_07_22
The defined function works perfectly if I put *getFilePath( "0","testServer"
) *into the *select* statement.
But I want to get that particular URL as the *local directory name*.
(The requirement is such that this should not be hard-coded in the hive
query. Rather should be generated in the custom UDF. )
So can I do something like I v shown below?
*set file_name= getFilePath( "0","testServer" ); *//Define a parameter.*
*
*.................*
*..............*
*INSERT OVERWRITE LOCAL DIRECTORY 'file:///${hiveconf:file_name}'
*//Assign the above parameter as the file URL
I tried this way. But the directory name is returned as
file:/getFilePath( "0" , "testServer" )
Does that mean I cannot use UDF to define the local directory name? Or am I
doing anything wrong in here?
Thanks
Manisha
On Mon, Jul 23, 2012 at 1:47 PM, Vinod Singh <[email protected]> wrote:
> The output path in this query is already parameterized-
>
> *INSERT OVERWRITE LOCAL DIRECTORY 'file:///${hiveconf:file_name}'*
>
> Though UDF is not going to be invoked here.
>
> Thanks,
> Vinod
>
>
> 2012/7/23 Manisha Gayathri <[email protected]>
>
>> Hi
>>
>> Is there any possibility of defining the output directory of a hive
>> query using a Hive UDF?
>>
>> In my UDF, I am passing 2 parameters (as follows) and this generates a
>> file-system URL
>> *getFilePath( "0","testServer" );*
>>
>> Can I use the above getFilePath( "0","testServer" ) value, as the Local
>> Directory location as follows?
>> *INSERT OVERWRITE LOCAL DIRECTORY 'file:///${hiveconf:file_name}'*
>>
>> If above is not the correct way, could you please show me how to do it?
>> Your help is much appreciated!
>>
>> Thanks
>>
>> ~Regards
>> *Manisha Eleperuma*
>> Software Engineer
>>
>> *
>> *
>>
>>
>
--
~Regards
*Manisha Eleperuma*
Software Engineer