v2/spanner-change-streams-to-sharded-file-sink/src/main/java/com/google/cloud/teleport/v2/templates/utils/ShardIdFetcherImpl.java [40:64]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public ShardIdResponse getShardId(ShardIdRequest shardIdRequest) {
    try {
      String tableName = shardIdRequest.getTableName();
      String shardIdColumn = getShardIdColumnForTableName(tableName);
      if (shardIdRequest.getSpannerRecord().containsKey(shardIdColumn)) {
        String shardId = shardIdRequest.getSpannerRecord().get(shardIdColumn).toString();
        ShardIdResponse shardIdResponse = new ShardIdResponse();
        shardIdResponse.setLogicalShardId(shardId);
        return shardIdResponse;
      } else {
        LOG.error("Cannot find entry for the shard id column '" + shardIdColumn + "' in record.");
        throw new RuntimeException(
            "Cannot find entry for the shard id column '" + shardIdColumn + "' in record.");
      }
    } catch (IllegalArgumentException e) {
      LOG.error("Error fetching shard Id column for table: " + e.getMessage());
      throw new RuntimeException("Error fetching shard Id column for table: " + e.getMessage());
    } catch (Exception e) {
      StringWriter errors = new StringWriter();
      e.printStackTrace(new PrintWriter(errors));
      LOG.error("Error fetching shard Id colum: " + e.getMessage() + ": " + errors.toString());
      throw new RuntimeException(
          "Error fetching shard Id colum: " + e.getMessage() + ": " + errors.toString());
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/utils/ShardIdFetcherImpl.java [40:64]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public ShardIdResponse getShardId(ShardIdRequest shardIdRequest) {
    try {
      String tableName = shardIdRequest.getTableName();
      String shardIdColumn = getShardIdColumnForTableName(tableName);
      if (shardIdRequest.getSpannerRecord().containsKey(shardIdColumn)) {
        String shardId = shardIdRequest.getSpannerRecord().get(shardIdColumn).toString();
        ShardIdResponse shardIdResponse = new ShardIdResponse();
        shardIdResponse.setLogicalShardId(shardId);
        return shardIdResponse;
      } else {
        LOG.error("Cannot find entry for the shard id column '" + shardIdColumn + "' in record.");
        throw new RuntimeException(
            "Cannot find entry for the shard id column '" + shardIdColumn + "' in record.");
      }
    } catch (IllegalArgumentException e) {
      LOG.error("Error fetching shard Id column for table: " + e.getMessage());
      throw new RuntimeException("Error fetching shard Id column for table: " + e.getMessage());
    } catch (Exception e) {
      StringWriter errors = new StringWriter();
      e.printStackTrace(new PrintWriter(errors));
      LOG.error("Error fetching shard Id colum: " + e.getMessage() + ": " + errors.toString());
      throw new RuntimeException(
          "Error fetching shard Id colum: " + e.getMessage() + ": " + errors.toString());
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



