Skip to content
j2h is a tool to convert json to hive ddl.
Go
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor/github.com/tidwall Introducing vendoring by dep Jun 4, 2017
Gopkg.lock Introducing vendoring by dep Jun 4, 2017
Gopkg.toml Introducing vendoring by dep Jun 4, 2017
LICENSE
README.md Update readme Jun 4, 2017
convert.go Modify json vaild method Jun 6, 2017
convert_test.go Introduce errors Jun 4, 2017
main.go
printer.go Add cli Jun 4, 2017
printer_test.go

README.md

j2h

j2h is a tool to convert json to hive ddl.

Installation

$ go get github.com/kanga333/j2h

or

Download the binary directly from the release page.

Usage

$ j2h -help
j2h is a tool to convert json to hive ddl

Usage: j2h <option>
  -json-path string
        Path of json file.
  -version
        Print version information.

Example

{
  "foo": {
    "bar": [
      10,
      21,
      20
    ],
    "baz": [
      [
        1.1,
        1.2
      ],
      [
        1.3,
        1.4
      ]
    ],
    "hoge": "string"
  },
  "piyo": true
}
$ j2h -path test.json
create external table json_data(
  foo struct<
    bar:array<int>,
    baz:array<
      array<double>
    >,
    hoge:string
  >,
  piyo boolean
)

Restrictions

  • Hive Reserved words are output in lowercase letters.
  • It does not correspond to the output that converts json to map of hive.
  • All integers are output as int type.
  • All decimals are output as double type.
  • The null type of json is converted to the binary type of hive.
  • If the array element type of json is mixed, it is converted to binary type of hive.
You can’t perform that action at this time.