You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "zhengyuan-cn (via GitHub)" <gi...@apache.org> on 2024/03/01 07:08:03 UTC
[I] [Bug] The Paimon official website's lacking execution condition statement in stream-read demo code [incubator-paimon]
zhengyuan-cn opened a new issue, #2931:
URL: https://github.com/apache/incubator-paimon/issues/2931
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/incubator-paimon/issues) and found nothing similar.
### Paimon version
0.8-SNAPSHOT
### Compute Engine
JavaAPI
### Minimal reproduce step
https://paimon.apache.org/docs/master/program-api/java-api/#stream-read
`public class StreamReadTable {
public static void main(String[] args) throws Exception {
// 1. Create a ReadBuilder and push filter (`withFilter`)
// and projection (`withProjection`) if necessary
Table table = GetTable.getTable();
PredicateBuilder builder =
new PredicateBuilder(RowType.of(DataTypes.STRING(), DataTypes.INT()));
Predicate notNull = builder.isNotNull(0);
Predicate greaterOrEqual = builder.greaterOrEqual(1, 12);
int[] projection = new int[] {0, 1};
ReadBuilder readBuilder =
table.newReadBuilder()
.withProjection(projection)
.withFilter(Lists.newArrayList(notNull, greaterOrEqual));
// 2. Plan splits in 'Coordinator' (or named 'Driver')
StreamTableScan scan = readBuilder.newStreamScan();
while (true) {
List<Split> splits = scan.plan().splits();
// Distribute these splits to different tasks
Long state = scan.checkpoint();
// can be restored in scan.restore(state) after fail over
// 3. Read a split in task
TableRead read = readBuilder.newRead();
// shuld call .executeFilter() if not , the conditions will not take effect
TableRead read = readBuilder.newRead().executeFilter();
RecordReader<InternalRow> reader = read.createReader(splits);
reader.forEachRemaining(System.out::println);
Thread.sleep(1000);
}
}
}`
### What doesn't meet your expectations?
TableRead read = readBuilder.newRead();
change to
TableRead read = readBuilder.newRead().executeFilter();
### Anything else?
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] The Paimon official website's lacking execution condition statement in stream-read demo code [incubator-paimon]
Posted by "zhengyuan-cn (via GitHub)" <gi...@apache.org>.
zhengyuan-cn closed issue #2931: [Bug] The Paimon official website's lacking execution condition statement in stream-read demo code
URL: https://github.com/apache/incubator-paimon/issues/2931
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org