> On Dec. 22, 2015, 2:35 p.m., Amareshwari Sriramadasu wrote:
> > lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java,
> > line 149
> > <https://reviews.apache.org/r/41035/diff/5/?file=1173946#file1173946line149>
> >
> > What all objects fall in this check ?
>
> Rajat Khandelwal wrote:
> All our classes generaged by the xsd.
>
> Amareshwari Sriramadasu wrote:
> What about the classes annototated with XmlRootElement like LensQuery ?
Good point. So I'll give a hive level description here.
for compiling xsd to classes, we're using some extensions in the jaxb plugin.
One of the extensions is generating `toString()`. The extension makes all the
classes implement from `ToString` and generates this code in all the classes:
```
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
// custom implementation of ToString#append
// custom implementation of ToString#appendFields
```
You see that the default strategy is an instance of `JAXBToStringStrategy`,
which generates some output for `toString`. I've written a custom strategy that
generates the output in http://www.yaml.org/ format. I plan to make this the
default strategy for our classes in the long run, but for now, We'll use this
to just print an object in a user-readable format.
XML Classes outside xsd can all implement `ToString` and the existing code
should work :). We can make that happen in different jira(s).
When we make this the default strategy, then the CLI code will be able to just
use `toString()` inside `describe`. That again can happen in different jira(s).
- Rajat
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41035/#review111587
-----------------------------------------------------------
On Dec. 21, 2015, 10:39 p.m., Rajat Khandelwal wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41035/
> -----------------------------------------------------------
>
> (Updated Dec. 21, 2015, 10:39 p.m.)
>
>
> Review request for lens.
>
>
> Bugs: LENS-791
> https://issues.apache.org/jira/browse/LENS-791
>
>
> Repository: lens
>
>
> Description
> -------
>
> fixing cli formatting
>
>
> Diffs
> -----
>
> lens-api/pom.xml 8aa2f67a92d22cc6a807b44bdc7e451d09959768
> lens-api/src/main/java/org/apache/lens/api/LensConf.java
> ff965d6aabf052371e0b3b4644a5f60d1210be3d
> lens-api/src/main/java/org/apache/lens/api/jaxb/YAMLToStringStrategy.java
> PRE-CREATION
>
> lens-api/src/test/java/org/apache/lens/api/jaxb/YAMLToStringStrategyTest.java
> PRE-CREATION
> lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java
> 643772596c4724253333c0688a93ed621b4dba45
> lens-cli/src/main/java/org/apache/lens/cli/commands/LensCRUDCommand.java
> a0c05b41650cd8303879c6c370d892c544adf6ca
>
> lens-cli/src/main/java/org/apache/lens/cli/commands/LensConnectionCommands.java
> 0aa51a8eeea2ad3e0b43d7f011c50b83b0ba30e4
>
> lens-cli/src/main/java/org/apache/lens/cli/commands/LensDimensionCommands.java
> dc8349e322adcb031ef503850e012603f5865088
> lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java
> e3c08ff1e17feeb6b7d3a5e42599993350e7d166
>
> lens-cli/src/main/java/org/apache/lens/cli/commands/LogicalTableCrudCommand.java
> a04d5c836a31b625e0efcd5509d999d6e483cbb6
> lens-client/src/main/java/org/apache/lens/client/LensClient.java
> 8f197e4ec5f9c0cc050643cf7333aeba5eec6e08
> pom.xml 746204e87d046454fbd0e3f4690e3b220487418c
> src/site/apt/admin/config.apt 54f827e8b18b139a6ade8b480881bdf9a7942306
>
> Diff: https://reviews.apache.org/r/41035/diff/
>
>
> Testing
> -------
>
> ```
> Welcome to Lens Client
> lens-shell>describe cube sales
> properties:
> cube.col.production_city_name.description: City name in which the product
> was produced
> cube.measure.rating.class: org.apache.lens.cube.metadata.ColumnMeasure
> cube.dimension.customer_city_name.type: string
> cube.col.profit.displaystring: Profit
> cube.dimension.production_city_id.type: int
> cube.dimension.customer_city_name.class:
> org.apache.lens.cube.metadata.ReferencedDimAtrribute
> cube.dimension.production_city_id.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.measure.line_item_quantity.aggregate: SUM
> cube.col.promotion_sales.cost: 0.0
> cube.dimension.delivery_city_id.type: int
> cube.timedim.partition.delivery_time: dt
> cube.sales.joinchains.list0:
> customer_details,product_details,customer_city,delivery_city,production_city
> base.sales.expressions.list.size: 1
> cube.dimension.order_id.type: int
> cube.measure.max_line_item_price.aggregate: MAX
> transient_lastDdlTime: 1450698320
> cube.measure.line_item_product_price.class:
> org.apache.lens.cube.metadata.ColumnMeasure
> cube.col.profit.type: double
> cube.col.promotion_sales.expr:
> c3VtKGNhc2Ugd2hlbiBwcm9tb3Rpb25faWQgPSAwIHRoZW4gMCBlbHNlIHN0b3JlX3NhbGVzIGVu
> ZCk=
> :2015-04-11-18:|c3VtKGNhc2Ugd2hlbiBwcm9tb3Rpb25faWQgPSAtMSB0aGVuIDAgd2hlbiBwcm9tb3Rpb25faWQg
> PSAtMSB0aGVuIDAgZWxzZSBzdG9yZV9zYWxlcyBlbmQp
> ::2015-04-11-18
> cube.measure.line_item_tax.aggregate: SUM
> cube.measure.line_item_tax.type: float
> cube.col.delivery_city_name.description: City name to which the product was
> delivered
> cube.measure.unit_sales.type: bigint
> cube.measure.store_sales.class: org.apache.lens.cube.metadata.ColumnMeasure
> cube.measure.line_item_quantity.class:
> org.apache.lens.cube.metadata.ColumnMeasure
> cube.dimension.customer_city_id.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.dimension.production_city_name.chain.name: production_city
> cube.dimension.delivery_city_name.class:
> org.apache.lens.cube.metadata.ReferencedDimAtrribute
> cube.dimension.delivery_city_name.chain.name: delivery_city
> cube.col.max_line_item_discount.displaystring: Maximum Line item discount
> base.sales.expressions.list0: profit,promotion_sales
> cube.dimension.production_country.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.col.customer_city_name.description: City name to which the customer
> belongs
> cube.sales.timed.dimensions.list: order_time,delivery_time
> cube.measure.line_item_product_price.type: float
> cube.col.line_item_product_price.displaystring: Line item product price
> cube.joinchain.customer_city.fullchain.1:
> sales.customer_id.false,customer.id.false,customer.city_id.false,city.id.false
> cube.col.line_item_discount_amount.displaystring: Line item discount
> cube.joinchain.customer_city.fullchain.0:
> sales.customer_city_id.false,city.id.false
> cube.joinchain.customer_city.numchains: 2
> cube.dimension.customer_city_id.type: int
> cube.col.profit.expr.base64: true
> cube.dimension.production_country.type: string
> cube.dimension.customer_id.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.dimension.customer_id.type: int
> cube.measure.max_line_item_price.class:
> org.apache.lens.cube.metadata.ColumnMeasure
> cube.dimension.delivery_city_id.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.col.store_cost.displaystring: Store Cost
> cube.joinchain.customer_details.numchains: 1
> cube.timedim.relation.order_time: delivery_time+[-20 days,-1 hour]
> cube.table.sales.weight: 0.0
> cube.dimension.product_id.type: int
> cube.measure.line_item_quantity.type: int
> cube.col.max_line_item_price.displaystring: Maximum Line item price
> cube.dimension.customer_city_name.chain.column.name: name
> cube.joinchain.delivery_city.numchains: 1
> cube.col.customer_city_name.displaystring: Customer City
> cube.measure.max_line_item_discount.class:
> org.apache.lens.cube.metadata.ColumnMeasure
> cube.dimension.order_id.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.dimension.customer_city_name.chain.name: customer_city
> cube.sales.dimensions.list.size: 1
> cube.joinchain.product_details.fullchain.0:
> sales.product_id.false,product.id.false
> cube.dimension.production_state.type: string
> cube.measure.max_line_item_price.type: float
> cube.col.store_sales.displaystring: Store Sales
> cube.col.delivery_city_name.displaystring: Delivery City
> cube.table.type: CUBE
> cube.col.promotion_sales.expr.base64: true
> cube.col.store_cost.starttime: 2015-02-28-18
> cube.dimension.production_state.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.col.unit_sales.displaystring: Unit Sales
> cube.sales.measures.list0:
> unit_sales,store_sales,store_cost,line_item_quantity,line_item_product_price,line_item_discount_amount,line_item_tax,max_line_item_price,max_line_item_discount,rating
> cube.col.production_state.displaystring: Production State
> cube.dimension.order_time.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.measure.unit_sales.format: #,###
> cube.col.line_item_tax.displaystring: Line item tax
> cube.measure.max_line_item_discount.type: float
> cube.dimension.product_id.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.measure.line_item_product_price.aggregate: SUM
> cube.dimension.production_city_name.class:
> org.apache.lens.cube.metadata.ReferencedDimAtrribute
> cube.col.production_country.description: Country name in which the product
> was produced
> cube.col.production_city_name.displaystring: Production City
> cube.measure.store_sales.format: #,###.##
> cube.col.profit.expr: c3RvcmVfc2FsZXMgLSBzdG9yZV9jb3N0
> ::
> cube.dimension.delivery_time.type: timestamp
> cube.measure.rating.type: float
> cube.measure.line_item_tax.class:
> org.apache.lens.cube.metadata.ColumnMeasure
> cube.measure.unit_sales.class: org.apache.lens.cube.metadata.ColumnMeasure
> cube.sales.joinchains.list.size: 1
> cube.joinchain.customer_details.fullchain.0:
> sales.customer_id.false,customer.id.false
> cube.col.customer_city_id.starttime: 2015-02-28-18
> cube.joinchain.production_city.numchains: 1
> cube.sales.dimensions.list0:
> customer_id,product_id,promotion_id,order_id,order_line_number,order_time,delivery_time,customer_city_id,production_city_id,delivery_city_id,customer_city_name,production_location,delivery_city_name
> cube.measure.store_cost.type: double
> cube.dimension.production_city_name.chain.column.name: name
> cube.measure.store_sales.aggregate: SUM
> cube.joinchain.product_details.numchains: 1
> cube.measure.rating.aggregate: AVG
> cube.dimension.order_line_number.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.col.promotion_sales.type: double
> cube.dimension.order_line_number.type: int
> cube.dimension.production_location.hierarchy.2:
> production_country,org.apache.lens.cube.metadata.BaseDimAttribute
> cube.dimension.delivery_city_name.type: string
> cube.dimension.production_location.hierarchy.1:
> production_state,org.apache.lens.cube.metadata.BaseDimAttribute
> cube.dimension.production_location.hierarchy.0:
> production_city_name,org.apache.lens.cube.metadata.ReferencedDimAtrribute
> cube.dimension.delivery_city_name.chain.column.name: name
> cube.joinchain.delivery_city.fullchain.0:
> sales.delivery_city_id.false,city.id.false
> cube.measure.store_sales.type: double
> cube.measure.line_item_discount_amount.aggregate: SUM
> cube.dimension.promotion_id.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.col.production_country.displaystring: Production Country
> cube.col.profit.cost: 0.0
> cube.measure.line_item_discount_amount.type: float
> cube.measure.unit_sales.aggregate: SUM
> cube.sales.measures.list.size: 1
> cube.dimension.production_location.class:
> org.apache.lens.cube.metadata.HierarchicalDimAttribute
> cube.dimension.promotion_id.type: int
> cube.measure.max_line_item_discount.aggregate: MAX
> cube.measure.line_item_discount_amount.class:
> org.apache.lens.cube.metadata.ColumnMeasure
> cube.dimension.delivery_time.class:
> org.apache.lens.cube.metadata.BaseDimAttribute
> cube.measure.store_cost.aggregate: SUM
> cube.col.rating.displaystring: Rating
> cube.measure.store_cost.class: org.apache.lens.cube.metadata.ColumnMeasure
> cube.col.production_state.description: State name in which the product was
> produced
> cube.col.promotion_sales.displaystring: Promotion sales
> cube.joinchain.production_city.fullchain.0:
> sales.production_city_id.false,city.id.false
> cube.dimension.order_time.type: timestamp
> cube.col.line_item_quantity.displaystring: Line item quantity
> cube.timedim.partition.order_time: ot
> cube.measure.store_cost.format: #,###.00
> cube.dimension.production_city_name.type: string
> name: sales
> measures:
> rating:
> displayString: Rating
> type: FLOAT
> defaultAggr: AVG
> line_item_quantity:
> displayString: Line item quantity
> type: INT
> defaultAggr: SUM
> store_sales:
> displayString: Store Sales
> type: DOUBLE
> defaultAggr: SUM
> formatString: #,###.##
> unit_sales:
> displayString: Unit Sales
> type: BIGINT
> defaultAggr: SUM
> formatString: #,###
> line_item_tax:
> displayString: Line item tax
> type: FLOAT
> defaultAggr: SUM
> max_line_item_discount:
> displayString: Maximum Line item discount
> type: FLOAT
> defaultAggr: MAX
> store_cost:
> displayString: Store Cost
> type: DOUBLE
> defaultAggr: SUM
> formatString: #,###.00
> startTime: 2015-02-28T23:30:00.000+05:30
> max_line_item_price:
> displayString: Maximum Line item price
> type: FLOAT
> defaultAggr: MAX
> line_item_discount_amount:
> displayString: Line item discount
> type: FLOAT
> defaultAggr: SUM
> line_item_product_price:
> displayString: Line item product price
> type: FLOAT
> defaultAggr: SUM
> dimAttributes:
> production_location:
> hierarchy:
> production_city_name:
> displayString: Production City
> description: City name in which the product was produced
> refSpec:
> chainRefColumn:
> -
> chainName: production_city
> refCol: name
> destTable: city
> type: string
> joinKey: false
> production_state:
> displayString: Production State
> description: State name in which the product was produced
> type: string
> joinKey: false
> production_country:
> displayString: Production Country
> description: Country name in which the product was produced
> type: string
> joinKey: false
> joinKey: false
> customer_city_name:
> displayString: Customer City
> description: City name to which the customer belongs
> refSpec:
> chainRefColumn:
> -
> chainName: customer_city
> refCol: name
> destTable: city
> type: string
> joinKey: false
> production_city_id:
> type: int
> joinKey: false
> product_id:
> type: int
> joinKey: false
> order_id:
> type: int
> joinKey: false
> delivery_city_id:
> type: int
> joinKey: false
> delivery_time:
> type: timestamp
> joinKey: false
> order_time:
> type: timestamp
> joinKey: false
> order_line_number:
> type: int
> joinKey: false
> customer_city_id:
> type: int
> startTime: 2015-02-28T23:30:00.000+05:30
> joinKey: false
> promotion_id:
> type: int
> joinKey: false
> delivery_city_name:
> displayString: Delivery City
> description: City name to which the product was delivered
> refSpec:
> chainRefColumn:
> -
> chainName: delivery_city
> refCol: name
> destTable: city
> type: string
> joinKey: false
> customer_id:
> type: int
> joinKey: false
> expressions:
> profit:
> displayString: Profit
> exprSpec:
> -
> expr: store_sales - store_cost
> type: double
> promotion_sales:
> displayString: Promotion sales
> exprSpec:
> -
> expr: sum(case when promotion_id = 0 then 0 else store_sales end)
> startTime: 2015-04-11T23:30:00.000+05:30
> -
> expr: sum(case when promotion_id = -1 then 0 when promotion_id = -1
> then 0 else store_sales end)
> endTime: 2015-04-11T23:30:00.000+05:30
> type: double
> joinChains:
> product_details:
> paths:
> -
> sales.product_id=product.id
> destTable: product
> production_city:
> paths:
> -
> sales.production_city_id=city.id
> destTable: city
> customer_details:
> paths:
> -
> sales.customer_id=customer.id
> destTable: customer
> delivery_city:
> paths:
> -
> sales.delivery_city_id=city.id
> destTable: city
> customer_city:
> paths:
> -
> sales.customer_city_id=city.id
> -
> sales.customer_id=customer.id
> customer.city_id=city.id
> destTable: city
>
> ```
>
> Thoughts?
>
>
> Thanks,
>
> Rajat Khandelwal
>
>