Class TableTools

java.lang.Object
com.illumon.iris.db.tables.utils.TableTools

public class TableTools
extends Object
Tools for working with tables. This includes methods to examine tables, combine them, convert them to and from CSV files, and create and manipulate columns.
  • Field Details

  • Constructor Details

  • Method Details

    • show

      public static void show​(@NotNull Table source, String... columns)
      Prints the first few rows of a table to standard output.
      Parameters:
      source - a Deephaven table object
      columns - varargs of column names to display
    • showWithIndex

      public static void showWithIndex​(@NotNull Table source, String... columns)
      Prints the first few rows of a table to standard output, and also prints the details of the index and record positions that provided the values.
      Parameters:
      source - a Deephaven table object
      columns - varargs of column names to display
    • showCommaDelimited

      public static void showCommaDelimited​(@NotNull Table source, String... columns)
      Prints the first few rows of a table to standard output, with commas between values.
      Parameters:
      source - a Deephaven table object
      columns - varargs of column names to display
    • show

      public static void show​(@NotNull Table source, DBTimeZone timeZone, String... columns)
      Prints the first few rows of a table to standard output.
      Parameters:
      source - a Deephaven table object
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      columns - varargs of column names to display
    • show

      public static void show​(@NotNull Table source, long maxRowCount, String... columns)
      Prints the first few rows of a table to standard output.
      Parameters:
      source - a Deephaven table object
      maxRowCount - the number of rows to return
      columns - varargs of column names to display
    • showWithIndex

      public static void showWithIndex​(@NotNull Table source, long maxRowCount, String... columns)
      Prints the first few rows of a table to standard output, and also prints the details of the index and record positions that provided the values.
      Parameters:
      source - a Deephaven table object
      maxRowCount - the number of rows to return
      columns - varargs of column names to display
    • showCommaDelimited

      public static void showCommaDelimited​(@NotNull Table source, long maxRowCount, String... columns)
      Prints the first few rows of a table to standard output, with commas between values.
      Parameters:
      source - a Deephaven table object
      maxRowCount - the number of rows to return
      columns - varargs of column names to display
    • show

      public static void show​(@NotNull Table source, long maxRowCount, DBTimeZone timeZone, String... columns)
      Prints the first few rows of a table to standard output.
      Parameters:
      source - a Deephaven table object
      maxRowCount - the number of rows to return
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      columns - varargs of column names to display
    • show

      public static void show​(@NotNull Table source, long maxRowCount, DBTimeZone timeZone, PrintStream out, String... columns)
      Prints the first few rows of a table to standard output.
      Parameters:
      source - a Deephaven table object
      maxRowCount - the number of rows to return
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      out - a PrintStream destination to which to print the data
      columns - varargs of column names to display
    • showWithIndex

      public static void showWithIndex​(@NotNull Table source, long maxRowCount, DBTimeZone timeZone, PrintStream out, String... columns)
      Prints the first few rows of a table to standard output, and also prints the details of the index and record positions that provided the values.
      Parameters:
      source - a Deephaven table object
      maxRowCount - the number of rows to return
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      out - a PrintStream destination to which to print the data
      columns - varargs of column names to display
    • showWithIndex

      public static void showWithIndex​(@NotNull Table source, long firstRow, long lastRow, PrintStream out, String... columns)
      Prints the first few rows of a table to standard output, and also prints the details of the index and record positions that provided the values.
      Parameters:
      source - a Deephaven table object
      firstRow - the firstRow to display
      lastRow - the lastRow (exclusive) to display
      out - a PrintStream destination to which to print the data
      columns - varargs of column names to display
    • show

      public static void show​(@NotNull Table source, long maxRowCount, DBTimeZone timeZone, String delimiter, PrintStream out, boolean showIndex, String... columns)
      Prints the first few rows of a table to standard output.
      Parameters:
      source - a Deephaven table object
      maxRowCount - the number of rows to return
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      delimiter - a String value to use between printed values
      out - a PrintStream destination to which to print the data
      showIndex - a boolean indicating whether to also print index details
      columns - varargs of column names to display
    • showWithIndex

      public static void showWithIndex​(@NotNull Table source, long firstRow, long lastRow, String... columns)
      Prints the first few rows of a table to standard output, and also prints the details of the index and record positions that provided the values.
      Parameters:
      source - a Deephaven table object
      firstRow - the firstRow to display
      lastRow - the lastRow (exclusive) to display
      columns - varargs of column names to display
    • display

      @Deprecated public static JFrame display​(Table source, String... columns)
      Deprecated.
    • display

      @Deprecated public static JFrame display​(Table source, boolean shutdownProcessOnClose, String... columns)
      Deprecated.
    • display

      @Deprecated public static JFrame display​(Table source, Map<String,​Format> formatters, String... columns)
      Deprecated.
    • display

      @Deprecated public static JFrame display​(Table source, boolean shutdownProcessOnClose, Map<String,​Format> formatters, String... columns)
      Deprecated.
    • string

      public static String string​(Table t, String... columns)
      Returns the first few rows of a table as a pipe-delimited string.
      Parameters:
      t - a Deephaven table object
      columns - varargs of columns to include in the result
      Returns:
      a String
    • string

      public static String string​(Table t, int size, String... columns)
      Returns the first few rows of a table as a pipe-delimited string.
      Parameters:
      t - a Deephaven table object
      size - the number of rows to return
      columns - varargs of columns to include in the result
      Returns:
      a String
    • stringWithIndex

      public static String stringWithIndex​(Table t, int size, String... columns)
    • string

      public static String string​(Table t, DBTimeZone timeZone, String... columns)
      Returns the first few rows of a table as a pipe-delimited string.
      Parameters:
      t - a Deephaven table object
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      columns - varargs of columns to include in the result
      Returns:
      a String
    • string

      public static String string​(Table t, int size, DBTimeZone timeZone, String... columns)
      Returns the first few rows of a table as a pipe-delimited string.
      Parameters:
      t - a Deephaven table object
      size - the number of rows to return
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      columns - varargs of columns to include in the result
      Returns:
      a String
    • html

      public static String html​(Table source)
      Returns a printout of a table formatted as HTML. Limit use to small tables to avoid running out of memory.
      Parameters:
      source - a Deephaven table object
      Returns:
      a String of the table printout formatted as HTML
    • diff

      public static String diff​(Table actualResult, Table expectedResult, long maxDiffLines)
      Computes the difference of two tables for use in verification.
      Parameters:
      actualResult - first Deephaven table object to compare
      expectedResult - second Deephaven table object to compare
      maxDiffLines - stop comparing after this many differences are found
      Returns:
      String report of the detected differences
    • diff

      public static String diff​(Table actualResult, Table expectedResult, long maxDiffLines, EnumSet<TableDiff.DiffItems> itemsToSkip)
      Computes the difference of two tables for use in verification.
      Parameters:
      actualResult - first Deephaven table object to compare
      expectedResult - second Deephaven table object to compare
      maxDiffLines - stop comparing after this many differences are found
      itemsToSkip - EnumSet of checks not to perform, such as checking column order, or exact match of double values
      Returns:
      String report of the detected differences
    • diffPair

      public static com.fishlib.base.Pair<String,​Long> diffPair​(Table actualResult, Table expectedResult, long maxDiffLines, EnumSet<TableDiff.DiffItems> itemsToSkip)
      Computes the difference of two tables for use in verification.
      Parameters:
      actualResult - first Deephaven table object to compare
      expectedResult - second Deephaven table object to compare
      maxDiffLines - stop comparing after this many differences are found
      itemsToSkip - EnumSet of checks not to perform, such as checking column order, or exact match of double values
      Returns:
      a pair of String report of the detected differences, and the first different row (0 if there are no different data values)
    • readBin

      public static Table readBin​(@NotNull String namespace, @NotNull String tableName, @NotNull File sourceDirectory, @NotNull String sourceFileNameGlob)
      Loads a binary log file as an in-memory DB table. Requires access to the listener class that matches the file to be loaded.
      Parameters:
      namespace - namespace to search for the Listener needed to import the data
      tableName - table name to find for the Listener needed to import the data
      sourceDirectory - file system path of the log file
      sourceFileNameGlob - file pattern to use to find log file(s) to import
      Returns:
      a Deephaven table object
    • readBin

      public static Table readBin​(@NotNull String namespace, @NotNull String tableName, String... sourceFiles)
      Loads a binary log file as an in-memory DB table. Requires access to the listener class that matches the file to be loaded.
      Parameters:
      namespace - namespace to search for the Listener needed to import the data
      tableName - table name to find for the Listener needed to import the data
      sourceFiles - list of names of files to import
      Returns:
      a Deephaven table object
    • readBin

      @ScriptApi public static Table readBin​(@NotNull String namespace, @NotNull String tableName, File... sourceFiles)
      Loads a binary log file as an in-memory DB table. Requires access to the listener class that matches the file to be loaded.
      Parameters:
      namespace - namespace to search for the Listener needed to import the data
      tableName - table name to find for the Listener needed to import the data
      sourceFiles - list of File objects to import
      Returns:
      a Deephaven table object
    • readBin

      public static Table readBin​(@NotNull String namespace, @NotNull String tableName, @NotNull TableType tableType, File... sourceFiles)
      Loads a binary log file as an in-memory DB table. Requires access to the listener class that matches the file to be loaded.
      Parameters:
      namespace - namespace to search for the Listener needed to import the data
      tableName - table name to find for the Listener needed to import the data
      tableType - table type this table definition
      sourceFiles - list of File objects to import
      Returns:
      a Deephaven table object
      Throws:
      SchemaException - if the table definition is not found or if the table type doesn't match
    • readBin

      public static Table readBin​(@NotNull String namespace, @NotNull String tableName, @NotNull TableDefinition tableDefinition, File... sourceFiles)
      Loads a binary log file as an in-memory DB table. Requires access to the listener class that matches the file to be loaded.
      Parameters:
      namespace - namespace to search for the Listener needed to import the data
      tableName - table name to find for the Listener needed to import the data
      tableDefinition - use this table definition rather than looking one up
      sourceFiles - list of File objects to import
      Returns:
      a Deephaven table object
    • readBin

      public static Table readBin​(@NotNull TableKey key, File... sourceFiles)
      Loads a binary log file as an in-memory DB table. Requires access to the listener class that matches the file to be loaded.
      Parameters:
      key - Interface that specifies key fields for a table-keyed object.
      sourceFiles - list of File objects to import
      Returns:
      a Deephaven table object
    • readCsv

      @ScriptApi public static DynamicTable readCsv​(InputStream is) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      is - an InputStream providing access to the CSV data.
      Returns:
      a Deephaven DynamicTable object
      Throws:
      IOException - if the InputStream cannot be read
    • readCsv

      @ScriptApi public static DynamicTable readCsv​(InputStream is, char separator) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      is - an InputStream providing access to the CSV data.
      separator - a char to use as the delimiter value when parsing the file.
      Returns:
      a Deephaven DynamicTable object
      Throws:
      IOException - if the InputStream cannot be read
    • readCsv

      @ScriptApi public static Table readCsv​(String filePath) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      filePath - the fully-qualified path to a CSV file to be read.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readCsv

      @ScriptApi public static Table readCsv​(String filePath, String format) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      filePath - the fully-qualified path to a CSV file to be read.
      format - an Apache Commons CSV format name to be used to parse the CSV, or a single non-newline character to use as a delimiter.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readCsv

      @ScriptApi public static Table readCsv​(String filePath, String format, StatusCallback progress) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      filePath - the fully-qualified path to a CSV file to be read.
      format - an Apache Commons CSV format name to be used to parse the CSV, or a single non-newline character to use as a delimiter.
      progress - a StatusCallback object that can be used to log progress details or update a progress bar. If passed explicitly as null, a StatusCallback instance will be created to log progress to the current logger.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readCsv

      @ScriptApi public static Table readCsv​(File file) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      file - a file object providing access to the CSV file to be read.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readCsv

      @ScriptApi public static Table readCsv​(File file, StatusCallback progress) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      file - a file object providing access to the CSV file to be read.
      progress - a StatusCallback object that can be used to log progress details or update a progress bar. If passed explicitly as null, a StatusCallback instance will be created to log progress to the current logger.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readCsv

      @ScriptApi public static Table readCsv​(File file, String format, StatusCallback progress) throws IOException
      Returns a memory table created from importing CSV data. The first row must be column names. Column data types are inferred from the data.
      Parameters:
      file - a file object providing access to the CSV file to be read.
      format - an Apache Commons CSV format name to be used to parse the CSV, or a single non-newline character to use as a delimiter.
      progress - a StatusCallback object that can be used to log progress details or update a progress bar. If passed explicitly as null, a StatusCallback instance will be created to log progress to the current logger.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readHeaderlessCsv

      @ScriptApi public static Table readHeaderlessCsv​(String filePath) throws IOException
      Returns a memory table created from importing CSV data. Column data types are inferred from the data.
      Parameters:
      filePath - the fully-qualified path to a CSV file to be read.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readHeaderlessCsv

      @ScriptApi public static Table readHeaderlessCsv​(String filePath, Collection<String> header) throws IOException
      Returns a memory table created from importing CSV data. Column data types are inferred from the data.
      Parameters:
      filePath - the fully-qualified path to a CSV file to be read.
      header - Column names to use for the resultant table.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readHeaderlessCsv

      @ScriptApi public static Table readHeaderlessCsv​(String filePath, String... header) throws IOException
      Returns a memory table created from importing CSV data. Column data types are inferred from the data.
      Parameters:
      filePath - the fully-qualified path to a CSV file to be read.
      header - Column names to use for the resultant table.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readHeaderlessCsv

      @ScriptApi public static Table readHeaderlessCsv​(String filePath, String format, StatusCallback progress, Collection<String> header) throws IOException
      Returns a memory table created from importing CSV data. Column data types are inferred from the data.
      Parameters:
      filePath - the fully-qualified path to a CSV file to be read.
      format - an Apache Commons CSV format name to be used to parse the CSV, or a single non-newline character to use as a delimiter.
      progress - a StatusCallback object that can be used to log progress details or update a progress bar. If passed explicitly as null, a StatusCallback instance will be created to log progress to the current logger.
      header - Column names to use for the resultant table.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • readHeaderlessCsv

      @ScriptApi public static Table readHeaderlessCsv​(File file, String format, StatusCallback progress, @Nullable Collection<String> header) throws IOException
      Returns a memory table created from importing CSV data. Column data types are inferred from the data.
      Parameters:
      file - a file object providing access to the CSV file to be read.
      format - an Apache Commons CSV format name to be used to parse the CSV, or a single non-newline character to use as a delimiter.
      progress - a StatusCallback object that can be used to log progress details or update a progress bar. If passed explicitly as null, a StatusCallback instance will be created to log progress to the current logger.
      header - Column names to use for the resultant table, or null if column names should be automatically generated.
      Returns:
      a Deephaven Table object
      Throws:
      IOException - if the file cannot be read
    • writeCsv

      @ScriptApi public static void writeCsv​(String sourcePath, String destPath, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      sourcePath - path to the table files to be exported
      destPath - path to the CSV file to be written
      columns - a list of columns to include in the export
      Throws:
      IOException - if source files cannot be read or target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(String sourcePath, String destPath, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      sourcePath - path to the table files to be exported
      destPath - path to the CSV file to be written
      columns - a list of columns to include in the export
      Throws:
      IOException - if source files cannot be read or target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(String sourcePath, String destPath, DBTimeZone timeZone, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      sourcePath - path to the table files to be exported
      destPath - path to the CSV file to be written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      columns - a list of columns to include in the export
      Throws:
      IOException - if source files cannot be read or target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(String sourcePath, String destPath, DBTimeZone timeZone, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      sourcePath - path to the table files to be exported
      destPath - path to the CSV file to be written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      nullsAsEmpty - if nulls should be written as blank instead of '(null)'
      columns - a list of columns to include in the export
      Throws:
      IOException - if source files cannot be read or target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, boolean compressed, String destPath, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      destPath - path to the CSV file to be written
      compressed - whether to compress (bz2) the file being written
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, boolean compressed, String destPath, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      destPath - path to the CSV file to be written
      compressed - whether to compress (bz2) the file being written
      nullsAsEmpty - if nulls should be written as blank instead of '(null)'
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, String destPath, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      destPath - path to the CSV file to be written
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, String destPath, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      destPath - path to the CSV file to be written
      nullsAsEmpty - if nulls should be written as blank instead of '(null)'
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, PrintStream out, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      out - the stream to write to
      columns - a list of columns to include in the export
      Throws:
      IOException - if there is a problem writing to the stream
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, PrintStream out, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      out - the stream to write to
      nullsAsEmpty - if nulls should be written as blank instead of '(null)'
      columns - a list of columns to include in the export
      Throws:
      IOException - if there is a problem writing to the stream
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, String destPath, boolean compressed, DBTimeZone timeZone, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      destPath - path to the CSV file to be written
      compressed - whether to zip the file being written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, String destPath, boolean compressed, DBTimeZone timeZone, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      destPath - path to the CSV file to be written
      compressed - whether to zip the file being written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      nullsAsEmpty - if nulls should be written as blank instead of '(null)'
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table source, String destPath, boolean compressed, DBTimeZone timeZone, boolean nullsAsEmpty, char separator, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      source - a Deephaven table object to be exported
      destPath - path to the CSV file to be written
      compressed - whether to zip the file being written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      nullsAsEmpty - if nulls should be written as blank instead of '(null)'
      separator - the delimiter for the CSV
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table[] sources, String destPath, boolean compressed, DBTimeZone timeZone, String tableSeparator, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      sources - an array of Deephaven table objects to be exported
      destPath - path to the CSV file to be written
      compressed - whether to compress (bz2) the file being written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      tableSeparator - a String (normally a single character) to be used as the table delimiter
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table[] sources, String destPath, boolean compressed, DBTimeZone timeZone, String tableSeparator, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      sources - an array of Deephaven table objects to be exported
      destPath - path to the CSV file to be written
      compressed - whether to compress (bz2) the file being written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      tableSeparator - a String (normally a single character) to be used as the table delimiter
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • writeCsv

      @ScriptApi public static void writeCsv​(Table[] sources, String destPath, boolean compressed, DBTimeZone timeZone, String tableSeparator, char fieldSeparator, boolean nullsAsEmpty, String... columns) throws IOException
      Writes a DB table out as a CSV.
      Parameters:
      sources - an array of Deephaven table objects to be exported
      destPath - path to the CSV file to be written
      compressed - whether to compress (bz2) the file being written
      timeZone - a DBTimeZone constant relative to which DBDateTime data should be adjusted
      tableSeparator - a String (normally a single character) to be used as the table delimiter
      fieldSeparator - the delimiter for the CSV files
      nullsAsEmpty - if nulls should be written as blank instead of '(null)'
      columns - a list of columns to include in the export
      Throws:
      IOException - if the target file cannot be written
    • colSource

      public static <T> ColumnSource<T> colSource​(Class<T> clazz, Collection<T> values)
      Creates an in-memory column of the specified type for a collection of values.
      Type Parameters:
      T - the type to use for the new column
      Parameters:
      clazz - the class to use for the new column
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • objColSource

      public static <T> ColumnSource objColSource​(T... values)
      Creates an in-memory column of the specified type for a collection of values
      Type Parameters:
      T - the type to use for the new column
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • colSource

      public static ColumnSource<Long> colSource​(long... values)
      Creates an in-memory column of type long for a collection of values.
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • colSource

      public static ColumnSource<Integer> colSource​(int... values)
      Creates an in-memory column of type int for a collection of values.
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • colSource

      public static ColumnSource<Short> colSource​(short... values)
      Creates an in-memory column of type short for a collection of values.
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • colSource

      public static ColumnSource<Byte> colSource​(byte... values)
      Creates an in-memory column of type byte for a collection of values.
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • colSource

      public static ColumnSource<Character> colSource​(char... values)
      Creates an in-memory column of type char for a collection of values.
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • colSource

      public static ColumnSource<Double> colSource​(double... values)
      Creates an in-memory column of type double for a collection of values.
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • colSource

      public static ColumnSource<Float> colSource​(float... values)
      Creates an in-memory column of type float for a collection of values.
      Parameters:
      values - a collection of values to populate the new column
      Returns:
      a Deephaven ColumnSource object
    • getKey

      public static Object getKey​(ColumnSource[] groupByColumnSources, long row)
      Returns a SmartKey for the specified row from a set of ColumnSources.
      Parameters:
      groupByColumnSources - a set of ColumnSources from which to retrieve the data
      row - the row number for which to retrieve data
      Returns:
      a Deephaven SmartKey object
    • getPrevKey

      public static Object getPrevKey​(ColumnSource[] groupByColumnSources, long row)
      Returns a SmartKey for the row previous to the specified row from a set of ColumnSources.
      Parameters:
      groupByColumnSources - a set of ColumnSources from which to retrieve the data
      row - the row number for which to retrieve the previous row's data
      Returns:
      a Deephaven SmartKey object
    • col

      public static <T> ColumnHolder col​(String name, T... data)
      Returns a ColumnHolder that can be used when creating in-memory tables.
      Type Parameters:
      T - the type of the column
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • stringCol

      public static ColumnHolder stringCol​(String name, String... data)
      Returns a ColumnHolder of type String that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • longCol

      public static ColumnHolder longCol​(String name, long... data)
      Returns a ColumnHolder of type long that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • intCol

      public static ColumnHolder intCol​(String name, int... data)
      Returns a ColumnHolder of type int that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • shortCol

      public static ColumnHolder shortCol​(String name, short... data)
      Returns a ColumnHolder of type short that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • byteCol

      public static ColumnHolder byteCol​(String name, byte... data)
      Returns a ColumnHolder of type byte that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • charCol

      public static ColumnHolder charCol​(String name, char... data)
      Returns a ColumnHolder of type char that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • doubleCol

      public static ColumnHolder doubleCol​(String name, double... data)
      Returns a ColumnHolder of type double that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • floatCol

      public static ColumnHolder floatCol​(String name, float... data)
      Returns a ColumnHolder of type float that can be used when creating in-memory tables.
      Parameters:
      name - name of the column
      data - a list of values for the column
      Returns:
      a Deephaven ColumnHolder object
    • emptyTable

      public static Table emptyTable​(long size)
      Returns a new, empty Deephaven Table.
      Parameters:
      size - the number of rows to allocate space for
      Returns:
      a Deephaven Table with no columns.
    • emptyTable

      public static Table emptyTable​(long size, @NotNull TableDefinition tableDefinition)
      Returns a new, empty Deephaven Table.
      Parameters:
      size - the number of rows to allocate space for
      tableDefinition - the TableDefinition (column names and properties) to use for the new table
      Returns:
      a Deephaven Table with columns.
    • newTable

      public static DynamicTable newTable​(long size, List<String> names, List<ColumnSource> columnSources)
      Creates a new DynamicTable.
      Parameters:
      size - the number of rows to allocate
      names - a List of column names
      columnSources - a List of the ColumnSource(s)
      Returns:
      a Deephaven DynamicTable
    • newTable

      public static DynamicTable newTable​(long size, Map<String,​ColumnSource> columns)
      Creates a new DynamicTable.
      Parameters:
      size - the number of rows to allocate
      columns - a Map of column names and ColumnSources
      Returns:
      a Deephaven DynamicTable
    • newTable

      public static DynamicTable newTable​(@NotNull TableDefinition definition)
      Creates a new DynamicTable.
      Parameters:
      definition - the TableDefinition (column names and properties) to use for the new table
      Returns:
      an empty Deephaven DynamicTable object
    • newTable

      public static DynamicTable newTable​(ColumnHolder... columnHolders)
      Creates a new DynamicTable.
      Parameters:
      columnHolders - a list of ColumnHolders from which to create the table
      Returns:
      a Deephaven DynamicTable
    • newTable

      public static DynamicTable newTable​(TableDefinition tDef, ColumnHolder... columnHolders)
      Creates a new DynamicTable.
      Parameters:
      columnHolders - a list of ColumnHolders from which to create the table
      Returns:
      a Deephaven DynamicTable
    • timeTable

      public static Table timeTable​(String period)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      period - time interval between new row additions.
      Returns:
      time table
    • timeTable

      public static Table timeTable​(String period, ReplayerInterface replayer)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      period - time interval between new row additions
      replayer - data replayer
      Returns:
      time table
    • timeTable

      public static Table timeTable​(DBDateTime startTime, String period)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      period - time interval between new row additions
      Returns:
      time table
    • timeTable

      public static Table timeTable​(DBDateTime startTime, String period, ReplayerInterface replayer)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      period - time interval between new row additions
      replayer - data replayer
      Returns:
      time table
    • timeTable

      public static Table timeTable​(String startTime, String period)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      period - time interval between new row additions
      Returns:
      time table
    • timeTable

      public static Table timeTable​(String startTime, String period, ReplayerInterface replayer)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      period - time interval between new row additions
      replayer - data replayer
      Returns:
      time table
    • timeTable

      public static Table timeTable​(long periodNanos)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      periodNanos - time interval between new row additions in nanoseconds.
      Returns:
      time table
    • timeTable

      public static Table timeTable​(long periodNanos, ReplayerInterface replayer)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      periodNanos - time interval between new row additions in nanoseconds.
      replayer - data replayer
      Returns:
      time table
    • timeTable

      public static Table timeTable​(DBDateTime startTime, long periodNanos)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      periodNanos - time interval between new row additions in nanoseconds.
      Returns:
      time table
    • timeTable

      public static Table timeTable​(DBDateTime startTime, long periodNanos, ReplayerInterface replayer)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      periodNanos - time interval between new row additions in nanoseconds.
      replayer - data replayer
      Returns:
      time table
    • timeTable

      public static Table timeTable​(String startTime, long periodNanos)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      periodNanos - time interval between new row additions in nanoseconds.
      Returns:
      time table
    • timeTable

      public static Table timeTable​(String startTime, long periodNanos, ReplayerInterface replayer)
      Creates a table that adds a new row on a regular interval.
      Parameters:
      startTime - start time for adding new rows
      periodNanos - time interval between new row additions in nanoseconds.
      replayer - data replayer
      Returns:
      time table
    • merge

      public static Table merge​(List<Table> theList)
      Concatenates multiple Deephaven Tables into a single Table.

      The resultant table will have rows from the same table together, in the order they are specified as inputs.

      When ticking tables grow, they may run out of the 'pre-allocated' space for newly added rows. When more key- space is needed, tables in higher key-space are shifted to yet higher key-space to make room for new rows. Shifts are handled efficiently, but some downstream operations generate a linear O(n) amount of work per shifted row. When possible, one should favor ordering the constituent tables first by static/non-ticking sources followed by tables that are expected to grow at slower rates, and finally by tables that grow without bound.

      Parameters:
      theList - a List of Tables to be concatenated
      Returns:
      a Deephaven table object
    • merge

      public static Table merge​(Collection<Table> tables)
      Concatenates multiple Deephaven Tables into a single Table.

      The resultant table will have rows from the same table together, in the order they are specified as inputs.

      When ticking tables grow, they may run out of the 'pre-allocated' space for newly added rows. When more key- space is needed, tables in higher key-space are shifted to yet higher key-space to make room for new rows. Shifts are handled efficiently, but some downstream operations generate a linear O(n) amount of work per shifted row. When possible, one should favor ordering the constituent tables first by static/non-ticking sources followed by tables that are expected to grow at slower rates, and finally by tables that grow without bound.

      Parameters:
      tables - a Collection of Tables to be concatenated
      Returns:
      a Deephaven table object
    • merge

      public static Table merge​(Table... tables)
      Concatenates multiple Deephaven Tables into a single Table.

      The resultant table will have rows from the same table together, in the order they are specified as inputs.

      When ticking tables grow, they may run out of the 'pre-allocated' space for newly added rows. When more key- space is needed, tables in higher key-space are shifted to yet higher key-space to make room for new rows. Shifts are handled efficiently, but some downstream operations generate a linear O(n) amount of work per shifted row. When possible, one should favor ordering the constituent tables first by static/non-ticking sources followed by tables that are expected to grow at slower rates, and finally by tables that grow without bound.

      Parameters:
      tables - a list of Tables to be concatenated
      Returns:
      a Deephaven table object
    • mergeSorted

      public static Table mergeSorted​(String keyColumn, Table... tables)
      Concatenates multiple sorted Deephaven Tables into a single Table sorted by the specified key column.

      The input tables must each individually be sorted by keyColumn, otherwise results are undefined.

      Parameters:
      tables - sorted Tables to be concatenated
      keyColumn - the column to use when sorting the concatenated results
      Returns:
      a Deephaven table object
    • mergeSorted

      public static Table mergeSorted​(String keyColumn, Collection<Table> tables)
      Concatenates multiple sorted Deephaven Tables into a single Table sorted by the specified key column.

      The input tables must each individually be sorted by keyColumn, otherwise results are undefined.

      Parameters:
      tables - a Collection of sorted Tables to be concatenated
      keyColumn - the column to use when sorting the concatenated results
      Returns:
      a Deephaven table object
    • roundDecimalColumns

      @ScriptApi public static Table roundDecimalColumns​(Table table)
      Produce a new table with all the columns of this table, in the same order, but with double and float columns rounded to longs.
      Returns:
      The new Table, with all double and float columns rounded to longs.
    • roundDecimalColumnsExcept

      @ScriptApi public static Table roundDecimalColumnsExcept​(Table table, String... columnsNotToRound)
      Produce a new table with all the columns of this table, in the same order, but with all double and float columns rounded to longs, except for the specified columnsNotToRound.
      Parameters:
      columnsNotToRound - The names of the double and float columns not to round to longs
      Returns:
      The new Table, with columns modified as explained above
    • roundDecimalColumns

      @ScriptApi public static Table roundDecimalColumns​(Table table, String... columns)
      Produce a new table with all the columns of this table, in the same order, but with double and float columns rounded to longs.
      Parameters:
      columns - The names of the double and float columns to round.
      Returns:
      The new Table, with the specified columns rounded to longs.
      Throws:
      IllegalArgumentException - If columns is null, or if one of the specified columns is neither a double column nor a float column.
    • computeFingerprint

      public static byte[] computeFingerprint​(Table source) throws IOException

      Compute the SHA256 hash of the input table.

      The hash is computed using every value in each row, using toString for unrecognized objects. The hash also includes the input table definition column names and types.

      Parameters:
      source - The table to fingerprint
      Returns:
      The SHA256 hash of the table data and TableDefinition
      Throws:
      IOException - If an error occurs during the hashing.
    • base64Fingerprint

      public static String base64Fingerprint​(Table source) throws IOException

      Compute the SHA256 hash of the input table and return it in base64 string format.

      Parameters:
      source - The table to fingerprint
      Returns:
      The SHA256 hash of the table data and TableDefinition
      Throws:
      IOException - If an error occurs during the hashing.