Delete Index Layer Data

The Data Client Library provides the class LayerUpdater to perform update operations on index layers.

The LayerUpdater has 3 methods:

  • updateLayer(catalogHrn, layerId) defines the catalog and layer which should be updated.
  • option("olp.deleteTimeoutKey", timeoutInMsec) defines the timeout of the delete function call in milliseconds. Default is 100 seconds.
  • delete(queryString) performs the delete operation according the query string. The query string is in RSQL format. The delete function call is blocking/syncronous. It returns when the delete operation finished or after timeout is expired as set by option function.

Project Dependencies

If you want to create an application that uses the HERE Open Location Platform Spark Connector to delete data from index layer, please add the required dependencies to your project as described in chapter Dependencies for Spark Connector.

Examples

The following snippet demonstrates how to delete data from an index layer of a catalog.

Scala
Java
import com.here.platform.data.client.spark.scaladsl.{
  GroupedData,
  IndexDataConverter,
  IndexRowMetadata
}
import com.here.platform.data.client.spark.LayerDataFrameReader.SparkSessionExt
import com.here.platform.pipeline.PipelineContext
import org.apache.spark.sql.SparkSession
val df = sparkSession
  .updateLayer(catalogHrn, layerId)
  .delete(s"testId == $testId")
df.show()
val deleteResult = df.select("result").first.getString(0)
val deletedCount = df.select("count").first.getInt(0)
val deletionMessage = df.select("message").first.getString(0)
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

Dataset<Row> df =
    JavaLayerUpdater.create(sparkSession)
        .updateLayer(catalogHrn, layerId)
        .delete("testId == " + testId);
int deletedCount = df.select("count").first().getInt(0);
String deletionMessage = df.select("message").first().getString(0);
Note:

For information on RSQL please see RSQL.

results matching ""

    No results matching ""