Skip to content

Commit 7b9b38a

Browse files
committed
Fix so generic data source returns typed information
1 parent 96070e3 commit 7b9b38a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/FlowtideDotNet.Core/Sources/Generic/Internal/GenericTableProvider.cs

+9-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
// See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13+
using FlowtideDotNet.Core.ColumnStore.ObjectConverter;
1314
using FlowtideDotNet.Substrait.Sql;
15+
using FlowtideDotNet.Substrait.Type;
1416
using System.Diagnostics.CodeAnalysis;
1517

1618
namespace FlowtideDotNet.Core.Sources.Generic.Internal
@@ -21,18 +23,14 @@ internal class GenericTableProvider<T> : ITableProvider
2123

2224
public GenericTableProvider(string name)
2325
{
24-
var properties = typeof(T).GetProperties();
25-
var columnNames = properties.Select(x =>
26+
var schema = BatchConverter.GetBatchConverter(typeof(T)).GetSchema();
27+
schema.Names.Add("__key");
28+
if (schema.Struct != null)
2629
{
27-
return x.Name;
28-
}).ToList();
29-
30-
columnNames.Add("__key");
31-
32-
_tableMetadata = new TableMetadata(name, new Substrait.Type.NamedStruct()
33-
{
34-
Names = columnNames
35-
});
30+
schema.Struct.Types.Add(new StringType());
31+
}
32+
33+
_tableMetadata = new TableMetadata(name, schema);
3634
}
3735

3836
public bool TryGetTableInformation(IReadOnlyList<string> tableName, [NotNullWhen(true)] out TableMetadata? tableMetadata)

0 commit comments

Comments
 (0)