File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
mllib/src/main/scala/org/apache/spark/ml/attribute Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff 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/**
You can’t perform that action at this time.
0 commit comments