Class Schema.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • addColumnFloat

        public Schema.Builder addColumnFloat​(String name)
        Add a Float column with no restrictions on the allowable values, except for no NaN/infinite values allowed
        Parameters:
        name - Name of the column
      • addColumnFloat

        public Schema.Builder addColumnFloat​(String name,
                                             Float minAllowedValue,
                                             Float maxAllowedValue)
        Add a Float column with the specified restrictions (and no NaN/Infinite values allowed)
        Parameters:
        name - Name of the column
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
        Returns:
      • addColumnFloat

        public Schema.Builder addColumnFloat​(String name,
                                             Float minAllowedValue,
                                             Float maxAllowedValue,
                                             boolean allowNaN,
                                             boolean allowInfinite)
        Add a Float column with the specified restrictions
        Parameters:
        name - Name of the column
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
        allowNaN - If false: don't allow NaN values. If true: allow.
        allowInfinite - If false: don't allow infinite values. If true: allow
      • addColumnsFloat

        public Schema.Builder addColumnsFloat​(String... columnNames)
        Add multiple Float columns with no restrictions on the allowable values of the columns (other than no NaN/Infinite)
        Parameters:
        columnNames - Names of the columns to add
      • addColumnsFloat

        public Schema.Builder addColumnsFloat​(String pattern,
                                              int minIdxInclusive,
                                              int maxIdxInclusive)
        A convenience method for adding multiple Float columns. For example, to add columns "myFloatCol_0", "myFloatCol_1", "myFloatCol_2", use addColumnsFloat("myFloatCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
      • addColumnsFloat

        public Schema.Builder addColumnsFloat​(String pattern,
                                              int minIdxInclusive,
                                              int maxIdxInclusive,
                                              Float minAllowedValue,
                                              Float maxAllowedValue,
                                              boolean allowNaN,
                                              boolean allowInfinite)
        A convenience method for adding multiple Float columns, with additional restrictions that apply to all columns For example, to add columns "myFloatCol_0", "myFloatCol_1", "myFloatCol_2", use addColumnsFloat("myFloatCol_%d",0,2,null,null,false,false)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
        allowNaN - If false: don't allow NaN values. If true: allow.
        allowInfinite - If false: don't allow infinite values. If true: allow
      • addColumnDouble

        public Schema.Builder addColumnDouble​(String name)
        Add a Double column with no restrictions on the allowable values, except for no NaN/infinite values allowed
        Parameters:
        name - Name of the column
      • addColumnDouble

        public Schema.Builder addColumnDouble​(String name,
                                              Double minAllowedValue,
                                              Double maxAllowedValue)
        Add a Double column with the specified restrictions (and no NaN/Infinite values allowed)
        Parameters:
        name - Name of the column
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
        Returns:
      • addColumnDouble

        public Schema.Builder addColumnDouble​(String name,
                                              Double minAllowedValue,
                                              Double maxAllowedValue,
                                              boolean allowNaN,
                                              boolean allowInfinite)
        Add a Double column with the specified restrictions
        Parameters:
        name - Name of the column
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
        allowNaN - If false: don't allow NaN values. If true: allow.
        allowInfinite - If false: don't allow infinite values. If true: allow
      • addColumnsDouble

        public Schema.Builder addColumnsDouble​(String... columnNames)
        Add multiple Double columns with no restrictions on the allowable values of the columns (other than no NaN/Infinite)
        Parameters:
        columnNames - Names of the columns to add
      • addColumnsDouble

        public Schema.Builder addColumnsDouble​(String pattern,
                                               int minIdxInclusive,
                                               int maxIdxInclusive)
        A convenience method for adding multiple Double columns. For example, to add columns "myDoubleCol_0", "myDoubleCol_1", "myDoubleCol_2", use addColumnsDouble("myDoubleCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
      • addColumnsDouble

        public Schema.Builder addColumnsDouble​(String pattern,
                                               int minIdxInclusive,
                                               int maxIdxInclusive,
                                               Double minAllowedValue,
                                               Double maxAllowedValue,
                                               boolean allowNaN,
                                               boolean allowInfinite)
        A convenience method for adding multiple Double columns, with additional restrictions that apply to all columns For example, to add columns "myDoubleCol_0", "myDoubleCol_1", "myDoubleCol_2", use addColumnsDouble("myDoubleCol_%d",0,2,null,null,false,false)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
        allowNaN - If false: don't allow NaN values. If true: allow.
        allowInfinite - If false: don't allow infinite values. If true: allow
      • addColumnInteger

        public Schema.Builder addColumnInteger​(String name)
        Add an Integer column with no restrictions on the allowable values
        Parameters:
        name - Name of the column
      • addColumnInteger

        public Schema.Builder addColumnInteger​(String name,
                                               Integer minAllowedValue,
                                               Integer maxAllowedValue)
        Add an Integer column with the specified min/max allowable values
        Parameters:
        name - Name of the column
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
      • addColumnsInteger

        public Schema.Builder addColumnsInteger​(String... names)
        Add multiple Integer columns with no restrictions on the min/max allowable values
        Parameters:
        names - Names of the integer columns to add
      • addColumnsInteger

        public Schema.Builder addColumnsInteger​(String pattern,
                                                int minIdxInclusive,
                                                int maxIdxInclusive)
        A convenience method for adding multiple Integer columns. For example, to add columns "myIntegerCol_0", "myIntegerCol_1", "myIntegerCol_2", use addColumnsInteger("myIntegerCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
      • addColumnsInteger

        public Schema.Builder addColumnsInteger​(String pattern,
                                                int minIdxInclusive,
                                                int maxIdxInclusive,
                                                Integer minAllowedValue,
                                                Integer maxAllowedValue)
        A convenience method for adding multiple Integer columns. For example, to add columns "myIntegerCol_0", "myIntegerCol_1", "myIntegerCol_2", use addColumnsInteger("myIntegerCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
      • addColumnCategorical

        public Schema.Builder addColumnCategorical​(String name,
                                                   String... stateNames)
        Add a Categorical column, with the specified state names
        Parameters:
        name - Name of the column
        stateNames - Names of the allowable states for this categorical column
      • addColumnCategorical

        public Schema.Builder addColumnCategorical​(String name,
                                                   List<String> stateNames)
        Add a Categorical column, with the specified state names
        Parameters:
        name - Name of the column
        stateNames - Names of the allowable states for this categorical column
      • addColumnLong

        public Schema.Builder addColumnLong​(String name)
        Add a Long column, with no restrictions on the min/max values
        Parameters:
        name - Name of the column
      • addColumnLong

        public Schema.Builder addColumnLong​(String name,
                                            Long minAllowedValue,
                                            Long maxAllowedValue)
        Add a Long column with the specified min/max allowable values
        Parameters:
        name - Name of the column
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
      • addColumnsLong

        public Schema.Builder addColumnsLong​(String... names)
        Add multiple Long columns, with no restrictions on the allowable values
        Parameters:
        names - Names of the Long columns to add
      • addColumnsLong

        public Schema.Builder addColumnsLong​(String pattern,
                                             int minIdxInclusive,
                                             int maxIdxInclusive)
        A convenience method for adding multiple Long columns. For example, to add columns "myLongCol_0", "myLongCol_1", "myLongCol_2", use addColumnsLong("myLongCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
      • addColumnsLong

        public Schema.Builder addColumnsLong​(String pattern,
                                             int minIdxInclusive,
                                             int maxIdxInclusive,
                                             Long minAllowedValue,
                                             Long maxAllowedValue)
        A convenience method for adding multiple Long columns. For example, to add columns "myLongCol_0", "myLongCol_1", "myLongCol_2", use addColumnsLong("myLongCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
        minAllowedValue - Minimum allowed value (inclusive). If null: no restriction
        maxAllowedValue - Maximum allowed value (inclusive). If null: no restriction
      • addColumnString

        public Schema.Builder addColumnString​(String name)
        Add a String column with no restrictions on the allowable values.
        Parameters:
        name - Name of the column
      • addColumnsString

        public Schema.Builder addColumnsString​(String... columnNames)
        Add multiple String columns with no restrictions on the allowable values
        Parameters:
        columnNames - Names of the String columns to add
      • addColumnString

        public Schema.Builder addColumnString​(String name,
                                              String regex,
                                              Integer minAllowableLength,
                                              Integer maxAllowableLength)
        Add a String column with the specified restrictions
        Parameters:
        name - Name of the column
        regex - Regex that the String must match in order to be considered valid. If null: no regex restriction
        minAllowableLength - Minimum allowable length for the String to be considered valid
        maxAllowableLength - Maximum allowable length for the String to be considered valid
      • addColumnsString

        public Schema.Builder addColumnsString​(String pattern,
                                               int minIdxInclusive,
                                               int maxIdxInclusive)
        A convenience method for adding multiple numbered String columns. For example, to add columns "myStringCol_0", "myStringCol_1", "myStringCol_2", use addColumnsString("myStringCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
      • addColumnsString

        public Schema.Builder addColumnsString​(String pattern,
                                               int minIdxInclusive,
                                               int maxIdxInclusive,
                                               String regex,
                                               Integer minAllowedLength,
                                               Integer maxAllowedLength)
        A convenience method for adding multiple numbered String columns. For example, to add columns "myStringCol_0", "myStringCol_1", "myStringCol_2", use addColumnsString("myStringCol_%d",0,2)
        Parameters:
        pattern - Pattern to use (via String.format). "%d" is replaced with column numbers
        minIdxInclusive - Minimum column index to use (inclusive)
        maxIdxInclusive - Maximum column index to use (inclusive)
        regex - Regex that the String must match in order to be considered valid. If null: no regex restriction
        minAllowedLength - Minimum allowed length of strings (inclusive). If null: no restriction
        maxAllowedLength - Maximum allowed length of strings (inclusive). If null: no restriction
      • addColumnTime

        public Schema.Builder addColumnTime​(String columnName,
                                            TimeZone timeZone)
        Add a Time column with no restrictions on the min/max allowable times NOTE: Time columns are represented by LONG (epoch millisecond) values. For time values in human-readable formats, use String columns + StringToTimeTransform
        Parameters:
        columnName - Name of the column
        timeZone - Time zone of the time column
      • addColumnTime

        public Schema.Builder addColumnTime​(String columnName,
                                            org.joda.time.DateTimeZone timeZone)
        Add a Time column with no restrictions on the min/max allowable times NOTE: Time columns are represented by LONG (epoch millisecond) values. For time values in human-readable formats, use String columns + StringToTimeTransform
        Parameters:
        columnName - Name of the column
        timeZone - Time zone of the time column
      • addColumnTime

        public Schema.Builder addColumnTime​(String columnName,
                                            org.joda.time.DateTimeZone timeZone,
                                            Long minValidValue,
                                            Long maxValidValue)
        Add a Time column with the specified restrictions NOTE: Time columns are represented by LONG (epoch millisecond) values. For time values in human-readable formats, use String columns + StringToTimeTransform
        Parameters:
        columnName - Name of the column
        timeZone - Time zone of the time column
        minValidValue - Minumum allowable time (in milliseconds). May be null.
        maxValidValue - Maximum allowable time (in milliseconds). May be null.
      • addColumnNDArray

        public Schema.Builder addColumnNDArray​(String columnName,
                                               long[] shape)
        Add a NDArray column
        Parameters:
        columnName - Name of the column
        shape - shape of the NDArray column. Use -1 in entries to specify as "variable length" in that dimension
      • addColumnBoolean

        public Schema.Builder addColumnBoolean​(String columnName)
        Add a boolean (binary true/false) column
        Parameters:
        columnName - Name of the new column
      • build

        public Schema build()
        Create the Schema