Class StringDistanceFunctions.LongestCommonSubstringDistanceFunction

java.lang.Object
org.apache.drill.exec.udfs.StringDistanceFunctions.LongestCommonSubstringDistanceFunction
All Implemented Interfaces:
DrillFunc, DrillSimpleFunc
Enclosing class:
StringDistanceFunctions

public static class StringDistanceFunctions.LongestCommonSubstringDistanceFunction extends Object implements DrillSimpleFunc
The Longest common subsequence algorithm returns the length of the longest subsequence that two strings have in common. Two strings that are entirely different, return a value of 0, and two strings that return a value of the commonly shared length implies that the strings are completely the same in value and position. Note: Generally this algorithm is fairly inefficient, as for length m, n of the input CharSequence's left and right respectively, the runtime of the algorithm is O(m*n).

This implementation is based on the Longest Commons Substring algorithm from https://en.wikipedia.org/wiki/Longest_common_subsequence_problem.

Usage: SELECT longest_common_substring_distance( string1, string2 ) FROM...

  • Constructor Details

    • LongestCommonSubstringDistanceFunction

      public LongestCommonSubstringDistanceFunction()
  • Method Details