Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed codegen: EMapKeys #105

Open
izgzhen opened this issue Feb 25, 2019 · 6 comments
Open

Failed codegen: EMapKeys #105

izgzhen opened this issue Feb 25, 2019 · 6 comments
Assignees

Comments

@izgzhen
Copy link
Collaborator

izgzhen commented Feb 25, 2019

https://gist.github.com/izgzhen/2b35cb49b2347e18ec48f9b5aa1fc545

Traceback (most recent call last):
  File "/home/zgzhen/anaconda3/bin/cozy", line 11, in <module>
    load_entry_point('cozy', 'console_scripts', 'cozy')()
  File "/home/zgzhen/projects/cozy/cozy/main.py", line 188, in run
    codegen.CxxPrinter(out=out, use_qhash=args.use_qhash).visit(impl, state_map, share_info, abstract_state=ast.spec.statevars)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 93, in g
    ret = f(*args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 817, in visit_Spec
    self.visit(stm)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 528, in visit_SSeq
    self.visit(ss)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 514, in visit_SAssign
    value = self.visit(s.rhs)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 332, in visit_Exp
    raise NotImplementedError(e)
NotImplementedError: EMapKeys(EMove(EVar('_map482932').with_type(TMap(TInt(), TBag(TRecord((('orderkey', TInt()), ('partkey', TInt()), ('suppkey', TInt()), ('linenumber', TInt()), ('quantity', TFloat()), ('extendedprice', TFloat()), ('discount', TFloat()), ('tax', TFloat()), ('returnflag', TNative('char')), ('linestatus', TNative('char')), ('shipdate', TNative('uint64_t')), ('commitdate', TNative('uint64_t')), ('receiptdate', TNative('uint64_t')), ('shipinstruct', TString()), ('shipmode', TString()), ('comment', TString()))))))).with_type(TMap(TInt(), TBag(TRecord((('orderkey', TInt()), ('partkey', TInt()), ('suppkey', TInt()), ('linenumber', TInt()), ('quantity', TFloat()), ('extendedprice', TFloat()), ('discount', TFloat()), ('tax', TFloat()), ('returnflag', TNative('char')), ('linestatus', TNative('char')), ('shipdate', TNative('uint64_t')), ('commitdate', TNative('uint64_t')), ('receiptdate', TNative('uint64_t')), ('shipinstruct', TString()), ('shipmode', TString()), ('comment', TString()))))))).with_type(TBag(TInt()))
@izgzhen izgzhen added the bug label Feb 25, 2019
@izgzhen izgzhen self-assigned this Feb 25, 2019
@izgzhen
Copy link
Collaborator Author

izgzhen commented Feb 27, 2019

This is not a bug that can be reproduced every time. Trying to hook into PyCharm debugger to fix it.

@izgzhen
Copy link
Collaborator Author

izgzhen commented Oct 3, 2019

Looks part of tpch-q02

@izgzhen izgzhen added the invalid label Oct 3, 2019
@izgzhen
Copy link
Collaborator Author

izgzhen commented Oct 3, 2019

can't reproduce

@izgzhen izgzhen closed this as completed Oct 3, 2019
@izgzhen
Copy link
Collaborator Author

izgzhen commented Oct 21, 2019

Implementation was dumped to /tmp/failed_codegen.py
Traceback (most recent call last):
  File "/home/zgzhen/projects/cozy/.venv/bin/cozy", line 11, in <module>
    load_entry_point('cozy', 'console_scripts', 'cozy')()
  File "/home/zgzhen/projects/cozy/cozy/main.py", line 188, in run
    codegen.CxxPrinter(out=out, use_qhash=args.use_qhash).visit(impl, state_map, share_info, abstract_state=ast.spec.statevars)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 93, in g
    ret = f(*args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 817, in visit_Spec
    self.visit(stm)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 528, in visit_SSeq
    self.visit(ss)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 514, in visit_SAssign
    value = self.visit(s.rhs)
  File "/home/zgzhen/projects/cozy/cozy/common.py", line 281, in visit
    return f(x, *args, **kwargs)
  File "/home/zgzhen/projects/cozy/cozy/codegen/cxx.py", line 332, in visit_Exp
    raise NotImplementedError(e)
NotImplementedError: EMapKeys(EMove(EVar('_map294339').with_type(TMap(TInt(), TBag(TRecord((('orderkey', TInt()), ('partkey', TInt()), ('suppkey', TInt()), ('linenumber', TInt()), ('quantity', TFloat()), ('extendedprice', TFloat()), ('discount', TFloat()), ('tax', TFloat()), ('returnflag', TNative('char')), ('linestatus', TNative('char')), ('shipdate', TNative('uint64_t')), ('commitdate', TNative('uint64_t')), ('receiptdate', TNative('uint64_t')), ('shipinstruct', TString()), ('shipmode', TString()), ('comment', TString()))))))).with_type(TMap(TInt(), TBag(TRecord((('orderkey', TInt()), ('partkey', TInt()), ('suppkey', TInt()), ('linenumber', TInt()), ('quantity', TFloat()), ('extendedprice', TFloat()), ('discount', TFloat()), ('tax', TFloat()), ('returnflag', TNative('char')), ('linestatus', TNative('char')), ('shipdate', TNative('uint64_t')), ('commitdate', TNative('uint64_t')), ('receiptdate', TNative('uint64_t')), ('shipinstruct', TString()), ('shipmode', TString()), ('comment', TString()))))))).with_type(TBag(TInt()))

Another instance.
failed_codegen.py.txt

@izgzhen izgzhen reopened this Oct 21, 2019
@izgzhen
Copy link
Collaborator Author

izgzhen commented Oct 21, 2019

In C++, there is no direct way to express the "keys of a map". Normally, we iterate through them, but this requires a callback/continuation

@izgzhen
Copy link
Collaborator Author

izgzhen commented Oct 21, 2019

The root cause of why such expression is generated is unclear either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant