Skip to content

Commit bd63c82

Browse files
author
bosiew.tian
committed
[core]fix2 - resolve confliction
1 parent 4e71808 commit bd63c82

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

docs/content/concepts/system-tables.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ SELECT * FROM my_table$audit_log;
136136
*/
137137
```
138138

139-
#### Reading with Sequence Number
140-
141139
For primary key tables, you can enable the `table-read.sequence-number.enabled` option to include the `_SEQUENCE_NUMBER` field in the output.
142140

143141
{{< tabs "audit-log-sequence-number" >}}
144142

143+
{{< tab "Enable via ALTER TABLE" >}}
144+
```sql
145+
ALTER TABLE my_table SET ('table-read.sequence-number.enabled' = 'true');
146+
```
147+
{{< /tab >}}
148+
145149
{{< tab "Enable via CREATE TABLE" >}}
146150
```sql
147151
CREATE TABLE my_table (
@@ -152,12 +156,6 @@ CREATE TABLE my_table (
152156
```
153157
{{< /tab >}}
154158

155-
{{< tab "Enable via ALTER TABLE" >}}
156-
```sql
157-
ALTER TABLE my_table SET ('table-read.sequence-number.enabled' = 'true');
158-
```
159-
{{< /tab >}}
160-
161159
{{< /tabs >}}
162160

163161
```sql

paimon-core/src/main/java/org/apache/paimon/table/system/AuditLogTable.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.apache.paimon.metrics.MetricRegistry;
3636
import org.apache.paimon.operation.ManifestsReader;
3737
import org.apache.paimon.partition.PartitionPredicate;
38+
import org.apache.paimon.predicate.FieldRef;
3839
import org.apache.paimon.predicate.LeafPredicate;
3940
import org.apache.paimon.predicate.Predicate;
4041
import org.apache.paimon.predicate.PredicateBuilder;
@@ -111,15 +112,20 @@ public AuditLogTable(FileStoreTable wrapped) {
111112
/** Creates a PredicateReplaceVisitor that adjusts field indices by systemFieldCount. */
112113
private PredicateReplaceVisitor createPredicateConverter() {
113114
return p -> {
114-
if (p.index() < specialFields.size()) {
115+
Optional<FieldRef> fieldRefOptional = p.fieldRefOptional();
116+
if (!fieldRefOptional.isPresent()) {
117+
return Optional.empty();
118+
}
119+
FieldRef fieldRef = fieldRefOptional.get();
120+
if (fieldRef.index() < specialFields.size()) {
115121
return Optional.empty();
116122
}
117123
return Optional.of(
118124
new LeafPredicate(
119125
p.function(),
120-
p.type(),
121-
p.index() - specialFields.size(),
122-
p.fieldName(),
126+
fieldRef.type(),
127+
fieldRef.index() - specialFields.size(),
128+
fieldRef.name(),
123129
p.literals()));
124130
};
125131
}
@@ -767,11 +773,6 @@ public boolean isNullAt(int pos) {
767773
return super.isNullAt(pos);
768774
}
769775

770-
@Override
771-
public long getLong(int pos) {
772-
return super.getLong(pos);
773-
}
774-
775776
@Override
776777
public BinaryString getString(int pos) {
777778
int index = indexMapping[pos];

0 commit comments

Comments
 (0)