AnsweredAssumed Answered

Drill Query Issues - MapR-DB JSON Tables

Question asked by john.humphreys on Mar 16, 2018
Latest reply on Mar 17, 2018 by john.humphreys

I can't get any records back from a MapR-DB JSON table's non-default column families unless I include a separate select * from the table. (using "use dfs.maprdb");


For example, "a.b" is part of "cf1", a separate column family.  Everything else should be in the default column family.


The query:  ( select x.*, x.a.b.d as cf1_result from `test-cf` x ) returns results for everything and for cf1.


The query: ( select x.a.b.d as cf1_result from `test-cf` x ) which just targets the second column returns no results whatsoever.


Here's how the table was created:

(!MapRDB.tableExists(tableName)) {

    TableDescriptor tableDescriptor = MapRDB.newTableDescriptor(tableName);
    FamilyDescriptor defaultfamilyDesc = MapRDB.newDefaultFamilyDescriptor();

    FamilyDescriptor familyDescriptor = MapRDB.newFamilyDescriptor()

    createJSONTable(tableName, tableDescriptor);

    Table table = MapRDB.getTable(tableName);

    //Insert document at a.b.c.
    Document doc = MapRDB.newDocument();
    doc.set("_id", "123")
            .set("a.b.c", "cake")   //Should be in special column family.
            .set("a.b.d", "pie")    //Should be in special column family.
            .set("a.e", "flowers"); // Should be in default.

It can be queried fine in Java for both the default and non-default fields:

Table table = MapRDB.getTable(tableName);

System.out.println("In special column family:");
table.find("a.b").forEach(d -> System.out.println(d.asJsonString()));

System.out.println("In default column family:");
table.find("a.e").forEach(d -> System.out.println(d.asJsonString()));
table.getTableDescriptor().getFamilies().forEach(x -> System.out.println(x.getJsonFieldPath()));

Is this a drill bug or am I doing something wrong?