Skip to content

How to get older data from a table with a self terminating query? #13

@d-thomson

Description

@d-thomson

Hi Mario,

Thank you for the new release of the driver, I am now able to connect to a KSQL instance. I am able to query metadata (SHOW STREAMS; SHOW TABLES; etc.) however I am having trouble finding a way to query old data from a table where the query wont hang.

The code snippet I'm using:

// query: SELECT * FROM USERS_ORIGINAL LIMIT 3
//rs.beforeFirst(); // <<NOT SUPPORTED  

while (rs.next()) { // << "HANGS" HERE
	for (int colInd = 1; colInd <= rsMetaData.getColumnCount(); colInd++){
		String val = rs.getString(colInd);
                System.out.print(val);
                System.out.print("\t");
	}
	System.out.println();
}

The issue seems to be that the pointer for a table is always at the latest position, so when I run the query the driver seems to hang because there is no data coming in. I see that there is a way to set the offset to the earliest position using the following command

SET 'auto.offset.reset' = 'earliest';

but this doesn't seem to be supported by the driver. Do you know if there is a way to set this globally for the KSQL instance or if there's a way to specify this in the query itself?

Much appreciated.
Daniel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions