|
20 | 20 | import com.alibaba.fluss.config.Configuration; |
21 | 21 | import com.alibaba.fluss.lake.lance.LanceConfig; |
22 | 22 | import com.alibaba.fluss.lake.lance.testutils.FlinkLanceTieringTestBase; |
| 23 | +import com.alibaba.fluss.lake.lance.utils.LanceDatasetAdapter; |
23 | 24 | import com.alibaba.fluss.metadata.TableBucket; |
24 | 25 | import com.alibaba.fluss.metadata.TablePath; |
25 | 26 | import com.alibaba.fluss.row.InternalRow; |
|
37 | 38 | import java.util.ArrayList; |
38 | 39 | import java.util.Arrays; |
39 | 40 | import java.util.Collections; |
| 41 | +import java.util.HashMap; |
40 | 42 | import java.util.Iterator; |
41 | 43 | import java.util.List; |
| 44 | +import java.util.Map; |
42 | 45 |
|
| 46 | +import static com.alibaba.fluss.lake.committer.BucketOffset.FLUSS_LAKE_SNAP_BUCKET_OFFSET_PROPERTY; |
43 | 47 | import static com.alibaba.fluss.testutils.DataTestUtils.row; |
44 | 48 | import static org.assertj.core.api.Assertions.assertThat; |
45 | 49 |
|
@@ -80,20 +84,38 @@ void testTiering() throws Exception { |
80 | 84 | // note: we can't update log start offset for unaware bucket mode log table |
81 | 85 | assertReplicaStatus(t1Bucket, 30); |
82 | 86 |
|
| 87 | + LanceConfig config = |
| 88 | + LanceConfig.from( |
| 89 | + lanceConf.toMap(), |
| 90 | + Collections.emptyMap(), |
| 91 | + t1.getDatabaseName(), |
| 92 | + t1.getTableName()); |
| 93 | + |
83 | 94 | // check data in lance |
84 | | - checkDataInLanceAppendOnlyTable(t1, flussRows); |
| 95 | + checkDataInLanceAppendOnlyTable(config, flussRows); |
| 96 | + // check snapshot property in lance |
| 97 | + Map<String, String> properties = |
| 98 | + new HashMap<String, String>() { |
| 99 | + { |
| 100 | + put( |
| 101 | + FLUSS_LAKE_SNAP_BUCKET_OFFSET_PROPERTY, |
| 102 | + "[{\"bucket_id\":0,\"log_offset\":30}]"); |
| 103 | + } |
| 104 | + }; |
| 105 | + checkSnapshotPropertyInLance(config, properties); |
85 | 106 |
|
86 | 107 | jobClient.cancel().get(); |
87 | 108 | } |
88 | 109 |
|
89 | | - private void checkDataInLanceAppendOnlyTable( |
90 | | - TablePath tablePath, List<InternalRow> expectedRows) throws Exception { |
91 | | - LanceConfig config = |
92 | | - LanceConfig.from( |
93 | | - lanceConf.toMap(), |
94 | | - Collections.emptyMap(), |
95 | | - tablePath.getDatabaseName(), |
96 | | - tablePath.getTableName()); |
| 110 | + private void checkSnapshotPropertyInLance( |
| 111 | + LanceConfig config, Map<String, String> expectedProperties) throws Exception { |
| 112 | + Map<String, String> transactionProperties = |
| 113 | + LanceDatasetAdapter.getTransactionProperties(config, null); |
| 114 | + assertThat(transactionProperties).isEqualTo(expectedProperties); |
| 115 | + } |
| 116 | + |
| 117 | + private void checkDataInLanceAppendOnlyTable(LanceConfig config, List<InternalRow> expectedRows) |
| 118 | + throws Exception { |
97 | 119 |
|
98 | 120 | try (Dataset dataset = |
99 | 121 | Dataset.open( |
|
0 commit comments