Die UDF-Methode sim(String[] a, String[] b), bei der a und b aus zwei verschiedenen Datensätzen stammen, erhält für beidJava

Java-Forum
Guest
 Die UDF-Methode sim(String[] a, String[] b), bei der a und b aus zwei verschiedenen Datensätzen stammen, erhält für beid

Post by Guest »

I h a v e t o c a l c u l a t e a s i m i l a r i t y v a l u e b e t w e e n t h e c o m p e t e n c i e s o f a r e f e r e n c e l o c a l a u t h o r i t y i n F r a n c e : < / p > < b r / > < d i v c l a s s = " s - t a b l e - c o n t a i n e r " > < t a b l e c l a s s = " s - t a b l e " > < b r / > < t h e a d > < b r / > < t r > < b r / > < t h > C 1 0 1 0 < / t h > < b r / > < t h > C 1 0 1 5 < / t h > < b r / > < t h > C 1 0 2 0 < / t h > < b r / > < t h > C 1 0 2 5 < / t h > < b r / > < t h > C 1 0 3 0 < / t h > < b r / > < t h > C 1 5 0 2 < / t h > < b r / > < t h > C 1 5 0 5 < / t h > < b r / > < t h > C 1 5 0 7 < / t h > < b r / > < t h > C 1 5 1 0 < / t h > < b r / > < t h > C 1 5 1 5 < / t h > < b r / > < t h > C 1 5 2 0 < / t h > < b r / > < t h > C 1 5 2 5 < / t h > < b r / > < t h > C 1 5 2 8 < / t h > < b r / > < t h > C 1 5 2 9 < / t h > < b r / > < t h > C 1 5 3 0 < / t h > < b r / > < t h > C 1 5 3 1 < / t h > < b r / > < t h > C 1 5 3 2 < / t h > < b r / > < t h > C 1 5 3 3 < / t h > < b r / > < t h > C 1 5 3 4 < / t h > < b r / > < t h > C 1 5 3 5 < / t h > < b r / > < t h > C 1 5 4 0 < / t h > < b r / > < t h > C 1 5 4 5 < / t h > < b r / > < t h > C 1 5 5 0 < / t h > < b r / > < t h > C 1 5 5 5 < / t h > < b r / > < t h > C 1 5 6 0 < / t h > < b r / > < t h > C 2 0 0 5 < / t h > < b r / > < t h > C 2 0 1 0 < / t h > < b r / > < t h > C 2 0 1 5 < / t h > < b r / > < t h > C 2 5 1 0 < / t h > < b r / > < t h > C 2 5 1 5 < / t h > < b r / > < t h > C 2 5 2 0 < / t h > < b r / > < t h > C 2 5 2 1 < / t h > < b r / > < t h > C 2 5 2 5 < / t h > < b r / > < t h > C 2 5 2 6 < / t h > < b r / > < t h > C 3 0 0 5 < / t h > < b r / > < t h > C 3 0 1 0 < / t h > < b r / > < t h > C 3 0 1 5 < / t h > < b r / > < t h > C 3 0 2 0 < / t h > < b r / > < t h > C 3 0 2 5 < / t h > < b r / > < t h > C 3 2 1 0 < / t h > < b r / > < t h > C 3 2 2 0 < / t h > < b r / > < t h > C 3 5 0 5 < / t h > < b r / > < t h > C 3 5 1 0 < / t h > < b r / > < t h > C 3 5 1 5 < / t h > < b r / > < t h > C 4 0 0 5 < / t h > < b r / > < t h > C 4 0 0 6 < / t h > < b r / > < t h > C 4 0 0 7 < / t h > < b r / > < t h > C 4 0 0 8 < / t h > < b r / > < t h > C 4 0 1 0 < / t h > < b r / > < t h > C 4 0 1 5 < / t h > < b r / > < t h > C 4 0 1 6 < / t h > < b r / > < t h > C 4 0 1 7 < / t h > < b r / > < t h > C 4 0 2 0 < / t h > < b r / > < t h > C 4 0 2 5 < / t h > < b r / > < t h > C 4 5 0 5 < / t h > < b r / > < t h > C 4 5 1 0 < / t h > < b r / > < t h > C 4 5 1 5 < / t h > < b r / > < t h > C 4 5 2 0 < / t h > < b r / > < t h > C 4 5 2 5 < / t h > < b r / > < t h > C 4 5 3 0 < / t h > < b r / > < t h > C 4 5 3 1 < / t h > < b r / > < t h > C 4 5 3 2 < / t h > < b r / > < t h > C 4 5 3 5 < / t h > < b r / > < t h > C 4 5 4 0 < / t h > < b r / > < t h > C 4 5 4 5 < / t h > < b r / > < t h > C 4 5 5 0 < / t h > < b r / > < t h > C 4 5 5 5 < / t h > < b r / > < t h > C 4 5 6 0 < / t h > < b r / > < t h > C 5 0 0 5 < / t h > < b r / > < t h > C 5 0 1 0 < / t h > < b r / > < t h > C 5 0 1 5 < / t h > < b r / > < t h > C 5 2 1 0 < / t h > < b r / > < t h > C 5 2 2 0 < / t h > < b r / > < t h > C 5 5 0 5 < / t h > < b r / > < t h > C 5 5 1 0 < / t h > < b r / > < t h > C 5 5 1 5 < / t h > < b r / > < t h > C 5 5 2 0 < / t h > < b r / > < t h > C 5 5 2 5 < / t h > < b r / > < t h > C 5 5 3 0 < / t h > < b r / > < t h > C 5 5 3 5 < / t h > < b r / > < t h > C 5 5 4 0 < / t h > < b r / > < t h > C 5 5 4 5 < / t h > < b r / > < t h > C 5 5 5 0 < / t h > < b r / > < t h > C 5 5 5 5 < / t h > < b r / > < t h > C 7 0 0 5 < / t h > < b r / > < t h > C 7 0 1 0 < / t h > < b r / > < t h > C 7 0 1 2 < / t h > < b r / > < t h > C 7 0 1 5 < / t h > < b r / > < t h > C 7 0 2 0 < / t h > < b r / > < t h > C 7 0 2 5 < / t h > < b r / > < t h > C 7 0 3 0 < / t h > < b r / > < t h > C 9 9 0 5 < / t h > < b r / > < t h > C 9 9 1 0 < / t h > < b r / > < t h > C 9 9 1 5 < / t h > < b r / > < t h > C 9 9 2 0 < / t h > < b r / > < t h > C 9 9 2 2 < / t h > < b r / > < t h > C 9 9 2 3 < / t h > < b r / > < t h > C 9 9 2 4 < / t h > < b r / > < t h > C 9 9 2 5 < / t h > < b r / > < t h > C 9 9 3 0 < / t h > < b r / > < t h > C 9 9 3 5 < / t h > < b r / > < t h > C 9 9 4 0 < / t h > < b r / > < t h > C 9 9 5 0 < / t h > < b r / > < t h > C 9 9 9 9 < / t h > < b r / > < t h > n o m G r o u p e m e n t < / t h > < b r / > < t h > s i r e n G r o u p e m e n t < / t h > < b r / > < t h > n o m b r e D e C o m p e t e n c e s E x e r c e e s < / t h > < b r / > < / t r > < b r / > < / t h e a d > < b r / > < t b o d y > < b r / > < t r > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > C C d u T h o u a r s a i s < / t d > < b r / > < t d > 2 4 7 9 0 0 7 9 8 < / t d > < b r / > < t d > 3 7 < / t d > < b r / > < / t r > < b r / > < / t b o d y > < b r / > < / t a b l e > < / d i v > < b r / > a n d t h o s e o f a l l l o c a l a u t h o r i t i e s o f F r a n c e ( f i r s t f e w s h o w n h e r e ) : < / p > < b r / > < d i v c l a s s = " s - t a b l e - c o n t a i n e r " > < t a b l e c l a s s = " s - t a b l e " > < b r / > < t h e a d > < b r / > < t r > < b r / > < t h > C 1 0 1 0 < / t h > < b r / > < t h > C 1 0 1 5 < / t h > < b r / > < t h > C 1 0 2 0 < / t h > < b r / > < t h > C 1 0 2 5 < / t h > < b r / > < t h > C 1 0 3 0 < / t h > < b r / > < t h > C 1 5 0 2 < / t h > < b r / > < t h > C 1 5 0 5 < / t h > < b r / > < t h > C 1 5 0 7 < / t h > < b r / > < t h > C 1 5 1 0 < / t h > < b r / > < t h > C 1 5 1 5 < / t h > < b r / > < t h > C 1 5 2 0 < / t h > < b r / > < t h > C 1 5 2 5 < / t h > < b r / > < t h > C 1 5 2 8 < / t h > < b r / > < t h > C 1 5 2 9 < / t h > < b r / > < t h > C 1 5 3 0 < / t h > < b r / > < t h > C 1 5 3 1 < / t h > < b r / > < t h > C 1 5 3 2 < / t h > < b r / > < t h > C 1 5 3 3 < / t h > < b r / > < t h > C 1 5 3 4 < / t h > < b r / > < t h > C 1 5 3 5 < / t h > < b r / > < t h > C 1 5 4 0 < / t h > < b r / > < t h > C 1 5 4 5 < / t h > < b r / > < t h > C 1 5 5 0 < / t h > < b r / > < t h > C 1 5 5 5 < / t h > < b r / > < t h > C 1 5 6 0 < / t h > < b r / > < t h > C 2 0 0 5 < / t h > < b r / > < t h > C 2 0 1 0 < / t h > < b r / > < t h > C 2 0 1 5 < / t h > < b r / > < t h > C 2 5 1 0 < / t h > < b r / > < t h > C 2 5 1 5 < / t h > < b r / > < t h > C 2 5 2 0 < / t h > < b r / > < t h > C 2 5 2 1 < / t h > < b r / > < t h > C 2 5 2 5 < / t h > < b r / > < t h > C 2 5 2 6 < / t h > < b r / > < t h > C 3 0 0 5 < / t h > < b r / > < t h > C 3 0 1 0 < / t h > < b r / > < t h > C 3 0 1 5 < / t h > < b r / > < t h > C 3 0 2 0 < / t h > < b r / > < t h > C 3 0 2 5 < / t h > < b r / > < t h > C 3 2 1 0 < / t h > < b r / > < t h > C 3 2 2 0 < / t h > < b r / > < t h > C 3 5 0 5 < / t h > < b r / > < t h > C 3 5 1 0 < / t h > < b r / > < t h > C 3 5 1 5 < / t h > < b r / > < t h > C 4 0 0 5 < / t h > < b r / > < t h > C 4 0 0 6 < / t h > < b r / > < t h > C 4 0 0 7 < / t h > < b r / > < t h > C 4 0 0 8 < / t h > < b r / > < t h > C 4 0 1 0 < / t h > < b r / > < t h > C 4 0 1 5 < / t h > < b r / > < t h > C 4 0 1 6 < / t h > < b r / > < t h > C 4 0 1 7 < / t h > < b r / > < t h > C 4 0 2 0 < / t h > < b r / > < t h > C 4 0 2 5 < / t h > < b r / > < t h > C 4 5 0 5 < / t h > < b r / > < t h > C 4 5 1 0 < / t h > < b r / > < t h > C 4 5 1 5 < / t h > < b r / > < t h > C 4 5 2 0 < / t h > < b r / > < t h > C 4 5 2 5 < / t h > < b r / > < t h > C 4 5 3 0 < / t h > < b r / > < t h > C 4 5 3 1 < / t h > < b r / > < t h > C 4 5 3 2 < / t h > < b r / > < t h > C 4 5 3 5 < / t h > < b r / > < t h > C 4 5 4 0 < / t h > < b r / > < t h > C 4 5 4 5 < / t h > < b r / > < t h > C 4 5 5 0 < / t h > < b r / > < t h > C 4 5 5 5 < / t h > < b r / > < t h > C 4 5 6 0 < / t h > < b r / > < t h > C 5 0 0 5 < / t h > < b r / > < t h > C 5 0 1 0 < / t h > < b r / > < t h > C 5 0 1 5 < / t h > < b r / > < t h > C 5 2 1 0 < / t h > < b r / > < t h > C 5 2 2 0 < / t h > < b r / > < t h > C 5 5 0 5 < / t h > < b r / > < t h > C 5 5 1 0 < / t h > < b r / > < t h > C 5 5 1 5 < / t h > < b r / > < t h > C 5 5 2 0 < / t h > < b r / > < t h > C 5 5 2 5 < / t h > < b r / > < t h > C 5 5 3 0 < / t h > < b r / > < t h > C 5 5 3 5 < / t h > < b r / > < t h > C 5 5 4 0 < / t h > < b r / > < t h > C 5 5 4 5 < / t h > < b r / > < t h > C 5 5 5 0 < / t h > < b r / > < t h > C 5 5 5 5 < / t h > < b r / > < t h > C 7 0 0 5 < / t h > < b r / > < t h > C 7 0 1 0 < / t h > < b r / > < t h > C 7 0 1 2 < / t h > < b r / > < t h > C 7 0 1 5 < / t h > < b r / > < t h > C 7 0 2 0 < / t h > < b r / > < t h > C 7 0 2 5 < / t h > < b r / > < t h > C 7 0 3 0 < / t h > < b r / > < t h > C 9 9 0 5 < / t h > < b r / > < t h > C 9 9 1 0 < / t h > < b r / > < t h > C 9 9 1 5 < / t h > < b r / > < t h > C 9 9 2 0 < / t h > < b r / > < t h > C 9 9 2 2 < / t h > < b r / > < t h > C 9 9 2 3 < / t h > < b r / > < t h > C 9 9 2 4 < / t h > < b r / > < t h > C 9 9 2 5 < / t h > < b r / > < t h > C 9 9 3 0 < / t h > < b r / > < t h > C 9 9 3 5 < / t h > < b r / > < t h > C 9 9 4 0 < / t h > < b r / > < t h > C 9 9 5 0 < / t h > < b r / > < t h > C 9 9 9 9 < / t h > < b r / > < t h > n o m G r o u p e m e n t < / t h > < b r / > < t h > s i r e n G r o u p e m e n t < / t h > < b r / > < t h > n o m b r e D e C o m p e t e n c e s E x e r c e e s < / t h > < b r / > < / t r > < b r / > < / t h e a d > < b r / > < t b o d y > < b r / > < t r > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 1 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d > < b r / > < t d > 0 < / t d>
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
CC du Val de l'Oise
200040426
25


