Skip to content

Commit

Permalink
Minor.
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelbranco80 committed Oct 29, 2024
1 parent 5538289 commit 6ce2469
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class InferAndReadJsonEntry extends SugarEntryExtension with JsonEntryExtensionH
val preferNulls = optionalArgs.collectFirst { case a if a._1 == "preferNulls" => a._2 }.forall(getBoolValue)
val inferenceDiagnostic: Either[Seq[ErrorCompilerMessage], InferrerOutput] =
getJsonInferrerProperties(mandatoryArgs, optionalArgs)
.flatMap(i => programContext.infer(i))
.flatMap(programContext.infer)
.left
.map(error => Seq(InvalidSemantic(node, error)))
for (
Expand Down Expand Up @@ -366,7 +366,7 @@ class InferAndParseJsonEntry extends SugarEntryExtension with JsonEntryExtension
Seq(ValueArg(SnapiLocationValue(new InMemoryByteStreamLocation(codeData), "<value>"), SnapiLocationType())),
optionalArgs
)
.flatMap(i => programContext.infer(i))
.flatMap(programContext.infer)
.left
.map(error => Seq(InvalidSemantic(node, error)))
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class InferAndReadXmlEntry extends SugarEntryExtension with XmlEntryExtensionHel
varArgs: Seq[Arg]
)(implicit programContext: ProgramContext): Either[Seq[ErrorCompilerMessage], Type] = {
val inferenceDiagnostic = getXmlInferrerProperties(mandatoryArgs, optionalArgs)
.flatMap(i => programContext.infer(i))
.flatMap(programContext.infer)
.left
.map(error => Seq(InvalidSemantic(node, error)))
val preferNulls = optionalArgs.collectFirst { case a if a._1 == "preferNulls" => a._2 }.forall(getBoolValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class LocalInferrerTest extends RawTestSuite with SettingsTestContext with Stric
inferrer.infer(AutoInferrerInput(l1, None))
assert(detectedEncoding == encoding)
} finally {
RawUtils.withSuppressNonFatalException(inferrer.stop())
RawUtils.withSuppressNonFatalException(f.delete())
}
}
Expand Down Expand Up @@ -75,6 +76,7 @@ class LocalInferrerTest extends RawTestSuite with SettingsTestContext with Stric
})
}
} finally {
RawUtils.withSuppressNonFatalException(inferrer.stop())
RawUtils.withSuppressNonFatalException(ex.shutdownNow())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ class RD3852Test extends RawTestSuite with SettingsTestContext with StrictLoggin
val inferrer = new LocalInferrerService
val p = RawUtils.getResource("data/students/students.csv")
val l1 = new LocalPath(p)
val TextInputStreamInferrerOutput(_, _, format) = inferrer.infer(AutoInferrerInput(l1, None))
assert(format.isInstanceOf[CsvFormatDescriptor])
try {
val TextInputStreamInferrerOutput(_, _, format) = inferrer.infer(AutoInferrerInput(l1, None))
assert(format.isInstanceOf[CsvFormatDescriptor])
} finally {
RawUtils.withSuppressNonFatalException(inferrer.stop())
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ protected Object doDescribe(
return record;
} catch (RawException ex) {
return new ErrorObject(ex.getMessage());
} finally {
inferrer.stop();
}
}
}

0 comments on commit 6ce2469

Please sign in to comment.