How the Collector handles class text data calculations

Source: Internet
Author: User

Json

Java has enough class libraries to parse and generate JSON, but lacks subsequent computing power. The collector supports multilayer structure data and can parse the JSON into a computable memory data table without losing information for further processing.

JSON data is available in the following format:

{

"Order": [

{

"Client": "Beijing Run Dry Software",

"Date": "2015-6-23",

"Item": [

"Product": "HP Notebook",

"Number": 4,

"Price": 3200

},

{

"Product": "Dell Server",

"Number": 1,

"Price": 22100

}]

},...]

}

To write to the order table in the database, the structure is: orderid,client,date; and OrderDetail table, the structure is: orderid,seq,product,number,price orderdetail table, OrderID and SEQ are generated sequentially.

A

1

=file ("Data.json"). read () [email protected] (). Order

2

=a1.new (#:orderid,client,date)

3

=a1.news (item; A1.#:orderid,#:seq,product,number,price)

4

>[email protected] (A2,order)

5

>[email protected] (A3,ordedetail)

The collector parses a multilayer JSON string into a multi-tiered dataset, and the A2 item field is a table.

In addition to parsing, you can use the collector to generate multilayer JSON strings from a multi-tier dataset.

Excel

Excel is equivalent to already structured text. Java has an open source class library (such as a POI) capable of parsing XLS, which is powerful but too low-level and highly complex to develop. The collector encapsulates the POI, which can be read into the XLS into a two-dimensional data table for further operation.

The contents of Range.xls and Position.xls are as follows:

Range.xls

Position.xls

Range

Start

Stop

Point

Position

Range1

4561

6321

Point1

5213

Range2

9842

11253

Point2

10254

...

...

To position for each line of Position.xls, find start/stop to overwrite it in Range.xls, and then add the contents of the corresponding row in Range.xls to Posistion.xls.

A

1

=file ("Range.xls") [email protected] ()

2

=file ("Position.xls") [email protected] ()

3

=a2.derive ([email protected] (position>=start&&position<=stop)). Range:range,

T.start:start,t.stop:stop)

4

=file ("Result.xls"). Exportxls (A3)

When the collector is read into XLS, it can take advantage of existing computing power. VBA with Excel can only be hard-coded to implement join, very cumbersome, and sometimes have to import the database to do.

How the Collector handles class text data calculations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.