Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-6903

SchemaBuilder improvements

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.16.0
    • 1.16.0
    • None

    Description

      SchemaBuilder code will be moved to the exec package from test in DRILL-6901.
      There are a couple of improvements that can be done in the existing code:

      1. ColumnBuilder: setScale method
      setScale method is a bit awkward, it requires precision as second parameter. More natural to go with precision and then scale.
      Suggestion is to have setPrecisionAndScale method instead which will accept precision and scale as first and second parameters.
      https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/test/rowSet/schema/ColumnBuilder.java#L57

      2. SchemaContainer: addColumn method
      addColumn method has parameter AbstractColumnMetadata, since we have interface ColumnMetadata, it's better to operate on the interface level rather than on the abstract class.
      https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/test/rowSet/schema/SchemaContainer.java#L28

      3. MapBuilder / RepeatedListBuilder / UnionBuilder: buildCol method
      buildCol method is private in these classes. These classes create columns and add them to the schema. There might be use cases when dev needs only column and will add it to the schema when needed. Suggestion is to make buildCol method public. Also all these classes require SchemaContainer as parent, though when we only need them to build the column, second constructor can be added without SchemaContainer parameter.

      Attachments

        Issue Links

          Activity

            People

              arina Arina Ielchiieva
              arina Arina Ielchiieva
              Paul Rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: