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

The Pig CqlStorage/AbstractCassandraStorage classes don't handle collection types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 1.2.10, 2.0.1
    • None
    • Normal

    Description

      The CqlStorage class gets the Pig data type for values from the AbstractCassandraStorage class, in the getPigType method. If it isn't a known data type, it makes the value into a ByteArray. Currently there aren't any cases there for lists, maps, and sets.
      https://github.com/apache/cassandra/blob/cassandra-1.2.8/src/java/org/apache/cassandra/hadoop/pig/AbstractCassandraStorage.java#L336

      See this describe output from the grunt shell:

      grunt> describe listdata ;                                        
      listdata: {id: (name: chararray,value: int),alist: (name: chararray,value: bytearray),amap: (name: chararray,value: bytearray),aset: (name: chararray,value: bytearray)}
      

      where the cql data structures had this schema:

      CREATE TABLE alltypes (
        id int PRIMARY KEY,
        alist list<text>,
        amap map<text, text>,
        aset set<text>
      

      It turns out that if you cast the map in grunt to a pig map, then it sort of works, but I don't think we should probably use a pig map. Lists don't appear to work at all, as there is no Pig analogue. I think you could probably just do a UDF to cast these things, but we already have all of the type information, so we just need to change them to tuples or bags or whatever.

      Attachments

        1. 5867-1.2-branch.txt
          9 kB
          Alex Liu
        2. 5867-2-1.2-branch.txt
          10 kB
          Alex Liu
        3. 5867-3-1.2-branch.txt
          13 kB
          Alex Liu
        4. 5867-bug-fix-filter-push-down-1.2-branch.txt
          4 kB
          Alex Liu
        5. 5867-4-1.2-branch.txt
          9 kB
          Alex Liu
        6. 5867-5-1.2-branch.txt
          9 kB
          Alex Liu

        Issue Links

          Activity

            People

              alexliu68 Alex Liu
              jeromatron Jeremy Hanna
              Alex Liu
              Brandon Williams
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: