Github user eyalfa commented on the issue:

    https://github.com/apache/spark/pull/14444
  
    I'm not talking about the default column name,but rather on explicit column
    names. When users alias the expression or refers to already named columns
    (I.e. table columns) they expect the strut's attribute to have this name.
    
    Regarding your first claim, I think we should treat generated names
    differently from explicit names. I don't care much if the column is named
    col1,col2 or Moses :-) as long as it's stable,so far these names stabilized
    after analysis (give or take bugs) so they were usable.
    
    Back to the case at hand,i think if we'd assign stars with a generated name
    it'd be immediately discarded during analysis when the star is resolved.
    What do you think about this?
    
    On Sep 15, 2016 1:01 PM, "Wenchen Fan" <notificati...@github.com> wrote:
    
    > *@cloud-fan* commented on this pull request.
    > ------------------------------
    >
    > In sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/
    > complexTypeCreator.scala <https://github.com/apache/spark/pull/14444>:
    >
    > > -  override lazy val dataType: StructType = {
    > -    val fields = children.zipWithIndex.map { case (child, idx) =>
    > -      child match {
    > -        case ne: NamedExpression =>
    > -          StructField(ne.name, ne.dataType, ne.nullable, ne.metadata)
    > -        case _ =>
    > -          StructField(s"col${idx + 1}", child.dataType, child.nullable, 
Metadata.empty)
    > +object CreateStruct extends (Seq[Expression] => CreateNamedStruct) {
    > +  def apply(children: Seq[Expression]) : CreateNamedStruct = {
    > +    val namedStructArgs = {
    > +      val attNames = for {
    > +        (child, idx) <- children.zipWithIndex
    > +      } yield {
    > +        child match {
    > +          case ne: NamedExpression => ne.name
    > +          case _ => s"col${idx + 1}"
    >
    > I'd argue that we break it already. In the previous CreateStruct, the
    > field name is inherited from *resolved* NamedExpression, but now we get
    > it from the NamedExpression that may not be resolved. This can bring
    > inconsistency, e.g. after resolve UnresolvedAttribute to 
AttriuteReference,
    > the name may change.
    >
    > If you agree that default column name is not a backwards compatibility
    > issue, why do you treat default struct field name a backwards 
compatibility
    > issue?
    >
    > —
    > You are receiving this because you were mentioned.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/spark/pull/14444>, or mute the thread
    > 
<https://github.com/notifications/unsubscribe-auth/ABFFOc5Yptufe51K1N90GuyEUYlAaWgvks5qqReDgaJpZM4JaDJr>
    > .
    >



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to