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

Decide how to deal with conflict between native and user-defined functions



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


      We have a bunch of native/hardcoded functions (now(), dateOf(), ...) and in 3.0, user will be able to define new functions. Now, there is a very high change that we will provide more native functions over-time (to be clear, I'm not particularly for adding native functions for allthethings just because we can, but it's clear that we should ultimately provide more than what we have). Which begs the question: how do we want to deal with the problem of adding a native function potentially breaking a previously defined user-defined function?

      A priori I see the following options (maybe there is more?):

      1. don't do anything specific, hoping that it won't happen often and consider it a user problem if it does.
      2. reserve a big number of names that we're hoping will cover all future need.
      3. make native function and user-defined function syntactically distinct so it cannot happen.

      I'm not a huge fan of solution 1). Solution 2) is actually what we did for UDT but I think it's somewhat less practical here: there is so much types that it makes sense to provide natively and so it wasn't too hard to come up with a reasonably small list of types name to reserve just in case. This feels a lot harder for functions to me.

      Which leaves solution 3). Since we already have the concept of namespaces for functions, a simple idea would be to force user function to have namespace. We could even allow that namespace to be empty as long as we force the namespace separator (so we'd allow bar::foo and ::foo for user functions, but not foo which would be reserved for native function).


        1. 7813v8.txt
          101 kB
          Robert Stupp
        2. 7813v7.txt
          100 kB
          Robert Stupp
        3. 7813v6.txt
          100 kB
          Robert Stupp
        4. 7813v5.txt
          77 kB
          Robert Stupp
        5. 7813v4.txt
          76 kB
          Robert Stupp
        6. 7813v3.txt
          73 kB
          Robert Stupp
        7. 7813v2.txt
          74 kB
          Robert Stupp
        8. 7813.txt
          75 kB
          Robert Stupp

        Issue Links



              snazy Robert Stupp
              slebresne Sylvain Lebresne
              Robert Stupp
              Benjamin Lerer
              0 Vote for this issue
              11 Start watching this issue