0
0
0
1
0
0
1
1
1
0
0
0
1
1
0
1
1
0
0
0
1
0
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
0
0
0
1
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
CC de l'Est de la Somme
200070985
30


0
0
0
0
0
1
1
1
1
0
0
0
1
1
0
1
1
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
1
0
1
0
1
1
1
1
0
1
0
0
0
0
0
0
1
0
0
0
0
1
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
CC du Pays de Bray
246000913
29



I received many solutions from the Data Science S.E. here, and I'm willing to try them. But I'm using Java and Spark 3.5.4 so I have to translate the code.
To perform the job, I have created an UDF function whose meant prototype is:

Code: Select all

Double similariteCompetences(String sirenGroupement, String[] competencesIntercoCandidate, String[] competencesIntercoReference)
und wird wie folgt implementiert:

Code: Select all

/** Les codes des compétences étudiées */
private final String[] codesCompetences = {
"C1010", "C1015", "C1020", "C1025", "C1030", "C1502", "C1505", "C1507", "C1510", "C1515",
"C1520", "C1525", "C1528", "C1529", "C1530", "C1531", "C1532", "C1533", "C1534", "C1535",
"C1540", "C1545", "C1550", "C1555", "C1560", "C2005", "C2010", "C2015", "C2510", "C2515",
"C2520", "C2521", "C2525", "C2526", "C3005", "C3010", "C3015", "C3020", "C3025", "C3210",
"C3220", "C3505", "C3510", "C3515", "C4005", "C4006", "C4007", "C4008", "C4010", "C4015",
"C4016", "C4017", "C4020", "C4025", "C4505", "C4510", "C4515", "C4520",
"C4525", "C4530", "C4531", "C4532", "C4535", "C4540", "C4545", "C4550", "C4555", "C4560",
"C5005", "C5010", "C5015", "C5210", "C5220", "C5505", "C5510", "C5515", "C5520", "C5525",
"C5530", "C5535", "C5540", "C5545", "C5550", "C5555", "C7005", "C7010", "C7012", "C7015",
"C7020", "C7025", "C7030", "C9905", "C9910", "C9915", "C9920", "C9922", "C9923", "C9924",
"C9925", "C9930", "C9935", "C9940", "C9950", "C9999"
};

