Class MappingBatcher

    • Field Detail

      • dataCube

        private final DataCube dataCube
        The datacube this batcher inserts data for.
      • noRawMapping

        private final boolean noRawMapping
        If the data cube has already received it's data and no raw data can be linked.
      • queuedInsertCount

        private int queuedInsertCount
        The number of queued inserts. Used to check when a flush is needed.
      • totalInsertCount

        private int totalInsertCount
        The total number of inserts done by this batcher.
      • bytes

        private long bytes
        The number of bytes this batcher has added to the experiment.
      • bytesPerRow

        private final long bytesPerRow
        The number of bytes used by a single row.
      • rawMappingSql

        private PreparedStatement rawMappingSql
        The statement that inserts the spot/raw data link.
        INSERT INTO Dynamic#RawParents (cube, column, position, rawdata_id)
        VALUES (cube, ?, ?, ?)
        
      • rawMappingSqlStatement

        private String rawMappingSqlStatement
        The SQL string for the rawMappingSql statement.
    • Constructor Detail

      • MappingBatcher

        MappingBatcher​(DbControl dc,
                       DataCube dataCube)
        Create a new position batcher for a data cube. It is assumed that the calling code has checked that the cube is allowed to receive more data (ie. it hasn't been committed to the database).
    • Method Detail

      • insert

        public void insert​(short column,
                           int position,
                           RawData rawData)
                    throws BaseException
        Link a spot to a raw data. One spot may be linked to several raw data items.
        Parameters:
        column - The column coordinate of the spot
        position - The position coordinate of the spot
        rawData - The raw data object
        Throws:
        InvalidDataException - If the raw data is null
        BaseException - If there is an error
      • insert

        public int insert​(AbstractSqlQuery query)
                   throws BaseException
        Insert mapping to raw spots using a query. The query MUST select data in the following order: column, position, rawDataId

        Internally this method converts the query into a INSERT INTO ... SELECT ... query, making it very fast, since the data for each position doesn't have to be retreived, processed and then inserted one row at a time. It is possible to call this method multiple times with the same or different query.

        Parameters:
        query - The query that selects the data to be inserted
        Returns:
        int The number of rows inserted
        Throws:
        BaseException - If there is an error
      • getTotalInsertCount

        public int getTotalInsertCount()
        Get the total number of mappings to raw data create by this mapper.
        Since:
        2.2