Skip to content

Commit

Permalink
avoid deserialize unnecessary fields
Browse files Browse the repository at this point in the history
  • Loading branch information
JNSimba authored and wuchong committed Dec 16, 2024
1 parent f0d800b commit c49e191
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.alibaba.fluss.exception.TableNotExistException;
import com.alibaba.fluss.metadata.TablePath;
import com.alibaba.fluss.row.InternalRow;
import com.alibaba.fluss.row.ProjectedRow;

import org.apache.flink.table.data.RowData;
import org.apache.flink.table.data.utils.ProjectedRowData;
Expand Down Expand Up @@ -171,9 +172,9 @@ private void fetchResult(
if (row == null) {
resultFuture.complete(Collections.emptyList());
} else {
// TODO: we can project fluss row first,
// to avoid deserialize unnecessary fields
RowData flinkRow = flussRowToFlinkRowConverter.toFlinkRowData(row);
RowData flinkRow =
flussRowToFlinkRowConverter.toFlinkRowData(
ProjectedRow.from(projection).replaceRow(row));
if (remainingFilter != null && !remainingFilter.isMatch(flinkRow)) {
resultFuture.complete(Collections.emptyList());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.alibaba.fluss.connector.flink.utils.FlussRowToFlinkRowConverter;
import com.alibaba.fluss.metadata.TablePath;
import com.alibaba.fluss.row.InternalRow;
import com.alibaba.fluss.row.ProjectedRow;

import org.apache.flink.table.data.RowData;
import org.apache.flink.table.data.utils.ProjectedRowData;
Expand Down Expand Up @@ -124,8 +125,9 @@ public Collection<RowData> lookup(RowData keyRow) {
try {
InternalRow row = table.lookup(flussKeyRow).get().getRow();
if (row != null) {
// TODO: we can project fluss row first, to avoid deserialize unnecessary fields
RowData flinkRow = flussRowToFlinkRowConverter.toFlinkRowData(row);
RowData flinkRow =
flussRowToFlinkRowConverter.toFlinkRowData(
ProjectedRow.from(projection).replaceRow(row));
if (remainingFilter == null || remainingFilter.isMatch(flinkRow)) {
return Collections.singletonList(maybeProject(flinkRow));
} else {
Expand Down

0 comments on commit c49e191

Please sign in to comment.