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

Revert "Merge pull request #23 from deepfield/PB-266-create_with_part… #25

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions ibis/impala/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,13 @@ def create_table(self, table_name, obj=None, schema=None, database=None,
ast = self._build_ast(to_insert)
select = ast.queries[0]

if partition is not None:
# Fairly certain this is currently the case
raise ValueError('partition not supported with '
'create-table-as-select. Create an '
'empty partitioned table instead '
'and insert into those partitions.')

statement = ddl.CTAS(table_name, select,
database=database,
can_exist=force,
Expand Down
8 changes: 0 additions & 8 deletions ibis/impala/ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,6 @@ def _storage(self):
}
return storage_lines[self.format]

def _partition(self):
if self.partition:
return "\nPARTITIONED BY ({})".format(", ".join(self.partition))
else:
return ''



class CTAS(CreateTable):

Expand All @@ -167,7 +160,6 @@ def __init__(self, table_name, select, database=None,
def compile(self):
buf = StringIO()
buf.write(self._create_line())
buf.write(self._partition())
buf.write(self._storage())
buf.write(self._location())

Expand Down
16 changes: 0 additions & 16 deletions ibis/impala/tests/test_ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,22 +291,6 @@ def test_create_external_table_as(self):
FROM test1""".format(path)
assert result == expected

def test_create_table_as_with_partitions(self):
partition = ('year', 'month', 'day')
select = build_ast(self.con.table('test1')).queries[0]
statement = ddl.CTAS('db.test_table',
select,
partition=partition)
result = statement.compile()

expected = """\
CREATE TABLE db.test_table
PARTIONED BY (year, month, day) AS SELECT *
FROM test1"""
assert result == expected



def test_create_table_with_location(self):
path = '/path/to/table'
schema = ibis.schema([('foo', 'string'),
Expand Down