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

Use -strict argument for Thrift code generation to prevent compatibility issues

    XMLWordPrintableJSON

Details

    Description

      When generating code, the Thrift compiler has a "-strict" option that errors out for certain warnings. Specifically, it errors out when there are implicit field keys:

              pwarning(1, "No field key specified for %s, resulting protocol may have conflicts or not be backwards compatible!\n", $6);
              if (g_strict >= 192) {
                yyerror("Implicit field keys are deprecated and not allowed with -strict");
                exit(1);
              }

      https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/thrifty.yy#L824-L828

      This is a warning that has been introduced in the past (see HIVE-27103 and HIVE-20365)

      I think that it would be useful to add "-strict" to the arguments for Thrift code generation. It would prevent the introduction of new compatibility issues, because the command would fail rather than generating a warning that is easy to miss.

      The current Thrift files already work with -strict, so this should be a painless thing.

      Attachments

        Issue Links

          Activity

            People

              joemcdonnell Joe McDonnell
              joemcdonnell Joe McDonnell
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: