def fudgeSizeEstimatesTable()

in connector/src/it/scala/com/datastax/spark/connector/rdd/CassandraRDDSpec.scala [1395:1427]


  def fudgeSizeEstimatesTable(tableName: String, sizeFudgeInMB: Long) = {

    val tokenFactory = TokenFactory.forSystemLocalPartitioner(conn)

    conn.withSessionDo { case session =>
      session.execute(SimpleStatement.builder(
        """DELETE FROM system.size_estimates
          |where keyspace_name = ?
          |AND table_name = ?""".stripMargin)
        .addPositionalValues(ks, tableName)
        .build())

      session.execute(
        SimpleStatement.builder(
        """
          |INSERT INTO system.size_estimates (
          |  keyspace_name,
          |  table_name,
          |  range_start,
          |  range_end,
          |  mean_partition_size,
          |  partitions_count)
          |  VALUES (?,?,?,?,?,?)
        """.
          stripMargin).addPositionalValues(
        ks,
        tableName,
        tokenFactory.minToken.toString,
        tokenFactory.maxToken.toString,
        sizeFudgeInMB * 1024 * 1024: java.lang.Long,
        1L: java.lang.Long).build())
    }
  }