Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-38434

Correct semantic of CheckAnalysis.getDataTypesAreCompatibleFn method

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.2.1
    • 3.3.0
    • SQL
    • None

    Description

      Currently, in `CheckAnalysis` method getDataTypesAreCompatibleFn implemented as:

        private def getDataTypesAreCompatibleFn(plan: LogicalPlan): (DataType, DataType) => Boolean = {
          val isUnion = plan.isInstanceOf[Union]
          if (isUnion) {
            (dt1: DataType, dt2: DataType) =>
              !DataType.equalsStructurally(dt1, dt2, true)
          } else {
            // SPARK-18058: we shall not care about the nullability of columns
            (dt1: DataType, dt2: DataType) =>
              TypeCoercion.findWiderTypeForTwo(dt1.asNullable, dt2.asNullable).isEmpty
          }
        }
      

      Return false when data types are compatible, otherwise return true, which is pretty confusing.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ivoson Tengfei Huang
            ivoson Tengfei Huang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment