All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.napalabs.spark.hscan.functions.scala Maven / Gradle / Ivy

Go to download

hyperscan wrapper for spark to allow matching large numbers (up to tens of thousands) of regular expressions

The newest version!
package ru.napalabs.spark.hscan

import org.apache.spark.sql.Column
import org.apache.spark.sql.catalyst.expressions.{Expression, Literal}
import ru.napalabs.spark.hscan.funcs.HyperscanLike

object functions {
  private def withExpr(expr: Expression): Column = new Column(expr)

  /**
   * Hyperscan regex like. Hyperscan regexps differs from java regexps,
   * see hyperscan documentation
   * @return boolean column with match result
   */
  def hlike(e: Column, patterns: Array[String]): Column = withExpr{
    HyperscanLike(e.expr, Literal(patterns))
  }

  /**
   * Hyperscan regex like. Hyperscan regexps differs from java regexps,
   * see hyperscan documentation
   * @return boolean column with match result
   */
  def hlike(e: Column, patterns: Column): Column = withExpr{
    HyperscanLike(e.expr, patterns.expr)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy