update mint tests with new minio-py APIs (#10238)

master
Harshavardhana 4 years ago committed by GitHub
parent 76b6dc0112
commit 9179cdfc9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 43
      mint/run/core/s3select/csv.py
  2. 11
      mint/run/core/s3select/sql_ops.py
  3. 1
      mint/run/core/s3select/tests.py

@ -22,7 +22,6 @@ from minio import Minio
from minio.select.options import (CSVInput, CSVOutput, InputSerialization, from minio.select.options import (CSVInput, CSVOutput, InputSerialization,
JSONOutput, OutputSerialization, JSONOutput, OutputSerialization,
RequestProgress, SelectObjectOptions) RequestProgress, SelectObjectOptions)
from utils import * from utils import *
@ -98,17 +97,17 @@ def test_csv_input_custom_quote_char(client, log_output):
expression="select * from s3object", expression="select * from s3object",
input_serialization=InputSerialization( input_serialization=InputSerialization(
compression_type="NONE", compression_type="NONE",
csv=CSVInput(FileHeaderInfo="NONE", csv=CSVInput(file_header_info="NONE",
RecordDelimiter="\n", record_delimiter="\n",
FieldDelimiter=",", field_delimiter=",",
QuoteCharacter=quote_char, quote_character=quote_char,
QuoteEscapeCharacter=escape_char, quote_escape_character=escape_char,
Comments="#", comments="#",
AllowQuotedRecordDelimiter="FALSE",), allow_quoted_record_delimiter="FALSE",),
), ),
output_serialization=OutputSerialization( output_serialization=OutputSerialization(
json=JSONOutput( json=JSONOutput(
RecordDelimiter="\n", record_delimiter="\n",
) )
), ),
request_progress=RequestProgress( request_progress=RequestProgress(
@ -155,20 +154,22 @@ def test_csv_output_custom_quote_char(client, log_output):
expression="select * from s3object", expression="select * from s3object",
input_serialization=InputSerialization( input_serialization=InputSerialization(
compression_type="NONE", compression_type="NONE",
csv=CSVInput(FileHeaderInfo="NONE", csv=CSVInput(file_header_info="NONE",
RecordDelimiter="\n", record_delimiter="\n",
FieldDelimiter=",", field_delimiter=",",
QuoteCharacter='"', quote_character='"',
QuoteEscapeCharacter='"', quote_escape_character='"',
Comments="#", comments="#",
AllowQuotedRecordDelimiter="FALSE",), allow_quoted_record_delimiter="FALSE",
),
), ),
output_serialization=OutputSerialization( output_serialization=OutputSerialization(
csv=CSVOutput(QuoteFields="ALWAYS", csv=CSVOutput(quote_fields="ALWAYS",
RecordDelimiter="\n", record_delimiter="\n",
FieldDelimiter=",", field_delimiter=",",
QuoteCharacter=quote_char, quote_character=quote_char,
QuoteEscapeCharacter=escape_char,) quote_escape_character=escape_char,
)
), ),
request_progress=RequestProgress( request_progress=RequestProgress(
enabled="False" enabled="False"

@ -21,7 +21,6 @@ from datetime import datetime
from minio.select.options import (CSVInput, CSVOutput, InputSerialization, from minio.select.options import (CSVInput, CSVOutput, InputSerialization,
JSONInput, JSONOutput, OutputSerialization, JSONInput, JSONOutput, OutputSerialization,
RequestProgress, SelectObjectOptions) RequestProgress, SelectObjectOptions)
from utils import generate_bucket_name, generate_object_name from utils import generate_bucket_name, generate_object_name
@ -82,11 +81,11 @@ def test_sql_expressions_custom_input_output(client, input_bytes, sql_input,
def test_sql_expressions(client, input_json_bytes, tests, log_output): def test_sql_expressions(client, input_json_bytes, tests, log_output):
input_serialization = InputSerialization( input_serialization = InputSerialization(
compression_type="NONE", compression_type="NONE",
json=JSONInput(Type="DOCUMENT"), json=JSONInput(json_type="DOCUMENT"),
) )
output_serialization = OutputSerialization( output_serialization = OutputSerialization(
csv=CSVOutput(QuoteFields="ASNEEDED") csv=CSVOutput(quote_fields="ASNEEDED")
) )
test_sql_expressions_custom_input_output(client, input_json_bytes, test_sql_expressions_custom_input_output(client, input_json_bytes,
@ -393,7 +392,7 @@ def test_sql_select_json(client, log_output):
"Select s.rules[1].expr from S3Object s", b'{"expr":"y > x"}\n{}\n'), "Select s.rules[1].expr from S3Object s", b'{"expr":"y > x"}\n{}\n'),
] ]
input_serialization = InputSerialization(json=JSONInput(Type="DOCUMENT")) input_serialization = InputSerialization(json=JSONInput(json_type="DOCUMENT"))
output_serialization = OutputSerialization(json=JSONOutput()) output_serialization = OutputSerialization(json=JSONOutput())
try: try:
test_sql_expressions_custom_input_output(client, json_testcontent, test_sql_expressions_custom_input_output(client, json_testcontent,
@ -417,8 +416,8 @@ val4,val5,val6
input_serialization = InputSerialization( input_serialization = InputSerialization(
csv=CSVInput( csv=CSVInput(
FileHeaderInfo="NONE", file_header_info="NONE",
AllowQuotedRecordDelimiter="FALSE", allow_quoted_record_delimiter="FALSE",
), ),
) )

@ -21,7 +21,6 @@ from csv import (test_csv_input_custom_quote_char,
test_csv_output_custom_quote_char) test_csv_output_custom_quote_char)
from minio import Minio from minio import Minio
from sql_ops import (test_sql_datatypes, test_sql_functions_agg_cond_conv, from sql_ops import (test_sql_datatypes, test_sql_functions_agg_cond_conv,
test_sql_functions_date, test_sql_functions_string, test_sql_functions_date, test_sql_functions_string,
test_sql_operators, test_sql_operators_precedence, test_sql_operators, test_sql_operators_precedence,

Loading…
Cancel
Save