Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-19587

Error result when casting binary type as varchar

    XMLWordPrintableJSON

Details

    Description

      The result is error when casting binary type as varchar type.

      For example,

      @Test
      def testCast1(): Unit = {
        testSqlApi(
          "CAST(X'68656c6c6f' as varchar)",
          "hello")
      }
      

      The result is

      Expected :hello
      Actual   :[B@57fae983
      

      It is right as follow,

      @Test
      def testCast(): Unit = {
        testSqlApi(
          "CAST(CAST(X'68656c6c6f' as varbinary) as varchar)",
          "hello")
      }
      

      We just need to change 

      case (VARBINARY, VARCHAR | CHAR)

      to 

      case (BINARY | VARBINARY, VARCHAR | CHAR) 
      

      in ScalarOperatorGens#generateCast.

       

      Attachments

        Issue Links

          Activity

            People

              hailong wang hailong wang
              hailong wang hailong wang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: