GitHub user SuJinpei opened a pull request: https://github.com/apache/incubator-trafodion/pull/1237
[TRAFODION-2726] odb support to load json file **1. Why support json?** 1. custormer needed. 2. JSON is a data inter-exchange format. When compared to XML, it is very lightweight and more human-readable. **2. Why not use existing c json lib?** Considered using the json-c and json-glibc, but seems neither them support stream parse. For a large file, the memory may not enough. **3. How odb support json loading function?** 1. Create table tbjson(id int, name char(20)); 2. cat test.json { "test":[ { "id":1 , "name":"hello" }, { "id":2 , "name":"world" }, ] } 3. `./odb64luo -l src=test.json:tgt=tbjson:jsonkey=test odb [parseopt(14249)] - Warning: this function is not fully tested "jsonkey" odb [2017-09-18 15:28:39]: starting ODBC connection(s)... 0 Connected to Trafodion [0] 2 records inserted [commit] [0] odb version 1.1.0 Load(X) statistics: [0] Target table: (null).(null).TBJSON [0] Source: test.json [0] Pre-loading time: 0.308 s (00:00:00.308) [0] Loading time: 0.021 s(00:00:00.021) [0] Total records read: 0 [0] Total records inserted: 2 [0] Total number of columns: 2 [0] Average input row size: NaN B [0] ODBC row size: 31 B (data) + 16 B (len ind) [0] Rowset size: 100 [0] Rowset buffer size: 4.59 KiB [0] Load throughput (real data): 0.000 KiB/s [0] Load throughput (ODBC): 2.883 KiB/s odb [2017-09-18 15:28:39]: exiting. Session Elapsed time 0.338 seconds (00:00:00.338) -bash-4.1$ ./odb64luo -x "select * from tbjson" odb [2017-09-18 15:29:28]: starting ODBC connection(s)... 0 1,hello 2,world [0.0.0]--- 2 row(s) selected in 0.025s (prep 0.006s, exec 0.008s, fetch 0.011s/0.006s) odb [2017-09-18 15:29:28]: exiting. Session Elapsed time 0.284 seconds (00:00:00.284)` You can merge this pull request into a Git repository by running: $ git pull https://github.com/SuJinpei/incubator-trafodion trafodion-2726 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/1237.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1237 ---- ---- ---