Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c44b65c
Widget for `File.new`.
jdunkerley Jan 14, 2026
e1d6ef2
Remove passing the Table object and use names and storages.
jdunkerley Jan 14, 2026
f1c3308
Fix missed changes.
jdunkerley Jan 14, 2026
c8c6ef2
Deal with one more place where null.
jdunkerley Jan 14, 2026
87b24be
PR comments.
jdunkerley Jan 14, 2026
f01e860
PR comments (2).
jdunkerley Jan 14, 2026
b421f59
Isolate the make local for StorageType into the interface itself.
jdunkerley Jan 14, 2026
cc65b60
Missing imports.
jdunkerley Jan 14, 2026
4e6546c
Whitespace
jdunkerley Jan 14, 2026
94008cd
Ensure inferPreciseType returns a local StorageType.
jdunkerley Jan 14, 2026
21531b9
Java format.
jdunkerley Jan 14, 2026
6410cbd
Move the polyglot materialisation to TypedStorage.
jdunkerley Jan 14, 2026
eb028f0
Debug the world
jdunkerley Jan 16, 2026
54ad38f
Fix compile error.
jdunkerley Jan 21, 2026
b767e37
Getting back to it.
jdunkerley Jan 21, 2026
47d0b21
Last bit of tidying.
jdunkerley Jan 21, 2026
9b1e80f
Docs
jdunkerley Jan 21, 2026
a6d78b1
Type fix.
jdunkerley Jan 21, 2026
529f04c
Fixes.
jdunkerley Jan 21, 2026
d9c8b08
Remove some more helper methods and move to using ColumnStorages when…
jdunkerley Jan 22, 2026
f6315a6
Wrong method name.
jdunkerley Jan 22, 2026
f75a771
Missed a rename or two.
jdunkerley Jan 22, 2026
37f82a0
Fix is_dry_run change.
jdunkerley Jan 22, 2026
fc65c90
Explicitly localise in HyperFormat.
jdunkerley Jan 22, 2026
970a499
Java format.
jdunkerley Jan 22, 2026
3ed64fe
Remove `getType` in favour of a static method which will ensure Stora…
jdunkerley Jan 23, 2026
2774c95
Part 2 for StorageType.ofStorage.
jdunkerley Jan 23, 2026
ef1be16
Part 3 for StorageType.ofStorage.
jdunkerley Jan 23, 2026
770f247
Part 4 for StorageType.ofStorage.
jdunkerley Jan 23, 2026
b4def16
Part 5 for StorageType.ofStorage.
jdunkerley Jan 23, 2026
85198cb
Part 6 for StorageType.ofStorage.
jdunkerley Jan 23, 2026
ba55fcd
And more...
jdunkerley Jan 23, 2026
645c7d3
And more...
jdunkerley Jan 23, 2026
78cacaa
Some cleaning.
jdunkerley Jan 23, 2026
ecabc4d
Fix defects.
jdunkerley Jan 26, 2026
5f683a9
Fix defects (2).
jdunkerley Jan 26, 2026
2de302c
Remove unused methods and move to storage not column to make a new ta…
jdunkerley Jan 26, 2026
3990bb2
Java format.
jdunkerley Jan 26, 2026
906f432
Fix issue with LongBuilder
jdunkerley Jan 26, 2026
f6d2929
Sort BigInteger in JVM mode.
jdunkerley Jan 26, 2026
d346511
Sort failing tests.
jdunkerley Jan 26, 2026
fbf3ab9
More to do but trying some ways to get it to work
jdunkerley Jan 26, 2026
8cf1a0d
Working on Builder
jdunkerley Jan 27, 2026
17d5765
Fixes.
jdunkerley Jan 27, 2026
f971bf3
Merged
jdunkerley Jan 28, 2026
e5563ae
Not sure if I need to do the conversion in the valueAsType methods bu…
jdunkerley Jan 28, 2026
52f7d95
Close to all working...
jdunkerley Jan 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type File

