Skip to content

Commit 658581b

Browse files
committed
fix sample error
1 parent a595240 commit 658581b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/test/java/examples/OTSMultiDataSample.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private static void putRows(OTSClient client, String tableName)
115115
PrimaryKeyValue.fromLong(i));
116116
rowChange.setPrimaryKey(primaryKey);
117117
rowChange.addAttributeColumn(COLUMN_NAME_NAME,
118-
ColumnValue.fromString("小" + Integer.toString(i + 1)));
118+
ColumnValue.fromString("小" + Integer.toString(i)));
119119
rowChange.addAttributeColumn(COLUMN_MOBILE_NAME,
120120
ColumnValue.fromString("111111111"));
121121
rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME,
@@ -146,20 +146,22 @@ private static void getRange(OTSClient client, String tableName)
146146
inclusiveStartKey.addPrimaryKeyColumn(COLUMN_GID_NAME,
147147
PrimaryKeyValue.fromLong(1));
148148
inclusiveStartKey.addPrimaryKeyColumn(COLUMN_UID_NAME,
149-
PrimaryKeyValue.INF_MIN); // 范围的边界需要提供完整的PK,若查询的范围不涉及到某一列值的范围,则需要将该列设置为无穷大或者无穷小
149+
PrimaryKeyValue.fromLong(1)); // 范围的边界需要提供完整的PK,若查询的范围不涉及到某一列值的范围,则需要将该列设置为无穷大或者无穷小
150150

151151
RowPrimaryKey exclusiveEndKey = new RowPrimaryKey();
152152
exclusiveEndKey.addPrimaryKeyColumn(COLUMN_GID_NAME,
153-
PrimaryKeyValue.fromLong(4));
153+
PrimaryKeyValue.fromLong(1));
154154
exclusiveEndKey.addPrimaryKeyColumn(COLUMN_UID_NAME,
155-
PrimaryKeyValue.INF_MAX); // 范围的边界需要提供完整的PK,若查询的范围不涉及到某一列值的范围,则需要将该列设置为无穷大或者无穷小
155+
PrimaryKeyValue.fromLong(4)); // 范围的边界需要提供完整的PK,若查询的范围不涉及到某一列值的范围,则需要将该列设置为无穷大或者无穷小
156156

157157
criteria.setInclusiveStartPrimaryKey(inclusiveStartKey);
158158
criteria.setExclusiveEndPrimaryKey(exclusiveEndKey);
159159
GetRangeRequest request = new GetRangeRequest();
160160
request.setRangeRowQueryCriteria(criteria);
161161
GetRangeResult result = client.getRange(request);
162162
List<Row> rows = result.getRows();
163+
164+
System.out.println("GetRange result:");
163165
for (Row row : rows) {
164166
System.out.println("name信息为:"
165167
+ row.getColumns().get(COLUMN_NAME_NAME));

0 commit comments

Comments
 (0)