[crush-tools] r524 committed - Treat empty input correctly in hashjoin....

1 view
Skip to first unread message

crush...@googlecode.com

unread,
Jan 7, 2013, 12:53:36 PM1/7/13
to crush...@googlegroups.com
Revision: 524
Author: jeremy...@gmail.com
Date: Mon Jan 7 09:53:20 2013
Log: Treat empty input correctly in hashjoin.

Fixes: Issue 20
Reported by: renwick

http://code.google.com/p/crush-tools/source/detail?r=524

Added:
/trunk/src/hashjoin/test/test_06.sh
Modified:
/trunk/src/hashjoin/hashjoin.c

=======================================
--- /dev/null
+++ /trunk/src/hashjoin/test/test_06.sh Mon Jan 7 09:53:20 2013
@@ -0,0 +1,24 @@
+test_number=06
+description="empty input file"
+
+infile=$test_dir/test_06_test.in
+dimfile="$test_dir/dimension_header.log"
+
+echo -n '' | $bin -k 1,2 -l 1,2 -j 3,4 -f $dimfile -
+
+if [ $? -ne 0 ]; then
+ test_status $test_number 1 "$description (stdin)" FAIL
+else
+ test_status $test_number 1 "$description (stdin)" PASS
+fi
+
+:> $infile
+echo -n '' | $bin -k 1,2 -l 1,2 -j 3,4 -f $dimfile $infile
+
+if [ $? -ne 0 ]; then
+ test_status $test_number 2 "$description (file)" FAIL
+else
+ test_status $test_number 2 "$description (file)" PASS
+fi
+
+rm $infile
=======================================
--- /trunk/src/hashjoin/hashjoin.c Wed Jul 8 10:10:14 2009
+++ /trunk/src/hashjoin/hashjoin.c Mon Jan 7 09:53:20 2013
@@ -102,6 +102,10 @@

while (infile) {
datareader = dbfr_init(infile);
+ if (datareader->eof) {
+ infile = nextfile(argc, argv, &optind, "r");
+ continue;
+ }

if (args->key_labels) {
n_key_fields = expand_label_list(args->key_labels,
datareader->next_line,
Reply all
Reply to author
Forward
0 new messages