Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-3506

CREATE TYPE needs to support a union type notation

    XMLWordPrintableJSON

Details

    Description

      Suppose you had the following CREATE TYPE statement:

      CREATE TYPE productsType AS

      { itemno: int, category: string, name: string, descrip: string?, manuf: string, listprice: int }

      ;

      If for some (perhaps ill-advised) reason you wanted to permit the listprice field to be either an int or a string, we have no way to express that at present. We need a notation that addresses that! E.g., something along the following lines (final syntax TBD):

      CREATE TYPE productsType AS

      { itemno: int, category: string, name: string, descrip: string?, manuf: string, listprice: int | string }

      ;

      Note that internally the schema inference under our columnar format can represent this, there's just no way to say it at the user level. Note that we'd also have to extend the check-before-deposit logic in INSERT and UPSERT to enforce these sorts of more general type constraints - not sure if it would "just work" or if it's significant new code (since I haven't looked at that part of the code base).

      Attachments

        Activity

          People

            Unassigned Unassigned
            dtabass Michael J. Carey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: