Fix cqlsh copy methods and timestamp format issues on windows

patch by tjake; reviewed by Josh McKenzie for CASSANDRA-9795
This commit is contained in:
T Jake Luciani 2015-07-13 09:41:18 -04:00
parent f60e4ad429
commit 9dc8c21980
6 changed files with 2698 additions and 2633 deletions

View File

@ -1,4 +1,5 @@
2.2.0-rc3
* Fix cqlsh copy methods and other windows specific issues (CASSANDRA-9795)
* Don't wrap byte arrays in SequentialWriter (CASSANDRA-9797)
* sum() and avg() functions missing for smallint and tinyint types (CASSANDRA-9671)
* Revert CASSANDRA-9542 (allow native functions in UDA) (CASSANDRA-9771)

2632
bin/cqlsh

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ if "%OS%" == "Windows_NT" setlocal
python -V >nul 2>&1
if ERRORLEVEL 1 goto err
python "%~dp0\cqlsh" %*
python "%~dp0\cqlsh.py" %*
goto finally
:err

2668
bin/cqlsh.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@ import calendar
import math
import re
import sys
import platform
import time
from collections import defaultdict
from . import wcwidth
@ -91,6 +92,9 @@ DEFAULT_NANOTIME_FORMAT = '%H:%M:%S.%N'
DEFAULT_DATE_FORMAT = '%Y-%m-%d'
DEFAULT_TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S%z'
if platform.system() == 'Windows':
DEFAULT_TIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'
class DateTimeFormat():
def __init__(self, timestamp_format=DEFAULT_TIMESTAMP_FORMAT, date_format=DEFAULT_DATE_FORMAT, nanotime_format=DEFAULT_NANOTIME_FORMAT):
self.timestamp_format=timestamp_format

View File

@ -32,29 +32,51 @@ public class TimestampSerializer implements TypeSerializer<Date>
private static final String[] dateStringPatterns = new String[] {
"yyyy-MM-dd HH:mm",
"yyyy-MM-dd HH:mm:ss",
"yyyy-MM-dd HH:mm z",
"yyyy-MM-dd HH:mm zz",
"yyyy-MM-dd HH:mm zzz",
"yyyy-MM-dd HH:mmX",
"yyyy-MM-dd HH:m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