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

Unsafe comparing bigints and strings

    XMLWordPrintableJSON

Details

    Description

      Comparing bigints and varchars or chars may result to wrong result, for example:

      CREATE TABLE test_a (appid1 varchar(256), appid2 char(20));
      INSERT INTO test_a VALUES ('2882303761517473127', '2882303761517473127'), ('2882303761517473276','2882303761517473276');

      SET hive.strict.checks.type.safety=false;
      SELECT appid1 FROM test_a WHERE appid1 = 2882303761517473127;
      SELECT appid2 FROM test_a WHERE appid2 = 2882303761517473127;​

      Both queries will output the row: ('2882303761517473276','2882303761517473276')

      Attachments

        1. HIVE-23269.3.patch
          8 kB
          Zhihua Deng
        2. HIVE-23269.2.patch
          8 kB
          Zhihua Deng
        3. HIVE-23269.patch
          10 kB
          Zhihua Deng

        Issue Links

          Activity

            People

              dengzh Zhihua Deng
              dengzh Zhihua Deng
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m