Hi James,
Maybe, i am missing your point. I dont see following method in
PreparedStatement interface:
pstmt.setString("STOCK_NAME", stockName);
Do i need to use some other stuff than Phoenix MR integration to get
that method?
Thanks,
Anil Gupta
On Tue, Jan 5, 2016 at 8:48 PM, James Taylor <jamestaylor@apache.org> wrote:
> With JDBC, both will already work.
>
> pstmt.setString("STOCK_NAME", stockName);
>
> pstmt.setString(1, stockName);
>
>
> On Tuesday, January 5, 2016, anil gupta <anilgupta84@gmail.com> wrote:
>
>> Hi,
>>
>> I am using Phoenix4.4. I am trying to integrate my MapReduce job with
>> Phoenix following this doc: https://phoenix.apache.org/phoenix_mr.html
>>
>>
>> My phoenix table has around 1000 columns. I have some hesitation
>> regarding using *COLUMN_INDEX* for setting its value rather than *NAME* as
>> per following example:
>>
>> @Override
>> public void write(PreparedStatement pstmt) throws SQLException {
>> pstmt.setString(1, stockName);
>> pstmt.setDouble(2, maxPrice);
>> }
>>
>> There are couple of problems with above:
>> 1. What if someone deletes a column from table? My guess, It will change
>> index of some of the columns. Right?(Lets say, a table has 5 columns. 3rd
>> column of table is deleted.)
>> 2. Readability of code is also less since column names are denoted by
>> numbers.(in reality it's a name/value pair)
>>
>> Instead, if we have following API then it will be much easier and above
>> problems will be fixed:
>>
>> @Override
>> public void write(PreparedStatement pstmt) throws SQLException {
>> pstmt.setString("STOCK_NAME", stockName);
>> pstmt.setDouble("MAX_RECORDING", maxPrice);
>> }
>>
>> Also, my coding habits are giving me hard time to code on basis of index when in
reality its a key/value pair. :)
>>
>> Is there anyway i can achieve the above? Would the community like to have the key/value
api?
>>
>>
>> --
>> Thanks & Regards,
>> Anil Gupta
>>
>
--
Thanks & Regards,
Anil Gupta
|