/**
* Renvoyer le dataset des différences de choix de compétences, ordonné par taux de similarité
* @param intercommunalites Compétences des intercommunalités du jeu de données
* @return Dataset des différences de choix de compétences, avec une colonne "similarite" supplémentaire, ordonné par taux de similarité
*/
private Dataset differencesDeChoixDeCompetencesParUDF(Dataset intercoDeReference, Dataset intercommunalites) {
this.sparkSession.udf().register("similariteCompetences", (UDF3)
(sirenGroupement, competencesIntercoCandidate, competencesIntercoReference) -> {
scala.collection.Iterator itCandidat = competencesIntercoCandidate.iterator();
scala.collection.Iterator itReference = competencesIntercoReference.iterator();

int nombreCompetencesEquivalentes = 0;

while(itCandidat.hasNext() && itReference.hasNext()) {
nombreCompetencesEquivalentes += itCandidat.next().equals(itReference.next()) ? 1 : 0;
}

return (double)nombreCompetencesEquivalentes / (double)GroupementsPerimetresITCase.this.codesCompetences.length;
}, DataTypes.DoubleType);

Column similarite = callUDF("similariteCompetences", SIREN_GROUPEMENT.col(), columnCompetences(intercommunalites), columnCompetences(intercoDeReference));

return intercommunalites.withColumn("similarite", similarite).orderBy(similarite.desc());
}
Ich erwarte, dass es zu jeder lokalen Behörde eine ähnliche Vermittlung von 0 zu 1.0 hinzufügt, in dem dargestellt wird, wie viel es ist Ähnlich wie bei meiner Referenz.
, aber wenn sie ausgeführt wird Kompetenzen, die der örtlichen Referenzbehörde, der eine der Vergleichskandidaten der örtlichen Behörde, ist immer gleich.
zum Aufrufen einer UDF -Fonction, die zwei Array -Parameter erfordert (die beide 104 Werte haben), muss ich eine Array -Spalte auf Datensätze Felderwerte erstellen. Weil UDF -Fonction nur mit Spalten Argumente aufgerufen werden kann. Und ich verwende org.apache.spark.sql.functions.Array ()

