Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-8374

Better support of null for UDF

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.2.0 beta 1
    • None
    • Docs

    Description

      Currently, every function needs to deal with it's argument potentially being null. There is very many case where that's just annoying, users should be able to define a function like:

      CREATE FUNCTION addTwo(val int) RETURNS int LANGUAGE JAVA AS 'return val + 2;'
      

      without having this crashing as soon as a column it's applied to doesn't a value for some rows (I'll note that this definition apparently cannot be compiled currently, which should be looked into).

      In fact, I think that by default methods shouldn't have to care about null values: if the value is null, we should not call the method at all and return null. There is still methods that may explicitely want to handle null (to return a default value for instance), so maybe we can add an ALLOW NULLS to the creation syntax.

      Attachments

        1. 8374-3.txt
          128 kB
          Robert Stupp
        2. 8374-3.txt
          87 kB
          Robert Stupp
        3. 8374-5.txt
          140 kB
          Robert Stupp
        4. 8473-1.txt
          73 kB
          Robert Stupp
        5. 8473-2.txt
          79 kB
          Robert Stupp
        6. 8473-4.txt
          129 kB
          Robert Stupp

        Issue Links

          Activity

            People

              snazy Robert Stupp
              slebresne Sylvain Lebresne
              Robert Stupp
              Benjamin Lerer
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: