Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of the columns are not same as input.json #11

Open
rbhogi opened this issue Feb 24, 2017 · 0 comments
Open

Order of the columns are not same as input.json #11

rbhogi opened this issue Feb 24, 2017 · 0 comments

Comments

@rbhogi
Copy link

rbhogi commented Feb 24, 2017

I have used below JSON to generate the DDL.

{
"business_id": "String",
"name": "String",
"neighborhood": "String",
"address": "String",
"city": "String",
"state": "String",
"postal_code": 12345,
"latitude": 124124124124,
"longitude": -111.936102,
"stars": 4.5,
"review_count": 17,
"is_open": 0,
"attributes": [{
"BikeParking": true,
"BusinessAcceptsBitcoin": false,
"BusinessAcceptsCreditCards": false,
"BusinessParking": {
"street": false,
"validated": false,
"lot": true,
"valet": false
},
"DogsAllowed": false,
"RestaurantsPriceRange2": 2,
"WheelchairAccessible": true
}],
"categories": [
"Tobacco Shops",
"Nightlife",
"Vape Shops",
"Shopping"
],
"hours": [
"Monday 11:0-21:0",
"Tuesday 11:0-21:0",
"Wednesday 11:0-21:0",
"Thursday 11:0-21:0",
"Friday 11:0-22:0",
"Saturday 10:0-22:0",
"Sunday 11:0-18:0"
],
"type": "business"
}

It created below

CREATE TABLE my_table_name (
address string,
attributes array<struct<bikeparking:boolean, businessacceptsbitcoin:boolean, businessacceptscreditcards:boolean, businessparking:struct<lot:boolean, street:boolean, valet:boolean, validated:boolean>, dogsallowed:boolean, restaurantspricerange2:int, wheelchairaccessible:boolean>>,
business_id string,
categories array,
city string,
hours array,
is_open int,
latitude int,
longitude double,
name string,
neighborhood string,
postal_code int,
review_count int,
stars double,
state string,
type string)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe';

I want to generate the order of the columns in the same order of JSON but in the output, columns are sorted alphabetical order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant