Michael J. Carey created ASTERIXDB-3012:
-------------------------------------------

             Summary: Samples from (typed) view datasets aren't working
                 Key: ASTERIXDB-3012
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3012
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: UI - Web Interface
    Affects Versions: 0.9.7
            Reporter: Michael J. Carey
             Fix For: 0.9.7
         Attachments: doncdata.sqlpp

The metadata brower's sample feature (when you click on a dataset name) comes 
up empty for typed views (and perhaps for untyped views, I didn't try that yet).

Here are some view definitions to try this against [^doncdata.sqlpp]with the 
DonCData example dataverse (which can be created using the attached DDL).

USE DonCData; 

-- FLATTEN CUSTOMERS

CREATE VIEW customers_view (
  custid STRING, name STRING, rating BIGINT, adr_street STRING, adr_city 
STRING, adr_zipcode STRING) 
DEFAULT NULL
PRIMARY KEY (custid) NOT ENFORCED
AS 
  SELECT custid, name, rating, address.street AS adr_street, address.city AS 
adr_city, address.zipcode AS adr_zipcode 
  FROM customers;

-- FLATTEN ORDERS

CREATE VIEW orders_view (orderno BIGINT, custid STRING, order_date DATE, 
ship_date DATE) 
DEFAULT NULL
PRIMARY KEY (orderno) NOT ENFORCED
FOREIGN KEY (custid) REFERENCES customers_view NOT ENFORCED
AS 
  SELECT orderno, custid, order_date, ship_date FROM orders;

-- FLATTEN ITEMS

CREATE VIEW items_view (orderno BIGINT, itemno BIGINT, item_qty BIGINT, 
item_price DOUBLE) 
DEFAULT NULL
PRIMARY KEY (orderno, itemno) NOT ENFORCED
FOREIGN KEY (orderno) REFERENCES orders_view NOT ENFORCED
AS
  SELECT o.orderno, i.itemno, i.qty AS item_qty, i.price AS item_price
  FROM orders AS o UNNEST o.items AS i;

-- CHECK OUT FLAT VIEW CONTENTS

SELECT VALUE v FROM customers_view v;
SELECT VALUE v FROM orders_view v;
SELECT VALUE v FROM items_view v;



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to