Skip to content

Commit 92c8287

Browse files
committed
revert attributes change
1 parent c3da8f8 commit 92c8287

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

mllib/src/main/scala/org/apache/spark/ml/attribute/attributes.scala

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,18 @@ private[attribute] trait AttributeFactory {
124124
private[attribute] def fromMetadata(metadata: Metadata): Attribute
125125

126126
/**
127-
* Creates an [[Attribute]] from a [[StructField]] instance, optionally preserving name.
127+
* Creates an [[Attribute]] from a [[StructField]] instance.
128128
*/
129-
private[ml] def decodeStructField(field: StructField, preserveName: Boolean): Attribute = {
129+
def fromStructField(field: StructField): Attribute = {
130130
require(field.dataType.isInstanceOf[NumericType])
131131
val metadata = field.metadata
132132
val mlAttr = AttributeKeys.ML_ATTR
133133
if (metadata.contains(mlAttr)) {
134-
val attr = fromMetadata(metadata.getMetadata(mlAttr))
135-
if (preserveName) {
136-
attr
137-
} else {
138-
attr.withName(field.name)
139-
}
134+
fromMetadata(metadata.getMetadata(mlAttr)).withName(field.name)
140135
} else {
141136
UnresolvedAttribute
142137
}
143138
}
144-
145-
/**
146-
* Creates an [[Attribute]] from a [[StructField]] instance.
147-
*/
148-
def fromStructField(field: StructField): Attribute = decodeStructField(field, false)
149139
}
150140

151141
/**

0 commit comments

Comments
 (0)