[Swift-user] Need help with Integer cannot be cast to String
Michael Wilde
wilde at mcs.anl.gov
Fri Jul 12 18:32:57 CDT 2013
The problem here is a bug in both Swift and in usecase1.swift.
Swift is failing when you apply filesys_mapper or simple_mapper to a scalar variable. Its expecting to map an array, not a scalar.
In your firstdataset directory you have many files that match the filesys_mapper suffix eg *.NTT. Its failing in the process of trying to map a set of files to a scalar variable. We need to instead return a clear error message or just map the first file found to the scalar.
So you can fix usecase1.swift, function waitThenMine() to define pos and ev as arrays:
(dataminefile d) waitThenMine (string dataset, dummy a, dummy b, dummy c) {
timestampfile[] t <filesys_mapper;location=dataset, suffix=".T">;
nvt pos[] <filesys_mapper;location="firstdataset", suffix=".NVT">;
nev ev[] <filesys_mapper;location="firstdataset", suffix=".NEV">;
d = datamine(ev, pos, t);
}
but your datamine.py script looks like it expects only one pos and ev file per invocation. That in turn can be fixed with another foreach loop in the swift script, but you'll need to determine the logic for this.
Meanwhile we will find a fix for the confusing message, which was coming from Swift Java code and had nothing to do with trying to cast integers as strings within your Swift script.
Thanks for sending us all the details which helped immensely in finding this bug!
- Mike
----- Original Message -----
> From: "Michael Wilde" <wilde at mcs.anl.gov>
> To: "Andrew Shewmaker" <agshew at gmail.com>
> Cc: swift-user at ci.uchicago.edu
> Sent: Friday, July 12, 2013 6:07:43 PM
> Subject: Re: [Swift-user] Need help with Integer cannot be cast to String
>
> Andrew, Ive narrowed the problem to a Swift bug in filesys_mapper. I
> can replicate the problem with this script:
>
> type file;
>
> file pos <filesys_mapper;location="tdir", suffix=".NTT">;
>
> I hope to have a workaround for the problem shortly.
>
> - Mike
>
> ----- Original Message -----
> > From: "Andrew Shewmaker" <agshew at gmail.com>
> > To: "Michael Wilde" <wilde at mcs.anl.gov>
> > Cc: swift-user at ci.uchicago.edu
> > Sent: Friday, July 12, 2013 5:49:35 PM
> > Subject: Re: [Swift-user] Need help with Integer cannot be cast to
> > String
> >
> > Sorry, I should have said that I was running:
> >
> > ./usecase1.sh -filter=1 -clean=1
> >
> > I'm using Mac OS X Snow Leopard and swift 0.94 ... with an updated
> > script _swiftwrap from my previous bug report. I also tried it with
> > a
> > version of Swift I built from the repo, but I should have tried it
> > on
> > Linux too.
> >
> > java version "1.6.0_45"
> > Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
> > Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode
> >
> > Hmmm ... I thought I had updated Java already.
> >
> > Thanks for your help, Michael!
> >
> > Did it error out on one of the processDataSet() calls for you?
> >
> > -Andrew
> >
> > On Fri, Jul 12, 2013 at 4:16 PM, Michael Wilde <wilde at mcs.anl.gov>
> > wrote:
> > > Andrew, sorry - I see that I need to uncomment the offending
> > > statement.
> > >
> > > I can reproduce the error now and will look into it.
> > >
> > > - Mike
> > >
> > > ----- Original Message -----
> > >> From: "Michael Wilde" <wilde at mcs.anl.gov>
> > >> To: "Andrew Shewmaker" <agshew at gmail.com>
> > >> Cc: swift-user at ci.uchicago.edu
> > >> Sent: Friday, July 12, 2013 5:11:18 PM
> > >> Subject: Re: [Swift-user] Need help with Integer cannot be cast
> > >> to
> > >> String
> > >>
> > >> I should also note that I was running under this Java:
> > >>
> > >> swift$ java -version
> > >> java version "1.7.0_17"
> > >> Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
> > >> Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
> > >> swift$
> > >>
> > >> - Mike
> > >>
> > >> ----- Original Message -----
> > >> > From: "Michael Wilde" <wilde at mcs.anl.gov>
> > >> > To: "Andrew Shewmaker" <agshew at gmail.com>
> > >> > Cc: swift-user at ci.uchicago.edu
> > >> > Sent: Friday, July 12, 2013 4:48:06 PM
> > >> > Subject: Re: [Swift-user] Need help with Integer cannot be
> > >> > cast
> > >> > to
> > >> > String
> > >> >
> > >> > Hi Andrew,
> > >> >
> > >> > I was able to run your test case under Swift 0.94 on an Intel
> > >> > Linux
> > >> > host, and it ran to completion, doing 30 app() tasks without
> > >> > failure. (It encountered a small problem in cleanup, but thats
> > >> > a
> > >> > separate minor issue):
> > >> >
> > >> > ===
> > >> > ...
> > >> > Final status: Fri, 12 Jul 2013 21:35:45 +0000 Finished
> > >> > successfully:30
> > >> > Failed to clean
> > >> > file://localhost/_concurrent/waitnst-60fff1d4-b1af-4de8-80b6-234512833f01-4-0
> > >> > ...
> > >> > Starting cleanups
> > >> > ...
> > >> > Swift finished with no errors
> > >> >
> > >> > swift$ which swift
> > >> > /software/swift-0.94-all/bin/swift
> > >> >
> > >> > swift$ swift -version
> > >> > Swift 0.94 swift-r6414 (swift modified locally) cog-r3648
> > >> > ===
> > >> >
> > >> > What version of Swift were you running, on what platform? I
> > >> > vaguely
> > >> > recall a similar error, and wonder if you are running an older
> > >> > Swift.
> > >> >
> > >> > Can you send us the .log file for the failing run?
> > >> >
> > >> > Also, what version of Java were you using?
> > >> >
> > >> > Below is the directory this created for me.
> > >> >
> > >> > Thanks,
> > >> >
> > >> > - Mike
> > >> >
> > >> > swift$ cd firstdataset/
> > >> > swift$ ls -lt
> > >> > total 2944
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 8.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 8.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 8.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 18.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 18.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 18.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 12.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 12.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 12.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 28.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 28.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 28.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 29.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 29.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 29.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 0.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 0.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 0.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 1.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 23.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 1.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 1.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 3.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 23.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 3.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 3.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 23.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 13.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 13.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 13.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 9.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 9.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 9.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 17.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 27.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 21.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 21.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 21.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 27.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 27.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 6.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 6.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:35 17.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 6.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 17.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 20.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 20.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:35 20.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 10.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 10.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 10.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 4.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 4.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 19.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 4.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 14.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 19.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 19.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 14.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 14.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 26.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 26.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 26.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 22.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 22.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 22.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 11.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 11.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 11.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 24.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 24.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 24.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 5.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 15.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 5.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 15.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 16.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 16.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 2.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 25.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 16.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 5.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 7.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 25.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 7.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 25.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 2.1.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 7.4.T
> > >> > -rw-rw-r-- 1 wilde wilde 40 Jul 12 16:34 15.2.T
> > >> > -rw-rw-r-- 1 wilde wilde 0 Jul 12 16:34 2.2.T
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 9.NSE
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 8.NSE
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 7.NSE
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 6.NSE
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 5.NSE
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 4.NSE
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 3.NSE
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 29.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 28.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 27.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 26.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 25.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 24.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 23.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 22.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 21.NTT
> > >> > -rw-r--r-- 1 wilde wilde 160 Jul 12 16:34 20.NTT
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 2.NSE
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 19.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 18.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 17.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 16.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 15.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 14.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 13.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 12.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 11.NST
> > >> > -rw-r--r-- 1 wilde wilde 80 Jul 12 16:34 10.NST
> > >> > -rw-r--r-- 1 wilde wilde 44 Jul 12 16:34 1.NVT
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 1.NSE
> > >> > -rw-r--r-- 1 wilde wilde 28 Jul 12 16:34 1.NEV
> > >> > -rw-r--r-- 1 wilde wilde 40 Jul 12 16:34 0.NSE
> > >> > swift$
> > >> >
> > >> >
> > >> >
> > >> > ----- Original Message -----
> > >> > > From: "Andrew Shewmaker" <agshew at gmail.com>
> > >> > > To: swift-user at ci.uchicago.edu
> > >> > > Sent: Friday, July 12, 2013 3:18:36 PM
> > >> > > Subject: [Swift-user] Need help with Integer cannot be cast
> > >> > > to
> > >> > > String
> > >> > >
> > >> > > Hi,
> > >> > >
> > >> > > I'm learning how use Swift, and I'm trying to understand
> > >> > > what
> > >> > > I'm
> > >> > > doing
> > >> > > wrong that's causing this failure:
> > >> > >
> > >> > > java.lang.ClassCastException: java.lang.Integer cannot be
> > >> > > cast
> > >> > > to
> > >> > > java.lang.String
> > >> > >
> > >> > > on line 78 of the attached usecase1.swift
> > >> > >
> > >> > > I don't think I'm trying to use an Integer in the line
> > >> > > that's
> > >> > > mentioned.
> > >> > > Any help would be appreciated!
> > >> > >
> > >> > > Thanks,
> > >> > >
> > >> > > Andrew Shewmaker
> > >> > >
> > >> > > _______________________________________________
> > >> > > Swift-user mailing list
> > >> > > Swift-user at ci.uchicago.edu
> > >> > > https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
> > >> >
> > >> _______________________________________________
> > >> Swift-user mailing list
> > >> Swift-user at ci.uchicago.edu
> > >> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
> > >>
> >
> >
> >
> > --
> > Andrew Shewmaker
> >
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>
More information about the Swift-user
mailing list