example_new = File.new Examples.csv_path
```
@path Widget.Text_Input
new : (Text | File) -> Any ! Illegal_Argument
new path = case path of
_ : Text -> if path.contains "://" . not then resolve_local_file path else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ from Standard.Base.Metadata.Choice import Option
from Standard.Base.Metadata.Widget import Multiple_Choice, Single_Choice, Text_Input, Vector_Editor

import Standard.Table.In_Memory_Table.In_Memory_Table
import Standard.Table.Internal.In_Memory_Helpers
import Standard.Table.Rows_To_Read.Rows_To_Read
from Standard.Table import Table, Value_Type
from Standard.Table.In_Memory_Table import to_java_table
from Standard.Table.Internal.Storage import from_value_type

import Standard.Database.Bulk_Load_Exists.Bulk_Load_Exists
Expand Down Expand Up @@ -588,10 +588,10 @@ type DuckDB_Connection
Value_Type.Decimal _ s ->
if s>0 then BigDecimalType.new s else from_value_type c.value_type ..Ignore
_ -> from_value_type c.value_type ..Ignore
java_table = to_java_table in_memory
column_storages = In_Memory_Helpers.get_java_column_storages in_memory
self.jdbc_connection.with_handled_connection connection->
Illegal_Argument.handle_java_exception <| Panic.catch ArithmeticException handler=(err-> Error.throw (Illegal_Argument.Error err.getMessage)) <|
DuckDBUtils.append connection java_table table_name java_column_types
DuckDBUtils.append connection column_storages table_name java_column_types
created_table

## ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
- new columns:(Standard.Base.Data.Vector.Vector Standard.Base.Any.Any) -> (Standard.Table.Table.Table|Standard.Base.Any.Any)
- to_delimited self delimiter:(Standard.Table.Delimited.Delimited_Format.Delimited_Format|Standard.Base.Data.Text.Text)= quote_style:Standard.Table.Delimited.Quote_Style.Quote_Style= headers:Standard.Table.Headers.Headers= value_formatter:(Standard.Table.Data_Formatter.Data_Formatter|Standard.Base.Nothing.Nothing)= line_endings:(Standard.Base.Data.Text.Line_Ending_Style.Line_Ending_Style|Standard.Base.System.File_Format.Infer)= -> Standard.Base.Data.Text.Text
- from_java_table java_table:Standard.Base.Any.Any -> Standard.Base.Any.Any
- to_java_table table:Standard.Table.In_Memory_Table.In_Memory_Table table_class:Standard.Base.Any.Any= column_class:Standard.Base.Any.Any= -> Standard.Base.Any.Any
- Standard.Table.Table.Table.from that:Standard.Table.In_Memory_Table.In_Memory_Table -> Standard.Table.Table.Table
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Enso Signatures 1.0
## module Standard.Table.Internal.In_Memory_Helpers
- get_java_column_storages table:Standard.Table.In_Memory_Table.In_Memory_Table -> (Standard.Base.Data.Vector.Vector Standard.Table.Internal.In_Memory_Helpers.Java_ColumnStorage)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
## Enso Signatures 1.0
## module Standard.Table.Internal.Java_Exports
- make_bool_builder initial_size:Standard.Base.Any.Any -> Standard.Base.Any.Any
- make_builder_for_type value_type:Standard.Base.Any.Any initial_size:Standard.Base.Any.Any java_problem_aggregator:Standard.Base.Any.Any= -> Standard.Base.Any.Any
- make_column_from_java_column -> Standard.Base.Any.Any
- make_column_from_storage -> Standard.Base.Any.Any
- make_double_builder initial_size:Standard.Base.Any.Any java_problem_aggregator:Standard.Base.Any.Any= -> Standard.Base.Any.Any
- make_inferred_builder initial_size:Standard.Base.Any.Any java_problem_aggregator:Standard.Base.Any.Any= -> Standard.Base.Any.Any
- make_long_builder initial_size:Standard.Base.Any.Any bits:Standard.Base.Any.Any java_problem_aggregator:Standard.Base.Any.Any= -> Standard.Base.Any.Any
- make_string_builder initial_size:Standard.Base.Any.Any value_type:Standard.Base.Any.Any= -> Standard.Base.Any.Any
- make_string_builder initial_size:Standard.Base.Any.Any value_type:Standard.Table.Value_Type.Value_Type= -> Standard.Base.Any.Any
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ type In_Memory_Table
---
A getter that allows one to specify the target Java type and handles
conversions when needed
private java_table self table_class=Java_Table column_class=Java_Column =
private java_table self =
raw_table = self.internal_java_table
if raw_table.is_a table_class then raw_table else
if raw_table.is_a Java_Table then raw_table else
# coming from the other JVM and deserves conversion
new_columns = raw_table.getColumns.map c-> column_class.new c.getName c.getStorage
table_class.new new_columns
new_columns = raw_table.getColumns.map c-> Java_Column.new c.getName c.getStorage
Java_Table.new new_columns

## ---
private: true
Expand Down Expand Up @@ -105,13 +105,6 @@ from_java_table java_table =
Table_Refinements.refine_table <|
In_Memory_Table.Value java_table

## ---
private: true
---
Helper method for internal use to make a Java Table from a Table.
to_java_table table:In_Memory_Table table_class=Java_Table column_class=Java_Column =
table.java_table table_class column_class

## ---
private: true
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ type In_Memory_Column_Implementation
Vector.from_polyglot_array column_as_list . map java_to_enso

value_type (this_column : Column & In_Memory_Column) =
storage_type = this_column.java_column.getType
storage_type = this_column.java_column.getStorageType
Storage.to_value_type storage_type

inferred_precise_value_type (this_column : Column & In_Memory_Column) =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Standard.Base.Data.Vector.Vector

import project.In_Memory_Table.In_Memory_Table

polyglot java import org.enso.table.data.column.storage.ColumnStorage as Java_ColumnStorage

## ---
private: true
---
Gets the Java ColumnStorage object from an In_Memory_Table.
get_java_column_storages (table : In_Memory_Table) -> Vector Java_ColumnStorage =
java_columns = table.java_table.getColumns
java_columns.map c->c.getStorage

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,16 @@ from Standard.Base import all

import project.In_Memory_Column.In_Memory_Column
import project.Internal.Storage
import project.Value_Type.Bits
import project.Value_Type.Value_Type

polyglot java import org.enso.table.data.column.builder.Builder
polyglot java import org.enso.table.data.column.builder.BuilderForBoolean
polyglot java import org.enso.table.data.column.builder.BuilderForDouble
polyglot java import org.enso.table.data.column.builder.BuilderForLong
polyglot java import org.enso.table.problems.ProblemAggregator

## ---
private: true
---
Note: Value_Type must have an exact representation in Java.
make_builder_for_type : Value_Type -> Integer -> ProblemAggregator -> Builder
make_builder_for_type value_type initial_size java_problem_aggregator=(Missing_Argument.throw "java_problem_aggregator") =
storage_type = Storage.from_value_type_strict value_type
Builder.getForType storage_type initial_size java_problem_aggregator

## ---
private: true
---
make_bool_builder : Integer -> BuilderForBoolean
make_bool_builder initial_size = Builder.getForBoolean initial_size

## ---
private: true
---
make_double_builder : Integer -> ProblemAggregator -> BuilderForDouble
make_double_builder initial_size java_problem_aggregator=(Missing_Argument.throw "java_problem_aggregator") =
float_type = Storage.from_value_type_strict Value_Type.Float
Builder.getForDouble float_type initial_size java_problem_aggregator

## ---
private: true
---
make_long_builder : Integer -> Bits -> ProblemAggregator -> BuilderForLong
make_long_builder initial_size bits java_problem_aggregator=(Missing_Argument.throw "java_problem_aggregator") =
integer_type = Storage.from_value_type_strict (Value_Type.Integer bits)
Builder.getForLong integer_type initial_size java_problem_aggregator

## ---
private: true
---
make_string_builder : Integer -> Value_Type -> Builder
make_string_builder initial_size value_type=Value_Type.Char =
make_string_builder initial_size value_type:Value_Type=..Char =
storage_type = Storage.from_value_type_strict value_type
Builder.getForText storage_type initial_size

Expand All @@ -61,8 +26,3 @@ make_inferred_builder initial_size java_problem_aggregator=(Missing_Argument.thr
private: true
---
make_column_from_storage = In_Memory_Column.from_storage

## ---
private: true
---
make_column_from_java_column = In_Memory_Column.from_java_column
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ polyglot java import org.enso.table.data.column.builder.LossOfBigDecimalPrecisio
polyglot java import org.enso.table.data.column.builder.LossOfIntegerPrecision
polyglot java import org.enso.table.data.column.operation.cast.ConversionFailure
polyglot java import org.enso.table.data.column.operation.cast.ConversionFailureType
polyglot java import org.enso.table.data.column.storage.type.StorageType
polyglot java import org.enso.table.data.table.problems.ArithmeticError
polyglot java import org.enso.table.data.table.problems.ArithmeticOverflow
polyglot java import org.enso.table.data.table.problems.FloatingPointGrouping
Expand Down Expand Up @@ -56,14 +57,16 @@ translate_problem p = case p.problemType of
"LossOfBigDecimalPrecision" ->
Loss_Of_Decimal_Precision.Warning p.getAffectedRowsCount (java_to_enso p.getExampleValue) p.getExampleValueConverted
"ArithmeticOverflow" ->
target_type = Storage.to_value_type p.targetType
storage_type = StorageType.fromTypeCharAndSize p.targetTypeChar p.targetTypeSize
target_type = Storage.to_value_type storage_type
example_operands = case p.exampleOperands of
Nothing -> Nothing
array -> Vector.from_polyglot_array array
Arithmetic_Overflow.Warning target_type p.affectedRowCount example_operands
"ConversionFailure" ->
examples = Vector.from_polyglot_array p.examples
target_type = Storage.to_value_type p.targetType
storage_type = StorageType.fromTypeCharAndSize p.targetTypeChar p.targetTypeSize
target_type = Storage.to_value_type storage_type
related_column = p.relatedColumn
affected_rows_count = p.affectedRowCount
constructor = if p.errorType == ConversionFailureType.NUMBER_OUT_OF_RANGE then Conversion_Failure.Out_Of_Range else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ to_value_type storage_type = case storage_type of
_ : BigIntegerType -> Value_Type.Decimal scale=0
_ : NullType -> Value_Type.Null
_ : AnyObjectType -> Value_Type.Mixed
proxy ->
type_char = proxy.typeChar
type_size = proxy.size
java_type = StorageType.fromTypeCharAndSize type_char type_size
to_value_type java_type

## ---
private: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@ type Hyper_Table
Java_Problems.with_problem_aggregator problem_aggregator=ProblemAggregator Problem_Behavior.Report_Warning java_problem_aggregator->
row_count = if max_rows == Rows_To_Read.All_Rows then Nothing else max_rows.rows
java_columns = HyperFormat.readTable self.file.file.path self.schema self.table row_count java_problem_aggregator
enso_columns = java_columns.map Java_Exports.make_column_from_java_column
enso_columns = java_columns.map c-> Java_Exports.make_column_from_storage c.getName c.getStorage
Table.new enso_columns
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Standard.Base.System.Input_Stream.Input_Stream
from Standard.Base.Metadata.Choice import Option

import Standard.Table.In_Memory_Table.In_Memory_Table
import Standard.Table.Internal.In_Memory_Helpers
from Standard.Table import Table
from Standard.Table.Errors import Unmatched_Columns
from Standard.Table.In_Memory_Table import to_java_table
from Standard.Table.Match_Columns import Match_Columns

import project.Hyper_Errors
Expand All @@ -21,8 +21,6 @@ import project.Internal.Telemetry
from project.Hyper_Errors import Hyper_Unsupported_Type

polyglot java import org.enso.tableau.HyperFormat
polyglot java import org.enso.table.data.table.Column as Java_Column
polyglot java import org.enso.table.data.table.Table as Java_Table

## Read the file to a `Hyper_File` object.
type Tableau_Format
Expand Down Expand Up @@ -114,26 +112,30 @@ type Tableau_Format
---
Implements the `Table.write` for this `File_Format`.
write_table self file:Writable_File table:Table on_existing_file match_columns:Match_Columns on_problems:Problem_Behavior =
if table.is_a In_Memory_Table . not then Error.throw (Type_Error.Error "Tableau format only supports writing In-Memory tables. Use `read` to materialize the table first.")

_check_supported_types table
if (on_existing_file == Existing_File_Behavior.Error) && file.exists then Error.throw (File_Error.Already_Exists file) else
is_dry_run = Context.Output.is_enabled.not
resolved_file = if is_dry_run then (file.file.create_dry_run_file copy_original=True).path else file.file.path

needs_backup = on_existing_file == Existing_File_Behavior.Backup && is_dry_run.not
if needs_backup && file.exists then
backup_file = _find_bak_file file.file
Panic.rethrow <| file.file.copy_to backup_file replace_existing=True

resolved_schema = if self.schema == "*" then "Extract" else self.schema
resolved_table = case self of
Tableau_Format.Hyper_Table _ t -> t
_ -> "Extract"
warning_unmatched_columns = Hyper_Errors.handle_java_exceptions <|
java_table = to_java_table table:In_Memory_Table Java_Table Java_Column
HyperFormat.writeTable resolved_file resolved_schema resolved_table java_table (on_existing_file == Existing_File_Behavior.Append) (match_columns == Match_Columns.By_Name) (on_problems == Problem_Behavior.Report_Error)
problems = if warning_unmatched_columns.length > 0 then [Unmatched_Columns.Error warning_unmatched_columns.to_vector] else []
on_problems.attach_problems_before problems <|
File.new resolved_file
if (on_existing_file == Existing_File_Behavior.Error) && file.exists then Error.throw (File_Error.Already_Exists file)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • wow, this is relaying on a fact that statements that yield Error terminate block execution!
  • by having if_then only (and not if_then_else) you eliminate one indentation level
  • but it feels less FP-like... which is probably not a problem at all


resolved_file = if Context.Output.is_enabled then file.file.path else (file.file.create_dry_run_file copy_original=True).path

needs_backup = on_existing_file == Existing_File_Behavior.Backup && Context.Output.is_enabled
if needs_backup && file.exists then
backup_file = _find_bak_file file.file
Panic.rethrow <| file.file.copy_to backup_file replace_existing=True

resolved_schema = if self.schema == "*" then "Extract" else self.schema
resolved_table = case self of
Tableau_Format.Hyper_Table _ t -> t
_ -> "Extract"

column_storages = In_Memory_Helpers.get_java_column_storages table:In_Memory_Table
warning_unmatched_columns = Hyper_Errors.handle_java_exceptions <|
HyperFormat.writeTable resolved_file resolved_schema resolved_table table.column_names column_storages (on_existing_file == Existing_File_Behavior.Append) (match_columns == Match_Columns.By_Name) (on_problems == Problem_Behavior.Report_Error)

problems = if warning_unmatched_columns.length > 0 then [Unmatched_Columns.Error warning_unmatched_columns.to_vector] else []
on_problems.attach_problems_before problems <|
File.new resolved_file

private _check_supported_types table:Table =
f = table.columns.filter c->c.value_type.is_mixed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.enso.database.fetchers;

import java.lang.reflect.Proxy;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -135,15 +134,7 @@ public Object getValue(ResultSet resultSet) throws SQLException {
return offsetDateTime == null ? null : offsetDateTime.toZonedDateTime();
}
};
default -> {
if (Proxy.isProxyClass(storageType.getClass())) {
var fromProxy =
StorageType.fromTypeCharAndSize(storageType.typeChar(), storageType.size());
yield forStorageType(fromProxy, index, columnName, problemAggregator);
} else {
yield new InferredColumnFetcher(colIndex, columnName, problemAggregator);
}
}
default -> new InferredColumnFetcher(colIndex, columnName, problemAggregator);
};
}
}
Expand Down
Loading
Loading