Code: Select all

/**
* Renvoyer une colonne rapportant toutes les compétences d'une intercommunalité
* @param intercommunalites Le dataset d'intercommunalité(s) vers lequel doivent se référer les colonnes
* @return Column Array de compétences d'une intercommunalité
*/
private Column columnCompetences(Dataset intercommunalites) {
intercommunalites.show(2000, false);

Column[] colonnesCompetences = new Column[this.codesCompetences.length];

for(int index=0; index < this.codesCompetences.length; index++) {
colonnesCompetences[index] = intercommunalites.col(this.codesCompetences[index]);
}

return array(colonnesCompetences);
}
Was passiert:
Die Beispiellisten von Kompetenzen oben in dieser Frage sind diejenigen, die interkommunaliten.show (2000, False) Zeigt. P> Aber zur Laufzeit ein Haltepunkt in der Zeile festgelegt: < /p>

Code: Select all

return (double)nombreCompetencesEquivalentes / (double)GroupementsPerimetresITCase.this.codesCompetences.length;
von difficendechoixDecompeTenCarudf (...)
Zeigen Sie, dass es immer 104 ähnliche Werte findet, da beide empfangene Argumente völlig gleich sind ... < br/>

Was auch immer Zeilen berücksichtigt werden.
Nach den Datensatz -Dumps hätten sie unterschiedlich sein sollen. < /p>
Warum empfange ich jedes Mal die gleichen Werte für beide Parameter? Hypothese: Intercoreference wird von Intercommunaliten ein unerwarteter und übermäßiger Weg angetrieben:
Hier ist der Code, mit dem ich die Intercoreference oder Intercommunaliten zu Beginn des Tests:

