Changeset: 31e53a1c9ac4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/31e53a1c9ac4
Modified Files:
sql/backends/monet5/copy.c
sql/backends/monet5/copy.h
Branch: default
Log Message:
Split reader->offset into ->offset and ->skipped (#8093)
It was initially set to the OFFSET from the COPY statement
and then decremented for every line that was actually skipped.
However, we also need the unmodified value for error reporting.
diffs (43 lines):
diff --git a/sql/backends/monet5/copy.c b/sql/backends/monet5/copy.c
--- a/sql/backends/monet5/copy.c
+++ b/sql/backends/monet5/copy.c
@@ -202,6 +202,7 @@ reader_new(stream *s, BUN offset, BUN ma
r->sink.type = PIPELINE_IO_COPY;
r->s = s;
r->offset = offset;
+ r->skipped = 0;
r->maxcount = maxcount;
r->linecount = 0;
r->sz = sz<1024?sz+2:sz;
@@ -225,7 +226,7 @@ reader_new(stream *s, BUN offset, BUN ma
static lng
COPYskiplines(reader *r, int wid)
{
- lng toskip = r->offset, nr = 0;
+ lng toskip = r->offset - r->skipped, nr = 0;
unsigned char *start, *pos, *end;
if (!toskip)
@@ -629,9 +630,9 @@ COPYsplitlines(Client cntxt, MalBlkPtr m
}
/* TODO: handle skipping with jumping */
- if (!r->error && !r->done && r->offset) {
+ if (!r->error && !r->done && r->offset > r->skipped) {
lng skipped = COPYskiplines(r, p->wid);
- r->offset -= (BUN)skipped;
+ r->skipped += (BUN)skipped;
}
lng line_count = 0;
diff --git a/sql/backends/monet5/copy.h b/sql/backends/monet5/copy.h
--- a/sql/backends/monet5/copy.h
+++ b/sql/backends/monet5/copy.h
@@ -41,6 +41,7 @@ typedef struct reader {
stream *s;
BUN sz;
BUN offset;
+ BUN skipped;
BUN maxcount;
lng linecount;
bool done;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]