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

JSON to parquet - System.MissingMethodException: Constructor on type 'System.String' not found #293

Open
jsn-m opened this issue Jul 28, 2023 · 3 comments

Comments

@jsn-m
Copy link

jsn-m commented Jul 28, 2023

Processing JSON and writing out parquet I get the following error:

System.MissingMethodException: Constructor on type 'System.String' not found.
[2023-07-28T15:21:06.332Z]    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
[2023-07-28T15:21:06.333Z]    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
[2023-07-28T15:21:06.335Z]    at System.Activator.CreateInstance(Type type, Object[] args)
[2023-07-28T15:21:06.337Z]    at ChoETL.ChoActivator.CreateInstanceAndInit(Type objType, Object[] args)
[2023-07-28T15:21:06.339Z]    at ChoETL.ChoConvert.ChangeType(Object value, Type conversionType)
[2023-07-28T15:21:06.341Z]    at ChoETL.ChoUtility.Cast(Array array, Type elementType)
[2023-07-28T15:21:06.345Z]    at ChoETL.ChoParquetRecordWriter.WriteAllRecords(StreamWriter sw)
[2023-07-28T15:21:06.351Z]    at ChoETL.ChoParquetRecordWriter.Dispose(StreamWriter sw)
[2023-07-28T15:21:06.353Z]    at ChoETL.ChoParquetWriter`1.Dispose(Boolean finalize)
[2023-07-28T15:21:06.355Z]    at ChoETL.ChoParquetWriter`1.Dispose()

The code that makes this error:

using (var jsonReader = new ChoJSONReader(new StringReader(restResponse.Content), new ChoJSONRecordConfiguration() { ThrowAndStopOnMissingField = false, FlattenNode = true, TypeConverterFormatSpec = new ChoTypeConverterFormatSpec() { DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffffff" } }))
{
    using (var parser = new ChoParquetWriter("C:\\TEMP\\data1.parquet", new ChoParquetRecordConfiguration() { TreatDateTimeAsDateTimeOffset = true, IgnoreDictionaryFieldPrefix = true  }))
    {
        parser.Write(jsonReader);
    }
}

Packages: ChoETL.Parquet and ChoETL.JSON.NETStandard

using System.Net;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using RestSharp;
using Azure.Storage.Files.DataLake;
using ChoETL;
@Cinchoo
Copy link
Owner

Cinchoo commented Aug 5, 2023

can u pls share the versions of the library? also would be nice to share sample. thx

@jsn-m
Copy link
Author

jsn-m commented Aug 16, 2023

Hi Cinchoo,

I was using ChoETL version 1.2.1.60 and ChoETL.Parquet 1.0.1.27.

@jsn-m
Copy link
Author

jsn-m commented Aug 16, 2023

I eventually got it to work by removing IgnoreDictionaryFieldPrefix = true

using (var parser = new ChoParquetWriter("C:\\TEMP\\data1.parquet", new ChoParquetRecordConfiguration() { TreatDateTimeAsDateTimeOffset = true }))
    {
        parser.Write(jsonReader);
    }

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

No branches or pull requests

2 participants