Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-7762

Enhancement while getting partitions via webhcat client

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • WebHCat
    • None

    Description

      Hcatalog creates partitions in lower case, whereas getting partitions from hcatalog via webhcat client doesn't handle this. So the client starts throwing exceptions.
      Ex:
      CREATE EXTERNAL TABLE in_table (word STRING, cnt INT) PARTITIONED BY (Year STRING, Month STRING, Date STRING, Hour STRING, Minute STRING) STORED AS TEXTFILE LOCATION '/user/suhas/hcat-data/in/';

      Then i try to get partitions by:

              String inputTableName = "in_table";
              String database = "default";
      
              Map<String, String> partitionSpec = new HashMap<String, String>();
              partitionSpec.put("Year", "2014");
              partitionSpec.put("Month", "08");
              partitionSpec.put("Date", "11");
              partitionSpec.put("Hour", "00");
              partitionSpec.put("Minute", "00");
      
              HCatClient client = get(catalogUrl);
              HCatPartition hCatPartition = client.getPartition(database, inputTableName, partitionSpec);
      

      This throws up saying:

      Exception in thread "main" org.apache.hcatalog.common.HCatException : 9001 : Exception occurred while processing HCat request : Invalid partition-key specified: year
      	at org.apache.hcatalog.api.HCatClientHMSImpl.getPartition(HCatClientHMSImpl.java:366)
      	at com.inmobi.demo.HcatPartitions.main(HcatPartitions.java:34)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      

      The same code works if i do

              partitionSpec.put("year", "2014");
              partitionSpec.put("month", "08");
              partitionSpec.put("date", "11");
              partitionSpec.put("hour", "00");
              partitionSpec.put("minute", "00");
      

      Attachments

        1. HIVE-7762.patch
          2 kB
          Suhas Vasu
        2. HIVE-7762.4.patch
          11 kB
          Suhas Vasu
        3. HIVE-7762.3.patch
          11 kB
          Suhas Vasu
        4. HIVE-7762.2.patch
          2 kB
          Suhas Vasu

        Activity

          People

            Unassigned Unassigned
            suhas.ysr Suhas Vasu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: