def doMain(): args = parseOpts(sys.argv[1:]) idxL = pysows.getTypedColumnIndexList(args.group_indexes) for rec in pysows.recordReader(sys.stdin, args.separator): pysows.printList(pysows.projectConv(idxL, rec)) print
def doMain(): args = parseOpts(sys.argv[1:]) accGrp = AccumulatorGroup(args) for line in sys.stdin: rec = line.rstrip().split(args.separator) accGrp.add(rec) for sL in accGrp.iteritems(): pysows.printList(sL) print
def doMain(): args = parseOpts(sys.argv[1:]) outColumnIdxes = map(prefixToIsLeft, getColumnIndexListWithPrefix(args.out_columns)) getOutRec = generateGetOutputRecord(outColumnIdxes) lReader = pysows.recordReader(args.left_input, args.separator) rReader = pysows.recordReader(args.right_input, args.separator) lKeyIdxL, rKeyIdxL = getKeyIndexLists(args) lGetKey = pysows.generateProject(lKeyIdxL) rGetKey = pysows.generateProject(rKeyIdxL) hashTable = createHashTable(lReader, lGetKey) resultIter = hashJoin(hashTable, rReader, rGetKey) for lRec, rRec in resultIter: pysows.printList(getOutRec(lRec, rRec)) print
def doMain(): args = parseOpts(sys.argv[1:]) g = globals() l = locals() pysows.loadPythonCodeFile(args.load_file, g, l) mapFunc = eval(args.map_func, g, l) constructor = eval(args.record_constructor, g, l) convIdxL = pysows.getTypedColumnIndexList(args.group_indexes) assert len(convIdxL) > 0 getKeyFromRec = pysows.generateProjectConv(convIdxL) reader = pysows.recordReader(sys.stdin, args.separator) for rec in reader: key = getKeyFromRec(rec) mapped = mapFunc(*key) outRec = constructor(rec, mapped) pysows.printList(outRec) print
def doMain(): args = parseOpts(sys.argv[1:]) convIdxL = pysows.getTypedColumnIndexList(args.group_indexes) g = globals() l = locals() pysows.loadPythonCodeFile(args.load_file, g, l) if args.regex_list is None: filterBy = generateFilterByPredicate(args.predicate, convIdxL, g, l) else: filterBy = generateFilterByRegex(args.regex_list, convIdxL) if args.invert: notIfInvert = lambda x: not x else: notIfInvert = lambda x: x for rec in pysows.recordReader(sys.stdin, args.separator): if notIfInvert(filterBy(rec)): pysows.printList(rec) print