Skip to content

Commit

Permalink
add parsing of the URI
Browse files Browse the repository at this point in the history
  • Loading branch information
spaskob committed Oct 12, 2019
1 parent 9ebfe82 commit c077306
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
10 changes: 5 additions & 5 deletions pkg/ccl/importccl/import_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ const (
mysqlOutfileEnclose = "fields_enclosed_by"
mysqlOutfileEscape = "fields_escaped_by"

importOptionSSTSize = "sstsize"
importOptionDecompress = "decompress"
importOptionOversample = "oversample"
importOptionSkipFKs = "skip_foreign_keys"
importOptionSSTSize = "sstsize"
importOptionDecompress = "decompress"
importOptionOversample = "oversample"
importOptionSkipFKs = "skip_foreign_keys"
importOptionDisableGlobMatch = "disable_glob_matching"
importOptionSaveRejected = "experimental_save_rejected"
importOptionSaveRejected = "experimental_save_rejected"

pgCopyDelimiter = "delimiter"
pgCopyNull = "nullif"
Expand Down
32 changes: 16 additions & 16 deletions pkg/ccl/importccl/import_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import (
func TestImportData(t *testing.T) {
defer leaktest.AfterTest(t)()

//t.Skipf("failing on teamcity with testrace")
t.Skipf("failing on teamcity with testrace")

s, db, _ := serverutils.StartServer(t, base.TestServerArgs{})
ctx := context.Background()
Expand Down Expand Up @@ -241,25 +241,25 @@ d
// If err field is non-empty, the query filed specifies what expect
// to get from the rows that are parsed correctly (see option experimental_save_rejected).
{
name: "empty file",
create: `a string`,
typ: "DELIMITED",
data: "",
query: map[string][][]string{`SELECT * from t`: {}},
name: "empty file",
create: `a string`,
typ: "DELIMITED",
data: "",
query: map[string][][]string{`SELECT * from t`: {}},
},
{
name: "empty field",
create: `a string, b string`,
typ: "DELIMITED",
data: "\t",
query: map[string][][]string{`SELECT * from t`: {{"", ""}}},
name: "empty field",
create: `a string, b string`,
typ: "DELIMITED",
data: "\t",
query: map[string][][]string{`SELECT * from t`: {{"", ""}}},
},
{
name: "empty line",
create: `a string`,
typ: "DELIMITED",
data: "\n",
query: map[string][][]string{`SELECT * from t`: {{""}}},
name: "empty line",
create: `a string`,
typ: "DELIMITED",
data: "\n",
query: map[string][][]string{`SELECT * from t`: {{""}}},
},
{
name: "too many imported columns",
Expand Down
10 changes: 6 additions & 4 deletions pkg/ccl/importccl/read_import_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,13 @@ func readInputFiles(
// no rejected rows
return nil
}
suffix := ".rejected"
if es.Conf().Provider == roachpb.ExternalStorageProvider_Http {
suffix = "/rejected"
rejectedFile := dataFile
parsedURI, err := url.Parse(rejectedFile)
if err != nil {
return err
}
conf, err := cloud.ExternalStorageConfFromURI(dataFile + suffix)
parsedURI.Path = parsedURI.Path + ".rejected"
conf, err := cloud.ExternalStorageConfFromURI(rejectedFile)
if err != nil {
return err
}
Expand Down

0 comments on commit c077306

Please sign in to comment.