-
Notifications
You must be signed in to change notification settings - Fork 9
SQL-864: Json datasets for TDVT #8
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
Open
nbagnard
wants to merge
9
commits into
mongodb:master
Choose a base branch
from
nbagnard:SQL-864_json_dataset
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c7287ad
Add Calcs dataset in json format for mongoimport
660bb4b
Add Staples dataset in json format for mongoimport
9379141
Add Calcs collection schema
8c87a72
Fix boolean values for TDVT Calcs dataset
9e31de2
Update erroneous date, datetime and time values
5cc527b
Add README for tdvt dataset setup
3d6baa8
Change collections names case and add Data Federation (ADL) configura…
e38a5c0
Reformat
nbagnard 0fec4c7
Reformat
nbagnard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| # TDVT datasets | ||
|
|
||
| ## Import the datasets in your cluster | ||
| ### Calcs | ||
| ``` | ||
| mongoimport --uri "{your connection URL}" --db=tdvt --drop --collection Calcs --type=json --file={Path to tdvt/datasets directory}/Calcs.json | ||
| ``` | ||
| ### Staples | ||
| ``` | ||
| mongoimport --uri "{your connection URL}" --db=tdvt --drop --collection Staples --type=json --file={Path to tdvt/datasets directory}/Staples.json | ||
| ``` | ||
|
|
||
| ## Configure your Data Federation | ||
| Add the following to `databases` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a bit more detail to this line: such as for the local ADF the configuration change is in the file |
||
| ``` | ||
| { | ||
| "name":"tdvt", | ||
| "collections":[ | ||
| { | ||
| "name":"Staples", | ||
| "dataSources":[ | ||
| { | ||
| "collection":"Staples", | ||
| "storeName":"{your store name}", | ||
| "database":"tdvt" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name":"Calcs", | ||
| "dataSources":[ | ||
| { | ||
| "collection":"Calcs", | ||
| "storeName":"{your store name}", | ||
| "database":"tdvt" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## Set the schemas | ||
|
|
||
| ### Make sure to be on the correct database | ||
| ``` | ||
| use tdvt | ||
| ``` | ||
|
|
||
| ### Load Calcs schema | ||
| ``` | ||
| db.runCommand({ | ||
| sqlSetSchema: "Calcs", | ||
| schema: { | ||
| version: 1, | ||
| jsonSchema: { | ||
| bsonType: ['object'], | ||
| properties: { | ||
| bool2: { bsonType: ['bool', 'null'] }, | ||
| date3: { bsonType: ['date', 'null'] }, | ||
| _id: { bsonType: ['objectId', 'null'] }, | ||
| num2: { bsonType: ['double', 'null'] }, | ||
| time1: { bsonType: ['date', 'null'] }, | ||
| num4: { bsonType: ['double', 'null'] }, | ||
| int1: { bsonType: ['null', 'int'] }, | ||
| num1: { bsonType: ['double', 'null'] }, | ||
| bool0: { bsonType: ['bool', 'null'] }, | ||
| datetime0: { bsonType: ['date', 'null'] }, | ||
| date2: { bsonType: ['date', 'null'] }, | ||
| time0: { bsonType: ['date', 'null'] }, | ||
| date0: { bsonType: ['null', 'date'] }, | ||
| int3: { bsonType: ['int', 'null'] }, | ||
| str0: { bsonType: ['string', 'null'] }, | ||
| date1: { bsonType: ['date', 'null'] }, | ||
| int0: { bsonType: ['int', 'null'] }, | ||
| str3: { bsonType: ['string', 'null'] }, | ||
| key: { bsonType: ['string', 'null'] }, | ||
| num0: { bsonType: ['null', 'double'] }, | ||
| datetime1: { bsonType: ['string', 'null'] }, | ||
| str1: { bsonType: ['string', 'null'] }, | ||
| int2: { bsonType: ['int', 'null'] }, | ||
| zzz: { bsonType: ['string', 'null'] }, | ||
| bool3: { bsonType: ['null', 'bool'] }, | ||
| bool1: { bsonType: ['bool', 'null'] }, | ||
| num3: { bsonType: ['double', 'null'] }, | ||
| str2: { bsonType: ['string', 'null'] } | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| ``` | ||
|
|
||
| The schema definition is also available in `Calcs_schema.json` for reference. | ||
|
|
||
| ### Load Staples schema | ||
| ``` | ||
| db.runCommand({ | ||
| sqlSetSchema: "Staples", | ||
| schema: { | ||
| "version": 1, | ||
| "jsonSchema": { | ||
| bsonType: ['object'], | ||
| properties: { | ||
| PID: { bsonType: ['int'] }, | ||
| 'Ship Priority': { bsonType: ['string'] }, | ||
| 'Total Cycle Time': { bsonType: ['double'] }, | ||
| 'Employee Salary': { bsonType: ['decimal'] }, | ||
| 'Ship Mode': { bsonType: ['string'] }, | ||
| 'Product ID': { bsonType: ['string'] }, | ||
| 'Gross Profit': { bsonType: ['double'] }, | ||
| 'Product Name': { bsonType: ['string'] }, | ||
| 'Fill Time': { bsonType: ['double'] }, | ||
| 'Market Segment': { bsonType: ['string'] }, | ||
| 'Ship Handle Cost': { bsonType: ['decimal'] }, | ||
| 'Supplier Name': { bsonType: ['string'] }, | ||
| 'Order Quantity': { bsonType: ['double'] }, | ||
| 'Order Priority': { bsonType: ['string'] }, | ||
| 'Supplier Balance': { bsonType: ['double'] }, | ||
| 'Ship Date': { bsonType: ['date'] }, | ||
| 'Supplier State': { bsonType: ['string'] }, | ||
| 'Prod Type4': { bsonType: ['string'] }, | ||
| 'Customer State': { bsonType: ['string'] }, | ||
| 'Employee Yrs Exp': { bsonType: ['double'] }, | ||
| 'Employee Dept': { bsonType: ['string'] }, | ||
| 'Manager Name': { bsonType: ['string'] }, | ||
| 'Product In Stock': { bsonType: ['string'] }, | ||
| 'Supplier Region': { bsonType: ['string'] }, | ||
| 'Receive Time': { bsonType: ['double'] }, | ||
| 'Order Date': { bsonType: ['date'] }, | ||
| 'Prod Type1': { bsonType: ['string'] }, | ||
| 'Product Base Margin': { bsonType: ['double'] }, | ||
| 'Order Quarter': { bsonType: ['string'] }, | ||
| 'Customer Balance': { bsonType: ['double'] }, | ||
| 'Ship Promo': { bsonType: ['string'] }, | ||
| '': { bsonType: ['int'] }, | ||
| 'Item Count': { bsonType: ['int'] }, | ||
| 'Customer Name': { bsonType: ['string'] }, | ||
| 'Sales Total': { bsonType: ['double'] }, | ||
| 'Prod Type2': { bsonType: ['string'] }, | ||
| Discount: { bsonType: ['double'] }, | ||
| 'Received Date': { bsonType: ['date'] }, | ||
| 'Order Year': { bsonType: ['int'] }, | ||
| 'Customer Segment': { bsonType: ['string'] }, | ||
| 'Ship Charge': { bsonType: ['decimal'] }, | ||
| 'Tax Rate': { bsonType: ['double'] }, | ||
| 'Employee Name': { bsonType: ['string'] }, | ||
| 'Prod Type3': { bsonType: ['string'] }, | ||
| 'Order ID': { bsonType: ['string'] }, | ||
| _id: { bsonType: ['objectId'] }, | ||
| 'Order Status': { bsonType: ['string'] }, | ||
| Price: { bsonType: ['decimal'] }, | ||
| 'Call Center Region': { bsonType: ['string'] }, | ||
| 'Order Month': { bsonType: ['int'] }, | ||
| 'Product Container': { bsonType: ['string'] } | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| ``` | ||
| The schema definition is also available in `Staples_schema.json` for reference. | ||
|
|
||
| ### Validate the data is inserted correctly | ||
| ``` | ||
| db.aggregate([{$sql: {statement: "SELECT count(*) FROM \"Calcs\"",format: "jdbc",formatVersion: 1, dialect: "mongosql"}}]) | ||
| ``` | ||
| Expected result : `[ { '': { _1: 17 } } ]` | ||
|
|
||
| ``` | ||
| db.aggregate([{$sql: {statement: "SELECT count(*) FROM \"Staples\"",format: "jdbc",formatVersion: 1, dialect: "mongosql"}}]) | ||
| ``` | ||
| Expected result : `[ { '': { _1: 54860 } } ]` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this tdvt Readme it would be helpful to add the LogicalQueryFormat we use and the command to run with unsigned taco files:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And can we provide some context on what these are?