Different results on executing same stored procedure - sql
I have a stored procedure
CREATE PROCEDURE [dbo].[Proc_SplitAndRemoveDuplicates]
#sep VARCHAR(32),
#s NVARCHAR(MAX),
#hcp NVARCHAR(MAX) OUTPUT
AS
BEGIN
DECLARE #t TABLE (val NVARCHAR(MAX))
SET #hcp = ''
DECLARE #xml XML
SET #xml = N'<root><r>' + REPLACE(#s, #sep, '</r><r>') + '</r></root>'
PRINT CAST (#xml AS NVARCHAR(MAX))
INSERT INTO #t(val)
SELECT RTRIM(LTRIM(r.value('.','NVARCHAR(MAX)'))) as Item
FROM #xml.nodes('//root/r') AS RECORDS(r)
;WITH cte AS
(
SELECT ROW_NUMBER() OVER (PARTITION BY val ORDER BY val desc) RN
FROM #t
)
DELETE FROM cte
WHERE RN > 1
SET #hcp = (SELECT SPACE(1) + val + ',' from #t WHERE val <> '' FOR XML PATH ('') )
END
Now when I pass the same values in arguments it gives me different results, any ideas why is this happening?
Below is the query that's giving different results:
DECLARE #hcp NVARCHAR(MAX)
EXEC [Proc_SplitAndRemoveDuplicates] ',', 'Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, Marie-Louise Coenen, Christiaan Genbrugge, Kurt Geldof, Philippe Gilbert, Benoit Calcus, Michel Gijssels, Leon Ghyselinck, Ivan Ghillebert, Peter Chielens, Jozef Gevers, Bernard Gevenois, Paul Geusens, Jozef Geukens, Sabine Goolaerts, Yves Heeren, Val?rie Goffin, Pierro Fattizzo, Philippe Farr, Sophie Schyns, Jean-Pierre Falla, Jean-Michel Gobeaux, Marie-Annick G?tze, Pierre Firket, France Gosse, Johanna Gomez Tercero, Marianne Schoofs, Philippe Schockaert, Lieven De Norre, Val?rie Denef, Kathleen Geens, Walter Geeraerts, Fran?oise Gerard, Claudia Schomus, Ellen Schorkops, Bernard Gerbaux, Eveline Schleich, Micheline Demeyer, Brigitte Gadisseux, Brenda Laera, * GHERALDI, * VAUTHIER, . MARC, *THOMAS* RABERN, * BLANDIN, . BARON, A GUICHARD LEBRUN, A FRANCE VENTRE, A ILAH NOURY, A MARIE BONNERIC BRETON, A PAULE GIMENEZ ROQUEPLOT, A rakoto NIRHY LANTO, A sophie CHOQUET, A marie COURTEL, A MARIE HAOND, A sophie CALLOC H, A marie MAILLOTTE, AABDALLAH JOIDATE, AANYO KUZEAWU, ABBAS AL MAKKI, Abakar ABAKAR MAHAMAT, Ab nasser DOUMI, ABBAS SROUR, ABDAKA BELLOUTI, ABBOUD ABO, Abdallah MOUSTEAU, ', #hcp OUTPUT
SELECT #hcp
Any help would be really apreciated.
I notice two suspect things in your stored procedure. First is in this line:
(SELECT ROW_NUMBER() OVER (PARTITION BY val ORDER BY val desc) as RN
Sorting in SQL is unstable. That means that rows with the same key values can appear in any order -- and that order can change from one run to the next. That means that the specific row being deleted in indeterminate (although it would always have the correct val value).
Second, you have for xml path, but you have no order by. If the different results are simply in the "wrong" order, you can easily fix that by putting an order by into that statement.
These are just two issues that I spot. There may be other issues as well.
Related
How to combine a query search to show certain defined values at the same time as not showing specific defined values?
The goal is filter out a search result so that the result shows a certain value and filtering out other undesirable values. I'm thinking of a combination between IN and NOT IN? Basically, in the provided example here, the goal is to retrieve the courses that Lennart has taught but not Alan or Kjell. table bb ccode course name --------------- ------------------------------ ------------------------------ TIG162 Affarssystem Kjell TIG162 Affarssystem Kjell TIG162 Affarssystem Kjell TIG162 Affarssystem Lennart TIG162 Affarssystem Lisen TIG162 Affarssystem Lisen TIG162 Affarssystem Lisen TIG163 Beslutsstodsystem Alan TIG163 Beslutsstodsystem Faramarz TIG163 Beslutsstodsystem Janne TIG163 Beslutsstodsystem Lennart TIG163 Beslutsstodsystem Alan TIG163 Beslutsstodsystem Faramarz TIG163 Beslutsstodsystem Lennart TIG163 Beslutsstodsystem Faramarz TIG163 Beslutsstodsystem Lennart TIG163 Beslutsstodsystem Maria TIG163 Beslutsstodsystem Lennart TIG163 Beslutsstodsystem Maria TIG163 Beslutsstodsystem Alan TIG163 Beslutsstodsystem Faramarz TIG163 Beslutsstodsystem Lennart TIG067 Examensarbete Johan TIG067 Examensarbete Kalle TIG067 Examensarbete Magnus TIA004 Forandringsledning Janne TIA004 Forandringsledning Kalle TIG167 Fordjupning i programmering Dina TIG167 Fordjupning i programmering Janne TIG167 Fordjupning i programmering Henrik TIG167 Fordjupning i programmering Kjell TIG167 Fordjupning i programmering Henrik TIG167 Fordjupning i programmering Rikard TIG167 Fordjupning i programmering Henrik TIG167 Fordjupning i programmering Kjell TIA008 IT - infrastruktur Aida TIG065 IT ledning styrning och strate Kalle TIG065 IT ledning styrning och strate Aida TIG065 IT ledning styrning och strate Kalle TIG065 IT ledning styrning och strate Aida TIG065 IT ledning styrning och strate Kalle TIG065 IT ledning styrning och strate Aida TIG165 Informatik som vetenskap Alan TIG165 Informatik som vetenskap Lennart TIG165 Informatik som vetenskap William TIG165 Informatik som vetenskap Alan TIG165 Informatik som vetenskap Lennart TIG165 Informatik som vetenskap Lennart TIG165 Informatik som vetenskap Marie TIG165 Informatik som vetenskap Lennart TIG165 Informatik som vetenskap Marie TIG066 Informatikhistoria och vetensk Janne TIG066 Informatikhistoria och vetensk Janne TIG066 Informatikhistoria och vetensk Janne TIG066 Informatikhistoria och vetensk Janne TIG066 Informatikhistoria och vetensk Janne TIG015 Informationsteknologi och info Kalle TIG015 Informationsteknologi och info Kalle TIG015 Informationsteknologi och info Kalle TIG015 Informationsteknologi och info Kalle TIG015 Informationsteknologi och info Aida TIG015 Informationsteknologi och info Jonas TIG015 Informationsteknologi och info Kalle TIG015 Informationsteknologi och info Kjell TIG015 Informationsteknologi och info Magnus TIG015 Informationsteknologi och info Aida TIG015 Informationsteknologi och info Jonas TIG015 Informationsteknologi och info Kjell TIG015 Informationsteknologi och info Lennart TIG015 Informationsteknologi och info Maria TIG015 Informationsteknologi och info Urban TIG063 Informationsteknologi och samh Kjell TIG063 Informationsteknologi och samh Kjell TIG063 Informationsteknologi och samh Kjell TIG063 Informationsteknologi och samh Kjell TIA015 Innovation och entreprenorskap Lennart TIA015 Innovation och entreprenorskap Marie TIA010 Innovationsstrategi Juha TIG164 Interaktionsdesign Alan TIG164 Interaktionsdesign Juha TIG164 Interaktionsdesign Alan TIG164 Interaktionsdesign Juha TIG164 Interaktionsdesign Alan TIG164 Interaktionsdesign Juha TIG164 Interaktionsdesign Alan TIG164 Interaktionsdesign Alan TIG061 Manniska datorinteraktion Henrik TIG061 Manniska datorinteraktion Lennart TIG061 Manniska datorinteraktion Henrik TIG061 Manniska datorinteraktion Lennart TIA019 Masteruppsats Janne TIA019 Masteruppsats Lisen TIA019 Masteruppsats Urban TIG060 Organisationer och affarssyste Fredrik TIG060 Organisationer och affarssyste Juha TIG058 Programmeringsteknik och datab Alan TIG058 Programmeringsteknik och datab Janne TIG058 Programmeringsteknik och datab Alan TIG058 Programmeringsteknik och datab Lennart TIG058 Programmeringsteknik och datab Lennart TIG058 Programmeringsteknik och datab Alan TIG059 Systemutvecklingsprojekt Dina TIG059 Systemutvecklingsprojekt Janne TIG059 Systemutvecklingsprojekt Dina TIG059 Systemutvecklingsprojekt Janne TIG059 Systemutvecklingsprojekt Alan TIG059 Systemutvecklingsprojekt Janne TIG059 Systemutvecklingsprojekt Kalle TIG059 Systemutvecklingsprojekt Lennart TIG059 Systemutvecklingsprojekt Alan TIG059 Systemutvecklingsprojekt Janne TIG059 Systemutvecklingsprojekt Kalle TIG059 Systemutvecklingsprojekt Lennart TIG059 Systemutvecklingsprojekt Alan TIG059 Systemutvecklingsprojekt Janne TIG059 Systemutvecklingsprojekt Kalle TIG059 Systemutvecklingsprojekt Lennart TIG166 Tillampad IT management Fredrik TIG166 Tillampad IT management Juha TIG016 Verksamheter och information Janne TIG016 Verksamheter och information Maria TIG016 Verksamheter och information Janne TIG016 Verksamheter och information Kalle TIG016 Verksamheter och information Maria TIG016 Verksamheter och information Janne TIG016 Verksamheter och information Kalle TIG016 Verksamheter och information Janne TIG016 Verksamheter och information Kalle TIA003 Verksamhetsutveckling Dina TIA003 Verksamhetsutveckling Aida TIA003 Verksamhetsutveckling Dina TIA003 Verksamhetsutveckling Aida TIA003 Verksamhetsutveckling Dina TIA003 Verksamhetsutveckling Aida TIA003 Verksamhetsutveckling Dina TIA003 Verksamhetsutveckling Aida TIG098 eBusiness and eGovernment Agneta TIG098 eBusiness and eGovernment Lisen The retrieved tuples should be: Any suggestions on how the query should look like?
With NOT EXISTS: select distinct t.course from tablename t where name = 'Lennart' and not exists (select 1 from tablename where course = t.course and name in ('Alan', 'Kjell')); If you want to use IN, then this is the simplest way: select distinct course from tablename where name = 'Lennart' and course not in (select course from tablename where name in ('Alan','Kjell'));
You can use conditional aggregation: select knamn from t group by knamn having sum(namn = 'Lennart') > 0 and sum(namn = 'Alan') = 0 and sum(namn = 'Kjeli') = 0 ; It might be a wee bit more efficient to filter before aggregation, in which case you can just use: select knamn from t where namn in ('Lennart', 'Alan', 'Kjeli') group by knamn having min(namn) = max(namn) and min(namn) = 'Lennart';
Another approach using in and not in select distinct course from table where name = 'Lennart' and course not in (select course from table where name in ('Alan','Kjeli');
VerifyError: Bad type on operand stack dropwizard
We upgraded the java version to 11 in a microservice. When we tried to run the app, we got the following message: Caused by: java.lang.VerifyError: Bad type on operand stack Exception Details: Location: com/template/main/App.initialize(Lio/dropwizard/setup/Bootstrap;)V #153: invokespecial Reason: Type 'io/dropwizard/configuration/EnvironmentVariableSubstitutor' (current frame, stack[4]) is not assignable to 'org/apache/commons/text/StrSubstitutor' Current Frame: bci: #153 flags: { } locals: { 'com/template/main/App', 'io/dropwizard/setup/Bootstrap', 'com/bendb/dropwizard/jooq/JooqBundle' } stack: { 'io/dropwizard/setup/Bootstrap', uninitialized 137, uninitialized 137, 'io/dropwizard/configuration/ConfigurationSourceProvider', 'io/dropwizard/configuration/EnvironmentVariableSubstitutor' } Bytecode: 0000000: 2a2b b700 052a b600 064d 2b2c b600 072b 0000010: bb00 0859 b700 09b6 0007 2bbb 000a 59b7 0000020: 000b b600 0c2a b800 0d12 0eb6 000f bb00 0000030: 1059 b700 11b6 0012 bb00 1359 2cb7 0014 0000040: b600 12bb 0015 59b7 0016 b600 12bb 0017 0000050: 59b7 0018 b600 12bb 0019 59b7 001a b600 0000060: 12bb 001b 59b7 001c b600 1204 bd00 1d59 0000070: 0312 1e53 b600 1fb2 0020 b600 21b5 0022 0000080: 2b2a b400 22b6 0007 2bbb 0023 592b b600 0000090: 24bb 0025 5903 b700 26b7 0027 b600 282b 00000a0: bb00 2959 2ab7 002a b600 0c2b bb00 2b59 00000b0: 2ab7 002c b600 07b1 Any idea how can we fix it?
tornado-maven-osgi-project template for IntelliJ does not work [duplicate]
I am using the Kotlin getting started guide to setup Kotlin for the first time on IntelliJ IDEA with the following configuration: IntelliJ IDEA 2017.2.5 Build #IC-172.4343.14, built on September 26, 2017 JRE: 1.8.0_152-release-915-b12 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.11.6 I created an App.kt file in a new Kotlin project with the following code: fun main(args: Array<String>) { println("hello") } On running the code through the IDE, I get the following error: Error:Internal error: (java.lang.VerifyError) Uninitialized object exists on backward branch 90 Exception Details: Location: org/jetbrains/kotlin/jps/build/KotlinBuilder.createCompileEnvironment(Ljava/util/Map;Lorg/jetbrains/kotlin/incremental/components/LookupTracker;Lorg/jetbrains/jps/incremental/CompileContext;Lorg/jetbrains/kotlin/jps/build/KotlinBuilder$MessageCollectorAdapter;)Lorg/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment; #171: goto Reason: Error exists in the bytecode Bytecode: 0000000: bb03 fe59 b703 ff3a 0619 063a 0719 0713 0000010: 02d7 2cb6 0403 5719 0713 0405 bb04 0759 0000020: 2b3a 083a 093a 0a3a 0b3a 0c19 083a 0dbb 0000030: 0409 5919 08b9 040a 0100 b804 10b7 0411 0000040: c002 893a 0e19 0db9 028c 0100 c000 b03a 0000050: 0f19 0fb9 00b9 0100 3a10 1910 b900 be01 0000060: 0099 004d 1910 b900 c201 003a 1119 0e19 0000070: 11c0 028e 3a12 3a13 1912 b902 9101 00c0 0000080: 00c4 b804 173a 1419 1319 1419 11c0 028e 0000090: 3a15 3a16 3a17 1915 b902 9401 003a 1819 00000a0: 1719 1619 18b9 041b 0300 57a7 ffaf 190e 00000b0: 0000 3a13 190c 190b 190a 1909 1913 b704 00000c0: 1eb6 0403 5719 0713 0420 bb04 2259 2c2b 00000d0: 2db7 0425 b604 0357 1907 b604 283a 052a 00000e0: b704 2c3a 0619 06c6 0010 1906 b904 3101 00000f0: 00b6 013c 9a00 1319 04b2 0216 1304 3301 0000100: 0701 b801 fa01 b0bb 0262 5919 0619 05b2 0000110: 002e b604 3719 04c0 01c7 bb04 3959 b704 0000120: 3ab7 043d b0 Stackmap Table: full_frame(#90,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Top,Object[#1022],Object[#1022],Object[#649],Uninitialized[#28],Uninitialized[#28],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187]},{}) same_frame_extended(#174) full_frame(#247,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Object[#1102],Object[#1070],Object[#1022],Object[#649],Object[#1031],Object[#1031],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187],Top,Top,Object[#649]},{}) same_frame(#263) java.lang.VerifyError: Uninitialized object exists on backward branch 90 Exception Details: Location: org/jetbrains/kotlin/jps/build/KotlinBuilder.createCompileEnvironment(Ljava/util/Map;Lorg/jetbrains/kotlin/incremental/components/LookupTracker;Lorg/jetbrains/jps/incremental/CompileContext;Lorg/jetbrains/kotlin/jps/build/KotlinBuilder$MessageCollectorAdapter;)Lorg/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment; #171: goto Reason: Error exists in the bytecode Bytecode: 0000000: bb03 fe59 b703 ff3a 0619 063a 0719 0713 0000010: 02d7 2cb6 0403 5719 0713 0405 bb04 0759 0000020: 2b3a 083a 093a 0a3a 0b3a 0c19 083a 0dbb 0000030: 0409 5919 08b9 040a 0100 b804 10b7 0411 0000040: c002 893a 0e19 0db9 028c 0100 c000 b03a 0000050: 0f19 0fb9 00b9 0100 3a10 1910 b900 be01 0000060: 0099 004d 1910 b900 c201 003a 1119 0e19 0000070: 11c0 028e 3a12 3a13 1912 b902 9101 00c0 0000080: 00c4 b804 173a 1419 1319 1419 11c0 028e 0000090: 3a15 3a16 3a17 1915 b902 9401 003a 1819 00000a0: 1719 1619 18b9 041b 0300 57a7 ffaf 190e 00000b0: 0000 3a13 190c 190b 190a 1909 1913 b704 00000c0: 1eb6 0403 5719 0713 0420 bb04 2259 2c2b 00000d0: 2db7 0425 b604 0357 1907 b604 283a 052a 00000e0: b704 2c3a 0619 06c6 0010 1906 b904 3101 00000f0: 00b6 013c 9a00 1319 04b2 0216 1304 3301 0000100: 0701 b801 fa01 b0bb 0262 5919 0619 05b2 0000110: 002e b604 3719 04c0 01c7 bb04 3959 b704 0000120: 3ab7 043d b0 Stackmap Table: full_frame(#90,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Top,Object[#1022],Object[#1022],Object[#649],Uninitialized[#28],Uninitialized[#28],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187]},{}) same_frame_extended(#174) full_frame(#247,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Object[#1102],Object[#1070],Object[#1022],Object[#649],Object[#1031],Object[#1031],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187],Top,Top,Object[#649]},{}) same_frame(#263) at org.jetbrains.kotlin.jps.build.KotlinBuilderService.createModuleLevelBuilders(KotlinBuilderService.java:30) at org.jetbrains.jps.incremental.BuilderRegistry.<init>(BuilderRegistry.java:54) at org.jetbrains.jps.incremental.BuilderRegistry.<init>(BuilderRegistry.java:33) at org.jetbrains.jps.incremental.BuilderRegistry$Holder.<clinit>(BuilderRegistry.java:36) at org.jetbrains.jps.incremental.BuilderRegistry.getInstance(BuilderRegistry.java:43) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:133) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$$Lambda$3/1147174008.run(Unknown Source) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$$Lambda$1/684874119.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
This is due to a bug in earlier JDK 8 versions. Open up the project structure for your project and change your project SDK to a more recent version. Upgrading from JDK 1.8.0_11 to 1.80_72 solved the problem for me.
Just check "Use embedded JDK" in File>Project Structure>SDK Location> JDK Location
Kotlin VerifyError: Uninitialized object exists on backward branch 90
I am using the Kotlin getting started guide to setup Kotlin for the first time on IntelliJ IDEA with the following configuration: IntelliJ IDEA 2017.2.5 Build #IC-172.4343.14, built on September 26, 2017 JRE: 1.8.0_152-release-915-b12 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.11.6 I created an App.kt file in a new Kotlin project with the following code: fun main(args: Array<String>) { println("hello") } On running the code through the IDE, I get the following error: Error:Internal error: (java.lang.VerifyError) Uninitialized object exists on backward branch 90 Exception Details: Location: org/jetbrains/kotlin/jps/build/KotlinBuilder.createCompileEnvironment(Ljava/util/Map;Lorg/jetbrains/kotlin/incremental/components/LookupTracker;Lorg/jetbrains/jps/incremental/CompileContext;Lorg/jetbrains/kotlin/jps/build/KotlinBuilder$MessageCollectorAdapter;)Lorg/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment; #171: goto Reason: Error exists in the bytecode Bytecode: 0000000: bb03 fe59 b703 ff3a 0619 063a 0719 0713 0000010: 02d7 2cb6 0403 5719 0713 0405 bb04 0759 0000020: 2b3a 083a 093a 0a3a 0b3a 0c19 083a 0dbb 0000030: 0409 5919 08b9 040a 0100 b804 10b7 0411 0000040: c002 893a 0e19 0db9 028c 0100 c000 b03a 0000050: 0f19 0fb9 00b9 0100 3a10 1910 b900 be01 0000060: 0099 004d 1910 b900 c201 003a 1119 0e19 0000070: 11c0 028e 3a12 3a13 1912 b902 9101 00c0 0000080: 00c4 b804 173a 1419 1319 1419 11c0 028e 0000090: 3a15 3a16 3a17 1915 b902 9401 003a 1819 00000a0: 1719 1619 18b9 041b 0300 57a7 ffaf 190e 00000b0: 0000 3a13 190c 190b 190a 1909 1913 b704 00000c0: 1eb6 0403 5719 0713 0420 bb04 2259 2c2b 00000d0: 2db7 0425 b604 0357 1907 b604 283a 052a 00000e0: b704 2c3a 0619 06c6 0010 1906 b904 3101 00000f0: 00b6 013c 9a00 1319 04b2 0216 1304 3301 0000100: 0701 b801 fa01 b0bb 0262 5919 0619 05b2 0000110: 002e b604 3719 04c0 01c7 bb04 3959 b704 0000120: 3ab7 043d b0 Stackmap Table: full_frame(#90,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Top,Object[#1022],Object[#1022],Object[#649],Uninitialized[#28],Uninitialized[#28],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187]},{}) same_frame_extended(#174) full_frame(#247,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Object[#1102],Object[#1070],Object[#1022],Object[#649],Object[#1031],Object[#1031],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187],Top,Top,Object[#649]},{}) same_frame(#263) java.lang.VerifyError: Uninitialized object exists on backward branch 90 Exception Details: Location: org/jetbrains/kotlin/jps/build/KotlinBuilder.createCompileEnvironment(Ljava/util/Map;Lorg/jetbrains/kotlin/incremental/components/LookupTracker;Lorg/jetbrains/jps/incremental/CompileContext;Lorg/jetbrains/kotlin/jps/build/KotlinBuilder$MessageCollectorAdapter;)Lorg/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment; #171: goto Reason: Error exists in the bytecode Bytecode: 0000000: bb03 fe59 b703 ff3a 0619 063a 0719 0713 0000010: 02d7 2cb6 0403 5719 0713 0405 bb04 0759 0000020: 2b3a 083a 093a 0a3a 0b3a 0c19 083a 0dbb 0000030: 0409 5919 08b9 040a 0100 b804 10b7 0411 0000040: c002 893a 0e19 0db9 028c 0100 c000 b03a 0000050: 0f19 0fb9 00b9 0100 3a10 1910 b900 be01 0000060: 0099 004d 1910 b900 c201 003a 1119 0e19 0000070: 11c0 028e 3a12 3a13 1912 b902 9101 00c0 0000080: 00c4 b804 173a 1419 1319 1419 11c0 028e 0000090: 3a15 3a16 3a17 1915 b902 9401 003a 1819 00000a0: 1719 1619 18b9 041b 0300 57a7 ffaf 190e 00000b0: 0000 3a13 190c 190b 190a 1909 1913 b704 00000c0: 1eb6 0403 5719 0713 0420 bb04 2259 2c2b 00000d0: 2db7 0425 b604 0357 1907 b604 283a 052a 00000e0: b704 2c3a 0619 06c6 0010 1906 b904 3101 00000f0: 00b6 013c 9a00 1319 04b2 0216 1304 3301 0000100: 0701 b801 fa01 b0bb 0262 5919 0619 05b2 0000110: 002e b604 3719 04c0 01c7 bb04 3959 b704 0000120: 3ab7 043d b0 Stackmap Table: full_frame(#90,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Top,Object[#1022],Object[#1022],Object[#649],Uninitialized[#28],Uninitialized[#28],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187]},{}) same_frame_extended(#174) full_frame(#247,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Object[#1102],Object[#1070],Object[#1022],Object[#649],Object[#1031],Object[#1031],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187],Top,Top,Object[#649]},{}) same_frame(#263) at org.jetbrains.kotlin.jps.build.KotlinBuilderService.createModuleLevelBuilders(KotlinBuilderService.java:30) at org.jetbrains.jps.incremental.BuilderRegistry.<init>(BuilderRegistry.java:54) at org.jetbrains.jps.incremental.BuilderRegistry.<init>(BuilderRegistry.java:33) at org.jetbrains.jps.incremental.BuilderRegistry$Holder.<clinit>(BuilderRegistry.java:36) at org.jetbrains.jps.incremental.BuilderRegistry.getInstance(BuilderRegistry.java:43) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:133) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$$Lambda$3/1147174008.run(Unknown Source) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$$Lambda$1/684874119.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
This is due to a bug in earlier JDK 8 versions. Open up the project structure for your project and change your project SDK to a more recent version. Upgrading from JDK 1.8.0_11 to 1.80_72 solved the problem for me.
Just check "Use embedded JDK" in File>Project Structure>SDK Location> JDK Location
Use AWK on multi FASTA file to add new column based on contig header
I have a multi FASTA file that needs to be parsed so Glimmer multi-extract script can process it. It is composed of many contigs each with it's own header that starts with ">". What I need is to add each header as a new column, the problem is I don't know very much about the linux bash or awk for that matter. >contig-7 orf00002 1741 461 orf00003 3381 1747 >Wcontig-7000023 >Wcontig-11112 orf00001 426 2648 orf00002 2710 4581 orf00003 4569 5480 orf00004 6990 6133 orf00006 9180 7108 orf00007 10201 9209 orf00008 11663 10203 orf00009 12489 11680 orf00010 13153 12473 orf00011 14382 13225 orf00013 14715 15968 orf00014 19868 16410 >Wcontig-1674000002 orf00001 2995 637 orf00002 2497 1166 orf00003 2984 2529 I need to have each contig header added as a first column along with a tab delimiter. >contig-7 >contig-7 orf00002 1741 461 >contig-7 orf00003 3381 1747 >Wcontig-7000023 >Wcontig-11112 >Wcontig-11112 orf00001 426 2648 >Wcontig-11112 orf00002 2710 4581 >Wcontig-11112 orf00003 4569 5480 >Wcontig-11112 orf00004 6990 6133 >Wcontig-11112 orf00006 9180 7108 >Wcontig-11112 orf00007 10201 9209 >Wcontig-11112 orf00008 11663 10203 >Wcontig-11112 orf00009 12489 11680 >Wcontig-11112 orf00010 13153 12473 >Wcontig-11112 orf00011 14382 13225 >Wcontig-11112 orf00013 14715 15968 >Wcontig-11112 orf00014 19868 16410 >Wcontig-1674000002 >Wcontig-1674000002 orf00001 2995 637 >Wcontig-1674000002 orf00002 2497 1166 >Wcontig-1674000002 orf00003 2984 2529 Also, after adding the new column I have to erase all the headers, so it would end up looking like this >contig-7 orf00002 1741 461 >contig-7 orf00003 3381 1747 >Wcontig-11112 orf00001 426 2648 >Wcontig-11112 orf00002 2710 4581 >Wcontig-11112 orf00003 4569 5480 >Wcontig-11112 orf00004 6990 6133 >Wcontig-11112 orf00006 9180 7108 >Wcontig-11112 orf00007 10201 9209 >Wcontig-11112 orf00008 11663 10203 >Wcontig-11112 orf00009 12489 11680 >Wcontig-11112 orf00010 13153 12473 >Wcontig-11112 orf00011 14382 13225 >Wcontig-11112 orf00013 14715 15968 >Wcontig-11112 orf00014 19868 16410 >Wcontig-1674000002 orf00001 2995 637 >Wcontig-1674000002 orf00002 2497 1166 >Wcontig-1674000002 orf00003 2984 2529
Awk can be really handy to solve this problem: awk '{if($1 ~ /contig/){c=$1}else{print c"\t"$0}}' <yourfile>