1 / 7

CS122B: Projects in Databases and Web Applications Winter 201 9

CS122B: Projects in Databases and Web Applications Winter 201 9. Professor Chen Li Department of Computer Science UC Irvine Notes 12: User-Defined Functions (UDF) in MySQL. Purpose. SQL has its own limitations Enhance DB using functions implemented in C. Example: edit distance.

neile
Download Presentation

CS122B: Projects in Databases and Web Applications Winter 201 9

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS122B: Projects in Databases and Web Applications Winter 2019 Professor Chen Li Department of Computer Science UC Irvine Notes 12: User-Defined Functions (UDF) in MySQL

  2. Purpose • SQL has its own limitations • Enhance DB using functions implemented in C

  3. Example: edit distance • Edit distance between two strings is the minimum number of single-character operations (insert/delete/substitute) to transform one to the other • Also known as Levenshtein distance • Example: ed(”schwazeneger”, ”schwarzenegger”) = 2

  4. Dynamicprogrammingfor edit distance

  5. Example • ed(”elephant”, ”relevant”) = 3

  6. Supporting Edit Distance as UDF Compile Edit distance Function in C: ed.c Shared library libed.so CREATE FUNCTION ed RETURNS INTEGER SONAME 'libed.so'; SELECT ed('abc', 'ad'); MySQL

  7. Example: using ed as a UDF • select * from stars where name = ’Arnold schwarzenegger' limit 5 • select * from stars where ed(name, 'Arnold Schwarzeneger') <= 2 limit 5

More Related