Code: Select all

/**
* Les compétences communes d'intercommunalités
*/
@DisplayName("Compétences exclusives d'intercommunalités ou exclues")
@Order(30)
@Test
void competencesExclusivesEtExclues() {
String sirenGroupementCandidat = "247900798";

List competences = new ArrayList();

for(String codeCompetence : this.codesCompetences) {
competences.add(new Column(codeCompetence));
}

List selectClause = new ArrayList(competences);
selectClause.add(NOM_GROUPEMENT.col());
selectClause.add(SIREN_GROUPEMENT.col());
selectClause.add(col("nombreDeCompetencesExercees"));

OptionsCreationLecture options = this.perimetreEPCIDataset.optionsCreationLecture();

// Compétences des communautés de communes
Dataset competencesCC = this.perimetreEPCIDataset.rowPerimetres(options, new HistoriqueExecution(), 2024, true, new EPCIPerimetreTriCommuneSiegeCommuneMembreSirenMembre())
.where(NATURE_JURIDIQUE.col().equalTo("CC")                           // Les communautés de communes
.and(CODE_COMMUNE_SIEGE.col().equalTo(CODE_COMMUNE_MEMBRE.col()))) // Seulement la ligne de périmètre se rapportant au groupement siège
.sample(0.06, 15)
.select(selectClause.toArray(new Column[]{}));

Dataset intercoReference = competencesCC.where(SIREN_GROUPEMENT.col().equalTo(sirenGroupementCandidat));

LOGGER.info("Intercommunalité candidate : ");
intercoReference.show(1, false);

LOGGER.info("Intercommunalités comparées : ");
differencesDeChoixDeCompetencesParUDF(intercoReference, competencesCC)
.show(2000, false);
}
Nehmen wir an, Datensatz intercoreference = comportingcencescc.where (Siren_Groupement.col (). EqualTo (SirengroupementCandidat); /> Ich habe dieses Laden mit diesem geändert: < /p>

Code: Select all

Dataset competencesCC = this.perimetreEPCIDataset.rowPerimetres(options, new HistoriqueExecution(), 2024, true, new EPCIPerimetreTriCommuneSiegeCommuneMembreSirenMembre())
.where(NATURE_JURIDIQUE.col().equalTo("CC")                           // Les communautés de communes
.and(CODE_COMMUNE_SIEGE.col().equalTo(CODE_COMMUNE_MEMBRE.col()))) // Seulement la ligne de périmètre se rapportant au groupement siège
.sample(0.06, 15)
.select(selectClause.toArray(new Column[]{}));

Dataset intercoReference = this.perimetreEPCIDataset.rowPerimetres(options, new HistoriqueExecution(), 2024, true, new EPCIPerimetreTriCommuneSiegeCommuneMembreSirenMembre())
.where(NATURE_JURIDIQUE.col().equalTo("CC")                           // Les communautés de communes
.and(CODE_COMMUNE_SIEGE.col().equalTo(CODE_COMMUNE_MEMBRE.col()))  // Seulement la ligne de périmètre se rapportant au groupement siège
.and(SIREN_GROUPEMENT.col().equalTo(sirenGroupementCandidat)))     // Celle de référence
.select(selectClause.toArray(new Column[]{}));
Aber dann erhalte ich eine Laufzeitausnahme in der Zeile:

Code: Select all

return intercommunalites.withColumn("similarite", similarite).orderBy(similarite.desc());
von DataSet

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post