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

CheckOverflowInTableInsert does not handle cases where the cast was moved by the optimizer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.4.0
    • None
    • Optimizer
    • None

    Description

      CheckOverflowInTableInsert is supposed to rewrite error messages that come from overflow exceptions on casts that are implicitly inserted for INSERTs to match the output schema. This does not work in all cases, for example when the cast is moved by the optimizer
       

      CREATE TABLE source(value BIGINT) USING parquet
      INSERT INTO source values (${Long.MaxValue.toString})
      CREATE TABLE target(value INT) USING parquet
      INSERT INTO target SELECT CASE WHEN value < 0 THEN 0 ELSE value END FROM source

      In this case, the expression will no nothing because it only becomes effective if the direct child is a cast (matching code)

      Attachments

        Activity

          People

            Unassigned Unassigned
            olaky Jan-Ole Sasse
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: