Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private[offline] object DataFrameDefaultValueSubstituter extends DataFrameDefaul
// For tensor default, since we don't have type, so we need to use expr to construct the default column
val schema = field.dataType
val tensorData = defaultFeatureValue.getAsTensorData
val ts = FeaturizedDatasetUtils.tensorToFDSDataFrameRow(tensorData)
val ts = FeaturizedDatasetUtils.tensorToFDSDataFrameRow(tensorData, Some(schema))
val fdsTensorDefaultUDF = getFDSTensorDefaultUDF(schema, ts)
ss.udf.register("tz_udf", fdsTensorDefaultUDF)
expr(s"tz_udf($featureColumnName)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ class AnchoredFeaturesIntegTest extends FeathrIntegTest {
| type: "DENSE_VECTOR"
| default: [7,8,9]
| }
| ee2: {
| def: "c"
| type: {
| type: TENSOR
| tensorCategory: DENSE
| dimensionType: [INT]
| valType: FLOAT
| }
| default: []
| }
| ff: {
| def: "c"
| default: [6,7]
Expand Down Expand Up @@ -155,7 +165,7 @@ class AnchoredFeaturesIntegTest extends FeathrIntegTest {
*/
@Test
def testSingleKeyJoinWithDifferentFeatureTypes(): Unit = {
val selectedColumns = Seq("x", "aa", "bb", "cc", "dd", "ee", "ff", "multiply_a_b", "categorical_b") // , "z")
val selectedColumns = Seq("x", "aa", "bb", "cc", "dd", "ee", "ee2", "ff", "multiply_a_b", "categorical_b") // , "z")
val featureJoinConf =
s"""
|
Expand Down Expand Up @@ -186,6 +196,8 @@ class AnchoredFeaturesIntegTest extends FeathrIntegTest {
null,
// ee
mutable.WrappedArray.make(Array(7.0f, 8.0f, 9.0f)),
// ee2
mutable.WrappedArray.empty,
// ff
mutable.WrappedArray.make(Array(6.0f, 7.0f)),
// multiply_a_b
Expand All @@ -207,6 +219,8 @@ class AnchoredFeaturesIntegTest extends FeathrIntegTest {
mutable.WrappedArray.make(Array(1.0f, 2.0f, 3.0f)),
// ee
mutable.WrappedArray.make(Array(1.0f, 2.0f, 3.0f)),
// ee2
mutable.WrappedArray.make(Array(1.0f, 2.0f, 3.0f)),
// ff
mutable.WrappedArray.make(Array(1.0f, 2.0f, 3.0f)),
// multiply_a_b
Expand All @@ -228,6 +242,8 @@ class AnchoredFeaturesIntegTest extends FeathrIntegTest {
mutable.WrappedArray.make(Array(4.0f, 5.0f, 6.0f)),
// ee
mutable.WrappedArray.make(Array(4.0f, 5.0f, 6.0f)),
// ee2
mutable.WrappedArray.make(Array(4.0f, 5.0f, 6.0f)),
// ff
mutable.WrappedArray.make(Array(4.0f, 5.0f, 6.0f)),
// multiply_a_b
Expand All @@ -246,6 +262,7 @@ class AnchoredFeaturesIntegTest extends FeathrIntegTest {
StructField("cc", FloatType, true),
StructField("dd", ArrayType(FloatType, true), true),
StructField("ee", ArrayType(FloatType, false), true),
StructField("ee2", ArrayType(FloatType, false), true),
StructField("ff", ArrayType(FloatType, false), true),
StructField(
"multiply_a_b",
Expand Down