Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-6560

varchar and char types cannot be cast to binary

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.12.0, 0.13.0, 0.13.1
    • 0.14.0
    • Types, UDF
    • None
    • TODOC14

    Description

      GenericUDFToBinary can convert string to binary. VARCHAR and CHAR are substitutable with string. Thus, GenericUDFToBinary should also be able to convert VARCHAR and CHAR to binary. However,

      hive> select binary(cast('abc' as varchar(5)) from decimal_udf limit 1;
      FAILED: ParseException line 1:40 missing ) at 'from' near '<EOF>'
      hive> select binary(cast('abc' as varchar(5))) from decimal_udf limit 1;
      FAILED: SemanticException Line 0:-1 Wrong arguments ''abc'': Only string or binary data can be cast into binary data types.
      

      Attachments

        1. HIVE-6560.3.patch
          8 kB
          Chao Sun
        2. HIVE-6560.2.patch
          4 kB
          Chao Sun
        3. HIVE-6560.1.patch
          4 kB
          Chao Sun

        Activity

          People

            csun Chao Sun
            xuefuz Xuefu Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: