Skip to content

Commit

Permalink
0004918: support slicing tables for initial load
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Mar 29, 2021
1 parent 88e140d commit 268f08d
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
Expand Up @@ -1280,4 +1280,13 @@ public boolean supportsLimitOffset() {
public String massageForLimitOffset(String sql, int limit, int offset) {
return sql;
}

public boolean supportsSliceTables() {
return false;
}

public String getSliceTableSql(String columnName, int sliceNum, int totalSlices) {
return "";
}

}
Expand Up @@ -211,5 +211,9 @@ public Object[] getObjectValues(BinaryEncoding encoding, String[] values,
public boolean supportsLimitOffset();

public String massageForLimitOffset(String sql, int limit, int offset);

public boolean supportsSliceTables();

public String getSliceTableSql(String columnName, int sliceNum, int totalSlices);

}
Expand Up @@ -120,4 +120,14 @@ public String massageForLimitOffset(String sql, int limit, int offset) {
"where RowNum between " + (offset + 1) + " and " + (offset + limit);
}

@Override
public boolean supportsSliceTables() {
return true;
}

@Override
public String getSliceTableSql(String columnName, int sliceNum, int totalSlices) {
return "ascii(substring(" + columnName + ", 1, 1)) % " + totalSlices + " = " + sliceNum;
}

}
Expand Up @@ -247,5 +247,14 @@ public String massageForLimitOffset(String sql, int limit, int offset) {
return sql + " limit " + offset + "," + limit;
}

@Override
public boolean supportsSliceTables() {
return true;
}

@Override
public String getSliceTableSql(String columnName, int sliceNum, int totalSlices) {
return "ascii(substring(" + columnName + ", 1, 1)) % " + totalSlices + " = " + sliceNum;
}

}
Expand Up @@ -251,4 +251,14 @@ public String massageForLimitOffset(String sql, int limit, int offset) {
"where row_num between " + (offset + 1) + " and " + (offset + limit);
}

@Override
public boolean supportsSliceTables() {
return true;
}

@Override
public String getSliceTableSql(String columnName, int sliceNum, int totalSlices) {
return "mod(ora_hash(rowid), " + totalSlices + ") = " + sliceNum;
}

}
Expand Up @@ -346,4 +346,15 @@ public String massageForLimitOffset(String sql, int limit, int offset) {
}
return sql + " limit " + limit + " offset " + offset;
}

@Override
public boolean supportsSliceTables() {
return true;
}

@Override
public String getSliceTableSql(String columnName, int sliceNum, int totalSlices) {
return "ascii(substring(" + columnName + ", 1, 1)) % " + totalSlices + " = " + sliceNum;
}

}

0 comments on commit 268f08d

Please sign in to comment.