Thu, Aug 27, 2015 at 7:32 PM, Ahmed Nawar wrote:
> Dears,
>
> I needs to commit DB Transaction for each partition,Not for each row.
> below didn't work for me.
>
>
> rdd.mapPartitions(partitionOfRecords => {
>
> DBConnectionInit()
&g
>
>>>> I can not use foreachPartition because i need reuse the new RDD after
>>>> some maps.
>>>>
>>>>
>>>>
>>>> On Thu, Aug 27, 2015 at 5:11 PM, Cody Koeninger
>>>> wrote:
>>>>
>&
oeninger
>>> wrote:
>>>
>>>>
>>>> Map is lazy. You need an actual action, or nothing will happen. Use
>>>> foreachPartition, or do an empty foreach after the map.
>>>>
>>>> On Thu, Aug 27, 2015 at 8:53 AM, Ahmed Nawar
at 5:11 PM, Cody Koeninger
>> wrote:
>>
>>>
>>> Map is lazy. You need an actual action, or nothing will happen. Use
>>> foreachPartition, or do an empty foreach after the map.
>>>
>>> On Thu, Aug 27, 2015 at 8:53 AM, Ahmed Nawar
>
ing will happen. Use
>> foreachPartition, or do an empty foreach after the map.
>>
>> On Thu, Aug 27, 2015 at 8:53 AM, Ahmed Nawar
>> wrote:
>>
>>> Dears,
>>>
>>> I needs to commit DB Transaction for each partition,Not for each
>>
27, 2015 at 5:11 PM, Cody Koeninger wrote:
>
> Map is lazy. You need an actual action, or nothing will happen. Use
> foreachPartition, or do an empty foreach after the map.
>
> On Thu, Aug 27, 2015 at 8:53 AM, Ahmed Nawar
> wrote:
>
>> Dears,
>>
>> I nee
Dears,
I needs to commit DB Transaction for each partition,Not for each row.
below didn't work for me.
rdd.mapPartitions(partitionOfRecords => {
DBConnectionInit()
val results = partitionOfRecords.map(..)
DBConnection.commit()
results
})
Best regards,
Ahmed Atef Naww