@@ -381,6 +381,15 @@ def test_func(col1):
381
381
"test_func_col1_2" ,
382
382
]
383
383
384
+ def test_generate_output_column_names_single_argument_multiple_output_type_odt (
385
+ self ,
386
+ ):
387
+ @udf ([int , float , int ])
388
+ def test_func (col1 ):
389
+ return pd .DataFrame (
390
+ {"col1" : [col1 + 1 ], "col2" : [col1 + 1 ], "col3" : [col1 + 1 ]}
391
+ )
392
+
384
393
odt = TransformationFunction (
385
394
featurestore_id = 10 ,
386
395
hopsworks_udf = test_func ,
@@ -420,6 +429,17 @@ def test_func(col1):
420
429
"prefix_test_func_prefix_col1_2" ,
421
430
]
422
431
432
+ def test_generate_output_column_names_single_argument_multiple_output_type_prefix_odt (
433
+ self ,
434
+ ):
435
+ @udf ([int , float , int ])
436
+ def test_func (col1 ):
437
+ return pd .DataFrame (
438
+ {"col1" : [col1 + 1 ], "col2" : [col1 + 1 ], "col3" : [col1 + 1 ]}
439
+ )
440
+
441
+ test_func ._feature_name_prefix = "prefix_"
442
+
423
443
odt = TransformationFunction (
424
444
featurestore_id = 10 ,
425
445
hopsworks_udf = test_func ,
@@ -497,6 +517,17 @@ def test_func(col1, col2, col3):
497
517
"prefix_test_func_prefix_col1_prefix_col2_prefix_col3_2" ,
498
518
]
499
519
520
+ def test_generate_output_column_names_multiple_argument_multiple_output_type_prefix_odt (
521
+ self ,
522
+ ):
523
+ @udf ([int , float , int ])
524
+ def test_func (col1 , col2 , col3 ):
525
+ return pd .DataFrame (
526
+ {"col1" : [col1 + 1 ], "col2" : [col2 + 1 ], "col3" : [col3 + 1 ]}
527
+ )
528
+
529
+ test_func ._feature_name_prefix = "prefix_"
530
+
500
531
odt = TransformationFunction (
501
532
featurestore_id = 10 ,
502
533
hopsworks_udf = test_func ,
@@ -911,7 +942,7 @@ def really_long_function_name_that_exceed_63_characters_causing_invalid_name_for
911
942
"really_long_function_name_that_exceed_63_characters_causing_inv"
912
943
]
913
944
914
- def test_equality (self ):
945
+ def test_equality_mdt (self ):
915
946
@udf ([int ])
916
947
def add_one (feature ):
917
948
return feature + 1
@@ -928,6 +959,13 @@ def add_one(feature):
928
959
transformation_type = TransformationType .MODEL_DEPENDENT ,
929
960
)
930
961
962
+ assert mdt1 == mdt2
963
+
964
+ def test_equality_odt (self ):
965
+ @udf ([int ])
966
+ def add_one (feature ):
967
+ return feature + 1
968
+
931
969
odt1 = TransformationFunction (
932
970
featurestore_id = 10 ,
933
971
hopsworks_udf = add_one ,
@@ -940,6 +978,23 @@ def add_one(feature):
940
978
transformation_type = TransformationType .ON_DEMAND ,
941
979
)
942
980
943
- assert mdt1 == mdt2
944
981
assert odt1 == odt2
945
- assert mdt1 != odt1
982
+
983
+ def test_inequality (self ):
984
+ @udf ([int ])
985
+ def add_one (feature ):
986
+ return feature + 1
987
+
988
+ mdt = TransformationFunction (
989
+ featurestore_id = 10 ,
990
+ hopsworks_udf = add_one ,
991
+ transformation_type = TransformationType .MODEL_DEPENDENT ,
992
+ )
993
+
994
+ odt = TransformationFunction (
995
+ featurestore_id = 10 ,
996
+ hopsworks_udf = add_one ,
997
+ transformation_type = TransformationType .ON_DEMAND ,
998
+ )
999
+
1000
+ assert mdt != odt
0 commit comments