I am trying to cast a string into a datetime object in hadoop pig. But Grunt give me a strange error message : it is like It can't choose the correct 'ToDate' function. It is asking for an 'explicit cast', but I have no clue how to do so. Any idea ?
=> ERROR 1045: Could not infer the matching function for org.apache.pig.builtin.ToDate as multiple or none of them fit. Please use an explicit cast.
grunt> describe infos_by_nu_affa;
infos_by_nu_affa: {NU_AFFA: bytearray,affaires: {(NU_AFFA:bytearray,NU_PCP: bytearray,debut: bytearray,fin: bytearray)},prestations: {(NU_AFFA: bytearray,montant: bytearray,date: bytearray,NU_presta: bytearray,beneficiaire: bytearray)},clients: {(NU_PCP: bytearray,nom: bytearray,prenom: bytearray)}}
derivees = foreach infos_by_nu_affa generate *, ToDate(affaires.debut, 'dd/MM/yyyy') as (debut:datetime);
2015-03-28 15:46:36,089 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1045: <line 155, column 0> Could not infer the matching function for org.apache.pig.builtin.ToDate as multiple or none of them fit. Please use an explicit cast.
grunt> dump infos_by_nu_affa
(affaire5,{(affaire5,client5,01/01/14,05/01/15)},{},{(client5,enders,kililan)})
(affaire6,{(affaire6,client6,01/01/13,01/06/14)},{},{(client6,blanco,martine)})
(affaire7,{(affaire7,client7,01/01/10,02/03/13)},{},{(client7,sarah,moore)})
(affaire8,{(affaire8,client8,01/01/15,01/01/01)},{},{(client8,evrard,dominique)})
grunt> derivees = foreach infos_by_nu_affa
>> generate *,
>> COUNT(prestations) as nb_prestations,
>> ToDate(affaires.debut, 'dd/MM/yy') as debut;
2015-03-28 15:56:06,729 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1045:
<line 155, column 0> Could not infer the matching function for org.apache.pig.builtin.ToDate as multiple or none of them fit. Please use an explicit cast.