Commit Graph

65 Commits

Author SHA1 Message Date
Rafael Weinstein 01303a828d go read ahead (#3046) 2017-01-10 15:28:26 -08:00
Dan Willhite 46586ee928 Remove msg args from d.PanicIfTrue and d.PanicIfFalse. (#2757)
Should discourage people from writing code that does unnecessary work
to generate a msg every time that an error condition is checked. Fixes #2741
2016-11-03 11:43:57 -07:00
Eric Halpern d9715dba0e Support db aliases and default db for noms cli
This patch implements evolving support for configuring aliases and defaults for the noms cli (started with #2131)

For an introduction, please take a look at the sample code here: https://github.com/attic-labs/noms/blob/master/samples/cli/nomsconfig/README.md

Improvements include: 

 - All go samples now work with .nomsconfig
 - Absolute paths in ldb specs are now properly handled 
 - Add -v|--verbose flag to commands to debug expansion
 - Make default just another alias and change [default] section to [db.default]
 - Introduce the `.` shorthand to refer to a previously mentioned dataset/object
2016-09-27 22:21:32 -07:00
Ben Kalman 81673c2591 Add perf test for url-fetch 2016-09-27 16:52:54 -07:00
Aaron Boodman e52775f838 Refactor exit mockery into go/util/exit (#2622) 2016-09-27 13:51:27 -07:00
Ben Kalman 097863ea6f Use parallel NewBlob in the csv perf tests (#2625)
This just involves changing types.NewBlob(io.MultiReader(files...)) to
types.NewBlob(files...). On my laptop it improves
Test01ImportSfCrimeBlobFromTestdata from 21s to 16s - though much of
this is dominated by commit, which wouldn't be affected by this change.
2016-09-27 12:22:25 -07:00
cmasone-attic 2e462b11a5 Make Database a mutable API that vends immutable Datasets (#2617)
Noms SDK users frequently shoot themselves in the foot because they're
holding onto an "old" Database object. That is, they have a Database
tucked away in some internal state, they call Commit() on it, and
don't replace the object in their internal state with the new Database
returned from Commit.

This PR changes the Database and Dataset Go API to be in line with the
proposal in Issue #2589. JS follows in a separate patch.
2016-09-26 12:18:14 -07:00
Dan Willhite e351f718e4 Use smaller dataset to testing csv-import/multi-map (#2609)
Also reuse data already imported as blob by another test.
2016-09-23 10:59:30 -07:00
Dan Willhite e5541f9343 Make csv importer use GraphBuilder (#2600) 2016-09-22 15:19:37 -07:00
Dan Willhite 3b17956907 Add perf test for multi-key maps. (#2605) 2016-09-22 13:34:37 -07:00
Erik Arvidsson 5edf89cf3d Replace d.Chk.True with d.PanicIfFalse (#2563)
And same for d.Chk.False
2016-09-14 13:11:28 -07:00
Mike Gray 1996e0a3d8 Add Noms commit command (#2474)
* Add "noms commit" command
* Updated csv-import, json-import, xml-import and url-fetch to (optionally) not commit results
* Added helpers for creating commit meta-data struct through command line or function calls
2016-09-09 12:42:27 -04:00
zcstarr ef817db179 Adds error for invalid skip records argument and exits csv importer (#2522) 2016-09-06 17:37:05 -07:00
zcstarr b1c0aeb9c5 Adds checks for bad column-type and header csv-import flag values (#2525) 2016-09-06 17:12:21 -07:00
zcstarr ef11062cab Fixes bug where delimiter applied to header arguments (#2523) 2016-09-06 16:50:05 -07:00
Mike Gray 47565f39d1 Improve code based on tool analysis feeback (#2521)
Fixes are based on Go report card output:
- `gofmt -s` eliminates some duplication in struct/slice initialization
- `golint` found some issues like: `warning: should drop = nil from declaration of var XXX; it is the zero value`
- `golint` found some issues like: `warning: receiver name XXX should be consistent with previous receiver name YYY for ZZZ`
- `golint` says not to use underscores for function/variable names
- `golint` found several issues like: `warning: if block ends with a return statement, so drop this else and outdent its block`

No functional changes are included - just source code quality improvements.
2016-09-06 16:35:25 -04:00
zcstarr 3cdebb7e77 Add run safe method that reads stderr and stdout regardless of panic (#2475)
Run method will now always return stdout,stderr, and a recoveredErr
on Exit or Panic. MustRun will Panic with recoveredErr.
2016-09-06 11:30:57 -07:00
Ben Kalman 9c694f024b Add a perf test for CSV map import (#2461)
Currently we only have a perf test for CSV list import, which uses the
sf-crime dataset. This test uses the 43MB sf-registered-businesses
dataset instead, since sf-crime is too slow. Which is ironic, since we
normally parse sf-crime into a map.

I've also tightened up some of the other perf tests.
- Fixed a bug where Database was shared between runs.
- Make the pure CSV parsing test use a smaller dataset, it doesn't need
  to use something as large as ny-vehicle-registrations.
2016-08-31 17:05:00 -07:00
zcstarr aeb5c42bcc Add special encoding to csv imported struct fields (#2441)
CSV importing is changed to strip invalid characters from csv fields 
and camel case spaces. i.e. ca-mel case is translated to camelCase.
2016-08-30 14:59:10 -07:00
Ben Kalman 66b98ea2a1 Add perf test for just parsing a CSV (ny-vehicle-registrations) (#2439) 2016-08-25 17:13:06 -07:00
Mike Gray 2f66e67763 fixing misspellings, fixing IneffAssign reported issues (#2436)
also removing encode-perf-rig since codec-perf-rig is more current and real
2016-08-25 13:32:34 -04:00
Mike Gray 6a661361ad csv-import/csv-export support for compound keys/nested maps (#2433) 2016-08-25 09:34:21 -04:00
Mike Gray 4e54c44d56 no functional changes, improving code quality (#2410)
fix misspellings; fix code that was not gofmt'd - plus take advantage of gofmt -s too; couple of unreachable golint reported fixes; reference go report card results and tests
2016-08-23 13:51:38 -04:00
Ben Kalman 892f98050e Make perf suite testdata path configurable by -perf.testdata flag (#2406)
Needed by Jenkins shared workspaces.
2016-08-22 16:40:27 -07:00
Mike Gray 1197b4127f csv-analyze to detect column types and primary keys (#2366)
create csv-analyze; add detection of PKs; move detect-columns from csv-import to csv-analyze
2016-08-19 14:24:32 -04:00
Ben Kalman 064c398dec Add perf test suite infrastructure, and a perf test for csv-import (#2384)
You can run these yourself using the -perf flag, e.g.

> noms serve &
> go test -v -perf http://localhost:8000 ./samples/go/csv/csv-import
> noms ds http://localhost:8000

Though you'll need to go-get github.com/attic-labs/testdata.

Note that all of this only records test results, it doesn't have any
concept of failing perf (unless test assertsions themselves fail). It
will be the job of some other Noms client (work in progress) to do that.

I will be setting this up to run continuously momentarily.
2016-08-18 15:49:21 -07:00
Mike Gray 865e977320 add csv-import --detect-column-types option (#2329) 2016-08-11 17:02:05 -04:00
Sungguk Lim 6697c2e6fc Replace github.com/tsuru/gnuflag with github.com/juju/gnuflag (#2340)
Replace vendor folder and where it is used.
2016-08-11 10:29:57 -07:00
Tegan Snyder 25124a12b0 Update csv README.md (#2328) 2016-08-10 12:13:19 -04:00
Mike Gray a812034182 changing csv-import of map to include pk in struct (#2316) 2016-08-09 19:57:11 -04:00
Mike Gray 75ef96bdc7 implement csv-export writing maps of structs (#2322) 2016-08-09 18:31:54 -04:00
Mike Gray b42733e982 changing order of args to match JS and be more logical (#2223) 2016-08-01 11:17:59 -07:00
Mike Gray 93916c5139 exposing StructData, updating tour (#2214) 2016-08-01 12:09:02 -04:00
Erik Arvidsson ed0364cc19 Switch to gnuflag (#2206)
This is to support:
- shorthands
- Putting commands anywhere (after positional arguments too)
2016-07-29 18:08:23 -07:00
Ben Kalman 467bdc9bc1 Let csv-importer take the metadata date as a flag (#2196) 2016-07-29 10:44:08 -07:00
Erik Arvidsson 97093afa8c Rename csv StringToType to StringToValue (#2154) 2016-07-25 14:46:11 -07:00
Aaron Boodman a23052a1dd csv-import: add flexibility to handling of numbers and booleans (#2141)
* Default empty csv cells to reasonable values.

It would probably be better to have more control over this, or even
better, some kind of 'null' value. But I think this is perfectly
reasonable initial behavior, and much more compatible with other
code.

* Support more spellings of "true" and "false"

* csv-import: provide more helpful value parse errors
2016-07-23 23:01:38 -07:00
Aaron Boodman 521e120c74 Fix double-escaping in csv.Read. (#2122)
Fixes #2109
2016-07-21 15:33:35 -07:00
Dan Willhite 137e39d683 Add meta information to commits in cvs-import and url-fetch.
Add "meta" field to commit.
Change noms_log to print meta information when it exists.
Fixes #2012.
2016-07-20 17:18:21 -07:00
Erik Arvidsson 984fef226f Change dataset CommitWithParents to Commit with options (#2095)
The new API is `ds.Commit(value, CommitOptions{Parents: p})`

Related to #2012
2016-07-19 14:30:59 -07:00
Aaron Boodman 3d39d2b713 Add -skip-lines flag to csv-import (#2050) 2016-07-13 17:18:07 -07:00
Mike Gray 7c9ad898de use column-type from original csv file column order (#2013)
* use column-type from original csv file column order, not the one after map/struct field name reordering
* use column-type from original csv file column order (part 2)
2016-07-12 11:33:01 -07:00
Rafael Weinstein ee5c0f3a72 MakeStructType and NewStructWithType now takes slices rather than maps (#1945)
NewStructType and NewStructWithType now takes slices rather than maps
2016-07-07 16:36:48 -07:00
Ben Kalman eb9b67d571 csv-importer can accept a noms path as a source (#1981) 2016-07-07 15:10:13 -07:00
Mike Gray a7f29a716d noms as one command line application, with version and help (#1874) 2016-07-06 15:38:25 -04:00
Aaron Boodman 1d752e3101 Update license: Noms will be copyright Attic Labs. (#1976) 2016-07-05 22:07:42 -07:00
Mike Gray b2a4aa62b7 removing runtime.GOMAXPROCS calls (#1947) 2016-07-01 17:42:46 -04:00
Aaron Boodman 2921ca343c Part 2: Move things that are not samples out of samples/go (#1944) 2016-07-01 11:58:26 -07:00
Aaron Boodman 2386afc7fb Move stuff that is not samples out of samples directory (#1943)
* Move samples/go/*perf-reg to go/perf/

They aren't really samples.

* Move samples/go/util/check_error.go to go/d

* Remove samples/go/util/client_flags.go - unused

* remove httpcache.go - unused

* Remove samples/go/util/rungen.go - no generated code here anymore

* move NomsValueFromJSON to go/util/jsontonoms
2016-07-01 11:04:17 -07:00
Rafael Weinstein f464a2d94f Map.MX() -> NewStreamingMap (#1918) 2016-06-27 16:06:40 -07:00